Interfaces and Buses / CAN /
Block Name: CAN_Node

Code File Location: VisualSim/actor/lib/auto/CAN_Node

Description

The CAN_Node modules are used to connect to a CAN_Bus module. So if we want to create a CAN Network, then we need both CAN_Bus and CAN_Node. The CAN_Node can be configured to generate traffic on its own, by looking up on Messages_DB mentioned in CAN_Bus or it can be coonected to an external packet generator/ECU/Sensor etc.

The follwong graphic shows how a CAN_Node look like:

CAN_Bus

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_Bus.


To illustrate the usage, look at the following Examples in the BDE. 


  Click here to watch a video tutorial on designing an Automotive Network containing CAN Bus, TSN Gateway etc... 


Parameter Explanation  Type   Example 
Sim_Time
Defines the Simulation Time
Double 1.0
CAN_Bus_Name
The parameter is used to specify the name of the CAN Bus. This name has to be matched with the CAN_Bus_Name provide in the CAN_Bus module.
String "CAN1"
Node_Name
This parameter specifes the Node Name and this has to be unique in a CAN_Bus network.
String "ECU1"
Enable_Sensor_DB
This parameter is used to specify whether we are generating traffic from Database or is this node getting packets from External source. True means the traffic is generated from the database.
Boolean true
Enable_Sensor_Random
true- to randomize the sensor data rates that are listed in the Signal table. The Signal table is in the CAN_Bus block. [ This Parameter not used anymore ]
Boolean true
Packet_Error_Mbps
A value of 0.0 disables this error generation.If according to the value specified a failure  was detected then Error counters are incremented and when reaching threshold, appropriate actions will be taken.
Double 0.0


Accepting Input from External sources:


If we have the ECU designed in another part of the system and doesnt want to generate traffic from the Database synthetically, then we can configure the CAN_Node modules to accept the inputs. For this to happen, we have to set false value to the Enable_Sensor_DB parmater of CAN_Node.

The incoming packet should have some required fields and they are:


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"

Notes:

When providing ID field, User can use the setField  function.
Example: input.setField ("ID","0x168")
              Format is : data_Structure.setField("Field",value)

Port Explanation
node_in
Data from External Traffic generator is fed in here
node_out
Data Accepted by this Node is sent out through this port. This acceptance is based on the entries specified in Filterring_DB.
rx
Data sent from CAN_Bus is received here
tx
Data to CAN_Bus is sent on here

The Wire Port has to be connected to the rx and tx ports of CAN_Node. When connected all up, it should look like the following:

CAN_Bus


Note:

The structure of a Default CAN_Node has rx and tx ports on the right side. But on CAN_Node5 the rx and tx ports are on left side. It is because the ports are flipped horizontally. It can be done by right click on CAN_Node -> Appearence -> Flip Ports Horizontally

For users with older version:

Please make sure that CAN_Nodes are instantiated first before the CAN_Bus is instantiated , when building a model from scratch.