Check that signal satisfies upper and lower bounds during simulation

Simulink Design Optimization

Check that a signal satisfies upper and lower bounds during simulation:

If all bounds are satisfied, the block does nothing.

If a bound is not satisfied, the block asserts, and a warning message appears at the MATLAB

^{®}prompt. You can also specify that the block:Evaluate a MATLAB expression.

Stop the simulation and bring that block into focus.

During simulation, the block can also output a logical assertion signal:

If all bounds are satisfied, the signal is true (

`1`

).If a bound is not satisfied, the signal is false (

`0`

).

You can add Check Custom Bounds blocks on multiple signals to check that they satisfy the bounds.

You can also plot the bounds on a time plot to graphically verify that the signal satisfies the bounds.

This block and the other blocks in the Model Verification library test that a signal remains within specified time-domain characteristic bounds. When a model does not violate any bound, you can disable the block by clearing the assertion option. If you modify the model, you can re-enable assertion to ensure that your changes do not cause the model to violate a bound.

If the signal does not satisfy the bounds, you can optimize
the model parameters to satisfy the bounds. If you have Simulink^{®} Control Design™ software,
you can add frequency-domain bounds such as Bode magnitude and optimize
the model response to satisfy both time- and frequency-domain requirements.

The block can be used in all simulation modes for signal monitoring
but only in `Normal`

or `Accelerator`

simulation
mode for response optimization.

Task | Parameters |
---|---|

Specify upper and lower bounds to:Assert that a signal satisfies the bounds Optimize model response so that a signal satisfies the bounds
| In the Bounds tab: |

Specify assertion options (only when you specify upper and lower bounds). | In the Assertion tab: |

Open Response Optimization tool to optimize model response | Click Response
Optimization |

Plot upper and lower bounds | Click Show
Plot. |

Display plot window instead of Block Parameters dialog box on double-clicking the block. | Show
plot on block open |

Check that a signal is less than or equal to upper bounds, specified
in **Times
(seconds)** and **Amplitudes**, during
simulation. The software displays a warning if the signal violates
the upper bounds.

This parameter is used for assertion only if **Enable assertion** in
the **Assertion** tab is selected.

You can specify multiple upper bounds on various model signals.
The bounds also appear on the time plot. If you clear **Enable
assertion**, the bounds are not used for assertion but continue
to appear on the plot.

**Default:** On

- On
Check that the signal satisfies the specified upper bounds during simulation.

- Off
Do not check that the signal satisfies the specified upper bounds during simulation.

Clearing this parameter disables the upper bounds and the software stops checking that the bounds are satisfied during simulation. The bound segments are also greyed out on the plot.

To only view the bounds on the plot, clear

**Enable assertion**.

Parameter: `EnableUpperBound` |

Type: string |

Value: `'on'` | `'off'` |

Default: `'on'` |

Time vector for one or more upper bound segments, specified in seconds.

Specify the corresponding amplitude values in **Amplitudes**.

**Default:** `[0 5; 5 10]`

Must be specified as start and end times:

Positive finite numbers for a single bound with one edge.

Matrix of positive finite numbers for a single bound with multiple edges.

For example, type

`[0.1 1;1 10]`

for two edges at times [0.1 1] and [1 10].Cell array of matrices with positive finite numbers for multiple bounds.

To assert that amplitudes that correspond to the time vectors are satisfied, select both

**Include upper bound in assertion**and**Enable assertion**.You can add or modify start and end times from the plot window:

To add new time vectors, right-click the yellow area on the plot, and select

**Edit**. Click**Insert**to add a new row to the Edit Bound dialog box. Specify the start and end times of the new bound segment in the**Time**column. Specify the corresponding amplitudes in the**Amplitude**column.To modify the start and end times, drag the bound segment. Alternatively, right-click the segment, and select

**Edit**. Specify the new times in the**Time**column.

You must click

**Update Block**before simulating the model.

Parameter: `UpperBoundTimes` |

Type: string |

Value: `[0 5; 5 10]` | ```
positive
finite numbers
``` | `matrix of positive finite numbers` | ```
matrix
of positive finite numbers
``` ```
cell array of matrices
with positive finite numbers
``` . Must be specified inside single
quotes (`''` ). |

Default: ```
[0 5; 5
10]
``` |

Amplitude values for one or more upper bound segments.

Specify the corresponding start and end times in **Times (seconds)**.

**Default:** ```
[1.1 1.1;
1.01 1.01]
```

Must be specified as start and end amplitudes:

Finite numbers for a single bound with one edge

Matrix of finite numbers for a single bound with multiple edges.

For example, type

`[0 1; 2 3]`

for two edges at amplitudes [0 1] and [2 3].Cell array of matrices with finite numbers for multiple bounds

To assert that amplitude bounds are satisfied, select both

**Include upper bound in assertion**and**Enable assertion**.You can add or modify amplitudes from the plot window:

To add new amplitudes, right-click the plot, and select

**Edit**. Click**Insert**to add a new row to the Edit Bound dialog box. Specify the start and end amplitudes of the new bound segment in the**Amplitude**column. Specify the corresponding start and end times in the**Time**column.To modify the start and end amplitudes, drag the bound segment. Alternatively, right-click the segment, and select

