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 Monitor

Block

Mask

Description

The OpCanAc2 Monitor probes all messages, both transmitted and received, on a CanAc2 port.

Parameters

Controller IDControllerID refers to the OpCanAc2 Ctl block where the Can-Ac2 port configuration is provided.
Maximum number of packetThe maximum number of packets that could be received in a single calculation step. It is advised to make this number a little bigger than what is actually expected. Otherwise, exceeding packets will not be saved for the following steps.
Data unpacking

This option allows to format data unpacking for compatibility with other devices. 2 notions are implied.

The first specifies if the unpacking 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, unpacking will start from the most significant bits of the last transmitted byte and progress backward 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 before extracting signals.

'Signal 1 to N - No swapping' corresponds to the Intel format while'Signal N to 1 - Swap 8-bit' corresponds to the Motorola format.
Create log fileWhen this option is checked, all messages are logged into a mat file, which is written at runtime by a low priority thread. This option is not supported in XHP mode.
The following parameters are used only when the Create log file option is checked:
Log memory buffer size

Number of entries that the application can log into memory before placing data into the file. Since an RT-LABmodel is executed real-time, writing into a file has to be done by a lower priority thread to avoid overruns. This thread writes data when time is available and in case of time be missing, it is important to have a memory buffer large enough to keep messages in memory until the time is available to write to the file. This value should never be less than twice the Number of samples between writes or twice the sum of Packets Before and after Trigger when using trigger model. It should be much larger than those limits to prevent data loss.

The mat file contains 1 variable in which each column represents one message and rows contain the following values:

  1. The timestamp of the message (derived from the timestamp provided by the board)
  2. Message identifier
  3. DLC
  4. Data byte 1
  5. Data byte 2
  6. Data byte 3
  7. Data byte 4
  8. Data byte 5
  9. Data byte 6
  10. Data byte 7
  11. Data byte 8
  12. Error.
  13. Rx/Tx: 0=>message was received, 1=>message was transmitted)
  14. Model time when the message was processed by the model
  15. Identifier type: 0=>standard identifier, 1=>extended identifier
Log file nameName of the file, including the path. If no path is selected, the file will be placed in the model directory on the target node. The file name must have the extension '.mat'.
Static file name

This option allows the user to dynamically change the mat file log during model execution. Selecting this option makes a new inport appear. The user must use it to input an ID that will be used to create the name of the mat file log. The name of the mat file log follows the pattern:

<Log file name parameter value without extension>_<ID input by the user>.mat

A change in the ID input triggers the closing of the current log file and the opening of a new log file. The name of the new log file is based on the new ID. At the end of the simulation, after model reset, all log files will be transferred to the host. The user may individually transfer one or more log files to the host for further analysis, before the end of the simulation. By default, this feature is not available.



Note: when this option is activated, the ID affects also the Log variable name that will be constructed following the pattern described below:

<Log variable name>_<ID input by the user>



Log variable nameName of the Matlab variable created for the Mat file.
Number of samples between writesThe minimum number of log entries(packets) that are cumulated into memory before writing to a file. This number should be smaller than half of Log memory buffer size.
Maximum file size (Mb)Maximum size of the log file. When this size is reached, file logging stops and file-logging overrun messages may appear in the RT-LAB display.
Use triggerThis option allows the user to trigger when the logging starts and end. Selecting this option make a block inport appear. Logging to the file then starts when a rising edge (0 to 1) is detected at the inport. This allows users to narrow the file logging around some desired time value, and thus save disk space.
Packets to save before triggerSpecifies the number packets that came in before the trigger signal that is to be saved into the log file. The logging may not start at the exact step when the trigger was requested so it is safer to set this value large enough to obtain packets for several steps before the trigger.
Packets to save after triggerSpecifies the number packets that came in after the trigger signal that is to be saved into the log file. The logging may not start at the exact step when the trigger was requested.


Inputs

This block has no inports.

Outputs

Number of packetThe number of messages received since the last block execution.
Packet XAs many Packet outputs are created as the number specified in the Maximum number of packet parameter. These outports have a width of 8 signals and are used to output the data from each message.
IDsThe outport returns the identifiers of the received messages. This outport has a width equal to the Maximum number of packets parameter.
TimestampsThis outport returns the timestamps of the messages. Its width is equal to the Maximum number of packets parameter.
DLCsThis outport returns the DLCs from the received messages. Its width is equal to the Maximum number of packets parameter.
Error

Specifies if an error occurred.

Possible values are:

  • 0: no error
  • -1: CanAc2 reception FIFO overrun. Data has been lost at the hardware level.
  • -3: Internal buffer FIFO overrun. This should never occur unless Number of packets is much too small or model overruns occurred.

Characteristics and Limitations

When using file logging, it is possible that, if the hard drive is running out of space (maybe 300 Mb or less), writing to the file may take more time than expected (as continuous free blocks are getting scarcely available on disk) and file data may be lost. A logging buffer overrun then occurs and a message appears in the RT-LAB display.

Also, should the hard drive get full, model overruns may occur during actual accesses to the file.

CanAc2 Host Simulation

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

CanAc2 Monitor Data Decoding

CanAc2 Monitor block has been conceived to monitor all message's types transmitted over the bus, therefore there is no message structure associated with this block. In spite of this behavior, it is still possible to decode signal values embedded within the 8-value vector reported in PacketX outport. Click here to access the decodification process.

Direct FeedthroughNo
Discrete sample timeNo
XHP supportYes. File logging not supported.
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