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)

  • Always inside

  • Always outside

Trigger-Response Assessments

Create trigger-response assessments to verify a signal response when a trigger is detected. A trigger-response assessment requires:

  • Trigger parameter

  • Response parameter

  • Optional Delay parameter

The trigger condition is the condition pattern based on which the response signal is evaluated. There are five trigger condition patterns available:

Trigger Condition PatternBehaviorAvailable Time References
Whenever is trueCheck the response signal continuously whenever the triggering condition is true.N/A
Becomes trueCheck the response signal every time the triggering condition becomes true.Rising edge
Becomes true and stays true for at leastCheck the response signal every time the triggering condition becomes true and stays true for at least the interval specified by the min-time parameter (in s). You also specify an additional time reference parameter at which to evaluate the response signal.Rising edge of trigger or end of min-time
Becomes true and stays true for at mostCheck the response signal every time the triggering condition becomes true and stays true for at most the interval specified by the max-time parameter (in s). You also specify an additional time reference parameter at which to evaluate the response signal.Rising or falling edge of trigger or end of max-time
Becomes true and stays true for betweenCheck the response signal every time the triggering condition becomes true and stays true between the interval specified by the min-time and max-time parameters. You also specify an additional time reference parameter at which to evaluate the response signal.Rising or falling edge of the trigger or end of min-time or max-time

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 PatternBehavior
Must be trueThe response condition pattern must be true starting from the time reference parameter to the delay (if it is defined).
Must stay true for at leastThe response condition pattern must stay true for at least the duration specified by the min-time parameter.
Must stay true for at mostThe response condition pattern must stay true for at most the duration specified by the max-time parameter.
Must stay true for betweenThe response condition pattern must stay true for at least the duration specified by the min-time parameter and at most the duration specified by the max-time parameter.
Must stay true untilThe response condition must stay true until the until-condition parameter becomes true within the duration specified by the max-time parameter.

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.

Custom Assessments

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:

  • Logical operators: &, |, and ~

  • Relational operators: <, <=, ==, ~=, >=, and >

  • Arithmetic operators: +, -, and * (multiplication by scalar constants only)

  • Cast operators:

The functional forms of the logical, relational, and arithmetic operators are not supported. In addition to operators, you can also use the abs function to construct assessment conditions.

See Also