Real-Time Workshop User's Guide | ![]() ![]() |
Real-Time Object
Unlike other Real-Time Workshop code formats, Real-Time Workshop Embedded Coder generated code does not employ the SimStruct
. Instead, the Real-Time Workshop Embedded Coder uses a data structure called the real-time object. The real-time object, like the SimStruct
, contains essential timing and scheduling data, as well as model information. The real-time object is much more compact than the SimStruct
, achieving a significant reduction in code size. For example, the real-time object for a single-rate model typically requires 4 bytes.
Note that the real-time object is a model-specific data structure. The real-time object for a particular model is defined in model_export.h
.
Your code should not reference fields of the real-time object directly. The Real-Time Workshop provides accessor macros for the real-time object. These macros are defined in matlabroot
/rtw/c/ert/
ertformat.h. The macros are syntactically and functionally identical to the SimStruct
macros used with other code formats. If you are interfacing your code to a single model, you should refer to its real-time object generically as RT_OBJ, and use the macros to access RT_OBJ, as in the following code fragment.
#include "ertformat.h" const char_T *errStatus = ssGetErrorStatus(RT_OBJ);
For an example of how to interface your code to the real-time objects of more than one model, see How to Call the Entry Points Directly.
The logging object is a subobject of the real-time object. This data structure is used in generated code if the MAT-file logging code generation option is enabled.
![]() | Data Structures and Code Modules | Code Modules | ![]() |