Target Language Compiler    

Model Hierarchy

The root is the top level of the block diagram. The RootSignals record contains information about the makeup of signals within the root level. This includes indices to subsystems that are visible at the root level as well as the number of input and output signals that appear at the root level. The Subsystem records contain information about the number of virtual and nonvirtual subsystems contained in the model and identifiers for these.

Each subsystem in the model includes a system identifier, a name, and a set of indices to any additional child subsystems. Counts are also provided for the number of outputs for each subsystem and number, signal information, and total number of nonvirtual blocks within each subsystem.

The RootSignals and Subsystem records enable you to reconstruct the graphical model hierarchy. This is useful for third party monitoring and parameter tuning tools.

Table A-22: Model.rtw Model Hierarchy (Blocks, Signals, and Subsystems) 
Variable/Record Name
Description
SignalDefaults {

Default fields for Signal

  SigLabel

"": Signal label

  OutputPort

[0,1]: [outputPortIndex, outputPortWidth].

  SignalOffset

[0]: Vector whose length is the width of the output port. Needs to be used with the corresponding element in SignalSrc to identify the correct signal location within the record identified by SignalSrc.

}

RootSignals {

Signal and block information in the root window.

  

The contents of this record is identical to Subsystem record, except the SysId, Name, SLName, and Virtual fields are not present.

}

NumSubsystems

Total number of (non-empty) subsystems in the model. To obtain the number of virtual subsystems, use

CompiledModel.NumSubsystems - CompiledModel.NumSystems - 1.

Subsystem {

One record for each subsystem.

  SysId

System identifier. Each subsystem in the model is given a unique identifier of the form S# (e.g., S3).

  Name

Block name preceded with a <root> or <S#> token. The ID/Name values define an associative pair giving a complete mapping to the blocks full path name (e.g., <s2/gain1>).

  SLName

Unmodified Simulink name. This is only written if it is not equal to Name. This will occur when generating code using the rtwgen StringMapings argument. For the Real-Time Workshop C targets, any block name that contains a new-line, '/*', or '*/' will have these characters remapped. For example, suppose the Simulink block name is

  • my block name
    /* comment */
    

    The model.rtw file will contain

    Name   <Root>/my block name //+ comment +// SLName <Root>/my block name\n//* comment *//
  Virtual

yes/no: Whether or not the subsystem is virtual.

  ChildSubsystemIndices

Vector of integers specifying the subsystems that are directly contained within this subsystem. The indices index into the CompiledModel.Subsystem record list.

  NumSignals

Number of block output signals (including virtual) blocks.

  Signal {

One record for each block output signal (i.e., length of this list is NumSignals).

    Block

[systemIdx, callsiteIdx, blockIdx] or block name string if a virtual block.

    OutportName

This field is written only if the signal is emanating from a subsystem. It is the Outport block name corresponding to the output signal of a subsystem block.

    SigLabel

Signal label if present.

    OutputPort

[outputPortIndex, outputPortWidth] of the block producing this signal.

    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. Only written for nonvirtual blocks and if data type index is not 0 (i.e., real_T).

    ComplexSignal

yes: Only written for nonvirtual blocks and if signal is complex.

    SignalSrc

Vector of length outputPortWith giving the location of the signal source. Used with SignalOffset, this will give an index into the block I/O vector (B), or state vector (X), or external input vector (U) or unconnected ground (G) or F indicating the source is a function call.

    SignalOffset

Vector of length same as SignalSrc. Used with corresponding element in the SignalSrc field to identify the correct data offset in the record identified by SignalSrc.

  }

  NumBlocks

Number of nonvirtual blocks in the subsystem.

  BlockSysIdx

System index for blocks in this subsystem.

  BlockMap

Vector of length NumBlocks giving the blockIdx for each nonvirtual block in the subsystem.

}


  Custom Storage Class Record System Defaults (canonical inputs, outputs, and parameters)