Documentation Home Page ◇ HYPERSIM Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.
CAN | Configuration
Page Content
Accessing the I/O Interface Configuration
The CAN communication protocol is configured in the I/O Interface Configuration tool opened through the HYPERSIM ribbon.
For more information on the general use of the I/O Interface Configuration, see also I/O Interface Configuration.
General Configuration
The CAN I/O interface is configured within several pages. When creating a new instance of the configuration, two channels and one bus are preconfigured.
The first page contains some generic configurations.
Here is a description of each generic configuration field. This information is also displayed in tooltips or alt text by hovering the mouse over each of the fields.
Hardware | Type of CAN hardware connected to the simulator. |
|
---|---|---|
Use an RT core for asynchronous computation |
|
|
Verbose | If set to true, the entire configuration is displayed during the loading of the model. |
|
Reverse gain/offset computation | If selected, the gain and offset computation will be reversed. |
|
Enable queue length extension | If selected, an option to set the size of the queue will be provided. The queue is the size of the buffer for data transfer between the model and the driver. |
|
Queue length | Field only visible when Enable queue length extension above is enabled. This parameter represents the size of the queue which synchronizes the asynchronous CAN tool and the model. If the time step of the model is increased above 1ms then the queue length also needs to be increased; for example if the value of the time step is increased from 1ms to 10ms, then the queue length must increase from 25 to 250. |
|
Monitor message flags, error counters and statuses | If selected, connection points for channel flags, error counters and statuses will be created. |
|
Transmit rate factor | This parameter represents the factor that will be multiplied to the current time step of the model to calculate the transmit rate. |
|
Enable reverse gain/offset computation on channel basis | If selected, the reversal of the gain and offset computation will be overriden by the option on each channel. |
|
Enable virtual mode | In virtual mode, the model can be executed even if this I/O interface is not compatible with the hardware configuration of the system. The connections between the model and the I/O interface will be done during the initialization, but the I/O interface will not do anything. |
|
Gain and Offset Specification
The gain and offset computation is described in the next two figures.
The driver operations are within the purple boxes while the CAN-BUS box represents the real CAN network.
Reverse gain/offset computation Option Disabled
If the Reverse gain/offset computation option is disabled (no reversal applied) the operations are as follows:
Reverse gain/offset computation option enabled
If the Reverse gain/offset computation option is enabled (reversal applied) the operations are as follows:
Channel Configuration
Name | Name of the channel. |
---|---|
Channel ID | This parameter allows the driver to bind the configuration to a physical channel. When adding a new channel to the list, its ID is set to 0 by default. Make sure to change the ID to a value relevant to your simulation. |
Enable CAN FD | This parameter configures the channel in CAN FD mode allowing for up to 64 bytes of data on every message, provided that the hardware supports CAN FD. Non-CAN FD messages can still be sent/received by this channel. When CAN FD is enabled, a matching arbitration rate needs to be configured for all of the nodes of the bus on which this channel is connected. |
Arbitration bit rate | Field only visible when Enable CAN FD above is enabled. This parameter selects the arbitration bit rate when the channel is configured in CAN FD mode. The supported preset arbitration bit rate values are 1Mbps[SP 62.5%], 500Kbps[SP 62.5%], 500Kbps[SP 80%]. Users can configure a custom bitrate/sampling point combination. To do so, select Custom from the list and fill in the configuration fields (explained below). |
Bit rate | This parameter is chosen based on the desired setup (cable length) and behavior. The value is chosen from a list of bit rates from 50 Kbps to 1 Mbps (500 Kbps to 8Mbps for CAN FD) with pre-configured sampling point values. Users can configure a custom bitrate/sampling point combination. To do so, select Custom from the list and fill in the configuration fields (explained below). |
Use extended mode |
|
Use silent mode | If set to true, the channel will only act as a listener, it will not be possible to send any messages. |
Monitor bus load | If set to true, a connection point that gives the current utilization of the bus in percentage will be created. Enabling this option will slow down the CAN data communication. |
Enable transmission control | If set to true, a connection point that allows the activation or deactivation of the transmission feature of a channel at run time will be created. |
Enable reception control | If set to true, a connection point that allows the activation or deactivation of the reception feature of a channel at run time will be created. |
Monitor channel flags, error counters and statuses | If selected, connection points for channel flags, error counters and statuses will be created. |
Reverse gain/offset computation for this channel | Field only visible when Enable reverse gain/offset computation on channel basis in the General section is enabled. If selected, the gain and offset computation will be reversed. |
The following fields are available only when Custom is selected on the Arbitration bitrate field (for more information on how to configure these values please refer to the Kvaser bit timing calculator):
Arbitration time segment 1 | The number of quanta from (but not including) the sync segment to the sampling point in the arbitration phase. |
---|---|
Arbitration time segment 2 | The number of quanta from the sampling point to the end of the bit in the arbitration phase. |
Arbitration synchronization jump width (ASJW) | This parameter adjusts the bit clock as necessary to maintain synchronization with the transmitted message. It must be less than or equal to the minimum of Arbitration time segment 1 and Arbitration time segment 2. |
Arbitration prescaler | The prescaler value in the arbitration phase. |
The following fields are available only when Custom is selected on the Bitrate field (for more information on how to configure these values please refer to the Kvaser bit timing calculator):
Frequency | The desired bit rate value in Kbps. Not available for CAN FD. |
---|---|
Time segment 1 | The number of quanta from (but not including) the sync segment to the sampling point. |
Time segment 2 | The number of quanta from the sampling point to the end of the bit. |
Synchronization jump width (SJW) | This parameter adjusts the bit clock as necessary to maintain synchronization with the transmitted message. |
Bit sampling points | The number of sampling points per bit on the arbitration bitrate section (for CAN FD data rates the number of samples per bit is always 1). Not available for CAN FD. |
Prescaler | The prescaler value in the data phase. Only available for CAN FD. |
Bus Configuration
A bus is a container for a group of nodes.
Name | Name of the bus. |
---|---|
Filename | This parameter is set if the bus is configured from the CAN Importer wizard. It is blank otherwise. |
Node Configuration
A node is a container for a group of messages.
Name | Name of the node. |
---|---|
Channel ID | This parameter binds the messages in this node to a physical channel. Every message in the node will have the same channel ID. |
Vector__XXX: This is a special node, and it acts as a dummy node in the CAN configuration. The messages which are part of this node will not be part of CAN data communication. According to the CAN DB standards, the messages and signals configured for the node Vector_XXX are used for neither transmission nor reception. The purpose of this node is to accommodate the messages and signals which have not been assigned to a node.
Message Configuration
The following parameters are common to both transmission and reception messages:
Name | Name of the message. |
---|---|
Mode | Select Transmission or Reception depending on the desired behavior. |
Channel ID | The ID of the physical channel this message will be transmitted or received on. This parameter is read-only and can only be set by modifying the channel ID of the node that contains the message. |
If a message is to be transmitted, additional parameters must be set:
Use dynamic ID |
|
---|---|
CAN ID | Field not visible when Use dynamic ID above is enabled. ID of the message that represents a priority on the CAN bus. An ID equal to 0 represents the highest priority while the highest possible value represents the lowest priority. |
Specify DLC | The Data Length Code field can be computed based on defined fields of the message, or manually set to force a particular value. Importing from a database file (DBC or ARXML) will automatically set this checkbox. |
Data length code | Field only visible when Specify DLC above is enabled. A drop-down providing the possible DLC choices is available when the Specify DLC checkbox is checked. The list adapts its choices based on the type of CAN channel: up to 8 bytes with classic CAN or up to 64 bytes with CAN FD. |
Enable cyclic transmission |
|
Transmit rate (ms) | Field only visible when Enable cyclic transmission is enabled and Enable dynamic transmit rate is disabled. The rate at which the message should be transmitted. Rate is given in milliseconds. A message with a transmit rate lower than the model timestep is transmitted every timestep. |
Enable dynamic transmit rate | Field only visible when Enable cyclic transmission above is enabled. If set to true, the transmit rate for cyclic transmission is controlled during the simulation from the model. To achieve this, a connection has to be made with the Transmit Rate point created when this box is checked. If set to false, the transmit rate is to be configured through the configuration parameter. |
Enable transmit rate resynchronization | If set to true, the dynamic transmit rate will be applied to the transmission immediately upon the rising edge of the resynchronization signal. To achieve this, a connection has to be made with the Resynchronization Signal point created when this box is checked. If set to false, the dynamic transmit rate will be applied to the transmission at the completion of the existing transmit cycle. |
Force enable message | Field only visible when Enable cyclic transmission above is enabled. Force enable messsage when cyclic transmission is active. |
If a message is to be received, here are the additional parameters to be set:
Use promiscuous mode | If set to true, the signals of this message are updated with the contents of every message received on the respective channel, regardless of CAN ID. If set to false, the CAN ID is to be configured with the CAN ID parameter below. |
---|---|
CAN ID | Field only visible when Use promiscuous mode above is disabled. The signals are updated with the contents of messages that match this particular ID. |
Buffer size | Number of frames to be received in one calculation step. Buffer connectables (flags, signals, ID, ...) are created for each frame. |
Signals Configuration
Each message contains a list of one or more signals that can be configured as desired.
Name | This parameter is meant to uniquely identify each signal in order to create a connectable for it in the connection tree. |
---|---|
Type | See the table below for more information. |
Multiplexer mode | Possible values are:
|
Custom type | Only available for messages configured for transmission. None by default. If Rolling counter or CRC8_SAE_J1850 is selected, no connection point will be created. A signal with the Rolling counter option set will output a counter that starts at the minimum value configured, increments by 1 each time step until it gets to the maximum value configured. After that it returns to the minimum value and starts incrementing again. A signal with the CRC8_SAE_J1850 option set will output an 8-bit CRC value calculated from running a polynomial algorithm on the payload of the CAN data. |
Start bit | The start bit of the signal in the CAN frame. |
Size (bits) | The number of bits of the signal ranging from 1 to 64. |
Endianness | Can be Intel or Motorola. |
Initial value | The initial physical value of the signal. |
Min | The minimum physical value the signal can hold. Depends on the signal type and size in bits. |
Max | The maximum physical value the signal can hold. Also depends on the signal type and size in bits. |
Gain | Gain to be applied to the original received or transmitted value. |
Value offset | Offset to be applied to the original received or transmitted value. |
The table below lists the various signal types that can be inserted in each message:
Type | Description and size |
---|---|
Bit | Bit (1 bit) |
Unsigned | Positive integer (1 to 64 bits) |
Signed | Positive or negative integer (1 to 64 bits) |
Float | Single precision floating point (32 bits) |
Double | Double precision floating point (64bits) |
Each frame can contain up to 64 bits of data (64 bytes for CAN-FD), meaning that multiple combinations of signal types are possible.
CAN Importer
Clicking on the CAN Importer button brings up the CANdb importer wizard. This wizard simplifies the process of importing CAN configurations such as node, message and signal information from a CANdb file. The CANdb file must conform to the Vector standard:
ARXML
DBC
The configuration steps are different depending on the choice of file type (DBC or ARXML).
Follow the steps below to successfully import an ARXML file into the CAN configuration:
Select the type of CANdb file: Click the radio button next to ARXML to import the ARXML file type.
Select bus: A list of CANdb buses part of the selected ARXML file should be displayed after a successful import. At this point, the buses needed in the simulation can be enabled. DBC files are created for each CANdb bus with respective configurations.
Configure nodes: At this point buses selected at the previous step are available in the Bus drop-down menu.
Select a bus to display its nodes in the table.
Enable the nodes necessary for the simulation and set their types.
A node can be either simulated or physical. Physical nodes are nodes that represent real devices on the CAN network. Simulated nodes can exchange messages with physical nodes. Communication between simulated nodes is only possible if they're connected in loopback.
The buttons with labels Physical and Simulated allow setting all the nodes to one type. Note that the Next button will only be activated if at least one enabled message is of type Simulated. Only nodes selected as type Simulated will appear in the configuration.
Select messages: Clicking Next brings the Messages page.
Select the bus from the drop-down menu to display the enabled nodes and in turn display messages for configuring.
The messages are grouped by nodes and can be enabled or disabled as desired. Note that messages belonging to a node marked as physical are enabled by default and can not be modified. Also, simulated nodes with messages expected to be received from physical nodes are enabled by default but can be disabled if desired.
Select Finish: Clicking Finish closes the wizard and returns the user to the configuration, where all of the simulated nodes, enabled messages and their signals can now be seen.
Follow the steps below to import a DBC file into the CAN configuration:
Select the type of CAN db file: Click the radio button next to DBC to import the DBC file type.
Create new bus: Clicking the Create new button brings up a dialog allowing the user to choose a name for the bus.
Select DBC file: Select the DBC file to import by clicking on the file explorer button. The DBC file name should appear in the text box as shown below.
After this is done, the selected DBC file is linked to the newly created bus. A dialog window may appear if errors are found while parsing the DBC file. It is highly advisable to fix all errors found in the DBC file before starting the simulation.
Configure Nodes: A list of nodes is displayed after a successful import.
At this point, the user can enable the nodes needed to be part of the simulation and can set their type. A node can be either simulated or physical. Physical nodes are nodes that represent real devices on the CAN network. Simulated nodes can send and receive messages with physical nodes. They can only communicate with each other provided there is a loopback connection. The buttons labeled Physical and Simulated allow seting all the nodes to one type. The Next button is only activated if at least one enabled message is of type Simulated. Only nodes selected as Simulated appear in the configuration.
Select Messages: Clicking Next brings the Messages page.
The messages are grouped by nodes and can be enabled or disabled as desired. Messages belonging to a node marked as physical are enabled by default and can not be modified. Simulated nodes with messages expected to be received from physical nodes are enabled by default but can be disabled if desired.
Select Finish: Clicking Finish closes the wizard and returns the user to the configuration, where all of the simulated nodes, enabled messages and their signals can now be seen.
All of the buses created can be accessed using the Select bus button. The importer is able to parse DBC files with multiple transmitting nodes for the same message.
Potential Errors Returned While Importing a File and How to Fix Them
Invalid node information: Ensure the node line follows the format BU_: abc def
No node information found: Ensure the DBC file contains a line that starts with BU_.
Invalid message at line: Ensure the message found at the indicated line matches the format: BO_ x abc: x def
Invalid signal at line: Ensure the signal found at the indicated line matches one of the following formats:
SG_ abc : x|x@0+ (y,y) [y|y] def
SG_ abc : x|x@0- (y,y) [y|y] def
SG_ abc : x|x@1+ (y,y) [y|y] def
SG_ abc : x|x@1- (y,y) [y|y] def
SG_ abc M x|x@0+ (y,y) [y|y] def
SG_ abc M x|x@0- (y,y) [y|y] def
SG_ abc M x|x@1+ (y,y) [y|y] def
SG_ abc M x|x@1- (y,y) [y|y] def
SG_ abc mx x|x@0+ (y,y) [y|y] def
SG_ abc mx x|x@0- (y,y) [y|y] def
SG_ abc mx x|x@1+ (y,y) [y|y] def
SG_ abc mx x|x@1- (y,y) [y|y] def
SG_ abc : x|x@0+ (y,y) [y|y] ijk def
SG_ abc : x|x@0- (y,y) [y|y] ijk def
SG_ abc : x|x@1+ (y,y) [y|y] ijk def
SG_ abc : x|x@1- (y,y) [y|y] ijk def
SG_ abc M x|x@0+ (y,y) [y|y] ijk def
SG_ abc M x|x@0- (y,y) [y|y] ijk def
SG_ abc M x|x@1+ (y,y) [y|y] ijk def
SG_ abc M x|x@1- (y,y) [y|y] ijk def
SG_ abc mx x|x@0+ (y,y) [y|y] ijk def
SG_ abc mx x|x@0- (y,y) [y|y] ijk def
SG_ abc mx x|x@1+ (y,y) [y|y] ijk def
SG_ abc mx x|x@1- (y,y) [y|y] ijk defNote: x is a positive integer and y can be any number. abc, def and ijk can be any character or set of characters.
If a signal cannot be found in the configuration after finishing the import process, ensure that the message containing this signal is enabled.
Simple Signal Multiplexing
CAN DBC files allow for the multiplexing of signals in messages. Multiplexing of signals in CAN means to combine multiple signals with the same memory range in the data frame of a message. This method allows to reduce the number of messages in the CAN configuration by combining two or more messages with the same meta data. Depending on the multiplex value, certain signals are selected for the data frame during the model execution.
The signal which contains the multiplex value is called multiplexer signal and the signals that depend on this value are called multiplexed signals. Each one of these signals is identified by a multiplex value in the Multiplexer mode field.
There are two types of multiplexing:
Simple signal multiplexing
Extended signal multiplexing
Currently only simple signal multiplexing is supported. In this mode only one multiplexer signal can be defined in a message and each multiplexed signal can have only one multiplex value.
Overlap error detection is disabled for multiplexed messages because their signals are normally overlapped.
Even though all signals are displayed, only certain are transmitted and received. The value on the multiplexer signal determines which signals are included in the data frame.
As seen in the screenshot below, the following signals are identified by the multiplex value '0' in their Multiplexer mode column:
BCS_HS_Load_01
BCS_HS_Load_02
BCS_HS_Load_03
BCS_HS_Load_04
The following are identified by '1':
BCS_HS_Vout_01
BCS_HS_Vout_02
BCS_HS_Vout_03
BCS_HS_Vout_04
During the execution of the model, the value on the multiplexer signal (BCS_HS_Card1_Selection) determines the signals to be included in the data frame:
if BCS_HS_Card1_Selection is '0', the data frame will contain the multiplexer signal, signals marked as Normal in the Multiplexer mode column and BCS_HS_Load_01, BCS_HS_Load_02, BCS_HS_Load_03 and BCS_HS_Load_04 (identified by '0' in the Multiplexer mode column)
if BCS_HS_Card1_Selection is '1', the data frame will contain the multiplexer signal, signals marked as Normal in the Multiplexer mode column and BCS_HS_Vout_01, BCS_HS_Vout_02, BCS_HS_Vout_03 and BCS_HS_Vout_04 (which are identified by '1' in the Multiplexer mode column)
OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323
Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter