You are on page 1of 19

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Connexions
You are here: Home Content Vehicle Dynamics

Vehicle Dynamics
Module by: Jacob Fainguelernt. Summary: In this module, a physical model of vehicle engine management will be created. The model will be first simulated, and then used to create an implementation on the eZDSP-F2812. This board will emulate in real-time the behavior of a vehicle, under various stimuli. In this example, the environment is used to build a physical model of vehicle engine management in simulation, which is then used to create an implementation on the eZDSP-F2812. This board will emulate in real-time the behavior of a vehicle, under various stimuli.

Introduction
The Texas Instruments C28x family of processors has been designed to implement control applications, for example digital motor control and un-interruptible power supplies. We shall start here with a simple application. In this Laboratory, you will build a simulation model of a vehicle dynamics using Simulink, and then emulate it using the eZDSP-F2812 board.

Related Files
Powerpoint Presentation - VehicleDynamics.ppt (VehicleDynamics.ppt) Simulink Model for PC Simulation - VehicleDynamics.mdl (VehicleDynamics.mdl) Simulink Model for Simulation with DSKF2812 - VehicleDynamicsF2812Simulation.mdl (VehicleDynamicsF2812Simulation.mdl) Simulink Model for Real-Time - VehicleDynamicsDSKF2812.mdl (VehicleDynamicsDSKF2812.mdl)

Objectives
Design a Simulink model of the motion of a vehicle. Run the model using Simulink on a PC. Modify the model for use with the Texas Instruments C28x Digital Signal Processor. Run the modified model on the Texas Instruments F2812 ezDSP.

Level
Beginner; This is intended as the first complete project using Matlab and Simulink. It is suitable for students who have only limited exposure to Texas Instruments DSPs before.

Requirements
In developing this Laboratory, the following hardware and software were used: Matlab R2006b with Embedded Target for TI C2000. Code Composer Studio (CCS) 3.1. Spectrum Digital ezDSP F2812 Hardware Some external electronic components costing about $2.

Simulation
Running the Vehicle Dynamics Simulation
Open VehicleDynamics.mdl (VehicleDynamics.mdl) .

1 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Figure 1: Engine Management Subsystem

Run the Model. The input to the model is a ramp generator, which simulates smooth acceleration. You will see the graphs of Horsepower and Vehicle Speed.

Changing the Vehicle Mass


Double click on the Vehicle Dynamics block. This models the equation of motion using Simulink Blocks.

Figure 2: Vehicle Dynamics

At present, the vehicle mass is 8000 kg.

2 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

We will now simulate a small compact car. Change the 1/m gain block to 1/1000 and change the b/m block to 2/1000. Run the model again and notice the effect on maximum vehicle speed and how long it takes to reach maximum vehicle speed You might also like to simulate a 35,000 kg lorry. Change the 1/m block to 1/35000 and b/m to 10/35000.

Changing the Engine Power Profile


Double click on the Engine Management block. This models the gas in horsepower out function of the engine.

Figure 3: Engine Management Subsystem

Double-click on the Power Transfer Function

Figure 4: Engine Power Transfer Function

Change the shape of the Power Transfer Function. You may wish to change the gradient or make the plateau wider. Run the model.

Other Modifications to the Model


Go to the Website of an automobile manufacture, and obtain the actual engine power transfer function for a real car. Run this in the model. Replace the ramp generator input with a step function. This simulates someone stamping on the gas!

3 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Reference Simulation for F2812


Running the Vehicle Dynamics Simulation
Open VehicleDynamicsF2812Simulation.mdl (VehicleDynamicsF2812Simulation.mdl) .

Figure 5: Modified Model for F2812

Run this model. This is the behavior that should be seen when the real-time model is run on the ezDSP for F2812.

Creating Your Own Models


Creating a new Matlab Model
Start Matlab 7.3.0 R2006b In the top left hand corner of the Matlab screen, select: File -> New -> Model.

4 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Figure 6: A New MatLab Model

The following screen will appear.

Figure 7: An Empty MatLab Model

Saving the New Model


Save the model as vehicle_dynamics.mdl.

Figure 8: Saving the new model

Opening the Library Browser


Select View-> Library Browser

5 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Figure 9: Selecting the Library Browser

Selecting the Subsystems


A list of available blocks will appear. Select Commonly used blocks. Highlight Subsystems. Drag-and-drop two copies of this block into the model.

6 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Figure 10: The Simulink Library Browser

Subsystems Added
Rename the Subsystems to Engine Management and Vehicle Dynamics.

Figure 11: Subsystems Added

Drag-and-drop a saturation block onto the model.

7 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Adding a Ramp Generator


From the Simulink Library Browser, select Sources. Drag-and-drop the Ramp block onto the model.

Figure 12: Adding a Ramp Generator

Adding Scope Blocks


