Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Assertion

Check whether signal is zero

Library

Model Verification

Description

The Assertion block checks whether any of the elements of the input signal is zero. If all elements are nonzero, the block does nothing. If any element is zero, the block halts the simulation, by default, and displays an error message. Use the block parameter dialog box to:

  • Specify that the block should display an error message when the assertion fails but allow the simulation to continue.

  • Specify a MATLAB® expression to evaluate when the assertion fails.

  • Enable or disable the assertion.

You can also use the Model Verification block enabling setting on the Data Validity diagnostics pane of the Configuration Parameters dialog box to enable or disable all Assertion blocks in a model.

The Assertion block and its companion blocks in the Model Verification library are intended to facilitate creation of self-validating models. For example, you can use model verification blocks to test that signals do not exceed specified limits during simulation. When you are satisfied that a model is correct, you can turn error checking off by disabling the verification blocks. You do not have to physically remove them from the model. If you need to modify a model, you can temporarily turn the verification blocks back on to ensure that your changes do not break the model.

    Note:   For information about how Simulink® Coder™ generated code handles Model Verification blocks, see Debug.

Data Type Support

The Assertion block accepts input signals of any dimensions and any numeric data type that Simulink supports, including fixed-point data types.

For more information, see Data Types Supported by Simulink in the Simulink documentation.

Parameters and Dialog Box

Enable assertion

Clearing this check box disables the Assertion block, that is, causes the model to behave as if the Assertion block did not exist. The Model Verification block enabling setting under Debugging on the Data Validity diagnostics pane of the Configuration Parameters dialog box lets you enable or disable all Assertion blocks in a model regardless of the setting of this option.

Simulation callback when assertion fails

Specify a MATLAB expression to evaluate when the assertion fails. Because the expression is evaluated in the MATLAB workspace, define all variables used in the expression in that workspace.

Stop simulation when assertion fails

Selecting this check box causes the Assertion block to halt the simulation when the block input is zero and display an error in the Diagnostic Viewer. Otherwise, the block displays a warning message in the MATLAB Command Window and continues the simulation.

Sample time (-1 for inherited)

Enter the time interval between sample time hits or specify another appropriate sample time such as continuous. By default, the block inherits its sample time based upon its context within the model. For more information, see Sample Time.

Characteristics

Direct Feedthrough

No

Sample Time

Specified in the Sample time parameter

Scalar Expansion

No

Dimensionalized

Yes

Multidimensionalized

Yes

Zero-Crossing Detection

No

Was this topic helpful?