Target Language Compiler    

Data Type Work (DWork) Information

Certain blocks require persistence to store values between consecutive time intervals. When these blocks require the data to be stored in a data type other than real_T (the default data type), then instead of using an RWork element, a DWork element is used. DWork contains block identifier, name, width, datatype index, and a flag that tells whether it is used to retain data typed state information. Blocks that use data types but do not require persistence (e.g., Gain blocks) do not require DWork entries.

Note, all RWork, IWork, PWork, Mode, DiscState code elements are captured in the DWork records. Think of the real (RWork), integer (IWork), and pointer (PWork), etc. as well-defined data type (DWork) vectors.

Table A-12: Model.rtw Data Type (DWork) Information 
Variable/Record Name
Description
DWorkRecords {

List of all data type work vectors in the model. There is one DWorkRecord record for each data type work vector in the model. The source of a data type work vector is a block. A block can have zero or more data type work vectors.

  DWorkRecordDefaults {

Default values for the following DWorkRecord records.

    DataTypeIdx

0: Default vector of a DWorkRecord record is a real_T vector.

    ComplexSignal

no: Default vector of a DWorkRecord record is a non-complex vector.

    UsedAsDState

no: Default vector of a DWorkRecord record is not logged as a state (i.e., doesn't go in to the model.mat file).

  }

  NumDWorks

Number of data type work vectors in the model. Each block can register 0 or more data type work vectors. This include discrete states, RWork, IWork, PWork and Mode. Each record contains a vector as well as information describing the vector. For example, the model may contain two data type work records where one record contains a vector of length 3 and the other contains a vector of length 9 where each vector is of a different data type. In this case, NumDWorks is 2.

  DWork {

One DWork record for each data type work vector.

    Identifier

Identifier provides a unique variable name across all data type work vectors.

    Width

Length of the data type work vector.

    DataTypeIdx

Index into the CompiledModel.DataTypes.DataType record list (i.e., the data type table used to identify the data type for this DWork). Only written if data type is a non-real_T (i.e., not a 0).

    ComplexSignal

yes: Only written if this data type work vector is complex.

    UsedAs

Only written if not default ("DWORK"), it can be either "MODE" or "RWORK" or "IWORK" or "PWORK" or "DSTATE".

    SigSrc

[systemIdx, blockIdex, dworkIdx].

  }

}


 Block I/O Information State Mapping Information