| Target Language Compiler | ![]() |
model.rtw Changes Between Real-Time Workshop 3.0 and 4.0
Several changes have been made to the model.rtw file. These changes:
model.rtw Differences
StatesMap was updated to reduce the size of the model.rtw file, making code generation faster. The StatesMap now contains rows for states that go to a port (direct port connections). For example, SignalSrc X4 means the fifth row in the StatesMap only, not the fifth index.4. Note, the StatesMap now only contains the a mapping for the double, non-complex continuous and discrete states.UsingUPtrs ParamSetting for Level 2 C-MEX S-functions. This is needed to support the ssSetInputPortRequiredContiguous flag for non-inlined Level 2 C-MEX S-functions.ParamSetting.Contiguous field now writes out as "" instead of "yes".Slopes parameter from 1D Look-Up table. Slopes for the 1D look-up are computed at runtime.DiscStatesDataTypeIdx and DiscStatesComplexSignal. These are now handled by the data type work vector fields.FrameData field was added to each block input port record.DataOutputPortFrameData field was added to the block record. This was not added to block output port record because this record is specific to a buffer and not to a block. In the case of frame data, the same buffer could have different frame interpretations based on the block they feed into.BlockOutputDefaults record:NumReusedBlockOutputs 0 NumMergedBlockOutputs 0
DataLoggingOpts to reflect discrete states are now a part of DWork. Specifically:CompiledModel.NumDiscStates CompiledModel.Modes CompiledModel.NumRWork CompiledModel.NumIWork CompiledModel.NumPWork CompiledModel.NumDWork CompiledModel.NumDWorkRecords
DWork record as follows. old new
DWorkRecords { DWorks {
DWorkRecordDefaults { DWorkDefaults {
DataTypeIdx Data TypeIdx
ComplexSignal ComplexSignal
UsedAsDState UsedAs
} }
NumDWorkRecords NumDWorks
DWorkRecord { DWork {
BlockIdentifier Identifier
Name
Width Width
DaTaTypeIdx DataTypeIdx
ComplexSignal ComplexSignal
UsedAsDState UsedAs
DWorkSrc SigSrc
} }
: :
: :
} }
used to be changed to
Block.DiscStates [width, vectIdx] [width, dWorkIdx]
Block.RWork [width, vectIdx] [width, dWorkIdx]
Block.IWork [width, vectIdx] [width, dWorkIdx]
Block.PWork [width, vectIdx] [width, dWorkIdx]
Block.ModeVector [width, vectIdx] [width, dWorkIdx]
where vectIdx was the vector index into the corresponding vector, while recIdx is now the index of the corresponding DWork in the model-wide DWorks record.
Parameter records are now the last items in the Block records (i.e., parameter settings and so on come before block Parameter records and the parameter count vector.)ModelParameters record above the System records. Several new fields were added to the ModelParameters record. NumParameters 2
Parameter {
}
Parameter {
}
P1Name Parameter[0]
P2Name Parameter[1]
Parameter {
Value CompiledModel.ModelParameters.Parameter[#].Value
}
when a mapping can be located between the values in Parameter records and the ModelParameters record. This was done to speed up code generation and reduce the size of the model.rtw file when we can locate a mapping between the values in Parameter records and the ModelParameters record.
Matrix support involved adding a Dimensions field to many records. Specifically, we now:
Parameter records in the Block and ModelParameters Parameter records.DataStores record.RootSignals or Subsystem record.ExternalInputs record.ExternalOutputs record.BlockOutput record.DataInputPorts record.DataOutputPort record.Matrix support also required eliminating the notion of number of data logging rows. This required the renaming of the following blocks.
Renamed "MaxRows" to "MaxDataPoints"
Renamed "LimitMaxRows" to "LimitDataPoints"
Renamed "Matrix" option in SaveFormat parameter to "Array" format
DataOutputPort records to the Block records.ObjectProperities for signals specified in the Unified Data Repository to the BlockOutputs record. | General model.rtw Concepts | General Information and Solver Specification | ![]() |