User`s guide
Rapid Prototyping Program Framework
6-33
Figure 6-8: Execution of the Model Code
This diagram shows what functions are defined in the generated code and
where in the program these functions are called.
The Model Registration Function
The model registration function has the same name as the Simulink model
from which it is generated. It is called directly by the main program during
initialization. Its purpose is to initialize and return a pointer to the
SimStruct.
Models Containing S-Functions
A noninlined S-function is any C MEX S-function that is not implemented
using a customized TLC file. If you create a C MEX S-function as part of a
Simulink model, it is by default noninlined unless you write your own TLC file
that inlines it within the body of the
model.c code. The Real-Time Workshop
Main Program Termination
Model registration function — model
Update discrete state vector — MdlUpdate
Initialize sample times and offsets — MdlInitializeSampleTimes
Compute block and system outputs — MdlOutputs
Orderly termination at end of the program — MdlTerminate
Compute derivatives for continuous models — MdlDerivatives
Initialize sizes in the SimStruct — MdlInitializeSizes
Model Execution
Main Program Initialization
Model Code
Start model (initialize conditions, etc.) — MdlStart