Main Content

Define Data in Requirements Table Blocks

Since R2022a

Requirements Table blocks manage simulation information by using data that represents block inputs, outputs, parameters, local data, and constants. You can define or delete data in the Requirements Table block by using the Symbols pane or the Model Explorer. Then you can set the properties of the data in the Property Inspector or Model Explorer.

Create and Delete Data

You can define or delete data by using the Symbols pane or the Model Explorer.

To use the Symbols pane, open the block by double-clicking it. In the Modeling tab, in the Design section, click Symbols Pane. In the Symbols pane, click the Create Data button . Delete data by right-clicking the data and clicking Delete.

To use the Model Explorer. In the Modeling tab, in the Design section, click Model Explorer. In the Model Hierarchy pane, expand the model tree view and select the Requirements Table block. Add data by clicking Add > Data or the Add Data button . Delete data by selecting the data name and clicking Edit > Delete or the Delete button .

You must define and use the data in the block in either table of the Requirements or Assumptions tabs. If you define data without also entering it in either table, the Unused symbol icon appears next to the data in the Symbols pane. Enter the data in either table to remove the icon. If you enter data in either table without defining it, the Undefined Symbol icon appears next to data in the Symbols pane. To define the data that you have already entered in either table, click the Resolve Undefined Symbols button .

Set General Data Properties

You can modify the properties of data by using the Symbols pane and the Property Inspector or by using the Model Explorer.

To edit the properties by using the Symbols pane, open the properties in the Property Inspector by using of one of these approaches:

  • Right-click the data name and click Inspect.

  • Click the data name. In the Modeling tab, in the Design Data section, click Property Inspector.

To edit the properties by using Model Explorer, click the data, then edit the properties in the General tab.

Name

Specifies the name of the data. Use the same naming conventions used in MATLAB®. You can also modify this property in the Symbols pane directly.

Scope

Specifies where the data resides in memory relative to the block. This property determines the range of functionality of the data. You can also modify this property in the Symbols pane in the Type column. You can set Scope to one of these values:

ScopeDescription
Local

The data is defined in the current block only. You must define local data at each time step. The block clears local data from memory at the end of each time step. The Symbols pane indicates data have Scope set to Local with the Local Data icon .

Constant

The data is a read-only constant value that is visible to the block at each time step. The Symbols pane indicates data have Scope set to Constant with the Constant Data icon .

Parameter

The data resides in a variable of the same name in the MATLAB workspace, model workspace, or in the workspace of a masked subsystem that contains this block. Parameter data is visible to the block at each time step. If a variable of the same name exists in more than one of the workspaces visible to the block, the block uses the variable closest to the block in the workspace hierarchy. For more information, see Model Workspaces (Simulink). The Symbols pane indicates data have Scope set to Parameter with the Parameter Data icon .

Input

The data is an input signal to the Requirements Table block. The Symbols pane indicates data have Scope set to Input with the Input Data icon .

Output

The data is an output signal of the Requirements Table block. You must define output data at each time step. The Symbols pane indicates data have Scope set to Output with the Output Data icon .

The Precondition, Postcondition, and Action columns place some restrictions on the Scope the data can use.

  • Entries in the Precondition column must use at least one input data.

  • Entries in the Postcondition column must use at least one input data where the Treat as design model output for analysis property is enabled.

  • Actions cannot reassign values of input data.

Port

Specifies the index of the port associated with the data. You can set this property in the Symbols pane in the Port column. This property applies only to data with the Scope property set to Input or Output.

Data must resolve to signal object

Specifies that the data explicitly inherits properties from Simulink.Signal objects of the same name in the MATLAB base workspace or the Simulink® model workspace. When enabled, the data can inherit these properties:

  • Size

  • Complexity

  • Type

  • Unit

  • Minimum value

  • Maximum value

  • Initial value

  • Storage class

  • Sampling mode

This property applies only to data with the Scope property set to Output or Local. This property appears only if you set the configuration parameter Signal resolution to a value other than None. For more information, see Symbol Resolution (Simulink).

Tunable

Specifies whether the parameter used as the source of the data is tunable. For more information, see Tunable Parameters (Simulink). This property applies only to data with the Scope property set to Parameter. Clear this option if the parameter must be a constant expression.

Size

Specifies the size of the data. This property can be a scalar value or a MATLAB vector of values. Size defaults to –1, which means that the size is inherited. For more information, see Specify Size of Requirements Table Block Data.

