Products & Services Solutions Academia Support User Community Company

Learn more about Simulink Design Verifier   

sldv.condition - Test condition

Syntax

sldv.condition(expr)

Description

sldv.condition(expr) Specifies that expr is true for every time step in a generated text case. Use any valid Boolean Embedded MATLAB expression for expr.

This function has no output and no impact on its parenting function, other than any indirect side effects of evaluating expr. If you issue this function from the MATLAB command line, the function has no effect.

Intersperse sldv.condition test conditions within Embedded MATLAB code or separate the conditions into a verification script.

The Test conditions option in the Test generation pane applies to test conditions represented with the sldv.condition function, as well as with the Test Condition block.

Examples

Add a test objective and test conditions, using Embedded MATLAB expressions.

  1. Open the sldvdemo_cruise_control model and save it as my_sldvdemo_cruise_control.

  2. Remove the Test Condition block for the speed block signal. Instead of the Test Condition block, this example uses sldv.test and sldv.condition.

  3. From the User-Defined Functions library, add an Embedded MATLAB Function block and:

    1. Name the block "tests."

    2. Connect the block to the signal for the speed block and to the signal for the target block.

  4. Add the following code to the tests Embedded MATLAB Function block.

  5. In the Embedded MATLAB editor, save the updated code.

  6. Generate the test: select Tools > Design Verifier > Generate Tests.

Alternatives

Instead of using the sldv.condition function, you can insert a Test Condition block in your model. However, using sldv.condition instead of a Test Condition block offers several benefits, described in About Test Case Generation.

You can also specify test conditions by using Embedded MATLAB without using the sldv.condition function. However, using sldv.condition instead of directly using Embedded MATLAB eliminates the need to:

See Also

Proof Assumption | Proof Objective | sldv.assume | sldv.prove | sldv.test | Test Condition | Test Objective

Tutorials

How To

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS