Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

OpCanAc2 Recv


Block with external ID input


Block's mask with external ID input


The OpCanAc2 Recv block receives CAN data frames for one Standard or Extended identifier. The block refers to a physical port that is configured in the OpCanAc2 Ctl block. Note: The Dynamic Object Buffer mode is not supported anymore and the FIFO mode is now always used.


Controller IDRefers to the OpCanAc2 Ctl block where the Can-Ac2 port configuration is provided.
Use External IdentifierThis parameter will create additional inputs allowing the user to read dynamically message's IDs. The parameters Identifier, Output Line Width, Gain, and Offset shall be turned into inputs disappearing from the block's mask.

Note: New inputs Gain and Offset shall be available only if the parameter Show engineering values is selected.

IdentifierIdentifier of the data frame to be received.
Identifier TypeSpecifies the length of the data frame identifier. Normal type is 11 bits long while extended is 29 bits long.
Output Line WidthList that defines how the data from the data frame is supplied on the Data output pin. The list is handled from left to right and starts with byte 0 of the CAN data frame. For instance, a list of [4 4 8] means that the first (MSB) 4 bits of CAN data Byte 0 will be supplied on the Data output pin followed by the next 4 bits of Byte0 and the 8 bits forming Byte1.
FIFO internal Buffer SizeSpecifies the number of frames the block may store before producing values to Simulink.
Max number of packetsSpecifies the maximum number of frames that the block may produce to Simulink per calculation step. For instance, with a FIFO Internal Buffer Size of 10 and a Max number of packets of 3, up to 10 frames can be saved in the internal buffer but the block will only output from 0 to 3frames whenever it is called. Assuming 4 frames have been received, the block will output the first 3 frames and keep the remaining one for the next execution.
Sample TimeSample time of the block. A value of 0 represents the fastest sample time of the model.
Show timestampsCreates an additional outport which returns the timestamp of incoming data frames in seconds.
Show DLCCreates an additional outport which returns data length in bytes.
Show engineering vales

Creates an additional out port which returns the RawData values with applied Gain and Offset according to the following equation:

Eq. 1 Engineering value=RawData*Gain + Offset

GainVector the same length as Output line width specifying gain values to be applied. When using external ID input, the constant Gain vector should be zero-padded to keep the same length in the case we shall read a CAN message with shorter Output Line Width.
OffsetVector the same length as Output line width specifying offset values to be applied. When using external ID input, constant Offset vector should be zero-padded to keep the same length in the case we shall read a CAN message with shorter Output Line Width.
Data unpacking

This option allows formatting data unpacking for compatibility with other devices. Two notions are implied.

The first specifies if the unpacking of the signal should be started from the start or end of the data frame. If Signal 1 to N is selected, the packing will start from the less significant bits of the first transmitted byte. If Signal N to 1 is selected, unpacking will start from the most significant bits of the last transmitted byte and progress back into the data frame.

The second specifies if groups of 8, 16 or 32 bits must be permuted within the data frame with respect to its middle boundary. Swapping is performed before extracting signals.

Signal 1 to NNo swapping corresponds to the Intel format while Signal N to 1 - Swap 8-bit corresponds to the Motorola format.


The following inputs are available only if the parameter Use External Identifier is selected.

IdentifierSee definition of parameter Identifier
Output Line WidthSee the definition of parameter Output Line Width
Gain VectorSee the definition of parameter Gain
Offset VectorSee the definition of parameter Offset


Error: Reception Error value. The following table shows possible values and meaning:

Error values
0No Error
-1Hardware FIFO overrun
-3Software buffer overrun (Internal FIFO buffer size should be increased)
-4Reception is halted due to the fact that block's Msg ID is not compatible with current Identifier Type.

Status: Reception Status value. The following table shows possible values and meaning:

Status values
1A new data frame is available
0No new data frame
Nbr of PacketReturns the number of new data frames that are available on the Data output pin(s).
RawData/Packet NThe vector containing the data values in the format specified in the Output Width List parameter.
TimestampOptional outport which indicates the time stamp in seconds of received data frames.
Eng. Values Pckt NOptional outport which returns the engineering values corresponding to raw data. (Values resulting from applying gain and offset according to Eq. 1.)
DLCOptional outport which returns the length in bytes of the received data.

Characteristics and Limitations

CanAc2 Host Simulation

CanAc2 blocks now support execution of user-specific code duringWin32 target simulation. For more information, please refer to the CanAc2 HostSimulation documentation.

Direct FeedthroughNo
Discrete sample timeYes
XHP supportYes
Work offlineNo

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | | +1 514-935-2323