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 Send

Block

Mask

Description

The OpCanAc2 Send block allows transmission of CAN messages. The block refers to a physical port that is configured in the OpCanAc2Ctl block.



Note: In previous versions, each sends block was defined as using a specific message identifier. Now, the blocks take their message identifier from an inport, of which the value may change during run-time.




BEWARE: Models designed with the previous version of this block, require that their send ID and cyclic transmission rate be placed as block inports. To easily perform the modification, run the script "can_update" from the Matlab prompt with the model opened at the top level.



Parameters

Controller IDControllerID refers to the OpCanAc2 Ctl block where the Can-Ac2 port configuration is provided.
Identifier TypeStandard type allows 11-bit identifier while Extended allows 29-bit identifier.
CAN_Frame typeUse this parameter to define the frame type that shall be sent; there are two choices: DATA FRAME and RTR FRAME. When choosing RTR FRAME, the mask shall change to show only the parameters that are needed for this type of frame.
Input Line WidthList that defines how the data from the CAN message is supplied on the Data input pin. The list is handled from left to right and starts at Byte 0 of the CAN message. i.e. A list of [4 4 8] means that the first (MSB) 4 bits of CAN message Byte 0 will be supplied on the Data input pin followed by the next 4 bits of Byte0 and the 8 bits formingByte1.
Enable state input for Single Wire CANThis parameter is by default disabled. It shall become enabled when OpCanAc2-PCI_Ctl block is present in the same sub-system working with a Single Wire Plug-in module. State inport shall be created at the moment of activating this parameter. See the controller's documentation for further information.
Use resynchronizationCreates an additional inport which can be used to resynchronize cyclic transmission.
Allow data length overrideCreates an additional inport which allows specifying how many bytes of the message are to be shipped. If this option is not used, the complete packet is transmitted.



Note: RTR FRAME shall be sent with a DLC = 0 by default, if it is required to be sent with a different DLC this parameter should be turned ONto define the desired length.



Use input frequencyCreates an additional inport which can be used to specify message re-transmission rate in milliseconds. NOTE: This rate SHALL be an exact multiple of the subsystem execution rate where the OpCanAc2 Send block is located. Subsystem's execution rate is taken from the present OpComm block.
Data packingThis option allows to format data packing for compatibility with other devices. 2 notions are implied:

The first specifies if the packing of the signal should be started from the start or end of the packet. 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, the packing will start from the most significant bits of the last transmitted byte and progress back into the packet.

The second specifies if groups of 8, 16 or 32 bits must be permuted within the packet with respect to its middle boundary. Swapping is performed after signal packing.
Signal 1 to N No swapping corresponds to the Intel format while Signal N to 1 - Swap 8-bit corresponds to the Motorola format.
Set message priorityWhen multiple send blocs are used, this parameter allows forcing the order in which transmissions will occur. Valid priorities range between 0 and 2147483648 with 0 being the topmost priority. More than one block can have the same priority and priorities do not have to be consecutive numbers. For instance, it is possible to use: priorities 10,15, 100, which will act the same as 0 ,1 and2. Effective only in FIFO mode.


Inputs

DataThe vector containing the values of the message to be sent; Use the format specified in the Input Line Width parameter.
ResyncOptional inport to command resynchronization of cyclic transmission at the rising edge.
DLCOptional inport to specify length in bytes (in decimal format) of the transmitted message.
FrequencyOptional inport to specify cyclic transmission rate in milliseconds
ID

Message identifier value; it should be specified in decimal format.

The range depends on the Identifier Type chosen and user specifications:

  • For Standard type range could be 0 -> (2^11) - 1
  • For Extended type range could be 0 -> (2^29) - 1
PriorityPriority order of the message to be sent, being 0 the highest priority.


Outputs

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

Error values
0No Error
-1Bus Error (FIFO Overrun or transmission failure, most likely cable disconnection)
-2Truncation error 

This occurs when at least one value of the Data input is greater than its corresponding width specified in the Input Width List parameter.

i.e. With a width of 4 bits, the maximum possible value is 15 (2^4). 
-4Transmission is halted due to the fact that block's Msg ID is not compatible with current Identifier Type.

Status: Returns 0 unless the OP_CANAC2_READ_FIFO_LEVEL user variable is declared and set to ON (see MainControl->Configuration->User Variables).In this case, the transmission FIFO level is returned. Note that using this option increases the model computation time significantly and may create communication disruptions.

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 | opal-rt.com | +1 514-935-2323