5.1.102. Signal prepare (put_SignalPrepare)

Prepare signals for CAN transmission.

5.1.102.1. Supported targets

All targets

5.1.102.2. Required license

None (Main library). (See Section 2.3, “Licensed Features”.)

5.1.102.3. Description

The signal prepare block converts from engineering value to integer form. The input value is checked against minimum and maximum parameters and clipping may occur when the result is copied into one of the possible integer data types of the output port.

It is common to find a CAN specification that designates values for CAN signals as in error or unavailable. Although not always the case, typically the highest values are used (e.g., in an unsigned 8 bit quantity that can range from 0 to 255, typically 254 and 255 signify that the signal is unavailable or in error). This block directly supports this concept.

Minimum and maximum limits (in engineering units) are also defined for each CAN signal, and an engineering value outside this range is set to a value which indicates error to the receiving CAN node. This block directly supports checking for out of range engineering values.

And while many quantities are transmitted in integer format that corresponds to the value in engineering units, many other fields have scale and offset values. This block directly supports converting the engineering value to a scaled integer value as:

can_signal_value y = (u - Offset value) / Scale factor

5.1.102.4. Inports

5.1.102.5. Outports

  • y

    The value of u after being prepared for CAN transmission.

5.1.102.6. Mask parameters

  • Error value

    The value which is to be output on y if the inport u_invalid_code is equal to 1.

    Range: [-2147483647, 2147483647]

  • Unavailable value

    The value which is to be output on y if the inport u_invalid_code is equal to 2, 5, 6, 7 or 8.

    Range: [-2147483647, 2147483647]

  • Minimum value

    The smallest value of u that is valid. The data type of this parameter is the same as the input u.

  • Maximum value

    The largest value of u that is valid, The data type of this parameter is the same as the input u.

  • Scale factor

    Conversion factor applied to u to convert it from engineering units to an integer form. A value of 1 should be used if no scaling is required.

  • Offset value

    Offset factor applied to u to convert it from engineering units to an integer form. The data type is in engineering units. A value of 0 should be used if there is no offset.

  • Output type

    A drop down of possible types for inport u.

5.1.102.7. Notes

  • The possible error codes are enumerated as:

    Table 5.7. CAN signal prepare invalid codes.

    Error codeDescription
    0, 3, 4The block implements both conversion of the input engineering value to a scaled integer and clipping of the result, according to mask parameters setting.
    1The output value is forced to be equal to the mask error value.
    2 or >4The output value is forced to be equal to the mask unavailable value.