Managing CAN Variables
From v8.5+ analysis has comprehensive support for handling CAN data directly.
There are currently 3 ways in which CAN data can be handled:
1. The CAN on the vehicle can be converted/mapped to a Race Technology variable and stored and/or displayed. For example if you have an ECU that outputs coolant Temperature within a CAN message with an address 0x1243, bytes 2 and 4, then you could set up a CAN adapter or the DL1 to convert this CAN information to the Race Technology variable "Water temp". The varaible water can then be stored to memory card, or displayed on a dashboard display etc.
The advantage of this method of handling CAN data is that since it is converted "at source" it can be displayed in real time, and it can make handling data at a later date simpler as the data is already converted, and it isn't required to match it up with a CAN data base file etc.
The disadvantage of this method of configuration is that you have to preconfigure all the hardware to understand and convert the CAN data before you start working, and if there are any errors in the configuration then the data will be meaningless.
2. You can log the CAN data, which can then be converted to useful values in the analysis software using a DBC file. In this case the data logger or interface logs all the CAN data on the data bus directly, so all the valid "raw" CAN data is stored, this includes the address and data information. When analysis loads this data then it checks to see if the linked DBC file has information to convert the raw CAN data into something meaningful and calculates the result.
The advantage of this approach is that installation and configuration is greatly simplifed as all that is required is to connect to the CAN bus and specify a baud rate. Using this method it is also easier to handle very large numbers of channels, you simply specify a DBC file and all the varaibles automatically appear in the software.
The disadvantage of this approach is that the data is not available in "real time" and so CAN data isn't "understood" by the hardware, and it can't be filtered, displayed, used to start/stop logging etc.
3. Finally you can simply log the raw CAN data and display the individual bytes of raw can data in the software without any conversion. This is typically only done for diagnostics or when testing a system, or when trying to reverse engineer the format of data on a CAN bus.
The advantage of this approach is that you do not have to configure or specify any information about the CAN data format
The disadvantage is that without knowing the format of the CAN data it is very difficult to understand what the data means.
In practice it is normal to use a combination of the 3 approaches. Even when the CAN data is decoded to a Race Technology variable the raw data is still available if raw CAN data is enabled. In the case that only some of the CAN data is specified in the DBC file, the data specified appears as DBC variables, and the unspecified data automatically appears as just CAN bytes.
An example would be that the system is connected to a car for which a partial DBC file was available from the vehicle manufacturer. The user wants to be able to exhaust gas temperature on a display in the car, so the CAN message that includes exhaust temperature is configured to be converted on the hardware to an Race Technology data message.
In addition all the CAN data is also stored as raw CAN data, this is then loaded into the analysis software along with the partial DBC file. The CAN data that is specified in the DBC file is converted into variables, with the variable names as given in the DBC files.
Finally, the remainder of the CAN data that is not specified in the DBC file automatically appears just as bytes in the analysis software.
There is a final consideration when using a DBC file to define the data format in a CAN message. The DBC file specifies the following information:
- CAN address
- format of the data (byte ordering)
- start bit
- length in bits
It doesn't contain information other important information that the analysis software needs to know, this includes:
- additional/custom scaling
- sample rate
Since this information is not stored in the DBC file and it would be inconvenient to enter the details everytime the software was used, these additional settings are stored
What is a DBC file?
The DBC file type (also referred to as 'CANdb') was initially developed by Vector Informatik GmbH, but is now widely used as a standard for defining messages on the CAN data format.
The file is an ascii file that can be read in by analysis and used to decode the raw CAN messages.
Note that the analysis software has no facility to create or edit the DBC file, only load and use it. In many applications the DBC file will be supplied to the end user from the equipment supplier, alternatively there is a free toolset that can be used to generate and edit the files "CANdb editor", Race Technology Ltd do not supply or support this software, but it is freely available from the internet.
Note that from version 8.5.286+ analysis also support J1939 format CAN addresses.
Loading a DBC file into analysis
To load a DBC file into analysis got the data menu, then analysis options, and then to the TAB labelled DBC files:
To load a DBC file, just click on any of the cells in the leftmost column, then select a DBC file.
Note that when the DBC file is loaded, analysis stores the location of the original file, and also makes a local backup.
If the external DBC file remains in the same location then analysis will continue to use the file, each time analysis is started up it will check for the existence of the file and if it is available it will load it processes it, and use it. If when analysis starts up it cannot file the DBC file at the specified location then it will use its local copy of the file. Note that this change is perminant, even if the original file is replaced, the local copy will continue to be used. If you want to reinstate the link to the external file, then delete the DBC file from the list and add the external file back.
Additional information for CAN variables
Since the DBC file does not include all information that analysis uses such as filtering, this has to be set separately. For example if we have a CAN variable in the DBC file called SPEED_0x1234, then we can set it to be smoothed over 5 seconds in the variable manager in the normal way. The problem is that if we need to retain this information, otherwise if we switch to using another DBC file, then back to the original DBC file, the filtering information for this variable would be lost.
As a solution to this problem analysis saves the additional information in a separate file, and when a DBC file is loaded it checks this file for a matching variable name. If a match is found then the extra CAN variable information is automatically applied.
When you make a change to the settings for a CAN variable in the variable manager this information is automatically stored.
If you wish to remove this stored information, then go the data menu -> analysis options and the DBC vars tab. Find the variable whose information you wish to delete and right click on it.