Check whether signal is zero
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 All Parameters tab in 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.
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.
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 on the All Parameters tab in the Configuration Parameters dialog box lets you enable or disable all Assertion blocks in a model regardless of the setting of this option.
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.
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.
This parameter is not visible in the block dialog box unless
it is explicitly set to a value other than
Double | Single | Boolean | Base Integer | Fixed-Point
Inherited from driving block