Real-Time Workshop User's Guide | ![]() ![]() |
Object Property Information in the model.rtw File
During code generation, the Real-Time Workshop writes property information about signal and parameter objects to the model
.rtw
file. An ObjectProperties
record is written for each parameter or signal that meets certain conditions. These conditions are described in ObjectProperties Records For Parameters and ObjectProperties Records For Signals.
The ObjectProperties
records contain all of the property information from the associated object. To access ObjectProperties
records, you must write Target Language Compiler code (see Accessing Object Property Information via TLC).
ObjectProperties Records For Parameters
An ObjectProperties
record is included in the in the ModelParameters
section of model
.rtw
file for each parameter, under the following conditions:
Simulink.Parameter
object (or to a parameter object that comes from a class derived from the Simulink.Parameter
class).
RTWInfo.StorageClass
is set to anything but 'Auto
'.
The following is an example of an ObjectProperties
record for a parameter.
ModelParameters { ... Parameter { Identifier Kp Tunable yes ... Value [5.0] Dimensions [1, 1] ObjectProperties { RTWInfo { StorageClass "SimulinkGlobal" TypeQualifier "" } Value 5.0 ... } } }
ObjectProperties Records For Signals
An ObjectProperties
record is included in the BlockOutputs
section of the model
.rtw
file for each signal which meets the following conditions:
Simulink.Signal
object (or to an object that comes from a class derived from the Simulink.Signal
class).
Note If the signal is configured to be an unstructured global variable in the generated code, its validity and uniqueness are enforced and its symbol is always preserved. |
The following is an example of an ObjectProperties
record for a signal.
BlockOutputs { ... BlockOutput { Identifier SinSig ... SigLabel "SinSig" ObjectProperties { RTWInfo { StorageClass "SimulinkGlobal" TypeQualifier "" } ... } } }
Accessing Object Property Information via TLC
This section provides sample code to illustrate how to access object property information from the model
.rtw
file using TLC code. For more information on TLC and the model
.rtw
file, see the Target Language Compiler Reference Guide.
Accessing Parameter Object Property Records. The following code fragment iterates over the ModelParameters section of the model
.rtw
file and extracts information from any parameter ObjectProperties records encountered.
%with CompiledModel.ModelParameters %foreach modelParamIdx = NumParameters %assign thisModelParam = ModelParameter[modelParamIdx] %assign paramName = thisModelParam.Identifier %if EXISTS("thisModelParam.ObjectProperties") %with thisModelParam.ObjectProperties %assign valueInObject = Value %with RTWInfo %assign storageClassInObject = StorageClass %assign typeQualifierInObject = TypeQualifier %endwith %% *********************************** %% Access user-defined properties here %% *********************************** %if EXISTS("MY_PROPERTY_NAME") %assign userDefinedPropertyName = MY_PROPERTY_NAME %endif %% *********************************** %endwith %endif %endforeach %endwith
Accessing Signal Object Property Records. The following code fragment iterates over the BlockOutputs section of the model
.rtw
file and extracts information from any signal ObjectProperties records encountered.
%with CompiledModel.BlockOutputs %foreach blockOutputIdx = NumBlockOutputs %assign thisBlockOutput = BlockOutput[blockOutputIdx] %assign signalName = thisBlockOutput.Identifier %if EXISTS("thisBlockOutput.ObjectProperties") %with thisBlockOutput.ObjectProperties %with RTWInfo %assign storageClassInObject = StorageClass %assign typeQualifierInObject = TypeQualifier %endwith \ %% ***********************************\ %% Access user-defined properties here\ %% *********************************** %if EXISTS("MY_PROPERTY_NAME") %assign userDefinedPropertyName = MY_PROPERTY_NAME %endif %% *********************************** %endwith %endif %endforeach %endwith
Using Object Properties to Export ASAP2 Files
The ASAM-ASAP2 Data Definition Target provides special signal and parameter subclasses that support exporting of signal and parameter object property information to ASAP2 data files. For information about the ASAP2 target and its associated classes and TLC files, see Generating ASAP2 Files in the Real-Time Workshop online documentation.
![]() | Signal Objects | Configuring the Generated Code via TLC | ![]() |