You are on page 1of 11

Chapter 4

Simulation
4.1 Introduction to MATLAB/Simulink:
MATLAB is a numerical computation and simulation tool that was developed into a
commercial tool with a user friendly interface from the numerical function libraries LINPACK
and EISPACK, which were originally written in the FORTRAN programming language.
As opposed to the well-known computer algebra programs, such as MAPLE or
MATHEMATICA, which are capable of performing symbolic operations and, therefore,
calculating with mathematical equations as a person would normally do with paper and pencil, in
principle MATLAB does purely numerical calculations. Nevertheless, computer algebra
functionality can be achieved within the MATLAB environment using the so-called symbolics
toolbox.
Computer algebra programs require complex data structures that involve complicated
syntax for the ordinary user and complex programs for the programmer. MATLAB, on the other
hand, essentially only involves a single data structure, upon which all its operations are based.
This is the numerical field, or, in other words, the matrix. This is reflected in the name: MATLAB
is an abbreviation for MATrix LABoratory.
MATLAB limits itself to the basic data structure of the matrix, then MATLAB syntax
remains very simple and MATLAB programs can be written far more easily than programs in
other high level languages or computer algebra programs. A command interface created for
interactive management without much ado, plus a simple integration of particular functions,
programs, and libraries supports the operation of this software tool. This also makes it possible to
learn MATLAB rapidly.

33

M V G R College of Engineering

Department of Mechanical Engineering

Chapter 4

MATLAB is not just a numerical tool for evaluation of formulas, but is also an
independent programming language capable of treating complex problems and is equipped with
all the essential constructs of a higher programming language. Since the MATLAB command
interface involves a so-called interpreter and MATLAB is an interpreter language, all commands
can be carried out directly. This makes the testing of particular programs much easier.
MATLAB offers an intuitive language for expressing problems and their solutions both
mathematically and visually.
Typical uses include:
Numeric computation and algorithm development.
Symbolic computation (with the built-in Symbolic Math functions).
Modeling, simulation and prototyping.
Data analysis and signal processing.
Engineering graphics and scientific visualization.

4.2 Introduction to simulink:


Simulink has become the most widely used software package in academia and industry for
modeling and simulating dynamical systems. In simulink environment we can easily build
models from scratch, or take an existing model and add to it. Simulations are interactive, so we
can change parameters on the fly and immediately see what happens. We have instant access to
all of the analysis tools in MATLAB, so we can take the results and analyze and visualize them.
Simulink is a software package for modeling, simulating, and analyzing dynamical
systems. It supports linear and nonlinear systems, modeled in continuous time, sampled time, or a
hybrid of the two. Systems can also be multi rate, i.e., have different parts that are sampled or
updated at different rates. For modeling, Simulink provides a graphical user interface (GUI) for
building models as block diagrams, using click-and-drag mouse operations. Simulink includes a

34

M V G R College of Engineering

Department of Mechanical Engineering

Chapter 4

comprehensive block library of sinks, sources, linear and nonlinear components, and connectors.
We can also customize and create our own blocks.
Models are hierarchical, so we can build models using both top-down and bottom-up
approaches. We can view the system at a high level, and then double-click on blocks to go down
through the levels to see increasing levels of model detail. This approach provides insight into
how a model is organized and how its parts interact.
After we define a model, we can simulate it, using a choice of integration methods, either
from the Simulink menus or by entering commands in MATLABs command window. The menus
are particularly convenient for interactive work, while the command-line approach is very useful
for running a batch of simulations. Using scopes and other display blocks, we can see the
simulation results while the simulation is running. In addition, we can change parameters and
immediately see what happens, for what if exploration. The simulation results can be put in the
MATLAB workspace for post processing and visualization.
Model analysis tools include linearization and trimming tools, which can be accessed from
the MATLAB command line, plus the many tools in MATLAB and its application toolboxes. And
because MATLAB and Simulink are integrated, we can simulate, analyze, and revise your models
in either environment at any point.
One of the key features of Simulink is that it is built on top of MATLAB. As a result,
Simulink users have direct access to the wide range of MATLAB-based tools for generating,
analyzing, and optimizing systems implemented in Simulink. These tools include MATLAB
Application Toolboxes, specialized collections of M-files for working on particular classes of
problems.
Simulink can be used to explore the behavior of a wide range of real-world dynamic systems,
including electrical circuits, shock absorbers, braking systems, and many other electrical,
mechanical, and thermodynamic systems. Simulating a dynamic system is a two-step process
with Simulink. First, we have to create block diagram, using the Simulink model editor, that
graphically depicts time-dependent mathematical relationships among the system's inputs, states,

