Real-Time Workshop | ![]() ![]() |
Block State Storage Classes
The storage class property of a block state specifies how Real-Time Workshop declares and stores the state in a variable. Storage class options for block states are similar to those for signals. The available storage classes are:
Default Storage Class
Auto
is the default storage class. Auto
is the appropriate storage class for states that you do not need to interface to external code. States with Auto
storage class are stored as members of the Dwork
vector.
You can assign a symbolic name to states with Auto
storage class. If you do not supply a name, Real-Time Workshop generates one, as described in Symbolic Names for Block States.
Explicitly Assigned Storage Classes
Block states with storage classes other than Auto
are stored in unstructured global variables, independent of the Dwork
vector. These storage classes are appropriate for states that you want to interface to external code. The following storage classes are available for states:
ExportedGlobal
: The state is stored in a global variable. model
_private.h
exports the variable. States with ExportedGlobal
storage class must have unique names.
ImportedExtern
: model
_private.h
declares the state as an extern
variable. Your code must supply the proper variable definition. States with ImportedExtern
storage class must have unique names.
ImportedExternPointer
: model
_private.h
declares the state as an extern
pointer. Your code must supply the proper pointer variable definition. States with ImportedExternPointer
storage class must have unique names.
Table 5-8, State Properties Options and Generated Code, gives examples of variable declarations and the code generated for block states with each type of storage class.
You can assign a symbolic name to states with any of the above storage classes. If you do not supply a name, Real-Time Workshop generates one, as described in Symbolic Names for Block States.
The next section describes how to use the State Properties dialog box to assign storage classes to block states.
![]() | Block States: Storing and Interfacing | Using the State Properties Dialog Box to Interface States to External Code | ![]() |