The code generator uses the real-time model
(RT_MODEL) data structure. This structure is also referred to as the
rtModel
data structure. You can access rtModel
data by
using a set of macros analogous to the ssSetxxx
and
ssGetxxx
macros that S-functions use to access
SimStruct
data, including noninlined S-functions compiled by
the code generator.
You need to use the set of macros rtmGetxxx
and
rtmSetxxx
to access the real-time model data structure. The
rtModel
is an optimized data structure that replaces
SimStruct
as the top level data structure for a model. The
rtmGetxxx
and rtmSetxxx
macros are used in the
generated code as well as from the main.c
or main.cpp
module. If you are customizing main.c
or main.cpp
(either a static file or a generated file), you need to use rtmGetxxx
and
rtmSetxxx
instead of the ssSetxxx
and
ssGetxxx
macros.
Usage of rtmGetxxx
and rtmSetxxx
macros is the
same as for the ssSetxxx
and ssGetxxx
versions,
except that you replace SimStruct S
by real-time model data structure
rtM
. The following table lists rtmGetxxx
and
rtmSetxxx
macros that are used in grt_main.c
and
grt_main.cpp
.
Macros for Accessing the Real-Time Model Data Structure
rtm Macro Syntax |
Description |
---|---|
|
Get the derivatives of block continuous states |
|
Return the pointer to vector that stores sample time offsets of the model associated with rtM |
|
Get the number of sample times that a block has |
|
Return a pointer to |
|
Return an external mode information data structure of the model (used internally for external mode) |
|
Return a data structure used by code generator logging (internal use only) |
|
Return a data structure of real-time model methods information (internal use only) |
|
Return data structure containing solver information of the model (internal use only) |
|
Return a pointer to Sample Hit flag vector |
|
Get task sample time |
|
Get pointer to a task sample time |
|
Get pointer to a task ID |
|
Return simulation step type ID ( |
|
Return the fundamental step size of the model |
|
Get the current simulation time |
|
Set the time of the next sample hit |
|
Get the current time for the current task |
|
Get the simulation stop time |
|
Set the simulation stop time |
|
Return a data structure used by timing engine of the model (internal use only) |
|
Return a pointer to the current time |
|
Get the simulation start time |
|
Determine whether a task is continuous |
|
Determine whether the simulation is in a major step |
|
Determine whether the sample time is hit |
rtmGetErrorStatus(rtm) |
Get the current error status |
rtmSetErrorStatus(rtm,val) |
Set the current error status |
rtmGetErrorStatusPointer(rtm) |
Return a pointer to the current error status |
rtmGetStopRequested(rtm) |
Return whether a stop is requested |
rtmGetBlockIO(rtm) |
Get the block I/O data structure |
rtmSetBlockIO(rtm,val) |
Set the block I/O data structure |
rtmGetContStates(rtm) |
Get the continuous states data structure |
rtmSetContStates(rtm,val) |
Set the continuous states data structure |
rtmGetDefaultParam(rtm) |
Get the default parameters data structure |
rtmSetDefaultParam(rtm,val) |
Set the default parameters data structure |
rtmGetPrevZCSigState(rtm) |
Get the previous zero-crossing signal state data structure |
rtmSetPrevZCSigState(rtm,val) |
Set the previous zero-crossing signal state data structure |
rtmGetRootDWork(rtm) |
Get the DWork data structure |
rtmSetRootDWork(rtm,val) |
Set the DWork data structure |
rtmGetU(rtm) |
Get the root inputs data structure (when root inputs are passed as part of the model data structure) |
rtmSetU(rtm,val) |
Set the root inputs data structure (when root inputs are passed as part of the model data structure) |
rtmGetY(rtm) |
Get the root outputs data structure (when root outputs are passed as part of the model data structure) |
rtmSetY(rtm,val) |
Set the root outputs data structure (when root outputs are passed as part of the model data structure) |
For additional details on usage, see SimStruct Macros and Functions Listed by Usage.