Check Dynamic Lower Bound

Check that one signal is always less than another signal

Libraries:
HDL Coder / Model Verification

Description

The Check Dynamic Lower Bound block checks if a reference signal, min, is less than the amplitude of an input signal, u at each time step and executes an assertion after comparison. If min is less than u, the assertion is `true (1)` and the block does nothing. If not, the block halts the simulation and returns an error message by default.

The input signals can be scalars, vectors, or matrices. Both input signals must be the same data type. The block compares the value of u to the bound differently depending on the signal.

• When comparing scalars to vectors or matrices, the block compares the scalar signal to each element of the non-scalar signal.

• When comparing a vector or matrix signal to another vector or matrix signal, the block checks the signals element-by-element.

• For models with an input and bound that are both vectors or matrices, the input and bound must have the same dimensions.

Examples

expand all

Using the Check Dynamic Lower Bound block, you can check if an input signal falls below a changing lower bound during a simulation.

In this example, the Check Dynamic Lower Bound block compares the value of a tested input signal from a Step block at the u port to a Sine Wave block at the min port. The Check Dynamic Lower Bound block checks if the value of the signal at the min port is less than the value of the tested input sigal. If it is, the block asserts `true (1)`. Because the Output assertion signal parameter of the Check Dynamic Lower Bound block is selected, the block outputs the assertion value. Run the simulation to observe the model output.

At the start of the simulation, the Check Dynamic Lower Bound block outputs `0` because the value of the Sine Wave block is greater than the value of the Step block. At a time of `3.14`, the sine wave dips below `0`, causing the value of the Step block to exceed the sine wave. The Check Dynamic Lower Bound block recognizes this change and outputs `1`.

At a time of `5`, the Step block outputs a value of `0.5`, which is still greater than the sine wave. The Step block value stays greater than the sine wave until the time reaches `6.81`. The Check Dynamic Lower Bound block recognizes this change and the assertion fails. The assertion stays at `0` until the time reaches `8.90`, where the sine wave goes below the value of the Step block.

Ports

Input

expand all

Signal specifying the lower bound of the check against the input signal u amplitude. Signal data type and dimension must be the same as u.

Data Types: `half` | `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `Boolean` | `fixed point` | `enumerated`

Input signal checked against the lower bound specified by min. Both input signals must be the same data type and dimension.

Data Types: `half` | `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `Boolean` | `fixed point` | `enumerated`

Output

expand all

Output signal that is `true (1)` if the assertion succeeds and `false (0)` if the assertion fails. If, in the Configuration Parameters window, in the Math and Data Types section, under Advanced parameters, you select Implement logic signals as Boolean data, then the output data type is `Boolean`. Otherwise, the data type of the signal is `double`.

Dependencies

To enable this output port, select the Output assertion signal parameter check box.

Data Types: `double` | `Boolean`

Parameters

expand all

Clearing this parameter disables the block and causes the model to behave as if the block does not exist. To enable or disable all verification blocks, regardless of the setting of this option, go to the Configuration Parameters window, click Diagnostics > Data Validity, expand the Advanced parameters section, and set Model Verification block enabling to ```Enable all``` or `Disable all`.

Programmatic Use

 Parameter: `enabled` Type: string scalar or character vector Values: `"on"` | `"off"` Default: `"on"`

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.

Dependencies

To enable this parameter, select the Enable assertion parameter.

Programmatic Use

 Parameter: `callback` Type: string scalar or character vector Default: `""`

Select this parameter to stop the simulation when the check fails. Clear this parameter to display a warning and continue the simulation.

Programmatic Use

 Parameter: `stopWhenAssertionFail` Type: string scalar or character vector Values: `"on"` | `"off"` Default: `"on"`

Select this parameter to enable the output port.

Programmatic Use

 Parameter: `export` Type: string scalar or character vector Values: `"on"` | `"off"` Default: `"off"`

Specify the style of the block icon. 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.

Programmatic Use

 Parameter: `icon` Type: string scalar or character vector Values: `"graphic"` | `"text"` Default: `"graphic"`

Block Characteristics

 Data Types `Boolean` | `double` | `enumerated` | `fixed point` | `half` | `integer` | `single` Direct Feedthrough `no` Multidimensional Signals `yes` Variable-Size Signals `no` Zero-Crossing Detection `no`

Version History

Introduced before R2006a