Using ModelSim and Matlab/Simulink for System Simulation...

Preview:

Citation preview

Mentor Graphics Users‘ Group, October 2003

Using ModelSim and Matlab/Simulink for System Simulation in Automotive Engineering

Dipl.-Ing. Sven AltmannDr.-Ing. Ulrich DonathFraunhofer-Institut Integrierte SchaltungenBranch Lab Design Automation Dresden

“Mentor Graphics Users‘ Group 2003“9. / 10. Oktober 2003, Sonthofen

Mentor Graphics Users‘ Group, October 2003

Automotive Engineering

System Specification- X-by-Wire, ABS, ESP- Automatic climate control - Automatic transmission

System Simulation- Functional test- Parametrisation- Configuration

Controller Design- ECU - FPGA- ASIC

Mentor Graphics Users‘ Group, October 2003

• Objective

• Matlab/Simulink Vehicle Model

• VHDL-Design Controller

• Simulator Coupling

• System Simulation

• Summary

Outline

Mentor Graphics Users‘ Group, October 2003

Objective

Requirements for Simulation

Simulation Support in Automotive System Design

•Reduction in developing effort

• Increasing design guaranty and reliability

•Reducing costs

•Check of the system functionality, performance andsecurity

•Behaviour of subsystems in interaction with the environment

•System dynamics in time critical load cases anderror situations

•Optimisation of selected operating parameters

Mentor Graphics Users‘ Group, October 2003

FhG IIS LibraryCoupling blocks

Objective

Model VEHICLE

Vehicle modelling

Simulator coupling

System simulation

Model CONTROL

Exact environment modelling for controller design

Test environment

VHDL

Model VEHICLE

SimulationVEHICLE

Controller design

Model CONTROL

SimulationCONTROL

Mentor Graphics Users‘ Group, October 2003

• Objective

• Matlab/Simulink Vehicle Model

• VHDL-Design Controller

• Simulator Coupling

• System Simulation

• Summary

Outline

Mentor Graphics Users‘ Group, October 2003

Matlab/Simulink Vehicle Model

Vehicle model contains models of : - Engine, transmission- Controller- Driver activity

Example from MATLAB Demos :- Automatic transmission control

Mentor Graphics Users‘ Group, October 2003

Module : Shift logic

Matlab/Simulink Vehicle Model

Shift logic

Mentor Graphics Users‘ Group, October 2003

Matlab/Simulink Vehicle Model

FSM 2Shift Selection

FSM 1Gear Switching

Stateflow model : Shift logic

Mentor Graphics Users‘ Group, October 2003

Matlab/Simulink Vehicle Model

Shift Schedule (MATLAB Demo)

Threshold Up_Shift

Threshold Down_Shift

Mentor Graphics Users‘ Group, October 2003

Speed

Gear

Throttle

Driver activitySimulation OutputVehicle behaviour

Simulation Input

Matlab/Simulink Vehicle Model

Mentor Graphics Users‘ Group, October 2003

• Objective

• Matlab/Simulink Vehicle Model

• VHDL-Design Controller

• Simulator Coupling

• System Simulation

• Summary

Outline

Mentor Graphics Users‘ Group, October 2003

System model in Matlab/Simulink

VHDL-Design Controller

Transformation of the Stateflow model „Shift logic“ into VHDL

Mentor Graphics Users‘ Group, October 2003

VHDL-Design Controller

FSM 2Shift Selection

FSM 1Gear Switching

Block diagram „Shift logic“ in HDL-Designer

Mentor Graphics Users‘ Group, October 2003

VHDL-Design Controller

Transformation of the FSMGear Switching

Mentor Graphics Users‘ Group, October 2003

VHDL-Design Controller

Transformation of the FSMShift Selection

Mentor Graphics Users‘ Group, October 2003

Transformation of Shift Schedule

VHDL-Design Controller

Shift Schedule (MATLAB Demo) LookUp-Table Up_Shift

GearThrottle [%]

3 4

1020

100

21

30405060708090

∞∞∞∞∞∞∞∞∞

10.010.0

40.0

13.018.023.027.032.036.040.0

30.030.0

80.0

30.034.042.048.056.063.080.0

50.050.0

100.0