Variable size

Specifies whether the size of the data is variable. This property only applies to data with the Scope property set to Output or Local. Input data inherit size variability from their corresponding signals.

This property appears only if the Requirements Table block property Support variable-size arrays is enabled. See Support variable-size arrays.

Complexity

Specifies real or complex data. Set Complexity to one of these values:

ComplexityDescription
InheritedThe data inherits complexity based on the Scope property. Input and output data inherit complexity from the Simulink signals connected to them. Local and parameter data inherits complexity from the parameter to which the data is bound.
OffThe data is a real number.
On

The data is a complex number.

This property does not apply to data with the Scope property set to Constant.

Type

Specifies the data type for the data. You can specify the data type by:

  • Selecting a built-in type from the Type drop-down list.

  • Entering an expression in the Type field that evaluates to a data type.

  • In the Model Explorer, using the Data Type Assistant to specify the Mode property, then specifying the data type based on that mode.

    Note

    To display the Data Type Assistant, click the Show data type assistant button .

For more information, see Set Data Types in Requirements Table Blocks.

Lock data type against Fixed-Point tools

Prevents replacement of the current fixed-point type with an autoscaled type chosen by the Fixed-Point Tool (Fixed-Point Designer). See Autoscaling Data Objects Using the Fixed-Point Tool (Fixed-Point Designer).

Treat as design model output for analysis

Specifies data that the Requirements Table block identifies as output signals from the attached model. If you use postconditions, you must enable this property on at least one data in each postcondition. If you use only preconditions and actions, do not enable this property. This property applies only when the Scope property is Input. Input data with this property enabled are called design model outputs.

Unit (e.g. m, m/s^2, N*m)

Specifies the physical units for the data. By default, this property inherits the unit from the Simulink signal on the corresponding input or output port. This property applies only to data with the Scope property set to Input or Output.

Initial Value

Initial value of the data object. The options for this property depend on the scope of the data object.

ScopeOption for Initial Value
Local

You cannot specify an initial value.

Constant

You cannot specify an initial value.

Parameter

You cannot specify an initial value.

Input

You must specify an initial value to use this data as an input to getPrevious, hasChanged, hasChangedTo, or hasChangedFrom. The initial value defines the previous value of the data when the simulation time is 0.

Output

You must specify an initial value to use this data as an input to getPrevious, hasChanged, hasChangedTo, or hasChangedFrom. The initial value defines the previous value of the data when the simulation time is 0.

Constant value

Specifies the value of the data. Modify this property in the Symbols pane directly in the Value column. When you leave the Constant value field blank, the data resolves to a default value of 0.

Set Limit Range Properties

You can set the range of acceptable values for data in the Limit range section of the Property Inspector or Model Explorer. The Requirements Table block uses this range to validate the values used by the data as they enter, are used by, or leave the block. In some instances, you can also define the limit range by using the table in the Assumptions tab. See Add Assumptions to Requirements. You can enter an expression or parameter that evaluates to a numeric scalar. Specify the range by using two properties. These properties apply only to data with the Scope property set to Input, Output, or Local.

Minimum

Specifies the smallest value allowed for the data during simulation. The default value is -inf.

Maximum

Specifies the largest value allowed for the data during simulation. The default value is inf.

Set Logging Properties

You can set logging properties in the Properties tab of the Property Inspector or the Logging tab of the Model Explorer. For more information on signal logging, see Save Signal Data Using Signal Logging (Simulink). These properties can only be assigned to data with the Scope property set to Output or Local.

Log signal data

Whether to enable signal logging. Signal logging saves the values of the data to the MATLAB workspace during simulation.

Logging Name

Signal name used to log the data.

  • To use the name of the data, select Use signal name.

  • To specify a different name, select Custom and enter the custom logging name.

Limit data points to last

Whether to limit the number of data points to log. For example, if you set the maximum number of data points to 5000, the block logs only the last 5000 data points generated by the simulation.

Decimation

Whether to limit the amount of logged data by skipping samples using the specified decimation interval. For example, if you set a decimation interval of 2, the block logs every other sample.

Set Description Properties

After clicking the data you want to modify in the Model Explorer, you can set the following properties in the Description tab. You can also set the following properties with the Property Inspector by clicking the Properties tab.

Description

Specifies the description of the data.

See Also

Related Topics