Chip simulation of
automotive ECUs
Jakob Mauss, QTronic GmbH
Matthias Simons, Daimler AG
9. Symposium
Steuerungssysteme für automobile Antriebe
Berlin-Tempelhof, 20.-21.09.2012
Outline of the talk
Chip simulation of automotive ECUS
1. Motivation
2. Setting up a simulation
3. Performance
4. Limitations
5. Conclusion
Chip simulation of automotive ECUs - Steuerungssysteme für automobile Antriebe 20-21.09.2012 - Berlin
Motivation
ECU: more than 30.000 software parameter
Example: 16 x 10 map
ECU memory dump
Chip simulation of automotive ECUs - Steuerungssysteme für automobile Antriebe 20-21.09.2012 - Berlin
Motivation
Engine calibration
- tune more than 30.000 ECU parameter
- done by the OEM, not by the supplier of the ECU
Process today
- automated optimization of stationary states
- real-time test rig or vehicle: based on the real ECU
- PC based: engine and ECU both simulated, e.g. in Simulink
Problems
- real-time test rig:
- limited reproducibility
- expensive (invest, operation)
- slow (real time)
- PC: reverse engineering of ECU is
- time consuming
- complex
- error prone
für automobile
Chip simulation of automotive ECUs - Steuerungssysteme für automobile Antriebe
Antriebe 20-21.09.2012
20-21.09.2012 -- Berlin
Berlin
Motivation
Idea
move engine calibration (and other development tasks)
from test rig to PC
Benefit
- simulation runs much faster than real time
- enables use of mathematical optimization
für automobile
Chip simulation of automotive ECUs - Steuerungssysteme für automobile Antriebe
Antriebe 20-21.09.2012
20-21.09.2012 -- Berlin
Berlin
Motivation
Simulation of ECUs on PC:
Problem:
How to simulate ECU if no C source or model is available ?
?
Ideas:
- Simulate the CPU based on the hex file
- Integrate this feature into MATLAB and QTronic Silver
Chip simulation of automotive ECUs - Steuerungssysteme für automobile Antriebe 20-21.09.2012 - Berlin
Example - TCU Control Software in Silver
Chip simulation of automotive ECUs - Steuerungssysteme für automobile Antriebe 20-21.09.2012 - Berlin
Setting up a TriCore simulation
1. write spec.txt to specify what functions to run
2. step and debug the simulation in Silver debug mode
3. generate fast running SFunction or Silver module: runs without a2l and hex
Chip simulation of automotive ECUs - Steuerungssysteme für automobile Antriebe 20-21.09.2012 - Berlin
Setting up a TriCore simulation
1. write spec.txt to specify what functions to run
2. step and debug the simulation in Silver debug mode
3. generate fast running SFunction or Silver module: runs without a2l and hex
01 # specification of sfunction or Silver module
02 hex_file(m12345.hex, TriCore_1.3.1)
03 a2l_file(m12345.a2l)
04 map_file(m12345.map) # a TASKING or GNU map file
05 frame_file(frame.s) # assembler code to emulate RTOS
06 frame_set(STEP_SIZE, 10) # Silver step size in ms
07 frame_set(TEXT_START, 0xa0000000) # location of frame code
08
09 # functions to be simulated, in order of execution
10 task_initial(ABCDE_ini)
11 task_initial(ABCDE_inisyn)
12 task_triggered(ABCDE_syn, trigger_ABCDE_syn)
13 task_periodic(ABCDE_20ms, 20, 0)
14 task_periodic(ABCDE_200ms, 200, 0)
15
16 # interface of the generated sfunction or Silver module
17 a2l_function_inputs(ABCDE)
18 a2l_function_outputs(ABCDE)
19 a2l_function_parameters_defined(ABCDE)
Chip simulation of automotive ECUs - Steuerungssysteme für automobile Antriebe 20-21.09.2012 - Berlin
generated SFunction in MATLAB/Simulink
spec.txt
.hex .map characteristics turned into
MATLAB workspace variables
.a2l frame.s - read by S-function
- may be modified by script
tcbuild
.mexw32 MATLAB/Simulink
S-function
40 MIPS
default values for
characteristics from
.mask.txt HEX file as m script,
mask for S-function
block and similar
Simulink snippets
Chip simulation of automotive ECUs - Steuerungssysteme für automobile Antriebe 20-21.09.2012 - Berlin
generated virtual ECU in Silver
spec.txt virtual ECU
QTronic
tcbuild TriCore
ECU
.hex .map functions
emulation
code 40 MIPS
.a2l frame.s generator RTOS
emulation
4GB
tcbuild virtual memory INCA on-line calibration:
TCP/IP measure and tune
CANape running simulation
.mexw32 MATLAB/Simulink
S-function A2L
XCP
40 MIPS conversion
vehicle simulation
or measurements
tsim.dll
Silver
TriCore debug mode
0.4 MIPS
Chip simulation of automotive ECUs - Steuerungssysteme für automobile Antriebe 20-21.09.2012 - Berlin
Virtual ECU running in Silver: MED17
Chip simulation of automotive ECUs - Steuerungssysteme für automobile Antriebe 20-21.09.2012 - Berlin
Performance and Limitations
Run complex function for a measured scenario, 3.5 minutes
target execution time MIPS
Silver in debug mode 919.15 sec 0.41
generated Silver module or 9.30 sec 40.80
MATLAB/Simulink SFunction
MED17 with TC1797, 180 Mhz 210.00 sec 270
Limitations:
- instruction accurate, but not cycle accurate
- based on TriCore specification: 'silicon bugs' are not simulated
- PCP, CAN controllers and other on chip devices not modeled
Chip simulation of automotive ECUs - Steuerungssysteme für automobile Antriebe 20-21.09.2012 - Berlin
Summary
ECU simulation on Windows PC
- without expensive reverse engineering
- without access to ECU source files
- based on HEX, MAP and A2L file
- low work effort for modeling
- high accuracy of model
- application example: automated calibration
- works for TriCore processors: TC1796, TC1797, TC1798, ...
- performance: 40 MIPS
Chip simulation of automotive ECUs - Steuerungssysteme für automobile Antriebe 20-21.09.2012 - Berlin