User`s guide
Rapid Prototyping Program Framework
6-25
Rapid Prototyping Program Framework
Generating code for a Simulink model results in at least four files — model.c,
model.h, model.prm,andmodel.reg,wheremodel is the name of the Simulink
model. This code implements the model’s system equations, contains block
parameters, and performs initialization.
The Real-Time Workshop’s program framework provides the additional source
code necessary to build the model code into a complete, stand-alone program.
The program framework consists of application modules (files containing
source code to implement required functions) designed for a number of
different programming environments.
The automatic program builder ensures the program is created with the proper
modules once you have configured your template makefile.
The application modules and the code generated for a Simulink model are
implemented using a common API (application program interface). This API
defines a data structure (called a
SimStruct) that encapsulates all data for
your model. Note that the embedded-C target does not have a
SimStruct,but
does have a common calling syntax for model execution.
This API is similar to that of S-functions, with one major exception: the API
assumes that there is only one instance of the model, whereas S-functions can
have multiple instances. The function prototypes also differ from S-functions.
Rapid Prototyping Program Architecture
The structure of a real-time program consists of three components.Each
component has a dependency on a different part of the environment in which
the program executes. The following diagram illustrates this structure.