You are currently viewing TSMaster XCP 模块输出的 mat 文件格式说明

Description of the mat file format output by the TSMaster XCP module

Table of Contents for this article.

I. mat variable format definition

1. Fixed variable definition

2. Time resolution method

3. Time-correlated signal resolution methods

4. build timeseries


II. Simulink Signal Playback

1. Playback workspace variables in the model


I. mat variable format definition

The TSMaster XCP module supports direct output of compressed HDF5 format mat files (Matlab version 7.3 and above), which facilitates the development of Simulink-based models. mat files output by TSMaster are loaded into Matlab with the following workspace variables.

1、Fixed variable definition

The list of fixed variables is as follows.

1、Time analysis method

First separate the time series and obtain all time axes.

>The time series TIME_LIST string variable for the signal recorded in AN0001, for example, is as follows.

ecu1_TIME_DAQ_Cyclic,ecu1_TIME_DAQ_10_ms,ecu1_TIME_DAQ_100ms,ecu1 _TIME_POLL_noiseSignal,TIME_XCPSimBus__engine_speed

Each time axis array can be associated with one or a group of signals, and there are three types of time axes: DAQ time (one time axis contains one or a group of signals); Poll time (one time axis corresponds to one signal) and system variable time (one time axis corresponds to one signal).

>The absolute time in seconds of each time axis can be extracted according to the name of each time axis array, as shown in ecu1_TIME_DAQ_100ms for example.

3、Signal analysis method of time correlation

>After obtaining the timeline, you need to obtain the list of signals associated with the timeline, and locate the signals according to their names in the list. Take ecu1_TIME_DAQ_100ms as an example, the corresponding signal list is stored in a comma-separated string variable named ecu1_TIME_DAQ_100ms_LIST, and the variable name rule is

Timeline Name_LIST

>Expand the string variable ecu1_TIME_DAQ_100ms_LIST in a comma-separated manner to get the name of the variable or group of variables corresponding to the timeline ecu1_TIME_DAQ_100ms, in this case, only one name.


>This variable name eventually leads to the signal array "ecu1_triangleSignal", where each element of the signal array corresponds in time to each element of the time signal array.

>Right-click on this signal to plot the signal distribution by point (without time information), as shown in the following figure.

4、Build timeseries

>If you need to construct a sequence of signal values with time information, you need to execute an additional m-script to construct timeseris. Taking the signal ecu1_triangleSignal as an example, whose corresponding time axis is ecu1_TIME_DAQ_100ms, timeseries can be constructed by the following script.

Triangle_signal = timeseries(ecu1_triangleSignal, ecu1_TIME_DAQ_100ms)

>After the construction, a new signal "Triangle_signal" appears in the workspace.

> Right click to plot its change curve, you can see that the horizontal and vertical coordinates are time and value respectively.

II. Simulink Signal Playback

1. Playback workspace variables in the model

There are several steps to play back the XCP signal in the model.

Open the Simulink module, double-click in the module margin and select "FromWorkspace".

Change the name of the signal in Simulink to "Triangle_signal" according to the names of the timeseries, i.e., you can participate in the simulation and testing process of the algorithm related to the model.

After connecting Scope, the simulation results are as follows.