35

M V G R College of Engineering

Department of Mechanical Engineering

Chapter 4

and outputs. Then we simulate the system represented by the model from a specified start time to
a specified stop time.

4.3 Simulation of TWV:


After modeling the vehicle as six degrees of freedom model with single sprung mass and
three un-sprung masses using six linear second order differential equations the vehicle vertical
response has been found when the vehicle is moving at a speed of 45 km-ph on a random road
surface.
In majority cases dynamic systems (that are continuous in time) will be described by
differential equations. Thus in simulink we describe the system with a block diagram and
simulate the reaction of the system to an input signal. In order to find the response of TWV the
linear second order differential equations has to be modeled as a block diagram and the response
of system has been found for road disturbance signal.
The equations have been transformed into the block diagrams using integrator, gain add
blocks from the simulink library. Modeling all the equations in a single system is more complex
and confusing for that each and every mode has been modeled separately in different subsystems
and are connected using bus creators and bus selectors. The parent diagram and simulink models
for each subsystem are presented in annexure iii. The road disturbance that has been modeled as a
longitudinal displacement and corresponding time values are brought to the simulink
environment using from work space block. The response has been found in time domain using
scope block. And the response has been exported to MATLAB for frequency analysis using To
Workspace block. The disturbance has been given to three wheels without any time difference.
The simulation has been carried out for 10 seconds using ode4 (Runge-kutta) solver and
fixed time step. Physical parameters have been set by typing the related commands in the
MATLAB window.
Frequency analysis has been done in MATLAB workspace using fast Fourier transforms.
The goal of spectral estimation is to describe the distribution (over frequency) of the power

36

M V G R College of Engineering

Department of Mechanical Engineering

Chapter 4

contained in a signal, based on a finite set of data. Using pwelch command the response has been
found in frequency domain.

4.3.1 Building the model:


This system will be modeled by summing the forces acting on the system (body and
suspension) and integrating the accelerations of each mass twice to give velocities and positions.
Newton's law will be applied to each mass.

-Kms

z1

1
s

z2

z1

z3

1
s

z2

z3

-K-

i-i

-K-

k1+k2+k3

c1+c2+c3

1
r2

-K-

p3

P-1

-K-

p2

P'-1
3
z12

k2

z13
c2

z1-1

k3

z23

z1'-1

z2-1
10

c3

z22

R-1

R'-1
2

-K-

r3

-K-

z33

z2'-1
5
z32

k1
z3-1

c1
z3'-1

Fig.4.1 simulink model for sprung mass bounce mode


Figure shows the simulink model developed for sprung mass bounce mode based on the equation,

ms z c1 ( z1 1 ) c2 ( z 2 2 ) c3 ( z 3 3 ) k1 ( z1 1 ) k2 ( z2 2 ) k3 ( z3 3 ) 0

..(4.1)

In order to model the equation it can be expressed as

37

M V G R College of Engineering

Department of Mechanical Engineering

Chapter 4

1
c1 ( z1 1 ) c2 ( z 2 2 ) c3 ( z 3 3 ) k1 ( z1 1 ) k2 ( z2 2 ) k3 ( z3 3 )
ms

..(4.2)

These equations can be represented with gain blocks, integrator block and summation blocks
For the equation 4.2 first we will model the integrals of the accelerations of the masses

Insert an Integrator block (from the linear block library) and draw lines to and from its
input and output terminals.

Label the input line "z1" (for acceleration) and the output line "z2" (for velocity) by double
clicking in the empty space just above the line.

Insert another Integrator block connected to the output of the first.

Draw a line from its output and label it "z3" (for displacement).
We have taken a multi degree freedom system, in order to completely model the above

equation we need accelerations and velocities of other masses. For that five more pair of
integrators has been modeled. If we model the all of them in a single window the model will be
more confusing for that subsystems have been used. Each equation has been modeled in separate
subsystem. The variables that we are commonly exchanging among the equations are their
displacements, velocities and accelerations. The three variables are taken out of the each
subsystem by using out block. Using a bus creator the three variables can be converted to single
signal. All such signals have been added in order to generate a signal that contains all the
variables. Bus selectors are used to get the required variables from the signal. the parent diagram
for simulink vehicle model consisting of subsystems is as shown in fig 4.2
The equations can be represented with gain block (for 1/ms) and two summation blocks.

Insert a Gain block (from the Linear block library) one attached to the input of the
integrator pairs.

38

M V G R College of Engineering

