Documentation

Byte Packing

Construct data frames

Library

Simulink® Real-Time™ Library for Utilities

Description

The Byte Packing block converts one or more Simulink signals of user-selectable data types to a single vector of varying data types. The output of this block typically connects to an input port of a Send block.

To specify packing density as required by your application, use the Byte Alignment parameter . If the model accesses the data items frequently, consider selecting an alignment value equal to the largest data type that you want to access. If the model transfers the data items frequently as a group, consider selecting an alignment value of 1, which packs the data into as small a space as possible.

Block Parameters

Output port (packed) data type

Specify the data type for the different signals. The block determines the sizes of the signals. From the list, select an output port (packed) data type.

  • double

  • single

  • int8

  • uint8

  • int16

  • uint16

  • int32

  • uint32

  • boolean

Inport port (unpacked) data types (cell array)

Specify the data types of the input ports (unpacked) for the different signals as part of the block parameters.

  • double

  • single

  • int8

  • uint8

  • int16

  • uint16

  • int32

  • uint32

  • boolean

The data type must be a MATLAB® cell array vector. The number of elements in the cell array define the number of input ports shown by this block instance.

Byte Alignment

In the byte alignment field, you specify how the input signal data types are aligned after packing. The possible values are 1, 2, 4, and 8. Each element in the input signals list starts at a multiple of the alignment value, specified from the start of the vector.

If the alignment value is larger than the size of the data type in bytes, the block adds pad bytes of value 0 to fill the space. For example, if the alignment value is 4, a uint32 receives no padding, a uint16 receives 2 bytes of padding, and a uint8 receives 3 bytes of padding.

Was this topic helpful?