Table A-18: Model.rtw System Record
Variable/Record Name
|
Description
|
System {
|
One for each system in the model. This is equal to NumNonvirtSubsystems plus 1 for the root system.
|
Type
|
root, atomic, enable, trigger, enable_with_trigger, or function-call.
|
Name
|
Name of system.
|
SLName
|
Unmodified Simulink name. This is only written if it is not equal to Name.
|
NoCode
|
If yes, generate no code. This system runs on the host only (during simulations or during external mode).
|
Identifier
|
Unique identifier across all blocks.
|
SystemIdx
|
System index assigned to this system. Each system is assigned a unique non-negative integer by rtwgen.
|
SubsystemBlockIdx
|
[systemIndex, blockIndex]. Not present if Type is root. Vector of two elements. First element is the index of the parent system of this system. The second element is the index of this system in the block list of its parent.
|
NumChildrenSystems
|
Number of systems that this system parents.
|
Children
|
Subsystem indices of the children. Note that the Children field is only written out if NumChildrenSystems is greater than 0.
|
ForceNonInline
|
Only relevant if you have a function-call subsystem. Otherwise it will always be off. Field is only written out for non-root systems.
|
NumZCEvents
|
Number of zero-crossing events for all blocks in this system.
|
InlineSubsystem
|
Flag indicating whether subsystem should be inlined or not; Overridden by ForceNonInline flag for function-call subsystems if InlineSubsystem is on and ForceNonInline is on. Only written for non-root systems.
|
UseSystemNameForRTWFileName
|
Flag indicating whether the system name should be used for the code generation file name also. Only written for non-root systems.
|
SystemFileName
|
File name that code should be generated in to. Simulink determines the appropriate filename based on UseSystemNameForRTWFileName etc. so that TLC can directly use this file name. Only written for non-root systems.
|
LibraryName
|
Name of library that this system originated from if this block is a library link. This field is written out ONLY if the system is a library link or a descendent of it. Only written for non-root systems.
|
StartFcn
|
Name of start functions for nonvirtual subsystem.
|
InitializeFcn
|
Name of initialize function for enable systems that are configured to reset states.
|
OutputFcn
|
Name of output function for nonvirtual subsystem
|
UpdateFcn
|
Name of update function for nonvirtual subsystem.
|
DerivativeFcn
|
Name of derivative function for systems that have continuous states.
|
EnableFcn
|
Name of disable function for enable or enable_with_trigger systems.
|
DisableFcn
|
Name of disable function for enable or enable_with_trigger systems.
|
ZeroCrossingFcn
|
Name of nonsampled zero-crossing function for enable systems using variable step solver.
|
OutputUpdateFcn
|
Name of output/update function for trigger or enable_with_trigger systems.
|
NumBlocks
|
Number of nonvirtual blocks in the system.
|
BlocksIdx
|
0: Location of the first nonvirtual block in the following Block record list.
|
NumVirtualOutportBlocks
|
For the root system, the number of virtual outport blocks is 0 (since all root outport blocks are nonvirtual). For a system corresponding to a conditionally executed subsystem, this is equal to the number of outport blocks in the subsystem. For each of these virtual outport blocks, there is a corresponding Block record which appears after all the nonvirtual Block records.
|
VirtualOutportBlockIdx
|
Starting index in the following Block record list of the virtual outport blocks.
|
NumTotalBlocks
|
Number of blocks in the system (sum of NumBlocks and NumVirtualOutportBlocks).
|
Block {
|
One for each nonvirtual block in the system. The virtual outport block records are described below.
|
Type
|
Block type, e.g., Gain.
|
InMask
|
Yes if this block lives within a mask.
|
MaskType
|
Only written out if block is masked. If this property is yes, this block is either masked or resides in a masked subsystem. The default for MaskType is no meaning the block does not have a mask or resides in a masked subsystem.
|
Tag
|
This is the text that can be attached to a block via the command:
set_param('block','Tag','text')
This parameter is written if the text is non-empty.
|
RTWdata {
|
The RTWdata general record is only written if the RTWdata property of a block is non-empty. The RTWdata is created using the command:
set_param('block','RTWData',val)
where val is a MATLAB struct of string. For example,
val.field1 = 'field1 value' val.field2 = 'field2 value'
|
field1
|
"field1 value"
|
feild2
|
"field2 value"
|
}
|
|
Name
|
Block name preceded with a <root> or <S#> token.
|
SLName
|
Unmodified Simulink name. This is only written if it is not equal to Name.
|
Identifier
|
Unique identifer across all blocks in the model.
|
PortBasedSampleTimes
|
yes. Only written if block specified port based sample times.
|
InputPortTIDs
|
Only written if port sample time information is available.
|
OutputPortTIDs
|
Only written if port sample time information is available.
|
TID
|
Task ID, which can be one of:
- Integer >= 0, giving the index into the sample time table.
- Vector of two or more elements indicating that this block has multiple sample times.
constant indicating that the block is constant and doesn't have a task ID.
triggered indicating that the block is triggered and doesn't have a task ID.
Subsystem indicating that this block is a conditionally executed subsystem and the TID transitions are to be handled by the corresponding system.
|
SubsystemTID
|
Only written if TID equals Subsystem. This is the actual value of the subsystem TID (i.e., integer, vector, constant, or triggered).
|
FundamentalTID
|
Only written for multirate or hybrid enabled subsystems. This gives the sample time as the greatest common divisor of all sample times in the system.
|
SampleTimeIdx
|
Actual sample time of block. Only written for zero order hold and unit delay blocks.
|
AlgebraicLoopId
|
This ID identifies what algebraic loop this block is in. If this field is not present, the ID is 0 and the block is not part of an algebraic loop.
|
ContStates
|
Specified as [N,I] where N is number of continuous states and I is the index into the state vector, X. Not present if N==0.
|
ModeVector
|
Specified as [N,I] where N is the number of model vector elements and I is the index into the data type work vector record list. Not present if N==0.
|
RWork
|
Specified as [N,I] where N is the number of real-work vector elements and I is the index into the data type work vector record list. Not present if N==0.
|
IWork
|
Specified as [N,I] where N is the number of integer-work vector elements and I is the index into the data type work vector record list. Not present if N==0.
|
PWork
|
Specified as [N,I] where N is the number of pointer-work vector elements and I is the index into the data type work vector record list. Not present if N==0.
|
DiscStates
|
Specified as [N,I] where N is the number of discrete state vector elements and I is the index into the data type work vector record list. Not present if N==0.
|
NumDWork
|
Number of DWork records block has declared. There is one DWork record for each data type work vector of the block.
|
DWork {
|
One record for each data type work vector.
|
Name
|
Name of the data type work vector.
|
RecordIdx
|
Index of this record in the model wide CompiledModel.DWorkRecords.DWorkRecord list.
|
}
|
|
NonsampledZCs
|
Specified as [N,I], where N is the number of nonsampled zero-crossings and I is the index into the nonsampledZCs and nonsampledZCdirs vectors.
|
NonsampledZC {
|
One record for each nonsampled zero-crossing.
|
Index
|
Index of the block's zero-crossing.
|
Direction
|
Direction of zero-crossing: Falling, Any, Rising.
|
}
|
|
ZCEvents
|
Specified as [N,I], where N is the number of zero-crossing events and I is the index into the zcEvents vector.
|
ZCEvent {
|
One record for each zero-crossing event.
|
Type
|
Type of zero-crossing: DiscontinuityAtZC, ContinuityAtZC, TriggeredDisconAtZC.
|
Direction
|
Direction of zero-crossing: Falling, Any, Rising.
|
}
|
|
RollRegions
|
RollRegions is the contiguous regions defined by the inputs and block width. Block width is the overall width of a block after scalar expansion. RollRegions is provided for use by the %roll construct.
|
NumDataInputPorts
|
Number of data input ports. Only written if nonzero.
|
DataInputPort {
|
One record for each data input port.
|
Width
|
Length of the signal entering this input port.
|
Dimensions
|
Vector of the form [nRows, nCols] for the signal. Only written if number of dimensions is greater than 1.
|
DataTypeIdx
|
Index into the CompiledModel.DataTypes.DataType record list giving the data type of this port. Only written if not 0 (see CompiledModel.DataInputPortDefaults.DataTypeIdx).
|
ComplexSignal
|
Is this port complex? Only written if yes. The default from CompiledModel.DataInputPortDefaults.ComplexSignal is no.
|
FrameData
|
yes/no: Is this port frame-based?
|
HaveGround
|
yes/no: Is this port connected to ground?
|
SignalSrc
|
A vector of length Width where each element specifies the source signal. This is an index into the block I/O vector (Bi), an index into the state vector (Xi), an index into the external input vector (Ui), unconnected ground (G0), or FcnCall indicating the source is a function-call.
|
RollRegions
|
A vector (e.g., [1:5, 6:10, 11]) giving the contiguous regions for this data input port over which for loops can be used. This is always written for S-Function blocks, otherwise it is written only if it is different from the block RollRegions.
|
DirectFeedThrough
|
Does this input port have direct feedthrough? Only written if WriteBlockConnections is on and the value this port does not have direct feedthrough, in which case no is written.
|
BufferDstPort
|
Only written if this input port is used by an output port of this block. The default is CompiledModel.DataInputPortDefaults.BufferDstPort which is -1.
|
}
|
|
NumControlInputPorts
|
Number of control (e.g., trigger or enable) input ports. Only written if nonzero.
|
ControlInputPort {
|
One record for control input port.
|
Type
|
Type of control port: enable, trigger, or function-call.
|
Width
|
Width (i.e. vector length) of the signal entering this input port.
|
Dimensions
|
Vector of the form [nRows, nCols] for the signal. Only written if number of dimensions is greater than 1.
|
DataTypeIdx
|
Index into the CompiledModel.DataTypes.DataType record list giving the data type of this port. Only written if not 0 (see CompiledModel.ControlInputPortDefaults.DataTypeIdx).
|
ComplexSignal
|
Is this port complex? Only written if yes. The default from CompiledModel.ControlInputPortDefaults.ComplexSignal is no.
|
HaveGround
|
yes/no: Is this port connected to ground?
|
SignalSrc
|
A vector of length Width where each element specifies the source signal. This is an index into the block I/O vector (Bi), an index into the state vector (Xi), an index into the external input vector (Ui), or unconnected ground (G0).
|
SignalSrcTID
|
Vector of length Width giving the TID as an integer index, trigger, or constant identifier for each signal entering this control port. This is the rate at which the signal is entering this port. If the subsystem block has a triggered sample time, then the signal source must be triggered.
|
NumUniqueTIDs
|
Only written for enabled systems. Number of unique TIDs on the enable port, needed since there is only a mode element for each unique TID.
|
SrcTID
|
For each unique TID, a record which contains the tid and the roll regions on the enable port for that tid.
|
RollRegions
|
A vector (e.g., [1:5, 6:10, 11]) giving the contiguous regions for this data input port over which for loops can be used. This is always written for S-Function blocks, otherwise it is written only if it is different from the block RollRegions.
|
DirectFeedThrough
|
Does this input port have direct feedthrough? Only written if WriteBlockConnections is on and the value this port does not have direct feedthrough, in which case no is written.
|
BufferDstPort
|
Only written if this input port is used by an output port of this block.The default is CompiledModel.ControlInputPortDefaults.BufferDstPort which is -1.
|
}
|
|
NumDataOutputPorts
|
Number of output ports. Only written if nonzero.
|
DataOutputPort {
|
One record for each output port.
|
Index
|
Index in the BlockOutputs map.
|
Dimensions
|
Vector of the form [nRows, nCols] for the signal. Only written if number of dimensions is greater than 1.
|
FrameData
|
yes, no, or mixed: Is this port frame-based?
|
Offset
|
The offset of this port in its BlockOutputs which can be non-zero due to the merge block.
|
Width
|
The width of this port which can be different than width of its BlockOutputs due to the merge block.
|
}
|
|
Connections {
|
Only written if this is an S-Function block, or the WriteBlockConnections rtwgen option was specified as on.
|
InputPortContiguous
|
Vector of length NumDataInputPorts containing yes, no, or grounded.
|
DirectSrcConn
|
Vector of length NumDataInputPorts containing yes or no as to whether or not the input port is directly connected to a nonvirtual source block.
|
DirectDstConn
|
Vector of length NumDataOutputPorts containing yes or no as to whether or not the output port is directly connected to a signal nonvirtual destination block.
|
DataOutputPort {
|
One record for each data output port.
|
NumConnPoints
|
Number of destination connection points. A destination connection point is defined to be a one-to-one connection with elements from the output (src) port to the destination block and port.
|
ConnPoint {
|
|
SrcSignal
|
Vector of length two giving the range of signal elements for the connection:
[startIdx, length]
Where startIdx is the starting index of the connection in the output port and length is the number of elements in the connection.
|
DstBlockAndPortEl
|
Vector of length four giving the destination connection:
[sysIdx, blkIdx, inputPortIdx, inputPortEl]
sysIdx is the index of the system record. blkIdx is the index with in system record of the destination block. inputPortIdx is the index of the destination input port. inputPortEl is the starting offset within the port of the connection.
|
}
|
|
}
|
|
}
|
|
ParamSettings {
|
Optional record specific to block.
|
blockSpecificName
|
Block specific settings.
|
}
|
|
<S-function fields>
|
Optional fields (parameters and/or records) that are written to the model.rtw file by the your specific S-function mdlRTW method.
|
Parameters
|
Specified as [N,M] where N is the number of Parameter records that follow, M is the number of modifiable parameter elements. Not present if N==0.
|
Parameter {
|
One record for each parameter.
|
Name
|
Name of the parameter as defined by the block.
|
Dimensions
|
Vector of the form [nRows, nCols] for the signal. Only written if number of dimensions is greater than 1.
|
DataTypeIdx
|
Data type index of the parameter into the CompiledModel.DataTypes.DataType records. Only written if not 0 (i.e., not real_T).
|
ComplexSignal
|
Is this parameter complex? Only written if yes.
|
String
|
String entered in the Simulink block dialog box.
|
StringType
|
One of:
"Computed" indicating the parameter is computed from values entered in the Simulink dialog box.
"Variable" indicating the parameter is derived from a single MATLAB variable.
"Expression" indicating the parameter is a MATLAB expression.
|
ASTNode {
|
Contains the direct mapping of this parameter to the model parameters record list. Essentially, this is the `value' of the parameter.
|
Op
|
Op = SL_CALCULATED => AstNode contains ModelParametersIdx, an index into the ModelParameters table for evaluated (calculated) parameter expressions,
Op = SL_NOT_INLINED => AstNode contains ModelParametersIdx, an index into the ModelParameters table for evaluated (calculated) parameter expressions,
Op = SL_INLINED => AstNode contains ModelParametersIdx, an index into the ModelParameters table for evaluated (calculated) parameter expressions,
Op = M_ID (a terminal node), the AST record contains ModelParameterIdx.
Op = M_NUMBER (a terminal node), the AST record contains the numerical value (Value field).
Op = Simulink name of operator token (many). In this case, the ASTNode contains the fields NumChildren and the records for the children.
|
fields depend on Op
|
|
}
|
|
}
|
|
ParamName0
|
Parameter[0] - An alias to the first parameter.
|
...
|
|
ParamNameN-1
|
Parameter[N-1] - An alias to the last parameter.
|
}
|
|
Block {
|
One block record (after the nonvritual block records) for each virtual outport block in the system.
|
Type
|
Outport
|
Name
|
Block name preceded with a <root> or <S#> token.
|
SLName
|
Unmodified Simulink name. This is only written if it is not equal to Name.
|
Identifier
|
Unique identifer across all blocks.
|
RollRegions
|
A vector (e.g., [1:5, 6:10, 11]) giving the contiguous regions over which for loops can be used.
|
NumDataInputPorts
|
1
|
DataInputPort {
|
See nonvirtual block DataInputPort record.
|
}
|
|
}
|
|
EmptySubsysInfo {
|
|
NumRTWdatas
|
Number of empty subsystem blocks that have
set_param(block, 'RTWdata', val)
specified, where val is a struct of strings.
|
RTWdata {
|
The RTWdata general record is only written if the RTWdata property of a block is non-empty. The RTWdata is created using the command:
set_param('block','RTWData',val)
where val is a MATLAB struct of string. For example,
val.field1 = 'field1 value'
val.field2 = 'field2 value'
|
field1
|
"field1 value"
|
field2
|
"field2 value"
|
}
|
|
}
|
|