From the Simulink Library Browser, select Sinks. Drag-and-drop the Scope block onto the model twice. Drag-and-drop the Display block onto the model twice.

8 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Figure 13: Adding a Scope

Joining and Renaming the Blocks


Join the blocks as shown in the figure below. Change the names and add a title.

Figure 14: First Blocks Added

Setting the Solver


The ode45 solver is not suitable for use with DSP. Fixed Point Discrete is required.

9 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Figure 15: Configuring the Solver

The Engine Management Subsystem Overview of the Engine Management Subsystem


The first stage of the Engine Management Subsystem is a Gain block, which converts the Gas Pedal input (0-100%) to 0-4000 rpm. The second stage is a lookup table. This converts from rpm to hp.

Figure 16: The Engine Management Subsystem

Adding a Lookup Table


From the Simulink Lookup Tables, drag-and-drop the Lookup Table block onto the model.

10 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Figure 17: Adding a Lookup Table

Double click on the Lookup Table block.

Figure 18: Lookup Table Block Parameters

The values for the table can also be inserted as a table. Click on the Edit box.

Figure 19: Lookup Table Values

11 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Click on "Plot" as shown above, and you will see:

Figure 20: Adjusting the Lookup Table

The Vehicle Dynamics Subsystem Overview of Vehicle Dynamics Subsystem


The C28x operates in discrete-time; therefore the continuous integrator must be replaced by a Discrete Time Integrator for DSP model implementation.

Figure 21: Vehicle Dynamics Subsystem

Select the Main tab. Change the Constant value to 0. Click on OK.

Running the Simulation


The ramp generator gently changes the Gas Pedal from 0% to 100%. This simulates smooth acceleration. The Horsepower and Vehicle Speed are shown on the graphs.

12 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Figure 22: Running the Simulation

Modifications for ezDSP F2812


In order to run the model on the ezDSP F2812, some additional blocks need to be added to the project: An Analog-to-Digital Converter (ADC) to allow a potentiometer input. A block to scale the ADC input to the range 0 to 100%. A Digital-to-Analog Converter (DAC) to convert the Vehicle Speed to an analog output in the range 0 to 3.3V

Connecting the F2812 ezDSP


For Matlab and Simulink to run correctly, you need to run the F2812 ezDSP. Connect the F2812 hardware to the parallel port of the computer and turn on the supply to the board. When the board is powered, the two green LED lights on the board will come on during self-test. Start Code Composer Studio for F2812 ezDSP and use Debug -> Connect

13 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Figure 23: Startup Screen for Code Composer Studio (CCS)

Opening the Library Browser


Select View-> Library Browser

14 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Figure 24: Selecting the Library Browser

The Simulink Library Browser


A list of available blocks will appear. We are particularly interested in the Embedded Target for TI C2000 DSP. Click on this selection. In the following sections we will select the building blocks for the DSP model shown in Figure 30.

15 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Figure 25: The Simulink Library Browser

Selecting Target Preferences


From the C2000 Target Preferences, select F2812 ezDSP. Drag-and-drop the icon onto the new model.

Figure 26

Figure 26 Selecting Target Preferences

16 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

When the following screen appears, it is important to select Yes.

Figure 27: Initializing Simulation Parameters

Scaling the ADC Readings


To scale the ADC reading to the Gas Pedal 0 to 100% we will multiply the ADC input by 800 then divide by 32768.

Figure 28

Figure 28 Scaling the ADC

Scaling the DAC Output


To scale the kph to the DAC output, we will multiply the kph input by 312.5. The Saturation block limits the output to 200 kph.

17 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Figure 29: Scaling the DAC

The Finished Model


To scale the kph to the DAC output, we will multiply the kph input by 312.5.

Figure 30: The Final Model

Building the Model


Select Tools -> Real-Time Workshop -> Build Model.

18 -> 19

14.05.2012 20:35

Vehicle Dynamics

http://cnx.org/content/m22943/latest/

Figure 31: Building the Model

You may find the final model here (VehicleDynamicsDSKF2812.mdl) .

Comparing Performance
The real-time model running on the ezDSP F2812 should now be behaving in the same way as the Simulation.

References
1. Spectrum Digital Incorporated, "eZdspTM F2812 Technical Reference" Rev. F, September 2003. (http://c2000.spectrumdigital.com /ezf2812/docs/ezf2812_techref.pdf (http://c2000.spectrumdigital.com/ezf2812/docs/ezf2812_techref.pdf) )

More about this module: Metadata | Downloads | Version History How to reuse and attribute this content How to cite and attribute this content This work is licensed by Cathy Wicks under a Creative Commons Attribution License (CC-BY 2.0), and is an Open Educational Resource. Last edited by Jacob Fainguelernt on May 5, 2009 2:26 am GMT-5.

19 -> 19

14.05.2012 20:35

You might also like