User`s guide

Rapid Prototyping Program Framework
6-31
Application Modules for System Independent Components
The system independent components include these modules:
rt_sim.c Performs the activities necessary for one time step of the model.
It calls the model function to calculate system outputs and then updates the
discrete and continuous states.
ode1.c, ode2.c, ode3.c, ode4.c, ode5.c — These modules implement the
integration algorithms supported for real-time applications. See the
Simulink documentation for more information about these fixed-step
solvers.
simstruc.h Contains actual definition of the Simulink data structure and
the definition of the
SimStruct access macros.
simstruc_types.h Contains definitions of various events, including
subsystem enable/disable and zero crossings. It also defines data logging
variables.
The system independent components also include code that defines, creates,
and destroys the Simulink data structure (
SimStruct). The model code and all
S-functions included in the program define their own
SimStruct.
The
SimStruct data structure encapsulates all the data relating to the model
or S-function, including block parameters and outputs. See Writing
S-Functions for more information about the
SimStruct.
Rapid Prototyping Application Components
The application components contain the generated code for the Simulink
model, including the code for any S-functions in the model. This code is referred
to as the model code because these functions implement the Simulink model.
However, the generated code contains more than just functions to execute the
model (as described in the previous section). There are also functions to
perform initialization, facilitate data access, and complete tasks before
program termination. To perform these operations, the generated code must
define functions that:
Create the
SimStruct.
Initialize model size information in the
SimStruct.