Target Language Compiler    

System Record

The System record describes how to execute the blocks within your model. In general, a model can consist of multiple systems. There is one system for the root and one for each nonvirtual (conditionally executed) subsystem. All virtual (nonconditional) subsystems are flattened and placed within the current system. Each descendent system of the root system is written out using Pascal ordering (deepest first) to avoid forward references. Within each system is a sorted list of blocks.

There is one System record each system that is generated as a procedure (Inline==0). There is one System record for each instance of an inlined system (Inline==1). For example, if a nonvirtual subsystem block in a library is inlined an referenced five times, then there will be five System records for it.

During code generation, each system contains all relevant information to generate either the procedure bodies (or inlined code), and any required input argument types (e.g. the rtB_name typedef's structures) for the System.

Note, the various code generation data structures (e.g. rtB_name) are not flattened when a system is inlined, thus the overall structures (e.g. rtB) have the same general shape regardless of whether or not the system is inlined.

Table A-24: Model.rtw System Record  
Variable/Record Name
Description
NumSystems

Total number of System records (non-virtual) in the model. Use CompiledModel.NumSystems -1 to get the number of nonvirtual subsystems.

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, function-call, action or iterator

  CalledByBlock

yes if this is a derived atomic subsystem that is conditionally executed by another block, no otherwise. Think of this field as a subtype of atomic systems.

  Name

Name of system.

  SLName

Unmodified Simulink name. This is only written if it is not equal to Name.

  Identifier

Unique identifier for this system.

  Hash

Used in generating identifiers for systems during S-function importing.

  RTWSystemCode

0: The system is inlined. When the system is inlined there is only one call site (i.e., CallSites has only one row).

1: The system is a function that accesses global data. In this mode, the system access state, block I/O, etc via global memory and there is only one call site (i.e, CallSites has only one row).

2: The system is a reused function where all state, block I/O, etc. is passed to the system via function arguments. A reused function can have multiple call sites.

  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.

  SystemIdx

System index assigned to this system. Each system is assigned a unique non-negative integer by rtwgen. CompiledModel.System[SystemIdx] results in a reference to ourself.

  SL_SystemIdx

This is for use by the Simulink Accelerator. It provides in index into Simulink's internal call graph structure for the systems.

  HStructDeclSystemIdx

Where code, data structures, and local variables for this system are declared.

  • If Inlined == 0, then DeclSystemIdx == SystemIdx
  • If Inlined == 1, then we have either:
    1. DeclSystemIdx == SystemIdx. This only occurs when this is a function-call subsystem and the caller is inlined, but placing the `inlined' code with in a wrapper function.
    2. DeclSystemIdx > SystemIdx. This occurs when a) does not. This gives an ancestor providing the location of where the various items are declared. For example this, will be the calling system (i.e. the parent) if it is not inlined, otherwise it will be the caller of the calling system (i.e. the grandparent) if it is not inlined, etc.
  CallSites

[[callerSysIdx, callersCallSiteIdx, graphicalSysIdx, ssBlkIdxInGraphicalSys]; ...]

An Mx4 matrix, enabling us to trace the call stack enabling us to generate fully qualified structure accesses. Each row lets us fully walk back the function call stack. For each row, we have:

  parentSys = CompiledModel.System[CallSites[i,0]]

  grandparentCSI = parentSys.CallSites[CallSites[i,1]]

  graphicalSys = CompiledModel.System[CallSites[i,2]]

  subsysBlk = graphicalSys.Block[CallSites[i,3]]

This is a recursive definition because we can apply grandparentCSI to get its parent call site, and so on. The CallSites information is needed to generate accesses to elements within the various structures (e.g. rtB).

In general, callerSysIdx equals the graphicalSysIdx except for function-call subsystems crossing system boundaries.

The number of rows (M) is the number of unique call stacks to this system (instances), i.e., how many times this system was reused. The CallSites allows us to answer "Who is calling us?"

The CallSites can also be used to generate a list of names for a comment of who calls this function.

CallSites also gives the number of instances of people calling us (i.e., different call stacks).

  NumChildSystems

Number of systems that this system parents.

  ChildSystems

A %<NumChildSystems> x 4 matrix where each row contains:

[childSystemIdx, memoryReferenceCount, ... graphicalParentSysIdx, ssBlkIdxInGraphicalSys].

The memoryReferenceCount field is used in TLC when using the structure typedef's of the child systems in declaring the structure typedef for the current system. Nominally, the memoryReferenceCount will be 0. It will be non-zero for child function-call subsystems that are invoked from multiple sources (e.g., a wide function-call input port). For example, if a function-call subsystem is executed by three different initiators, then there will be three rows where that are identical, except for the memoryReferenceCount which takes on the values, 0, 1, 2.

To illustrate the meaning of other fields, consider this model:

The resulting model.rtw will contain:

  • System { # B
      NumChildSystems 0
    }
    System { # A
      NumChildSystems 1
      ChildSystems [0, 0, 2, 1]
      ...
      Block # sfcn (not accessable from ChildSystems)
    }
    System { # Root
      NumChildSystems 1
      ChildSystems [1, 0, 2, 0]
      Block # Subsystem block corresponding to system A
      Block # Subsystem block corresponding to system B
    }
    
  Interface {

Always present, even if the system is inlined or it is the root system. This field contains information about the data structures that are contained in this system and how to generate the interface for the system.

The interface record contains a number of argument definition records. For example, CanonicalInputArgDef. The presence of these records doesn't necessarily imply that the generated code will have these definitions as actual arguments to the code produced for this system. If the System is inlined or a non-reusable style function is being created, then the inputs are accessed via global data structures. If a reusable function is being generated for this system, then this arguments will only appear, if during code generation, blocks access the corresponding arguments. TLC tracks the access to the argument definitions, and after producing the `guts' of the function, TLC wraps this code in a function prototype.

    NumCanonicalInputArgDef

Length of the CanonicalInputArgDef records list giving the number of signals entering this system and are driven by blocks that are outside this system.

    CanonicaInputArgDef {

      Identifer

String such as u0 giving the name to map any (ui) signal sources to.

      FirstSignalSrc

Location of this signal in a specific data structure. It can be B# (BlockOutputs), D# (DWork), X# (ContStates) and the Width appended to it.e.g.,B5@4 which refers to the BlockOutput record with index 5 and of width 4. This is used to get the data type info to generate the actual input argument, e.g., real_T *signame.

      FirstSignalOffset

Used with FirstSignalSrc to find the corresponding offset for a signal.

      SignalWidth

The record identified by FirstSignalSrc may be wider than the actual input signal. In this case, the call-site adds the appropriate offset (consider the case of a demux'd signal feeding a system).

    }

    BlockIOArgDef {

Definition for the block I/O argument that contains entries in the overall block I/O structure for this system. Note is possible that a system has no block I/O argument (e.g., a single scope block in a system) in which case we identify that the system requires no block I/O argument via during TLC execution. An `is needed' flag tracked and set to true when a block within a system requires block I/O. Also consider a system that only contains a nonvirtual subsystem with no I/O and several blocks requiring block I/O. In this case NumFlatFields will be 0, but the lower system will require block I/O and this argument is required.

      FirstLocation

Index into CompiledModel.BlockOutputs.BlockOutput record list giving the first instance starting location of the block outputs that belong to this system. This enables TLC to generate the

procedure body when the system isn't inlined and there are multiple references because all the other references have the same pattern in the BlockOutputs structure. If the system is inlined then this is the only instance and we generate the inline code using the information from this index.

      NumFlatFields

The BlockOutputs record list is sorted such the all rtB_name flat structure field members (e.g. real_T speed[100]) appear before any non-flat fields (e.g. rtB_subname subNameId). This can be zero if there are only substructures within rtB_name. Used to determine how many arguments come from the block I/O, i.e., there is one for each `flat' field because these are referenced directly by blocks in this system.

    }

    NumCanonicalOutputArgDef

Length of the CanonicalOutputArgDef record list giving the number of outputs in a system that don't come from the systems `local block I/O'.

    CanonicalOutputArgDef {

Name of identifier to map (yi) signal sources to. Note, in general most outputs become part of the systems BlockIOArg, except when a subsystem output feeds a merge block, in which case, canonical is passed out via an explicit function argument.

      Identifer

"" if this is part of BlockIOArg, otherwise name for function prototype such as y0.

      FirstSignalSrc

Location of this signal in a specific data structure. If the signal source has a width of 1, FirstSignalSrc is formatted as B1. Otherwise it is formatted as Bi@w, where i is the index into the BlockOutput record, and w is the signal width. For example, B5@4 refers to a BlockOutput record with index 5 and of width 4. See Signal Connections for a usage example.

      FirstSignalOffset

Used with FirstSignalSrc to find the corresponding offset for a signal. The record identified by FirstSignalSrc may be wider than the actual output signal and because of the merge block capabilities, this output may be a subsection of the FirstSignalSrc record and this field gives the offset value

      SignalWidth

FirstSignalSrc may be wider than the actual output signal and this gives the actual width of the signal. This happens when a output signal from a system feeds a merge block.

    }

    PrmArgDef {

This contains the hierarchical parameter structure when inline parameters is off, and a semi-hierarchical parameter structure when inline parameters is on.

      FirstLocation

      NumFlatFields

Similar to BlockIOArgDef.FirstLocation

    }

Similar to BlockIOArgDef.NumFlatFields

    NumCanonicalPrmArgDefs

Length of the CanonicalPrmArg records list.

    CanonicalPrmArgDef {

One for each parameter argument. These originate when a variable in a parameter field (or child system Canonical parameter) maps back to a parameter field in a mask above us.

      Identifier

Identifier name of the parameter.

      Dimensions

[1]   : A scalar

[n]   : A vector

[n,m] : A matrix

We use this to decide if we are passing by value or reference.

      DataTypeIdx

Index into CompiledModel.DataTypes.DataType

      ComplexSignal

yes/no: is this parameter argument complex?

    }

    DWorkArgDef {

      FirstLocation

Index into CompiledModel.DWorks.DWork record list giving the starting location of the DWorks that belong to this system. Similar to BlockIOArgDef.FirstLocation handling.

      NumFlatFields

Number of DWork records that belong to this system. Similar to BlockIOArgDef.NumFlatFields handling.

  }

    ContStatesArgDef {

Used to generate the three input arguments to the system, rtX_name, rtXdot_name, rtXdis_name (disabled). We need to make sure that accesses to rtX_name, rtXdot, and no access to rtXdis_name result in only two arguments.

Structures are generated via:

typedef struct rtX_name_tag {

  real_T id1;

  ...

} rtX_name;

typedef rtX_name rtXdot_name;

typedef struct rtXdis_name_tag {

  boolean_T id1;

  ...

} rtXdis_name;

      FirstLocation

Index into CompiledModel.ContStates.ContState record list giving the starting location of the ContStates that belong to this system. Similar to BlockIOArgDef.FirstLocation handling.

      NumFlatFields

Number of ContState records that belong to this system. Similar to BlockIOArgDef.NumFlatFields handling

  }

    NonSampledZCArgDef {

Generates arguments: rtZC, rtZCdir

      FirstLocation

Index into CompiledModel.NoncampledZCs.NonsampledZC record list giving the starting location of the nonsampled zero crossings that belong to this system.

      NumFlatFields

Number of NonsampledZC records that belong to this system.

  }

    ZCEventArgDef {

Generates arguments: rtPZCE_name

      FirstLocation

Index into CompiledModel.ZCEvents.ZCEvent record list giving the starting location of the ZC events that belong to this system.

      NumFlatFields

Number of ZCEvent records that belong to this system. Similar to BlockIOArgDef.NumFlatFields handling.

  }

End of Interface record.

  InEnableHierarchy

Does this system reside within an enabled hierarchy (yes/no). This is used to aid in the generated code for the initialization of states, block I/O, etc.

  BlockControllingStateReset

Optional for InEnableHierarchy=1, giving the [system, block] index for the parent enabled system that controls state reset for this system (which may be itself)

  NoCode

If yes, generate no code. This system runs on the host only (during simulations or during external mode).

  NumChildPrmArgs

Only present if inline parameters is on. Number of elements in an aggregated list of all the parameters passed to child systems. See subsystem Block.CallSiteInfo.CanonicalPrmArg

  ChildPrmArg {

    TmpPrmId

"" or id. If this is non-empty, then there are multiple references to this canonical parameter argument and for efficiency we should create a local variable assigned to the parameter expression.

    ASTNode {

Handled just like a block Parameter[i].ASTNode

   }

  }

  NumZCEvents

Number of zero-crossing events for all blocks in this system.

  SystemFileName

Name of file into which generated code will be written. Simulink determines the appropriate filename based on Subsystem dialog settings and AutoRTWFileName so that TLC can directly use this file name. Only written for non-root systems.

  AutoRTWFileName

yes/no: Flag indicating whether a system has its RTWFileNameOpts set to 'Auto' or not. If set to 'Auto', Simulink determines the filename into which the system will generate if it generates into a separate file.

  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.

  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.

    BlockIdx

[systemIdx, callsiteIdx, blockIdx]

    ReducedBlocksConnected

Record of indices of connected blocks reduced

    ExprCommentInfo {

Record to hold block references of blocks folded into expressions. Record is used to create an appropriate comment.

      SysIdxList

Initialized to []. Managed in TLC.

      BlkIdxList

Initialized to []. Managed in TLC.

    }

    ExprCommentSrcIdx

Info for preserving comments

      SysIdx

Initialized to -1 set to at TLC runtime

      BlkIdx

Initialized to -1 set to at TLC runtime

    }

    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

      field2

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.

    InputPortSampleTimes

Only written if port sample time information is available.

    OutputPortSampleTimes

Only written if port sample time information is available.

    InputPortOffsetTimes

Only written if port sample time information is available.

    OutputPortOffsetTimes

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

[width, rootContStatesIdx, rootDerivStateIdx]

CompiledModel.ContStates.ContState[rootContStatesIdx] record list gives us the corresponding entry in the root ContState record list for this block. Not present if no continuos states, DefaultBlock.ContStates == [0, -1, -1].

    ModeVector

[width, firstRootDWorkIdx], where CompiledModel.DWorks.DWork[firstRootDWorkIdx] gives us the corresponding entry in the model-wide DWork record for this mode vector. Not present if no modes,

    RWork

[width, firstRootDWorkIdx], Similar to ModeVector

    IWork

[width, firstRootDWorkIdx], Similar to ModeVector

    PWork

[width, firstRootDWorkIdx], Similar to ModeVector

    DiscStates

[width, firstRootDWorkIdx], Similar to ModeVector

    NumDWork

Number of DWork records a block has declared. There is one DWork record for each data type work vector in the block. The DWork records include the ModeVector, RWork, IWork, PWork, DiscStates, and explicitly defined DWork vectors.

    DWork {

One record for each data type work vector.

      Name

A block defined name for the DWork vector. This defaults to DWORK# if not explicitly specified by the block.

      FirstRootIdx

CompiledModel.DWorks.DWork[FirstRootIdx] gives

us the corresponding entry in the root DWork record list for this DWork.

    }

    NumNonsampledZCs

Specified as [N,I], where N is the number of nonsampled zero-crossings and I is the index into the nonsampledZCs and nonsampled ZCdirs vectors.

    NonsampledZC {

One record for each nonsampled zero-crossing. Used to generate/work with rtZC, rtZCdir data structures.

      FirstRootIdx

CompiledModel.NonsampledZCs.NonsampledZC[FirstRootIdx] gives us the first corresponding entry in the root Nonsampled record list for this nonsampled zero crossing.

      MapIdx

The number of zero crossings a block may have is dependent on the type (e.g., sample time) of the signals entering the block's input port as well as things like the internal state of the block. For example, an absolute value block may have an input port width of 5, but only the 2nd and 4th elements of the input signal are continuous. The block has an overall sample time of continuous, but we only need track zero crossings on the 2nd and 4th elements. We could register 5 zero crossings, and the solver would be looking for zero crossings on all signals, but never see zero crossings on the 1st, 3rd, and 5th signals. To eliminate this inefficiency, we let blocks register the minimal number of zero and specify a local indices for each zero crossing giving information about which signals to return in the block's ZeroCrossing method. In our absolute value block example, we have two NonsampledZC records where MapIdx is 2 in the first record, and 4 in the second record.

      Direction

Direction of zero-crossing: Falling, Any, Rising.

    }

    ZCEvents

[width, rootZCEventIdx] where width is the number of zero-crossing events and CompiledModel.ZCEvents.ZCEvent[rootZCEventIdx] gives us the corresponding entry in the root ZCEvent record list for this ZCEvent zero crossing. The ZCEvent record list is used to generate rtPZCE (previous zero crossing event state).

    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.

      SignalSrc

A vector of length Width where each element specifies the source index of a signal. This is an index into the BlockOutput record (Bi), an index into the ContState record (Xi), an index into the DWork record (Di), an index into the external input vector (Ui), unconnected ground (G0), or F indicating the source is a function-call. Within a non-inlined system this can be a local/relative BlockOutput record index (bi), local contstate (xi) or local DWork vector index (di), canonical input (ui) or canonical output (yi).NOTE: The width of the input port may not match the width found in the corresponding BlockOutput record. This occurs when using the Merge block because it is possible to merge small signals into large signals.

      SignalOffset

A vector of length Width, where each element is an integer value giving the offset within the record specified by SignalSrc.

      FrameData

yes/no: Is this port frame-based?

      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.

      SystemToCall

[sysIdx, callSiteIdx]

      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.

      RecurseOnInput

0/1: Do we nominally recurse on input signal (for expression

folding)?

      SrcIdx

Optional [sysIdx, blkIdx, portIdx] if RecurseOnInput is 1 (true).

      HaveGround

yes/no: Is this port connected to ground?

      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.

      SignalSrc

Similar to DataInputPort.SignalSrc.

      SignalOffset

Similar to DataInputPort.SignalOffset.

      Type

Type of control port: enable, trigger, ifaction or function-call.

      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.

      Width to BufferDstPort

Similar to the items in the DataInputPort record.

    }

    NumDataOutputPorts

