Import of CAN Files

The addin reads BINLOG files (.blf), Vector ASCII logfiles (.asc), MDF4 Bus Logging files (.mf4), G.i.N Can LOG files (Data*F1 and Data*F1.gz) and A&D Can Log files (.tdfa) and converts the data into UniPlot data files into NC2 format. To interpret the Can messages, the addin needs the information from a CAN database file (DBC file). Only signals specified in the DBC file will be written to the NC2 file.

Multiplex messages are supported. With multiplexing, different signals can be transmitted using one message id.

In this version the import filter reads only CAN frames.

Note

The addin is a beta version.

Installation

Usage

  • Choose Tools=>CAN Configuration to select a DBC files and to create a configuration.

  • Choose File=>Import Data.

  • Choose Type "CAN File (*.blf; *.asc)".

  • Select one or more BLF/ASCII log files.

  • To create a dataset versus time: Choose the Type 2D: y/t MDF/INCA/CAN. If you select this type UniPlot will automatically select the correct time channel.

Can-Configuration

Goto the Tools menu to open the CAN Configuration dialog box. In this dialog box you can select one or more DBC files. The messages of all selected DBC files are listed in a separate list box.

../../_images/can-config-en.png

If a message is selected all signals will be converted into the NC2 file. At least one DBC file and one message must be selected.

For each DBC file a bus number (1 to 255) or “all” can be selected. For “all” all data for the selected messages are read. If a bus number in the range 1 to 255 is specified, only data that match the bus number will be read. In the NC file the Bus number will be displayed in the attribute “BusNumber”, e.g. “CAN12”.

The configuration must be saved under a name. The last selected configuration will be used to load a BLF file.

The configurations are saved as XML files in the sub directory can_dbc_ini in the UniPlot user directory. The Open Directory button opens the directory in the Windows Explorer.

Vector ASCII Logfiles

The CAN import filter supports the import of Vector ASCII Logfiles in classical format as well as CAN FD format.

The header data (maximum 50 lines) are saved as global attributes in the NC2-file.

The records of the ASCII data files must have the following structure:

Timestamp Busnumber CanId "Rx|Tx" "d" Number-of-bytes Byte1, Byte2, ..., Byte8

or in the case of CAN FD:

<time> CANFD <channel> <dir> <id> <brs> <esi> <dlc> <data_len> <data> [ ... ]

All other records will be ignored.

Vector ASCII logfile example:

// Configuration file: C:\x87366132.ltl
// Car: x2131
// Device: 3421412
date Dez. 3 2014 16:34:20
base hex  timestamps absolute
no internal events logged
   3.35516 1  B4323x         Rx D 8  72  E4  19  2F  14  00  00  00
   3.35522 6  52             Rx D 2  6C  60
   3.36716 1  B4323x         Rx D 8  73  E5  e9  24  e2  00  00  00
   3.36722 CANFD 15 Rx 86 1 0 8 8 48 75 6d 61 6e 69 73 6d 0 0 3000 0 0 0

G.i.N Can LOG Files

G.i.N CAN Log limits: All logging files must be located in one sub directory The file must match the pattern``Data*F*``. Only the format 3 is supported. Only CAN frames are read. G.i.N.: unsorted blocked mode is not supported.

SAE J1939

If one of the DBC files contains the element ProtocolType = J1939 the PGN (Parameter Group Number) is extracted from the extended CAN Id. Multibyte variables are not supported.

NC2-Files

The import filter creates files with the extension .nc2. The channel names in the NC2 files are formed from the message name followed by a period followed by the signal name specified in the DBC file. All signals for a selected message will be converted into the NC2 file. For each message a separate time channel is created (messagename.time). Each channel contains an attribute CanID with the message Id.

The global attributes contains the name of the configuration and the list of used DBC files.

Programming

The following function can be used to set multiple DBC files for the data import:

can_set_dbc_files(svDBCFiles, ssConfigurationName)

The parameter svDBCFiles is a string vector with the DBC file names. ssConfigurationName is the name for the configuration. The configuration contains the Can-Ids of all specified DBC files.

Example:

can_set_dbc_files(["s:/test-data/can-dbc/config1.dbc",
                   "s:/test-data/can-dbc/config2.dbc"], "MyTest");
svFile[1] = auto_ImportData(svFile[1]);

To load BLF files in an automation the configuration can be selected with the can_set_active_dbc_configuration function. Example to load a BLF file:

can_set_active_dbc_configuration("Engine");
svFile[1] = auto_ImportData(svFile[1]);

The source code can be found in Addin\rs_can directory.

Reading of Vector CAN database files::

// rvBusNo: 0,1,2,… 0 reads all data. default value is 0 oDBC = can_read_dbc(svFiles, rvBusNo) oDBC = can_read_dbc(svFiles)

oInfo = can_dbc_signal_info(oDBC, ssSignal)

Reading of BINLOG files (.blf):

oBLF = _blf_open_file(ssFilename)

nCount = _blf_read(oBLF, oData, nMaxMessages)

oStat = _blf_stat(oBLF)

[.
   ApplicationBuild = 94
   ApplicationID = 1
   ApplicationMajor = 7
   ApplicationMinor = 1
   FileSize = 1.09673e+06
   LastObjectTime = 40942.3
   MeasurementStartTime = 40942.3
   ObjectCount = 144599
   ObjectsRead = 144599
   UncompressedFileSize = 6.94596e+06
]

_blf_close_file(oBLF)

History

Version

Description

R2024.3

In case of multiplexed signal, the multiplexer is also present in the NC2 file.

R2020.4

The bus number can now be selected in the configuration dialog.

R2016.5

G.i.N Can LOG files (Data*F1 and Data*F1.gz) and A&D Can Log files (.tdfa) added.

R2016.2

Error Correction for signals with Motorola byte order.

R2015.5

SAE J1939 CAN Ids: The 8 bits source address is used to distinguish Ids.

R2015.1

Support of SAE J1939 CAN Ids.

R2015.1

Import of Vector ASCII Logfiles

R2012.9

Multiplex CAN Frames added.

R2012.7

Dialog box for message selection added.

R2012.6

New.

id-2071766