This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Assess Temporal Logic Using Temporal Assessments

Hybrid systems with discrete and continuous time behavior can require complex timing-dependent signal logic. Simulink® Test™ enables you to assess model timing and event ordering by authoring and including temporal assessments with test cases in the Test Manager.

To work with temporal assessments:

  1. Select an assessment template

  2. Enter assessment conditions:

    • Map symbols to model elements such as signals or to a time series or constant

    • View assessment summary

  3. Run the test case

  4. Use the results to assess the system under test (SUT) against your requirements

As an example, consider a forced oscillation damping problem that has this requirement:

For a signal S, if the signal magnitude exceeds a value P, then within t seconds, it must settle below a value Q and stay below Q for u seconds.

Create a Temporal Assessment

To create a temporal assessment:

  1. Create or open a test case.

  2. Navigate to the Logical and Temporal Assessments Editor.

  3. Click Add Assessment. These assessment templates are available:

    • Bounds Check – Check maximum and minimum bounds for signals and expressions

    • Trigger-Response – Check for a signal response when a trigger is detected

    • Custom – Check if a logical expression holds true for all time steps

    For this example, select Trigger-Response.

The Trigger-Response template appears. To finish creating the assessment, you define temporal assessment conditions in the context of the SUT.

Define Temporal Assessment Conditions

A Trigger-response assessment requires:

  • Trigger parameter

  • Response parameter

  • Optional Delay parameter

You can enter conditional statements as the trigger and response conditions. For the forced oscillation damping problem:

  1. Select whenever is true as the trigger and enter abs(S) > P as the condition. The trigger condition is the condition pattern after which the response signal is evaluated. The response condition is triggered when the magnitude of signal S exceeds value P.

  2. Select must stay true for at least as the response and enter abs(S) < Q and u as the condition and min-time respectively. The response condition describes the behavior of the SUT in response to the trigger condition. The response condition is that the magnitude of signal S must settle below value Q and stay below Q for at least u seconds.

  3. Select with a delay of at most as the delay type and set t as the max-time parameter. The delay is an optional time interval starting from a time reference parameter to the point where the response condition is expected to be satisfied. The delay is at most t seconds.

All time units are seconds.

When you add a symbol as part of a temporal assessment parameter in the Assessments editor, it is added to the list of symbols as an unresolved symbol. Resolve symbols by using the Symbols pane in the Assessments Editor.

Resolve Assessment Parameter Symbols

To resolve a symbol, right-click the symbol. Two options are available:

  1. Map to model element – Use the mapping dialog box to map symbols to a signal/parameter/block in the SUT.

    Select a symbol to map from the drop-down list at the top of the mapping dialog.

    After you finish mapping symbols to model elements, the Symbols pane displays metadata that corresponds to the model element.

    Signals mapped to a symbol used by an assessment in the editor are logged when you run the test case.

    If you map a bus or an array to a symbol, use the Field/Element row in the Symbols pane to select a scalar signal from the bus or array. For example:

    • If you want to map a symbol to a bus signal containing a bus element fieldA, enter .fieldA.

    • If you want to map a symbol to the signal element corresponding to index (5,5) in a signal array, enter (5,5).

    • You can combine both expressions as .fieldA(5,5).

  2. Map to expression – Assign a scalar constant value or time series object to a symbol.

    You can use the simulation output as a variable to map symbols to signals. For example, entering sltest_simout.logsout.get('mySignal') is equivalent to using Map to model element to map symbols to a signal mySignal. See Test-Case Level Callbacks for more information.

Review Temporal Assessment Summary

After you enter the assessment parameters, click the arrow to the left of the Assessment description to view the assessment summary.

The Visual Representation pane provides a graphical illustration of a passing case for the assessment.

View Passing and Failing cases for the assessment by clicking the Explore Pattern icon. Select the type of case you want to view (passing or failing) from the drop-down list and click to view different passing and failing cases.

Evaluate the SUT

Run the test case to evaluate the SUT. Temporal assessments are evaluated after simulation using logged signal data. Use the test case results to review the SUT against your requirements.

View Assessment Results

View the results of the assessment evaluation from the Results and Artifacts pane of the Test Manager. Select the test case and select the assessment in the Results tree to open a new Assessment Result tab. Simulink Test evaluates the assessment and displays the expected behavior and the actual result of the assessment execution with a description of the assessment failures at different time steps.

Investigate the SUT behavior using the and buttons and the textual descriptions at points of failure.

For a more detailed investigation, expand the Expression Tree to view results for every individual element of the assessment.

Use the zoom, pan, and data cursor functionalities to analyze assessment evaluation results in the Expression Tree.

Link Temporal Assessments to Requirements

If you have a Simulink Requirements™ license, you can establish traceability between temporal assessments and requirements in Simulink Requirements by linking assessments to requirements. To create links to requirements, select the assessment in the editor and click the Requirements column to open the Requirement Editor dialog box. See Link to Requirements for more information.

See Also