Simulink common module library (Data Type Conversion)

Table of contents

一. Data Type Conversion

reference article


一. Data Type Conversion

Chinese translation: data type conversion

Icon means:

Figure 1 Data Type Conversion

Module parameters:

Figure 2 Module parameters: Data Type Conversion

In the output data type you can choose:

Figure 3 Optional data types

Calculation formula arrangement:

Input and output have equal:

Usage example:

Figure 4 RWV example

Figure 5 SI example

Figure 6 Example of continuous use of SI

Integer rounding mode:

  • Up: rounds positive and negative values ​​toward positive infinity;
  • Convergence: Numbers are rounded to the nearest representable value, or to the nearest even integer if equality occurs. Equivalence occurs again, positive numbers are rounded towards positive infinity, and negative numbers are rounded towards negative infinity;
  • Down: rounds positive and negative values ​​toward negative infinity;
  • nearest neighbor: if equivalence occurs, round towards positive infinity;
  • Rounding: Both positive and negative numbers are rounded by absolute value. In the case of equivalence, positive numbers are rounded toward positive infinity, and negative numbers are rounded toward negative infinity;
  • Simplest: Automatically chooses whether to round towards negative infinity or term zero, and also generates rounding code that is as efficient as possible;
  • Zero: Rounds the value towards zero.

Saturation on integer overflow:

  • Figure 7 Saturation of integer overflow

reference article

Simulink Data Type Conversion module usage notes

Guess you like

Origin blog.csdn.net/m0_64651092/article/details/130130664