Main Content

Check Discrete Gradient

Check that absolute value of difference between successive samples of discrete signal is less than specified value

  • Library:
  • Simulink / Model Verification

    HDL Coder / Model Verification

  • Check Discrete Gradient block

Description

TheCheck Discrete Gradientblock checks each signal element and determines whether the absolute value of the difference between successive values of the element is less than an specified value. The block then executes an assertion after comparison. You can specify the value of gradient (1by default) by adjusting theMaximum gradientparameter. If the input signal difference is less than the absolute value of theMaximum gradient, the assertion istrue (1)and the block does nothing. If not, the block halts the simulation and returns an error message by default.

Note

To run simulations, the Check Discrete Gradient block requires a fixed-step discrete solver. If another solver is selected, an error prompts.

Ports

Input

expand all

Input signal the block checks to determine if the difference of each element between successive samples is less than the absolute value of theMaximum gradientparameter.

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

Output

expand all

Output signal that istrue (1)if the assertion succeeds, andfalse (0)如果断言失败。如果在配置Parameters window, in theMath and Data Typessection, underAdvanced parameters, you selectImplement logic signals as Boolean data, then the output data type isBoolean. Otherwise, the data type of the signal isdouble.

Dependencies

To enable this output port, select theOutput assertion signalparameter check box.

Data Types:double|Boolean

Parameters

expand all

Specify the value on the allowed gradient of the input signal.

Programmatic Use

Parameter:gradient
Type:string scalar or character vector
Values:real scalar
Default:"1"

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, clickDiagnostics>Data Validity, expand theAdvanced parameterssection, and setModel Verification block enablingtoEnable allorDisable 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 theEnable assertionparameter.

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. Thegraphicoption displays a graphical representation of the assertion condition on the icon. Thetextoption 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

double|fixed point|integer|single

Direct Feedthrough

no

Multidimensional Signals

yes

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

PLC Code Generation
使用仿真软件生成结构化文本代码®PLC万博1manbetxCoder™.

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

Version History

Introduced before R2006a