50.054.060.070.080.090.0

100.0

0 ∞10.0 30.0 50.0

Mentor Graphics Users‘ Group, October 2003

VHDL-Testbench in HDL-Designer

Reset Clock

Throttle Speed

Gear

Stimuli Response

Test pattern Comparing responses with Shift Schedule

MUT

VHDL-Design Controller

Mentor Graphics Users‘ Group, October 2003

VHDL-Design Controller

Simulation results in ModelSim

SpeedGear

Throttle

ModelSim Wavetool

Mentor Graphics Users‘ Group, October 2003

• Objective

• Matlab/Simulink Vehicle Model

• VHDL-Design Controller

• Simulator Coupling

• System Simulation

• Summary

Outline

Mentor Graphics Users‘ Group, October 2003

- vehicle dynamics are modelled roughly

- no feedback to vehicle behaviour

Solution Combining VHDL controller model and Matlab/Simulink vehicle model

Restrictions of the VHDL-testbench

Simulator Coupling

Mentor Graphics Users‘ Group, October 2003

System model in Matlab/Simulink

Simulator Coupling

VHDL model „Shift logic“

Mentor Graphics Users‘ Group, October 2003

TCP/IP

Socket-Channel

ModelSim

Matlab-Coupler C-Architecture (DLL)Th

rottl

e

Spee

d

Gea

r

Matlab/Simulink

ModelSim-Coupler S-Function (DLL)

Thro

ttle

Spee

d

Gea

rData transferSimulator Coupling

Mentor Graphics Users‘ Group, October 2003

t_ModelSim

t_Simulink

simulate to t2simulate to t1

t0

Synchronisation

Sample period Sample period

t1 t2

Simulator Coupling

ModelSim

Matlab/Simulink

Mentor Graphics Users‘ Group, October 2003

Vehicle model includes ModelSim-Coupler

Coupling block to ModelSim

Simulator Coupling

Mentor Graphics Users‘ Group, October 2003

Controller model includes Matlab-Coupler

Simulator Coupling

Coupling block to Matlab

Matlab_Coupler

Mentor Graphics Users‘ Group, October 2003

• Objective

• Matlab/Simulink Vehicle Model

• VHDL-Design Controller

• Simulator Coupling

• System Simulation

• Summary

Outline

Mentor Graphics Users‘ Group, October 2003

System Simulation

ThrottleSpeed

Gear

Matlab/Simulink

ResetClock

System testbench

Vehicle model

ModelSim

Shift logic

Mentor Graphics Users‘ Group, October 2003

Matlab/Simulink

ModelSim

Data to ModelSim Data from ModelSim

ModelSim-Coupler

Data to MatlabData from Matlab

Matlab-Coupler

System Simulation

TCP/IP

Mentor Graphics Users‘ Group, October 2003

System Simulation

Diagrams

Control signals

Driver activity

Lists, Statistics ...

Vehicle behaviour

Mentor Graphics Users‘ Group, October 2003

• Objective

• Matlab/Simulink Vehicle Model

• VHDL-Design Controller

• Simulator Coupling

• System Simulation

• Summary

Outline

Mentor Graphics Users‘ Group, October 2003

Summary

Model VEHICLE

SimulationVEHICLE

Model VEHICLE

Controller design

Vehicle modelling

Simulator coupling

Test environment

VHDL

System simulation

Model CONTROL

SimulationCONTROL

Model CONTROLFhG IIS Library

Coupling blocks

Exact environment modelling for controller design

Mentor Graphics Users‘ Group, October 2003

Using Simulation Results

System dynamics in time critical load cases and error situations

Check of the system functionality, performance and security

Behaviour of subsystems in interaction with the environment

Optimisation of selected operating parameters

• Does the transmission switch and are parameters kept (overspeed limitation) ?

• Effect of the current transmission gear for rotation speed and vehicle speed

• How does the vehicle react if brake and throttle are simultaneously activated or if signal transfer failed ?

• Customisation of the shift schedule

Mentor Graphics Users‘ Group, October 2003

Forecast : Synthesis of the FPGA Prototype

RTL Schematicof automatonShift Selection

Summary

Mentor Graphics Users‘ Group, October 2003

Thanks for your attention !