Documentation Center

  • Trial Software
  • Product Updates

Check Against Reference

Check that model signal tracks reference signal during simulation

Library

Simulink Design Optimization

Description

Check that a signal remains within tolerance bounds of a reference signal 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 Against Reference blocks on multiple signals to check that they track reference signals.

You can also plot the reference signal on a time plot to graphically verify that the signal tracks that signal.

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.

Parameters

TaskParameters
Specify a reference signal to:
  • Assert that a signal tracks the reference

  • Optimize model response so that a signal tracks the reference

Include reference signal tracking in assertion in Bounds tab.
Specify assertion options (only when you specify reference to track).In the Assertion tab:
Open Design Optimization tool to optimize model responseClick Response Optimization
Plot reference signalClick Show Plot.
Display plot window instead of Block Parameters dialog box on double-clicking the block.Show plot on block open

Include reference signal tracking in assertion

Check that the signal does not track the reference signal specified in Times (seconds) and Amplitudes during simulation.

The software displays a warning if the signal does not track the reference signal.

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

The reference signal also appears on a time plot if you click Show Plot, as shown in the next figure.

If you clear Enable assertion, the bounds are not used for assertion but continue to appear on the plot.

Settings

Default: On

On

Check that the signal tracks the specified reference signal during simulation.

Off

Do not check that the signal tracks the specified reference signal during simulation.

Tips

  • Clearing this parameter disables the reference signal and the software stops checking that the signal tracks the reference during simulation.

  • To only view the bounds on the plot, clear Enable assertion.

Command-Line Information

Parameter: EnableReferenceBound
Type: string
Value: 'on' | 'off'
Default: 'on'

Times (seconds)

Time vector for the reference signal. Specify the corresponding amplitudes in Amplitudes.

Settings

Default: linspace(0,10)

Command-Line Information

Parameter: ReferenceTimes
Type: string
Value: linspace(0,10) | vector of positive values of the same dimension as the amplitude vector |
Default: linspace(0,10)

Amplitudes

Amplitude of the reference signal corresponding to the time vector specified in Times (seconds).

Settings

Default: 1-exp(-linspace(0,10)/2)

Command-Line Information

Parameter: ReferenceAmplitudes
Type: string
Value: 1-exp(-linspace(0,10)/2) | vector of integers of the same dimension as the time vector
Default: 1-exp(-linspace(0,10)/2)

Absolute tolerance

Absolute tolerance used to determine bounds as the signal approaches the reference signal.

During simulation, the signal must remain within upper and lower limits respective to the reference signal given by:

yu = (1 + RelTol)yr + AbsTol

yl = (1 –RelTol)yrAbsTol

where yr is the value of the reference at a certain time, yu and yl are the upper and lower tolerance bounds corresponding to that time point.

The block asserts if the signal violates these limits.

Settings

Default: eps^(1/3)

Minimum: 0

Command-Line Information

Parameter: AbsTolerance
Type: string
Value: eps^(1/3) | positive real scalar
Default: eps^(1/3)

Relative tolerance

Relative tolerance used to determine bounds as the signal approaches the reference signal.

During simulation, the signal must remain within upper and lower limits respective to the reference signal given by:

yu = (1 + RelTol)yr + AbsTol

yl = (1 — RelTol)yrAbsTol

where yr is the value of the reference at a certain time, yu and yl are the upper and lower tolerance bounds corresponding to that time point.

The block asserts if the signal violates these limits.

Settings

Default: 0.01

Minimum: 0

Command-Line Information

Parameter: RelTolerance
Type: string
Value: 0.01 | positive real scalar
Default: 0.01

Enable assertion

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:

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 option in the Debugging area of Data Validity node, lets you to enable or disable all model verification blocks in a model, regardless of the setting of this option.

Settings

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.

Dependencies

This parameter enables:

  • Simulation callback when assertion fails (optional)

  • Stop simulation when assertion fails

Command-Line Information

Parameter: enabled
Type: string
Value: 'on' | 'off'
Default: 'on'

Simulation callback when assertion fails (optional)

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.

Settings

Default: []

A MATLAB expression.

Dependencies

Enable assertion enables this parameter.

Command-Line Information

Parameter: callback
Type: string
Value: '' | MATLAB expression
Default: ''

Stop simulation when assertion fails

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.

Settings

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.

Tips

  • 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.

Dependencies

Enable assertion enables this parameter.

Command-Line Information

Parameter: stopWhenAssertionFail
Type: string
Value: 'on' | 'off'
Default: 'off'

Output assertion signal

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

  • True (1) if assertion succeeds, i.e., all bounds are satisfied

  • False (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 in the Optimization pane of the Configuration Parameters dialog box of the Simulink model is selected. 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.

Settings

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.

Tips

Command-Line Information

Parameter: export
Type: string
Value: 'on' | 'off'
Default: 'off'

Show plot on block open

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.

Settings

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.

Command-Line Information

Parameter: LaunchViewOnOpen
Type: string
Value: 'on' | 'off'
Default: 'off'

Show Plot

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.

Response Optimization

Open the Design 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.

See Also

Was this topic helpful?