SIM2LU
SIM2LU
*
Harald Kirchsteiger
* H.
Kirchsteiger is with the University of Applied Sciences Upper Austria, Wels, Research Group ASiC. www.asic.
at [email protected]
General Guidelines
This course is an elective course on the topic of model based control held in summer 2019.
The topics covered in the course will be very similar to the ones of the lecture and the accompanying lab
”Model Based Engineering 1” from the winter semester 2018/2019.
Grading
Your preparation of the home exercises and your participation in the course
Initial tests (2-3 short questions) at the beginning of each lecture (starting with the second lab). The
topic of the tests is the content of the lecture as indicated in the handouts.
Contents Overview
1. Introduction
1
1 Introduction – Dynamic Modeling
When we talk about modeling in the context of control engineering, in most cases we are interested in a
dynamic model. This means that we want to know how certain physical quantities of a given system of
interest evolve over time. The proper mathematical representation for such systems is a set of differential
equations. In this course, we will in most of the cases work with linear, time invariant systems of the form
Time invariant means here that the matrices A, B, C, D are composed out of constant, real values. All the
systems considered here can be modeled using basic physical principles:
Mechanical systems: Newton’s laws of motion. For a straight line motion of a single mass m on which
several forces are acting:
N
X
ma(t) = mv̇(t) = mẍ(t) = Fi
i=1
For a rotational motion of a mass with inertia I with respect to an axis of rotation with angular speed
ω
N
X
I ω̇(t) = Mi (1.2)
i=1
Heat flow:
N
d T (t) X 1
= qi (t)
dt Ci
i=1
1
Thermal capacity C = mcp , heat energy flow with thermal resistance R: q = R ∆T , heat mass flow
with mass flow rate w: q = wcp ∆T
2
SIM1LU CHAPTER 1. INTRODUCTION – DYNAMIC MODELING
Consider the double pendulum shown in Figure 1.1. The two masses are coupled with a spring, which
generates no force if θ1 (t) = θ2 (t) = 0. The force of the spring acts perpendicular to the gravitational field
at all times while the spring itself has no mass.
2. Is the system linear? Is it autonomous? Is it time invariant? What are the equilibria for T = 0?
3. Assume the angles are small, in which case we can make use of the approximations sin(α) ≈ α and
cos(α) ≈ 1. Derive a state space representation of the system using those approximations. The output
signals are θ1 (t) and θ2 (t).
4. Simulate the nonlinear and the linear system in parallel in Simulink. Use the parameter values m1 =
1.5kg, m2 = 1.75kg, l = 0.8m, k = 120N/m, g = 9.81m/s2 . For the nonlinear system, use elementary
integrator blocks. For the linear system, use the state-space or LTI-system block. Compare the two
simulations. Up to which angle is the approximation still ”good”? Vary the initial values θ1 (0), θ2 (0)
to answer this question.
This section was previously part of SIM1LU and is required background for chapter 2
When the wheels are in movement, the tire will be continuously deformed on the contact surface with the
road which causes losses. This type of losses are dominant when driving at low speed. Conceptually, we can
think of a tire as a collection of radially arranged spring damper systems. The system currently in touch
with the ground will experience a slight compression. Mathematically, the rolling resistance is given by
FR = fr mg (1.3)
where fr is the rolling resistance friction coefficient which is mostly determined empirically. Depending on
the type of road, the following numbers give a good estimation: smooth tarmac road fr ≈ 0.01, solid dirt
road fr ≈ 0.05, wet and soaked underground fr ≈ 0.35, mud fr ≈ 1.8. Note that there is a strong influence
of the tire pressure on fr .
Aerodynamic Resistance
ρv 2
FA = cw A (1.4)
2
where the coefficient cw depends on the shape of the car, A is the area orthogonal to the driving direction,
ρ the density of the medium. Typical values for passenger cars are cw ∈ [0.25 . . . 0.35].
Acceleration Forces
When a vehicle is accelerated, its kinetic energy will change. The kinetic energy consists of the straight
movement along the driving direction, but also of all the rotational energy of the various parts rotating
inside a vehicle.
2
mv 2 J1 ω12 J N ωN
EKIN = + + ... + (1.5)
2 2 2
It is common to reduce all the velocities to the speed of the tire. Using a gear ratio i, the effective rolling
radius r0 of the tire and vii = r0 ωi we get
mv 2 J1 v 2 i21 JN v 2 i2N
EKIN = + + . . . + (1.6)
2 2r02 2r02
N
!
1 X Ji i2i
= m+ 2 v2 (1.7)
2 r 0
i=1
To analyze the aforementioned change of kinetic energy, we must take the first derivative to obtain
N
!
dEKIN X Ji i2i dv
=P = m+ v (1.8)
dt r02
i=1
dt
Since P = F v, we get
N
! N
!
X Ji i2 dv X Ji i2i dv
i
Facc = m+ = 1+ m = λmv̇ (1.9)
i=1
r02 dt
i=1
mr02 dt
The coefficient λ represents the additional inertia due to the rotational masses. Note that it depends on the
individual gear.
Incline Forces
When the vehicle is driving on a road with an angle α to the horizontal, the force
Fα = mg sin α (1.10)
has to be considered.
ρv 2
FZ = fr mg + cw A + λmv̇ + mg sin α (1.11)
2
An inverse vehicle model uses vehicle speed, acceleration and road slope in % as input variables and computes
the required engine variables as output (instead of using the accelerator pedal position as input which defines
the engine torque and the vehicle speed and acceleration). In this exercise, we want to build up such a model.
The overall model structure is shown in Figure 2.1. It consists of a desired drive cycle which provides the
desired speed and acceleration at any point in time and the corresponding road slope. The block vehicle
transforms those quantities into a torque and speed acting on the wheels, and also in a gear. The gearbox
gives the engine speed and torque based on the whees speed and torque. Finally, the block engine computes
a fuel consumption and the engine power.
This subsystem should read in a vector of velocities v and slopes p from the workspace. To implement this
subsystem, use the ”from workspace” block. Define a time vector and velocities and slopes in an init-file
(.m file). Use a time derivative to compute the acceleration a in Simulink.
6
SIM1LU CHAPTER 2. INVERSE VEHICLE MODEL
2.1.2 Vehicle
This subsystem makes use of the total driving resistance (see the notes from the first lab) given by
ρv 2
FZ = fr mg + cw A + λmv̇ + mg sin α (2.1)
2
where fr is the rolling resistance coefficient, m the total vehicle mass, cw the drag coefficient, A the frontal
area of the vehicle, ρ the density of air, v the vehicle speed, λ the additional inertia factor (”Drehmassen-
zuschlagsfaktor”) and α the incline in ◦ (needs to be converted from % to ◦ ). The torque on the wheel
is
Mwheel = FZ r0 (2.2)
where r0 is the static rolling radius of the wheel. The speed of the wheel can be computed out of the vehicle
velocity
v = r0 ωwheel (2.3)
The vehicle sub-model should also include a simple rule which gear should be used. For the sake of simplicity,
first assume gears are only shifted depending on the vehicle speed. Think of a reasonable strategy at which
speeds there should be a gear shift. Note: shifting depends whether the vehicle is accelerating or decelerating.
You might want to use several ”Switch” blocks to implement your strategy. (There are, as usual, also other
possibilities for implementation). The chosen gear is also an output of this subsystem.
Assume a dependency of λ on the gear: λ(gear) = [1.3, 1.2, 1.1, 1.05, 1]. (Is 1.3 for the 1st or for the 5th
gear?)
2.1.3 Gearbox
The power from the engine is transmitted via the transmission (gearbox and differential) and the drive axle
to the wheels. When assuming an efficiency ηgear , the relations between power and torque are given by
is given by the (constant) gear ratio of the axle iA and the gear ratios of the gearbox iG . Typical values for
a 5-gear transmission are iG = [5.09, 2.8, 1.76, 1.25, 1], iA = 2.47. Assume a constant efficiency of 90%
(this value depends also on the specific gear).
2.1.4 Engine
and the specific fuel consumption fc in g per hour. The specific fuel consumption computation will be
implemented with a 2D lookup table based on a graph as shown in Figure 2.2. For the moment, assume
there is a constant specific consumption cs = 400 g/kW h regardless of the operating point. Use a ”2-D
Lookup Table” with the inputs neng and Meng which gives as output the (constant) specific consumption.
The lookup table will be filled with reasonable data in the lab exercise. Note: the output of the subsystem
is required in g/h, not g/kWh.
If you are not familiar with lookup tables (1D and 2D), consult the Matlab documentation and understand
/ experiment with the examples.
Figure 2.2: Fuel consumption depending on engine speed (x-axis) and engine power (y-axis). The lines
indicate constant consumptions. The bold dashed line indicates the minimal consumption given
an engine power. [Mitschke 2014]
Define a simple drive cycle: t = 0, 10, 20, 30, 40, 50, 60s, v = 0, 12, 25, 35, 35, 30, 0 m/s, p = 0, 3, 2, 0, 0, 0, 0%
and run the simulation. Use a ”XY Graph” to visualize engine speed and torque simultaneously.
Figure 2.3: Average tire rolling resistances (of several manufacturers) [Mitschke 2014]
Note: in ”real” automatic transmissions, the gears are shifted based on accelerator pedal position, vehicle
speed and the current driving mode ranging from extra economy (XE) to extra sport (XS), see Figure 2.5.
Figure 2.5: Shifting curves for a gear change 1–2 [Reif: Automotive Mechatronics, 2015]
In this set of exercises, the anti-lock braking system ABS (”Anti-Blockiersystem”) and the traction control
system ASR (”Antriebs Schlupf Regelung”) will be analyzed.
Assume a vehicle which is driving with an initial speed of v0 km/h. We are now considering the activation
of the brakes, therefore there are no acceleration forces from the engine acting on the vehicle. For simplicity
we are only looking at one single wheel. The brake will create a certain torque MB on the wheel. Depending
on the current friction coefficient µ between wheel and road, the braking force FR will be transmitted to
the road which causes the vehicle to decelerate. Note that the friction coefficient is not a constant value, it
depends on the combination of tire and road and also on the slip (”Schlupf”).
ρv 2
mẍ = −FR − cw A (3.1)
2
if braking on a flat piece of road and with activated clutch such that the engine is decoupled from the wheels.
In the following we assume that the total braking force FR acting on the vehicle is generated by a single
wheel. The forces acting on the wheel are shown in Figure 3.2 which leads to
JR ϕ̈ = FR rR − MB (3.2)
where JR is the moment of inertia and rR the radius of the wheel. The amount of force which can be
transmitted from the brakes through the wheel on the ground depends on the relative speed difference
between wheel and vehicle. This difference is defined as the (tire) slip:
v0 , -
x
FR FR
12
SIM1LU CHAPTER 3. ABS AND ASR
ϕR , ωR
R
MB
v-
FR
FN
6
vR −v
Acceleration slip λA = vR
where vR = rR ωR is the wheel speed. Figure 3.3 shows a typical shape of the friction parameter for varying
slip values. Note: there is a maximum of this curve at relatively small slip values. At this point, the
maximum brake force can be transmitted to the road. If the wheels are subject to an increased braking
torque leading to a strong deceleration of the wheel but not of the car, i.e. a high slip, the friction parameter
decreases and less braking force can be transmitted to the ground. Also note: A high slip (in longitudinal
direction) will lead to a strongly decreased friction coefficient in lateral direction, which makes the vehicle
very difficult to steer. One particular slip curve can be approximated with the function
Home Exercise 3.2. Build a Simulink model, where the input is a braking torque MB and the output is
the speed v and distance x of the vehicle. Compute the braking slip λ in the model and use it to calculate the
current friction coefficient. Then, assume FR = 1.5µ(λ)mg. The factor 1.5 accounts for weight distributions
due to (hard) braking. Note: in the integrators, take care of correct initial conditions. Also activate the check-
box limit output and select a lower limit of 0; otherwise the braking force will eventually accelerate the car
in the opposing direction.
Simulate three cases: MB = 3000Nm, MB = 5300Nm, MB = 5500Nm. Compare the values for the braking
distance and for λ and µ: check the location of the simulated values in the slip-curve. The initial speed
is v0 = 100 km/h. Use the parameters m = 1500 kg, rR = 0.3 m, JR = 0.8kg m2 , A = 2 m2 , cw = 0.3,
ρ = 1.2kg/m3
Lab Exercise 3.1. Develop a simple anti-lock brake controller via a slip setpoint control.
The recorded data on the CAN bus includes the following signals:
1 Kurbelwellendrehzahl 19 Motordrehzahl
2 Soll Einspritzmenge 20 gestelltes Moment
3 ABS-Lampe 21 Fahrgeschwindigkeitsregler
4 ASC-Lampe 22 Fahrzeuggeschwindigkeit
5 ASC-Regelungsanzeige 23 Motortemperatur
6 Anforderung ASC 24 Schalter Kickdown
7 Anforderung MSR 25 Virtueller PWG f. FGR Betrieb
8 Fehler V1-Signal 26 Warmlauf-Information
9 Lampe el. Bremskraftvert. 27 Winkel Fahrpedal
10 Mittlere Vorderradgeschw. 28 Fahrgeschwindigkeitsregler
11 Momenteneingriff f. ASC Funktion 29 Schalter Kickdown
12 Momenteneingriff f. MSC Funktion 30 Kraftstoffverbrauch
13 Passivanzeige 31 Status Fahrgeschwindigkeitsregler
14 Schaltbeeinflussung 32 Sensorausgang Beschleunigung m/s2
15 Signal Bremslichtschalter 33 Sensorausgang Geschwindigkeit km/h
16 frei 34 Sensorausgang Raddrehzahl U/min
17 Fahrerwunschmoment 35 Sensorausgang Bremsdruck bar
18 Indiziertes Motormoment
The traction control system can be seen as an inverse ABS system in the sense that it controls the slip when
accelerating the car and prevents the wheels from spinning. However, ASR does not (initially) use the brakes
to control the slip, it directly acts on the torque produced by the engine. ASR also enables increased traction
on so-called µ-split surfaces, where one side of the road has a significantly different friction coefficient than
the other one. There are several ways for ASR to influence the engine torque:
If required, the traction control system can also build up brake pressure, even if the driver does not operate
the braking pedal at all.
The objective of this lab is to develop an active control for a magnetic bearing system used in turbomolecular
pumps. The magnet-rings shown in Figure 4.1 are permanent magnetic and are of unlike poles in stator
and rotor. There is a stabilizing force in radial direction. In axial direction, the setup is unstable because
if the rotor deviates only slightly from the symmetric middle position at y = 0, one pair of unlike poles will
create a force which increases with decreasing distance of the rotor to the stator.
To stabilize the rotor in axial direction, a coil (”Spulen”) is used to create a magnetic flux which counteracts
the one of the permanent magnets. Depending on the sign of the current, the resulting force on the rotor
will be upwards or downwards.
We assume the force of the permanent magnets to depend linearly on the distance y. A parameter kpm
determines the actual forces on the rotor and can be seen as stiffness of a spring. If the rotor hits the stator,
we assume some elasticity and a stiffness kw . The forces are
(
−kpm y for − ymax < y < ymax
f (y) =
−kpm y + kw (y − ymax sign(y)) for − ymax ≥ y ≥ ymax
16
SIM1LU CHAPTER 4. MAGNETIC BEARING
The coil consists of an ideal inductivity and a resistance where the supply voltage is uM . By Kirchhoff’s
di
law we get uM (t) = L dt + Ri. There is an electronic circuit (power electronics) between the controller and
the magnet. We assume that uM (t) = kI u(t) where u(t) is the controller output.
Applying Newton’s laws of motion in the y direction results in mÿ(t) = −f (y) − mg + kM i, where kM i is
the active force to be controlled.
Combining those equations, the overall system can be written in state-space form
ẏ 0 1 0 y 0 0
ÿ = kpm /m 0 kM /m ẏ + 0 u + (−kw (y − ymax sign(y)) − g)/m (4.1)
i̇ 0 0 −R/L i kI /L 0
We want to control the position y(t) of the rotor to zero using full state feedback. Assume that all states
are directly measurable (i.e. the matrix C is the identity matrix). Note that for control design, we only
consider the first part of (4.1): ẋ = Ax + Bu, the last term is considered as a disturbance from the point of
view of the controller.
closed loop system. Consider the eigenvalues of the open loop system as a first guess for the eigenvalues
of the closed loop system and modify them to get a desired response. Simulate the closed loop system and
observe: y(t), ẏ(t), i(t) if a) y(0) = ymax , b) y(0) = −ymax (the rotor is initially resting at the top or at the
bottom position). How long does it take until a steady state is reached?
An integrator can eliminate the steady state error. One way to incorporate integral action into a state space
control system is to augment the state vector with an additional error state. This means we artificially add
one state, assuming for the moment we only have one output y ∈ R to control. Based upon the standard
state space representation
ẋ = Ax + Bu, (4.2a)
y = Cx (4.2b)
we define the integral of the error e(t) = r(t) − y(t) as a new state
Z
xI = e(t)dt ⇔ ẋI = r − Cx (4.3)
The formal way to design the controller is similar to the methodology used earlier. The system input is still
u = −Kx, where the controller matrix K is now partitioned into sub-matrices K = [K0 K1 ]. The matrix
K0 corresponds to the states in x whereas K1 corresponds to the integrator state. We can now place the
poles of the closed loop system
A − BK0 −BK1
à − B̃K = (4.6)
−C 0
on the desired location with the controller matrix K. Since the integrator state depends according to (4.3)
on the reference input, the implementation of the control structure needs to separate the K1 from the K0
component, see Figure 4.2.
K0 x(t)
Figure 4.2: Block diagram of a state space controller with integral action