Simulink Reference    
Check Discrete Gradient

Check that the absolute value of the difference between successive samples of a discrete signal is less than an upper bound.

Library

Model Verification

Description


The Check Discrete Gradient block checks each signal element at its input to determine whether the absolute value of the difference between successive samples of the element is less than an upper bound. The block's parameter dialog box allows you to specify the value of the upper bound (1 by default). If the verification condition is true, the block does nothing. Otherwise the block halts the simulation, by default, and displays an error message in Simulink's Diagnostic Viewer.

You can also use the Advanced Pane of the Simulation Parameters dialog box to enable or disable all model verification blocks, including Check Discrete Gradient blocks, in a model.

The Check Discrete Gradient 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.

Data Type Support

The Check Discrete Gradient block accepts input signals of any dimensions and any built-in data type except int64 and uint64.

Parameters and Dialog Box

Maximum gradient
Upper bound on the gradient of the discrete input signal.
Enable Assertion
Unchecking this option disables the Check Discrete Gradient block, that is, causes the model to behave as if the block did not exist. The Advanced Pane of the Simulation Parameters dialog box allows you to enable or disable all Check Discrete Gradient blocks in a model regardless of the setting of this option.
Simulation callback when assertion fails
An M-expression to be evaluated when the assertion fails.
Stop simulation when assertion fails
If checked, this option causes the Check Discrete Gradient block to halt the simulation when the block's input is zero and display an error message in Simulink's Simulation Diagnostics viewer. Otherwise, the block displays a warning message in the MATLAB command window and continues the simulation.
Output Assertion Signal
If checked, this option causes the block to output a Boolean signal that is true (1) at each time step if the assertion succeeds and false (0) if the assertion fails. The data type of the output signal is boolean if you have selected the Boolean logic signals option on the Advanced pane of Simulink's Simulation Parameters dialog box. Otherwise the data type of the output signal is double.
Select Icon Type
Type of icon used to display this block in a block diagram: either graphic or text. The graphic option displays a graphical representation of the assertion condition on the icon. The text option displays a mathematical expression that represents the assertion condition. If the icon is too small to display the expression, the text icon displays an exclamation point. To see the expression, enlarge the icon.

Characteristics

Direct Feedthrough
No
Sample Time
Inherited from driving block
Scalar Expansion
No
Dimensionalized
Yes
Zero Crossing
No


  Bus Selector Check Dynamic Gap