Department of Mechanical Engineering

Chapter 4

Edit the gain block corresponding to ms by double-clicking it and changing its value to
"1/ms".
There are number of forces acting on the mass all of them have to be added, for that two

summation blocks have been included all damping forces are added together and these are added
to the spring forces in another summation block. The force can be obtained by multiplying the
distances by spring constants and velocities by damping coefficients. Insert gain blocks
corresponding to each force and change the parametric value to their corresponding spring
constants or damping coefficients. Input line of these gain blocks is connected to their respective
displacements in case of spring forces and velocities incase of damping forces that have been
brought from the other subsystems. The outputs of lines of these blocks are connected to
summation blocks and signs in the parameter block are changed according to the equation above.
Remaining modes of sprung mass has been modeled similar to the sprung bounce mode as above.

Fig.4.2 Simulink model TWV with subsystems


Where as in the case of unsprung masses disturbance force has to be added in addition to
the spring and damping forces. In road disturbing force there are two elements one corresponding
velocity and other one is displacement. We are giving the road disturbance as longitudinal
39

M V G R College of Engineering

Department of Mechanical Engineering

Chapter 4

displacement corresponding to time. Velocity component can be obtained by introducing a


derivative block in system. The simulink models for the all the modes sprung mass and bounce
modes of unsprung masses are as shown in the fallowing figures.

-K-

r1

r2

1
s

r1

Gai n

3
r3

1
s

r2

ii

r3

i i -i
-K-

-K-

Gain2

r-2
5

-K-

z2

-K-

z3

b-2

b'-2
6
2

-K-

p2

-K-

p3

p'-2

p-2
7

-K-

z13
3

z1-2

-K-

z12

z1'-2

4
z22

z23

-Kz2-2

-Kz2'-2
Add

Add1

Fig.4.3 Simulink modal for bounce mode of sprung mass

40

M V G R College of Engineering

Department of Mechanical Engineering

1
s

z1

ms

z2

z1

-K-

Chapter 4

z3

1
s

z2

z3

-K-

i-i

-K-

k1+k2+k3

c1+c2+c3

1
r2

R-1

R'-1
2

-K-

r3

-K-

-K-

p3

P-1

-K-

p2

P'-1
3

c2

z12

k2

z13

z1'-1

k3
z2-1
10

c3

z22

z1-1

9
z23

k1

z33

z3-1

z2'-1
5

c1

z32

z3'-1

Fig4.4 Simulink modal for sprung mass roll

-K-

p1

p2

p3

1
s

p1

ipy

1
s

p2

iii

p3

iii-i

-K-

-K-

p-3

p'-3
6
1

-K-

z2

-K-

z3

b'-3

b-3
7

-K-

r2

-K-

r3

r'-3

r-3
8

-K-

z13
3

z1-3

-K-

z12

z1'-3
4

-K-

z22

z32

z2-3
10
z33

z2'-3
5

-K-

z23

-Kz3-3

-Kz3'-3

41

M V G R College of Engineering

Department of Mechanical Engineering

Chapter 4

Fig.4.5 Simulink modal for sprung mass pitch

c4
c4

-Km uf

z31
z31

1
s

z31

z32

z33

1
s

z32
z32

vi

vi-i

z33
z33

-K-

k1

z3

b-6

k1
4

k1

2
p2

5
df

z3-6

c1+c4

z2

velocity

k4

-K-

du/dt
k4

p3

-Kp-6

-Kp'-6

Fig.4.6 Simulink model for front unsprung mass bounce

42

M V G R College of Engineering

Department of Mechanical Engineering

z21

z22

Chapter 4

du/dt

z23

velocity2

c5
k5

c5

7
drl

k5

-K-

z21

1
s

murl

1
s

z22

z23

-K-

v-i

k3+k6
-K-

-K-

r3

c3
2

k3
5

c3

z2

k3

z3

c3+c6

k3*l2
6

-K-

r2

-K-

p3

k3*l4

c3*l1
3

-K-

p2

c3*l4

Fig.4.7 Simulink model for rear right unsprung mass

z21

z22

du/dt

z23

velocity2

c5
k5

c5

7
drl

k5

-K-

z21

1
s

murl

1
s

z22

z23

-K-

v-i

k3+k6
-K-

p3

c3*l1
3

k3*l2
6

-K-

p2

-K-

r3

c3

r2

k3
5

c3

z2

k3

z3

c3+c6

-Kk3*l4

-Kc3*l4

Fig.4.8 Simulink model for rear left unsprung mass

43

M V G R College of Engineering

You might also like