Number of output ports. Only written if nonzero.

    DataOutputPort {

One record for each output port.

      SignalSrc

Where this data output port writes to.A vector of length Width where each element specifies the source index of a BlockOutput record (Bi) or that output is a FcnCall (F). Within a non-inlined System that is going to be generated as a procedure, this can be a local/relative BlockOutput record index (bi), or canonical output (yi).

      SignalOffset

A vector of length Width, where each element is an integer value giving the offset within the record specified by SignalSrc.

      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.

      ComplexSignal

yes/no: Is this port complex?

      OutputExpression

0/1, Is the output an expression (used by expression folding)?

      TrivialOutputExpression

0/1, Is the output a trivial expression (used by expression folding)?

      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.

      InputPortConnected

Vector of length NumDataInputPorts containing yes or no

      OutputPortConnected

Vector of length NumDataOutputPorts containing yes or no

      InputPortBeingMerged

Vector of length NumDataOutputPorts containing yes or no

      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 an evaluated (constant) parameter expression;
  • Op = SL_NOT_INLINED => ASTNode contains ModelParametersIdx, an index into the ModelParameters table for evaluated (calculated) parameter expressions when Inline Parameters is off;
  • Op = SL_INLINED => ASTNode contains ModelParametersIdx, an index into the ModelParameters table for an evaluated (constant) parameter expression when Inline Parameters is on;
  • Op = M_ID (a terminal node), the AST record contains ModelParameterIdx;
  • Op = M_CANPRM_ID, the AST record contains a CanonicalPrmArgDefIdx (an index that specifies which parameter argument of the system is used in the current parameter expression;
  • 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.
  }

  CallSiteIdx

The instance index of the block; only written for subsystem blocks

  CallSiteInfo {
  }

Record containing the call-site information for Subsystem blocks.

Only written for Subsystem block. See "Subsystem Block Specific Records

  HiddenDataInputPort {
  }

Only written for nonvritual inport blocks within nonvirtual subsystems. The contents of this record are similar to DataInputPort records.

  HiddenControlInputPort {
  }

Only written for enable and trigger port blocks. The contents of this record are similar to ControlInputPort records.

  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

  }

}


  System Defaults (canonical inputs, outputs, and parameters) Stateflow Record