Assert


The
assert statement provides a convenient means for specifying checks on model validity within a model. The assert expression in an assert statement or equation should normally evaluate to true. When the assertion evaluates to false, the message in the second argument will be displayed to the user and the simulation will stop. The class AssertTest contains an example of the use of assert.





1 Simulation of Test1 and Test2




In the simulation of Test2 we see that an error occurs and by looking in the file ??dslog.txt we see that the assertion fails and returns the message "Variable x out of limit".