Code File Location: VisualSim/actor/lib/auto/CAN_Bus
The
Controller Area Network ( CAN ) is a serial communications protocol
which efficiently supports distributed realtime control with a very
high level of security. What we have in visualsim is an extensive
library dedicated to all the protocols implemented in an Automobile.
CAN is one of them. It provides a very flexible network. Nodes can be
added without much difficulty. The following properties of the CAN has
been implemented in VisualSim :
[*] Prioritization of Messages
[*] Configuration flexibility
[*] Multicast reception with time synchronization
[*] System wide data consistency
[*] Multi master
[*] Error detection and signalling
[*] Automatic retransmission of corrupted messages as soon as the bus is idle again
[*] Distinction between temporary errors and
permanent faliures of nodes and autonomous switching off of defect nodes
[*] Both 11 bit and 29 bit can co-exist in the bus at the same time
Continuous monitoring for faults, generating various statistics like
power plots, latency, node activity etc are done in VisualSim.
Different test cases like what happens when a data frame and a remote
frame of same identifier competes for arbitration or how efficient
busOff recovery is? etc..
By validating all these test cases, one is able to identify all the
glitches or faults in their design and correct them in early stages.
The
CAN_Bus module alone wont be functional. We need to add CAN_Nodes (
atleast 2 ) . The CAN_Nodes communicate to each other with the help of
arbitration algorithms and access controls defined in CAN_Bus. Click here to read up on CAN_Node.
To illustrate the usage, look at the following Examples in the BDE.
| Parameter |
Explanation | Type
|
Example | ||
| Sim_Time |
|
Double | 1.0 | ||
| FD_Enable |
|
Boolean | true | ||
| FD_Multiplier |
|
Double | 1.0 | ||
| Plot_Enable |
|
Boolean | true | ||
| CAN_Bus_Name |
|
String | "CAN1" | ||
| CAN_Mbps |
|
Double | 0.5 | ||
| Base_Rate |
|
Double | 1.0e-3 | ||
| Identifier_Bits |
|
Pull Down |
11 | ||
| Random_Bit_Stuffing |
|
Boolean | true | ||
| MSCAN_T_Manual_F_Auto |
|
Boolean | false |
||
| Manual_Reset_Flag_Name |
|
String |
"Reset_Flag" |
| Name |
Address |
Message |
ID |
DLC |
Cycle_Time |
StartBit |
Length |
Initial_Value |
Offset |
Minimum |
Maximum |
| ECU1 |
0x600 |
ABSData |
0x608 |
4 |
50 |
2 |
4 |
0 |
0 |
0 |
2048 |
| Name |
ID |
DLC |
Cycle_Time |
StartBit |
Length |
Initial_Value |
Minimum |
Maximum |
| CarSpeed |
0x608 |
4 |
10 |
8 |
4 |
10 |
0 |
2048 |
| Name |
Message_Array |
| ECU1 |
{"ABSData","EngineData"} |
| ECU2 |
{"none"} |
| ECU3 |
{"ALL"} |
Each node can have a different termination resistance.
which means a different voltage. And the voltage value can be dynamic.
The computation of the Active power state can be a function of the volt.

From the above screenshot, we can see that, The power for each device is defined
separately. The active state power is the sum of the Tx and Rx power plus
the power transmission on the Wire. This includes the time that the
transmission starts to the time that it ends on the wire.
The standby
power is the beacon power of the Tx and Rx
The power
is unique for each Node connected to the Network
If the
device is turned off (Bus_Off), the power for each tx/Rx is in minimal possible
value but not exactly 0.0
The power is calculated as an expression based on the above items (ExpressionList Parameter section of Power_Table). We can also include the transmission resistance converted into volts plus other element values similarly.
For each device/Node, they have a separate row and
calculated values will vary between devices, if the user wishes to provide
different configuration values for each devices.
For example:

We can see that the Volts column for 4 devices are
different. So, since all power state calculation are linked with the Volts and
Mhz column, the calculated power for each device will be different.
By default,
all devices are in Standby state. If any device has been manually reset
or due to errors, the power is in the Bus_off state.
When the
device starts transmitting, the power turns to active state. This
continues until all the bits have completed been transmitted. All other
devices are in standby state.
| Field_Name |
Description | Example |
| IDE |
Required for specifying the Identifier.0 for 11 bits and 1 for 29 Bits. | 0 |
| DLC |
It should be less than 64 Bytes | 8 |
| ID |
USed to specify the Message ID |
"0x108" |
| Message |
Specify the Message name | "ABSData" |
| Length |
Specify the Length in Bytes |
8 |
| Error_Flag |
Specify the State of the Error_Flag. If True, then it is an Error Frame. |
false |
| Overload_Flag |
Specify the State of the Overload_Flag. If True, then it is an Overload Frame. | false |
| RTR_Bit |
Specify the State of the Remote_Bit. If True, then it is a Remote Frame. Else Data frame. |
false |
| A_Source |
To Specify the Source which generated this traffic |
"Brake_ECU" |
| Address |
The Address Mentioned on this field should also be specified in the Messages_DB and Signal_DB |
"0x608" |
| Port | Explanation |
| wire | Sends out data to all CAN_Nodes connected to the Network |