**Edit**. Specify the new amplitudes in the**Amplitude**column.

You must click

**Update Block**before simulating the model.

Parameter: `UpperBoundAmplitudes` |

Type: string |

Value: ```
[1.1 1.1;
1.01 1.01]
``` | `finite numbers ` | ```
matrix
of finite numbers
``` | ```
cell array of matrices with
finite numbers
``` . Must be specified inside single quotes (`''` ). |

Default: ```
[1.1 1.1;
1.01 1.01]
``` |

Check that a signal is greater than or equal to lower bounds,
specified in **Times
(seconds)** and **Amplitudes**, during simulation.

This parameter is used for assertion only if **Enable assertion** in
the **Assertion** tab is selected.

You can specify multiple lower bounds on various model signals.
The bounds also appear on the time plot. If you clear **Enable
assertion**, the bounds are not used for assertion but continue
to appear on the plot.

**Default:** Off

- On
Check that the signal satisfies the specified lower bounds during simulation.

- Off
Do not check that the signal satisfies the specified lower bounds during simulation.

Clearing this parameter disables the lower bounds and the software stops checking that the bounds are satisfied during simulation. The bound segments are also greyed out on the plot.

To only view the bounds on the plot, clear

**Enable assertion**.

Parameter: `EnableLowerBound` |

Type: string |

Value: `'on'` | `'off'` |

Default: `'off'` |

Time vector for one or more lower bound segments, specified in seconds.

Specify the corresponding amplitude values in **Amplitudes**

**Default:** `[]`

Must be specified as start and end times:

Positive finite numbers for a single bound with one edge.

Matrix of positive finite numbers for a single bound with multiple edges.

For example, type

`[0.1 1;1 10]`

for two edges at times [0.1 1] and [1 10].Cell array of matrices with positive finite numbers for multiple bounds.

To assert that amplitudes that correspond to the time vectors are satisfied, select both

**Include lower bound in assertion**and**Enable assertion**.You can add or modify start and end times from the plot window:

To add new time vectors, right-click the yellow area on the plot, and select

**Edit**. Click**Insert**to add a new row to the Edit Bound dialog box. Specify the start and end times of the new bound segment in the**Time**column. Specify the corresponding amplitudes in the**Amplitude**column.To modify the start and end times, drag the bound segment. Alternatively, right-click the segment, and select

**Edit**. Specify the new times in the**Time**column.

You must click

**Update Block**before simulating the model.

Parameter: `LowerBoundTimes` |

Type: string |

Value: `[]` | ```
positive
finite numbers
``` | `matrix of positive finite numbers` | ```
cell
array of matrices with positive finite numbers
``` . Must be
specified inside single quotes (`''` ). |

Default: `[]` |

Amplitude values for one or more lower bound segments.

Specify the corresponding start and end times in **Times (seconds)**.

**Default:** `[]`

Must be specified as start and end amplitudes:

Finite numbers for a single bound with one edge

Matrix of finite numbers for a single bound with multiple edges.

For example, type

`[0 1; 2 3]`

for two edges at amplitudes [0 1] and [2 3].Cell array of matrices with finite numbers for multiple bounds

To assert that amplitude bounds are satisfied, select both

**Include lower bound in assertion**and**Enable assertion**.You can add or modify amplitudes from the plot window:

To add new amplitudes, right-click the plot, and select

**Edit**. Click**Insert**to add a new row to the Edit Bound dialog box. Specify the start and end amplitudes of the new bound segment in the**Amplitude**column. Specify the corresponding start and end times in the**Time**column.To modify the start and end amplitudes, drag the bound segment. Alternatively, right-click the segment, and select

**Edit**. Specify the new amplitudes in the**Amplitude**column.

You must click

**Update Block**before simulating the model.

Parameter: `LowerBoundAmplitudes` |

Type: string |

Value: `[]` | ```
finite
numbers
``` | `matrix of finite numbers` | ```
cell
array of matrices with finite numbers
``` . Must be specified
inside single quotes (`''` ). |

Default: `[]` |

Ensure that the software simulates the model to produce output at the bound edges. Simulating the model at the bound edges prevents the simulation solver from missing a bound edge without asserting that the signal satisfies that bound.

For more information on zero-crossing detection, see Zero-Crossing Detection in
the *Simulink User Guide*.

**Default:** On

- On
Simulate model at the bound edges

This setting is ignored if the Simulink solver is fixed step.

- Off
Do not simulate model at the bound edges. The software may not compute the output at the bound edges.

Parameter: `ZeroCross` |

Type: string |

Value: `'on'` | `'off'` |

Default: `'on'` |

Enable the block to check that bounds specified and included
for assertion in the **Bounds** tab are satisfied
during simulation. Assertion fails if a bound is not satisfied. A
warning, reporting the assertion failure, appears at the MATLAB prompt.

If the assertion fails, you can optionally specify that the block:

Execute a MATLAB expression, specified in

**Simulation callback when assertion fails (optional)**.Stop the simulation and bring that block into focus, by selecting

**Stop simulation when assertion fails**.

This parameter has no effect if you do not specify any bounds.

Clearing this parameter disables assertion, i.e., the block no longer checks that specified bounds are satisfied. The block icon also updates to indicate that assertion is disabled.

In the Configuration Parameters dialog box of the Simulink model,
the **Model Verification block enabling** parameter
on the **All Parameters** tab lets you to enable
or disable all model verification blocks in a model, regardless of
the setting of this option in the block.

**Default:** On

- On
Check that bounds included for assertion in the

**Bounds**tab are satisfied during simulation. A warning, reporting assertion failure, is displayed at the MATLAB prompt if bounds are violated.- Off
Do not check that bounds included for assertion are satisfied during simulation.

This parameter enables:

**Simulation callback when assertion fails (optional)****Stop simulation when assertion fails**

Parameter: `enabled` |

Type: string |

Value: `'on'` | `'off'` |

Default: `'on'` |

MATLAB expression to execute when assertion fails.

Because the expression is evaluated in the MATLAB workspace, define all variables used in the expression in that workspace.

**Default:** `[]`

A MATLAB expression.

**Enable
assertion** enables this parameter.

Parameter: `callback` |

Type: string |

Value: `''` | ```
MATLAB
expression
``` |

Default: `''` |

Stop the simulation when a bound specified in the **Bounds** tab
is violated during simulation, i.e., assertion fails.

If you run the simulation from a Simulink model window, the Simulation Diagnostics window opens to display an error message. The block where the bound violation occurs is highlighted in the model.

**Default:** Off

- On
Stop simulation if a bound specified in the

**Bounds**tab is violated.- Off
Continue simulation if a bound is violated and produce a warning message at the MATLAB prompt.

Because selecting this option stops the simulation as soon as the assertion fails, assertion failures that might occur later during the simulation are not reported. If you want

*all*assertion failures to be reported, do not select this option.

**Enable
assertion** enables this parameter.

Parameter: `stopWhenAssertionFail` |

Type: string |

Value: `'on'` | `'off'` |

Default: `'off'` |

Output a Boolean signal that, at each time step, is:

True (

`1`

) if assertion succeeds, i.e., all bounds are satisfiedFalse (

`0`

) if assertion fails, i.e., a bound is violated.

The output signal data type is Boolean only if the **Implement
logic signals as Boolean data** option on the **All
Parameters** tab of the Configuration Parameters dialog box
of the Simulink model is checked. Otherwise, the data type of
the output signal is double.

Selecting this parameter adds an output port to the block that you can connect to any block in the model.

**Default:**Off

- On
Output a Boolean signal to indicate assertion status. Adds a port to the block.

- Off
Do not output a Boolean signal to indicate assertion status.

Use this parameter to design complex assertion logic. For an example, see Model Verification Using Simulink Control Design and Simulink Verification Blocks.

Parameter: `export` |

Type: string |

Value: `'on'` | `'off'` |

Default: `'off'` |

Open the plot window instead of the Block Parameters dialog box when you double-click the block in the Simulink model.

Use this parameter if you prefer to open and perform tasks,
such as adding or modifying bounds, in the plot window instead of
the Block Parameters dialog box. If you want to access the block parameters
from the plot window, select **Edit** or click
.

For more information on the plot, see **Show
Plot**.

**Default:** Off

- On
Open the plot window when you double-click the block.

- Off
Open the Block Parameters dialog box when double-clicking the block.

Parameter: `LaunchViewOnOpen` |

Type: string |

Value: `'on'` | `'off'` |

Default: `'off'` |

Open the plot window.

Use the plot to view:

System characteristics and signals computed during simulation

You must click this button before you simulate the model to view the system characteristics or signal.

You can display additional characteristics, such as the peak response time, by right-clicking the plot and selecting

**Characteristics**.Bounds

You can specify bounds in the

**Bounds**tab of the Block Parameters dialog box or right-click the plot and select**Bounds**>**New Bound**. For more information on the types of bounds, see the individual reference pages.You can modify bounds by dragging the bound segment or by right-clicking the plot and selecting

**Bounds**>**Edit Bound**. Before you simulate the model, click**Update Block**to update the bound value in the block parameters.

Typical tasks that you perform in the plot window include:

Opening the Block Parameters dialog box by clicking or selecting

**Edit**.Finding the block that the plot window corresponds to by clicking or selecting

**View**>**Highlight Simulink Block**. This action makes the model window active and highlights the block.Simulating the model by clicking or selecting

**Simulation**>**Start**. This action also linearizes the portion of the model between the specified linearization input and output.Adding legend on the linear system characteristic plot by clicking .

A new option **Response Optimization** appears
under **Tools** of Simulink Control Design Model
Verification blocks if Simulink Design Optimization™ is installed.

Open the Response Optimization tool to optimize the model response
to meet design requirements specified in the **Bounds** tab.

This button appears in Simulink Control Design Model Verification Block Parameters dialog box only if you have Simulink Design Optimization software.

Was this topic helpful?