Logical and Temporal Assessment Syntax
Simulink® Test™ provides three logical and temporal assessment templates:
Logical Assessment Templates
Bounds Check — Check maximum and minimum bounds for signals and expressions.
Custom — Check if a logical expression holds true for all time steps.
Temporal Assessment Template
Trigger-Response — Check for a signal response when a trigger is detected.
Bounds Check Assessments
Create bounds check assessments to check if the signals and expressions you test satisfy the boundary condition patterns you specify for them. Boundary condition pattern templates let you test if signals and expressions in terms of boundary values that you specify are:
Always less than (or equal to)
Always greater than (or equal to)
Create trigger-response assessments to verify a signal response when a trigger is detected. A trigger-response assessment requires:
The trigger condition is the condition pattern based on which the response signal is evaluated. There are five trigger condition patterns available:
|Trigger Condition Pattern||Behavior||Available Time References|
|Whenever is true||Check the response signal continuously whenever the triggering condition is true.||N/A|
|Becomes true||Check the response signal every time the triggering condition becomes true.||Rising edge|
|Becomes true and stays true for at least||Check the response signal every time the triggering condition
becomes true and stays true for at least the interval specified by
the ||Rising edge of trigger or end of
|Becomes true and stays true for at most||Check the response signal every time the triggering condition
becomes true and stays true for at most the interval specified by
the ||Rising or falling edge of trigger or end of
|Becomes true and stays true for between||Check the response signal every time the triggering condition
becomes true and stays true between the interval specified by the
||Rising or falling edge of the trigger or end of
To complete authoring a trigger-response assessment, you specify the response condition pattern and the response condition. There are five response condition patterns available:
|Response Condition Pattern||Behavior|
|Must be true||The response condition pattern must be true starting from the time reference parameter to the delay (if it is defined).|
|Must stay true for at least||The response condition pattern must stay true for at least the
duration specified by the |
|Must stay true for at most||The response condition pattern must stay true for at most the
duration specified by the |
|Must stay true for between||The response condition pattern must stay true for at least the
duration specified by the |
|Must stay true until||The response condition must stay true until the
The delay is an optional time interval starting from the time reference parameter to the point where the response condition is expected to be satisfied. You can set the delay to a maximum value or specify a time range in seconds.
The custom assessments template allows you to specify logical MATLAB® expressions that do not fit in previous templates. Assessments are meant to evaluate signal properties, so all symbols defined in a custom template must be mapped to signal data (model element or timeseries or a constant scalar value).
Logical and Temporal Assessment Conditions
You can enter MATLAB expressions that include these operators as the assessment conditions:
*(multiplication by scalar constants only)
The functional forms of the logical, relational, and arithmetic operators
are not supported. In addition to operators, you can use the
abs function to construct assessment conditions. You can also use the
t symbol to construct assessment conditions, which is
automatically bound to simulation time. Use of the
t symbol as a
max-time parameter in assessment
conditions is not supported. Event-based signals are not supported in logical or
Data Types in Assessment Conditions
Logical and temporal assessment conditions support the built-in data types listed
on Data Types Supported by Simulink, with the exception of
string. You can also use
Fixed-point data types are not supported in assessments.
All operands in an assessment condition must be of the same data type. You can use cast operators to change the data type of an operand or change an operand to a symbol and map the symbol to an expression. Read about mapping symbols to expression on Resolve Assessment Parameter Symbols. Read about defining variables for use in an expression on Define Variables in the Assessment Callback Section. When you map a symbol to an expression, the expression must be the same data type as other operands in the assessment condition.
When mapping a symbol to a bus signal or a multidimensional signal, you must map the symbol to only one element from the bus or multidimensional signal. Read about mapping to model elements on Resolve Assessment Parameter Symbols. The data type of the selected element from the bus or multidimensional signal should always be a supported type, and must be the same data type as other operands in the assessment condition.
Define Variables in the Assessment Callback Section
The Assessment Callback section allows you to define variables that you can use in logical and temporal assessment conditions and expressions. You can define variables the same way you do in the MATLAB workspace. This callback also has access to predefined variables that contain data from your test, model, and simulation, such as a signal from a Simulink block. You can define a variable as a function of this data. These objects are available:
|The test case result (|
|An array of simulation outputs ( |
|Current test case object (|
|Cell array of models simulated by the test case. Can be a harness model.|
|Cell array of systems under test. For a harness, this array contains the component under test.|
|Cell array that returns true if |
|Name of current test iteration.|
After defining the variables in the callback, you can map the symbols to variables for use in assessment conditions and expressions. Read about mapping a symbol to an expression on Resolve Assessment Parameter Symbols for information on how to map symbols to variables.
The variables created in the Assessment Callback section can only be used in conditions and expressions in the Logical and Temporal Assessments pane. These variables cannot be used in other areas of the Test Manager. The Assessment Callback is saved as part of the test file.