Vehicle Simulator
Vehicle Simulator
Published
04/12/2011
MATLAB-SIMULINK® BASED
VEHICLE SIMULATION
Using a MATLAB - Simulink® model, various simulations
can be performed to verify any ECU functionality at bench
level. This paper explains the following simulations:
1. Network simulation
Figure 2. Simulink® Model Distribution on to the 2. Decoding of CAN messages from the ECU
Targets
3. Instrumentation support for reading and writing memory
through CAN calibration protocol (CCP) [2] and universal
Opal-RT TestDrive™ [4] provides the most effective way to calibration protocol (XCP) [3]
implement a model-based approach to design vehicle
simulation. MATLAB-Simulink® will allow us to quickly 4. Support for periodic data acquisition (DAQ) and periodic
create real-time simulations of dynamic systems and use them data stimulation (STIM) using CCP and XCP
throughout the design cycle - from initial concepts, to 5. Simulation of fault conditions to test the ECU
controller design, test and validation using hardware-in-the-
loop (HIL) testing. 6. Simulation of diagnostic test tool to read diagnostic
trouble code (DTC)
The target system is a PC or cluster of PCs where the
simulation runs. The real-time requires a real-time operating 7. Simulation of power waveform test tool
system (RTOS) such as QNX. The target system allows us to
perform model compilation and real-time execution, as well
as scheduling any signal I/O hardware for HIL applications.
8. Replay CAN logs on target hardware for functional Each message also has individual control to simulate missing
verification message fault diagnostics.
9. Test automation using python scripts
The ACC gets CAN messages from other ECUs such as the
10. Message logger engine management system (EMS), brakes control module
(BCM), transmission control module (TCM) and instrument
1. NETWORK SIMULATION cluster (IC). The simulator model groups all these messages
Traffic data from the radar, yaw rate sensor, and vehicle based on the appropriate periodicity, with message triggering
speed sensor are simulated by Simulink® models. accomplished through the Simulink® pulse generator.
The radar sensor transmits scan data through a set of CAN Messages can employee several methods to maintain data
messages periodically. Each set of messages is transmitted integrity logic, through scan index, rolling count and
sequentially and the sequence is repeated. checksum calculations.
Figure 14. RC Sliding Window on Simulation The diagnostic response bytes are stored in a buffer based on
the frame index of the response.
error signals set, etc. The ECU sets the diagnostic trouble
codes (DTC) for each fault. These fault conditions can be
read from the diagnostic services. Since the ECUs support
30-50 different DTCs, this information has to be transmitted
in multiple CAN frames. Since each frame of the DTC
response is transmitted from the ECU, the Simulink® model
samples these messages and then stores it in buffers.
7. SIMULATION OF POWER
WAVEFORM TEST TOOL
In the vehicle environment, the ECU is subjected to power
variations and it is very important to know how the ECU's
functionality will be affected by such conditions. The
Simulink® model helps in generating different types of power
waveforms.
Figure 19b. Data logged during playback using DAQ feature of CCP
SUMMARY/CONCLUSIONS
Using Simulink®, the time required for vehicle simulator
modeling can be reduced drastically. Simulation logic can be
verified before running on target and can be separated from
low level device drivers, making the model less dependent on
the simulator. In this paper, Simulink® is used to build a
Vehicle Simulator Model containing basic functionalities for
effectively testing the ECU, which can be configured based
on the tests required to be performed. With this
programmable simulator, ECU is exposed to real world
driving scenarios in a laboratory environment with the test
cases being written through Python automated scripts. Real
world data in terms of vehicle logs can also be replayed back
into ECU and performance of various software algorithms
can be easily verified. The model simulates different kinds of
Figure 20. Python Scripting Window power waveforms to which the ECU is being exposed and the
performance is analyzed.
DEFINITIONS/ABBREVIATIONS QNX
Unix-like real time operating system
ACC
Adaptive Cruise Control
RADAR
Radio Detection And Ranging
A2L
ASAM MCD 2MC/ASAP2 standard
RC
Rolling Count
BCM
Brake Control Module
RTOS
Real Time Operating System
CAN
Controller Area Network
STIM
Data Simulation
CCP
CAN Calibration Protocol
TCP/IP
Transmission Control Protocol/Internet Protocol
DAQ
Data Acquisition
XCP
Universal Measurement and Calibration Protocol
UDP/IP
User Datagram Protocol/Internet Protocol
USB
Universal Serial Bus
The Engineering Meetings Board has approved this paper for publication. It has Positions and opinions advanced in this paper are those of the author(s) and not
successfully completed SAE's peer review process under the supervision of the session necessarily those of SAE. The author is solely responsible for the content of the paper.
organizer. This process requires a minimum of three (3) reviews by industry experts. SAE Customer Service:
Tel: 877-606-7323 (inside USA and Canada)
All rights reserved. No part of this publication may be reproduced, stored in a
Tel: 724-776-4970 (outside USA)
retrieval system, or transmitted, in any form or by any means, electronic, mechanical, Fax: 724-776-0790
photocopying, recording, or otherwise, without the prior written permission of SAE. Email: [email protected]
ISSN 0148-7191 SAE Web Address: http://www.sae.org
Printed in USA