Main Content

Check Input Resolution

Check that input signal has specified resolution

  • Library:
  • Simulink / Model Verification

    HDL Coder / Model Verification

  • Check Input Resolution block

Description

TheCheck Input Resolutionblock checks whether the input signal has a specified resolution. The block input and resolution can be either a scalar or vector. The input and resolution must be the same data type.

If theResolutionparameter is a scalar, the block calculates the modulus of the input signal over the provided scalar resolution. The calculated modulus is then compared to a tolerance of10e-3, and executes an assertion after comparison. If the modulus is less than the tolerance, the assertion istrue (1)and the block does nothing. If not, the block halts the simulation and returns an error message by default. If theResolutionparameter is a vector, it assertstrue (1)if the value of the input signal is equal to any of the resolution vector elements.

块比较输入的决议several additional ways depending on the dimensions of the signal and resolution.

  • When comparing a scalar input signal or resolution to a vector input signal or resolution, the block compares the scalar to each element of the vector.

  • When comparing a vector input signal to a vector resolution, the block compares the input signal to the resolution element-by-element.

  • For models with an input signal and resolution that are both vectors, the input signal and resolution must have the same dimensions.

Ports

Input

expand all

Input signal that the block checks against the resolution specified by theResolutionparameter.

Data Types:double

Output

expand all

Output signal that istrue (1)if the assertion succeeds andfalse (0)if the assertion fails. If, in the Configuration 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 port, selectOutput assertion signal.

Data Types:double|Boolean

Parameters

expand all

Specify the resolution requirement for the input signal.

Programmatic Use

Parameter:resolution
Type:string scalar or character vector
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"

Block Characteristics

Data Types

double

Direct Feedthrough

no

Multidimensional Signals

yes

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

PLC Code Generation
使用仿真软件生成结构化文本代码®PLC金宝appCoder™.

Version History

Introduced before R2006a