Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed...

55
151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control Swiss Federal Institute of Technology (ETH) Zurich Fall Semester 2019 Lecturer: Prof. Dr. Christopher Onder [email protected] Exercise Supervision: Johannes Ritzmann, ML K 41 Pol Duhr, ML K 39

Transcript of Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed...

Page 1: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

151-0567-00Engine Systems

Exercise Instructions

Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine

Institute for Dynamic Systems and ControlSwiss Federal Institute of Technology (ETH) Zurich

Fall Semester 2019

Lecturer:Prof. Dr. Christopher Onder

[email protected]

Exercise Supervision:Johannes Ritzmann, ML K 41

Pol Duhr, ML K 39

Page 2: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

2

Page 3: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Contents

1 Preliminary Exercise - Modeling of an Intake Manifold 51.1 Task Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.2 Hand In . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.3 File Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.4 Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2 Idle Speed Control Exercise 112.1 Problem Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.2 Milestone 1

Mathematical Model of the Plant . . . . . . . . . . . . . . . . . . . . 152.2.1 Task Description . . . . . . . . . . . . . . . . . . . . . . . . . 152.2.2 The Plant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.2.3 The Subsystems of the Plant . . . . . . . . . . . . . . . . . . 182.2.4 Remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.2.5 Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

2.3 Milestone 2Parameter Identification and Validation . . . . . . . . . . . . . . . . 252.3.1 Task Description . . . . . . . . . . . . . . . . . . . . . . . . . 252.3.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.3.3 The Throttle Parameters . . . . . . . . . . . . . . . . . . . . 252.3.4 The Engine Mass Flow Parameters . . . . . . . . . . . . . . . 262.3.5 The Intake Manifold Volume . . . . . . . . . . . . . . . . . . 282.3.6 The Generator Efficiency . . . . . . . . . . . . . . . . . . . . 282.3.7 The Engine Torque Generation and the Engine Inertia . . . . 282.3.8 Validation of the Model . . . . . . . . . . . . . . . . . . . . . 292.3.9 Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

2.4 Milestone 3Controller Synthesis . . . . . . . . . . . . . . . . . . . . . . . . . . . 312.4.1 Task Description . . . . . . . . . . . . . . . . . . . . . . . . . 312.4.2 Normalization and Linearization . . . . . . . . . . . . . . . . 312.4.3 Controller Synthesis . . . . . . . . . . . . . . . . . . . . . . . 32

2.5 Milestone 4Competition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392.5.1 Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392.5.2 Expected Files for the Competition . . . . . . . . . . . . . . . 392.5.3 Cost Function . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

A Introduction to Modeling and Control 41A.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41A.2 Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

A.2.1 General Form of First Principles Models . . . . . . . . . . . . 41A.2.2 Normalization . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

1

Page 4: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

A.2.3 Linearization . . . . . . . . . . . . . . . . . . . . . . . . . . . 42A.2.4 Consequences for Inputs/Outputs of the System . . . . . . . 44A.2.5 A Simple Example: The Pendulum . . . . . . . . . . . . . . . 44A.2.6 Frequency Domain . . . . . . . . . . . . . . . . . . . . . . . . 45

A.3 Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47A.3.1 Important Definitions . . . . . . . . . . . . . . . . . . . . . . 47A.3.2 Standard LQR Problem . . . . . . . . . . . . . . . . . . . . . 49A.3.3 Observer or LQG Approach . . . . . . . . . . . . . . . . . . . 50

B Least Squares Problem 51B.1 Solution of a Linear Least Squares Problem . . . . . . . . . . . . . . 51B.2 The Condition Number of a Matrix . . . . . . . . . . . . . . . . . . . 52

2

Page 5: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Introduction

Idle Speed Control System Design Exercise

The aim of this tutorial is to outline the design process of a model-based idle speedcontrol system. IThe control problem here will be formulated as a multiple-inputsingle-output (MISO) problem and only feedback action will be investigated. Thefocus will be on showing how some of the basic building blocks introduced in theclass text book Introduction to Modeling and Control of Internal Combustion En-gine Systems (which will from now on be referred to as ’the text book’) can becombined to build a mathematical model and on how the parameters of this modelcan be identified using measurements. Using this mathematical model, a controlsystem will be designed.

Students attending the lecture Engine Systems should gain experience treating thissimplified task on their own. However, since the exercise is rather extensive, thestudents will have to work in a team of three to five persons and an important stepwill be the scheduling and structuring of the exercise into subproblems that can besolved by individual subteams.

To emphasize the importance of splitting the job into subtasks, the following mile-stones will have to be handed in at a defined date:

1. Synthesis of a mathematical model describing the dynamic behavior of therelevant engine parts.

2. Parameter identification and model validation using data obtained on a dy-namic test bench.

3. Model normalization and linearization to obtain a finite-dimensional linearsystem description.

4. Synthesis of an idle speed control system.

At the end of the course, a direct comparison between the performances of the con-trollers of the various teams will be organized. A predefined cost function will haveto be minimized and the competition winning group will not only get fame, honorand recognition but also a voucher for a meal in the Pizzeria Al Forno.

3

Page 6: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Preliminary Manifold Modeling Exercise

A preliminary exercise will deal with the modeling of the intake manifold of an en-gine. Most of the tools required to solve the idle speed control system (ISCS) designexercise are introduced here in an easier-to-grasp environment and understandingthe general concepts will be a great benefit for the ISCS exercise. A solution, in-cluding the programming code, will be handed out once this preliminary exerciseis concluded. Thus, most MATLAB-related problems arising in the ISCS exercisecan be solved by the students autonomously by studying the provided code.

4

Page 7: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Chapter 1

Preliminary Exercise -Modeling of an IntakeManifold

1.1 Task Description

The aim of this exercise is to model the intake manifold of a naturally-aspirated 2.5-liter SI engine, which is operated at a constant speed (note that this engine differsfrom the one used in the ISCS exercise). Certain unknown parameters have to beestimated from measurements. In the end, the system is linearized and normalizedfor the controller design. Fig. 1.1 shows a sketch of the system. The control inputof the system is the mass flow min(t) into the intake manifold. Note that in general,the control input to the engine is not the mass flow. This is only a simplificationfor the current problem setting.

min(t) mout(t)p(t)

ϑ(t)

ϑin(t) ϑ(t)

Figure 1.1: Sketch of the intake manifold.

The differential equations describing the pressure p(t) and temperature ϑ(t) in theintake manifold can be found in the text book in the chapter Mean Value Modelsbut are repeated here for convenience. Assuming that no heat losses from the intakemanifold to the ambient take place (the adiabatic assumption) and considering thatthe changes in inlet (ambient) temperature ϑin(t) are small, the lumped parameterassumption yields the following relations. The pressure evolves according to

5

Page 8: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

dp(t)

dt=κ ·RVm

· (min(t) · ϑin(t)− mout(t) · ϑ(t)) , (1.1)

where κ is the isentropic coefficient, R is the specific ideal gas constant, Vm is theintake manifold volume and mout is the outgoing air mass flow. The temperatureevolution is captured by

dϑ(t)

dt=

ϑ(t) ·Rp(t) · Vm · cv

·[cp · min(t) · ϑin(t)− cp · mout(t) · ϑ(t)

− cv · (min(t)− mout(t)) · ϑ(t)

],

(1.2)

where cp and cv are the specific heat capacity of air at constant pressure and volume,respectively. We approximate the engine as a volumetric pump that enforces avolume flow proportional to its speed ωe. Neglecting the influence of varying fuelmass flows, the air mass flow out of the intake manifold mout can be modeled usingthe equation

mout(t) =p(t)

R · ϑ(t)· Vd · ωe

4π· λl(p(t)) , (1.3)

where Vd is the displacement volume of the engine and λl is the volumetric efficiencythat describes how much the engine differs from a perfect volumetric pump. Weapproximate it as

λl(p(t)) = λlω · λlp(p(t)) . (1.4)

Here, the parameter λlω is a fitting constant (since the engine is operated at con-stant speed, there is no need to include a speed dependency). Assuming that theexhaust gas remaining in the cylinder at top dead center expands isentropically intothe intake manifold once the intake valve is opened, we approximate the pressure-dependent part as

λlp(p(t)) =Vc + Vd

Vd−(pe

p(t)

)1/κ

· Vc

Vd, (1.5)

where Vc is the cylinder volume at top dead center, pe is the pressure of the exhaustgas remaining in the cylinder, and κ the isentropic coefficient. Lastly, we introducethe compression ratio ε as

ε =Vc + Vd

Vc(1.6)

and combine Eqs. (1.3), (1.4), (1.5) and (1.6) to obtain the final expression for themass flow out of the intake manifold

mout(t) =p(t)

R · ϑ(t)· Vd · ωe

4π· λlω ·

ε− 1− 1

ε− 1·(pe

p(t)

)1/κ)

. (1.7)

In Table 1.1, all the parameters and their numerical values (if available) are sum-marized. The unknown parameters Vm and λlω have to be identified in order to fitthe given measurement data.

6

Page 9: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Parameter Unit Value Description

cp

[J

kg·K

]1003 Specific heat capacity at constant pressure

cv

[J

kg·K

]717 Specific heat capacity at constant volume

κ [-] cp/cv Isentropic coefficient

Vd

[m3]

2.5 · 10−3 Engine displacement volume

ε [-] 10 Compression Ratio

pe [Pa] 1 · 105 Pressure of the exhaust gas trapped at TDC

R[

Jkg·K

]287 Specific gas constant

ϑin K 295 Temperature of the air entering the manifold

ωe

[rads

]125 Engine speed

Vm

[m3]

to be identified Volume of the intake manifold

λlω [-] to be identified Fitting constant for volumetric efficiency

Table 1.1: Summary of the parameters used in the intake manifold model.

The following points need to be treated to complete this exercise.

1. Week 1: Build a SIMULINK model describing the system.Implement Eqs. (1.1), (1.2) and (1.7) and make sure your system is running.Make reasonable assumptions for the unknown parameter values Vm and λlω.

2. Week 2: Estimate the unknown parameters Vm and λlω using the givenmeasurement data. The data can be downloaded from the class web page.Note that the provided measurements are dynamic and therefore it is ex-tremely hard, if not impossible, to find an analytical solution to the parame-ter identification problem. Check the additional material from the web page(especially the example of how to use the command fminsearch) if you arenot sure how to proceed.

3. Week 3: Normalize and linearize the model with the identified parametersusing the Matlab command linmod.

Perform a steady-state simulation with the nominal input min = 0.01 kgs in

order to get the equilibrium values of the states and the output of the system.See Appendix A.2.2 and Appendix A.2.3 for clarification of the normalizationand linearization procedure. Fig. 1.2 shows the Simulink structure of thesystem that is used for the linearization.

min

[kgs

]p[Pa]

min [−] ×min,nom

[kgs

]× p [−]×

pnom[Pa] ÷

Figure 1.2: Structure of the normalized nonlinear system which is used for the lin-earization. The dimensionless quantities are connected to the physical values according toEq. (A.4). Note that in addition to the input/output normalization, the states must alsobe normalized

7

Page 10: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

4. Compare the system response of the normalized and linearized model to theone of the nonlinear model.Take into account that the input and the output of the linearized and nor-malized system describe deviations from the linearization point and that theyare scaled according to the normalization. Fig. 1.3 shows the model structurethat is used for the simulation of the normalized and linearized system.

δmin [−] δp [−]

min

[kgs

min,nom

[kgs

]÷ p [Pa]×

pnom [Pa] ×

+

−1

++

1

Figure 1.3: Structure used for the simulation of the normalized and linearized system.The subtraction and addition of the value 1 stems from the fact that the linearizationpoint was chosen at the nominal values.

5. Optional: Compare the behavior to an isothermal manifold. You can find thecorresponding equations in the text book.

1.2 Hand In

Hand in a written report that summarizes your solution of the intake manifoldexercise until the Monday of the 4th lecture week (see the factsheet on the class webpage for the specific date).

1.3 File Structure

Fig. 1.4 shows a general structure of a parameter identification, normalization andlinearization process:

• Main.mFirst, the identification data and the parameters are loaded. Then the otherscripts are called from the main script. In addition, the identified parametersas well as the normalized and linearized model are validated. If you run themain file, the entire process should be executed.

• Parameters.mThe parameter file contains the known parameters, the initial conditions ofthe integrators in the system and the simulation options. Once these valuesare specified, they can easily be loaded by running the parameter script.

• ParID.mThe unknown parameters of all submodels are identified. If the submodel to beidentified is linear in the parameters, the parameters can be identified directlyvia the least squares algorithm. For the general nonlinear identification, aseparate error function Modelerror.m and model IdentificationModel.slxhave to be built for each identification process.

• Linearization.mFirst, a steady-state simulation is performed in order to obtain the nor-malization and linearization point. Second, the normalized nonlinear modelNonlinearModelNorm.slx is built identical to the structure shown in Fig. 1.2.The normalized and linearized model LinearizedModel.slx is then obtainedby linearizing the normalized nonlinear model around the linearization point.

8

Page 11: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

• Modelerror.mThis is the error function which is called via fminsearch. It simulates themodel IdentificationModel.slx with the current parameters and calculatesthe error between the model and the measurement.

• NonlinearModel.slxThis is the entire nonlinear model of the system which is used for validatingthe identified parameters.

• NonlinearModelNorm.slxThis model is built by normalizing the inputs and outputs of the modelNonlinearModel.m.

• LinearizedModel.slxThe linear model is obtained when the normalized nonlinear model is lin-earized.

Main.m

- load identification data- load Parameters- run ParID.m- Compare model to measurement- run Linearization.m- Compare nonlinear to normalized/linear Model

Parameters.m

- Specify known parameters- Specify initial conditions of integrators- Specify simulation options

ParID.m

- Initial guess of the unknown parameters- Call function modelerror.m via fminsearch- Save optimal parameter values

Linearization.m

- Determine normalization/linearization point- Use linmod to get system matrices

Modelerror.m

- load Parameters- Simulate ID model- Calculate error betweenmodel & measurement

NonlinearModel.slx

LinearizedModel.slx

IdentificationModel.slx

NonlinearModelNorm.slx

Figure 1.4: General file structure of a parameter identification and linearization process.

1.4 Hints

• All of the measured signals in this preliminary exercise are recorded at 100 Hz.The solver options in the Simulink configuration parameters should thereforebe set to Type: Fixed-step and Fixed-step size (fundamental sample time):0.01 s.

• A Simulink model can be run directly from a m-file by using the sim com-mand (type doc sim for further information). The simulation options canbe specified as well via the simset command. This should be done in theparameter file. Use the following specification:simopt = simset(’SrcWorkspace’,’current’,’FixedStep’,1e-2)

9

Page 12: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

10

Page 13: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Chapter 2

Idle Speed Control Exercise

2.1 Problem Setting

Modern spark-ignited (SI) engines have a low idle speed (around 700 rpm) in orderto minimize fuel consumption and pollutant emissions. The drawback of this lowspeed is that sudden changes in engine torque (electric load on the alternator, ACcompressor, etc.) might stall the engine.1 A fast idle speed control system (ISCS)is therefore required.

The basic structure of a modern ISCS for SI engines is shown in Fig. 2.1. Dur-ing normal operation (driving) the torque produced by the engine is controlled ina feedforward manner by the driver and the ISCS is disabled. During idling atstandstill, however, the driver does not give any input and a feedback controller,the ISCS, sets the engine inputs in order to control the engine speed and followthe reference speed. A multitude of variables, such as the engine oil temperature,the ambient pressure, the ambient temperature, etc., are considered to compute anengine speed reference.

feedforward feedback

ωe,refengine control

SI Engine

disturbance torque Tl

MBT ignition

driver

ϑoil, . . .

ωe

-

ignition command uζ

air command uα

Idle Speed Control System

Figure 2.1: Basic structure of an idle speed control system (ISCS).

1The higher the idle speed, the more kinetic energy is stored in the moving parts, and thelonger it takes for the engine speed to drop to the stalling speed. This leaves more time for theISCS to react.

11

Page 14: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

As illustrated in Fig. 2.1, the disturbance torque is compensated in a coordinatedmanner using both the air command and the ignition command. This approachallows for a fast reaction to engine load disturbances, as will be outlined below.

The design of a complete ISCS is beyond the scope of this exercise. Therefore thefollowing simplifications are made:

1. The injection control system is capable of keeping the air/fuel ratio at itsstoichiometric value of λ = 1.

2. As the disturbance torque is not measurable, no feedforward control is possibleand only feedback control is applied.

In this exercise you develop an ISCS for a naturally-aspirated 2.5-liter 5-cylinderSI engine with conventional port fuel injection. The air path control and the con-trol of the ignition angle run on a digital engine control unit. The outputs of themultivariable controller are the throttle valve position command signal uα and theretardation of the ignition angle ∆uζ from the maximum brake torque (MBT) value.The air/fuel ratio is kept at the desired value by a separate controller.

The individual outputs of the multivariable ISCS act on the engine speed with dif-ferent time scales. The engine speed responds faster to a change in the ignitionangle than to a change in the throttle position. The ignition angle path acts withinone engine segment whereas the throttle position influences the air mass flow intothe intake manifold and can therefore only act with the time constant of the intakemanifold pressure which is several engine cycles.

The ignition angle can be used to adapt the engine speed as it strongly influencesthe engine torque generation as shown in Fig. 2.2. At the MBT ignition angle,the maximum possible torque is produced for a given air mass flow and air/fuelratio. A retarded ignition angle leads to the combustion being less efficient andtherefore results in a smaller torque output. To assure that the ignition can beused to increase the torque, the nominal ignition angle ζ0 must be smaller thanζMBT. Ignition angle retardation is achieved by decreasing the value of ∆uζ as bothignition angle and ∆uζ are defined in degree crank angle before top dead center.An ignition before ζMBT is not considered as this brings no benefits, but increasesthe mechanical strain on the engine and results in higher pollutant formation.

Torque Te

TMBT

T0

∆uζ

∆uζ,nom

ζMBT ζ0Ignition Angle ζ

[◦CA BTDC]

Figure 2.2: The ISCS uses a nominal ignition angle ζ0. Be aware that the ignition anglehas the unit degree crank angle before top dead center (◦CA BTDC). Therefore, ∆uζ < 0holds for any ignition angle later than MBT.

12

Page 15: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Numerical example for ∆uζ

• Assuming most efficient ignition angle at idling is at ζMBT = 20 ◦CA BTDC.

• You decide to introduce 25 ◦CA of ignition retardation. This results in anominal ignition angle of ζ0 = −5 ◦CA BTDC.⇒ ∆uζ = ζ0 − ζMBT = −5− 20 ◦CA BTDC = −25 ◦CA BTDC.

The individual outputs of the multivariable controller can be used in a coordinatedmanner in order to react to disturbance torques or to changes in the desired enginespeed. Both controller outputs are supposed to change as quickly as possible withthe throttle position remaining at its new position while the ignition angle retar-dation should be phased back to its nominal value. A schematic representation ofthis process is shown in Fig. 2.3. For a nonzero ignition angle retardation ∆uζ ,the quick ignition path can be used to react to both positive and negative torquedisturbances. Once the intake pressure increases, more air is inducted and morefuel is combusted, the ignition retardation can be phased back to its nominal value.

t

tstepTime

Time

∆uζ

Figure 2.3: Desired responses of the individual channels of the multivariable controllerto a positive disturbance torque step. The ignition angle retardation ∆uζ is phased backto its nominal value with the time constant of the intake manifold pressure.

13

Page 16: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

14

Page 17: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

2.2 Milestone 1Mathematical Model of the Plant

2.2.1 Task Description

For milestone 1, each group has to create a simplified mathematical model of anengine. It has to be built in Simulink and reasonable values for the model parametershave to be estimated. In milestone 2, this model will be used to identify the modelparameters from measurements. Carefully read the entire Section 2.2 before youstart to implement your model. Make sure you structure your model well!

2.2.2 The Plant

The system to be modeled is shown in Fig. 2.4. It is a simplified version of thegeneral SI engine system introduced in Section 2.2.1 in the text book. According tothe simplifications listed in the previous section, the fueling part may be omitted.The three input signals (bold) and some of the measured variables are shown inFig. 2.4.

θeωe

on/off

mβmα

Vm pm ϑm

Te

Tl

cylinder

pe

intake manifold

electronic

ϑa

pa

intertia

external load

α

throttle valve

∆uζ

Figure 2.4: Simplified representation of the problem setting.

The engine is modeled as a mean-value volumetric pump, according to the theoret-ical background in Chapter 2 of the text book. The torque produced by the engineis linked to the amount of air aspirated by the engine and acts positively on theengine inertia. The engine is assumed to be decoupled from the rest of the powertrain and the load torque is presumed to act on the engine flywheel directly.

To simulate disturbances, an electrical load is connected to the electrical systemand draws power from the alternator. This results in a load torque acting on thecrank shaft. In this case a 1 kW electrical load (a water boiler) is used.

The corresponding cause and effect diagram of the combined ISCS is shown inFig. 2.5. While the shaded boxes indicate dynamic modules, the non-shaded boxesrepresent algebraic modules. The control inputs are uα and ∆uζ , i.e., the commandsignal for the electronic throttle valve and the retardation of the ignition angle.The disturbance input ul, which in the series application is assumed not to be mea-surable, is the only exogenous disturbance signal. However, in order to test the

15

Page 18: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

performance of the ISCS in simulation, this disturbance has to be modeled in thisexercise study.

The measured system variables are:

• mα: air mass flowing through the throttle into the intake manifold

• ωe: engine speed

• pm: intake manifold pressure

• ϑm: intake manifold temperature

• pa: ambient pressure

• ϑa: ambient temperature

• pe: exhaust manifold pressure

• Pl: load power

The recorded inputs are:

• ul: load on/off signal

• uα: throttle plate angle command signal

• ∆uζ : retardation of the ignition angle from ζMBT

16

Page 19: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

pm pa

Intake Manifold

Throttle Air Mass Flow

Engine Air Mass Flow

Engine Inertia

Engine Torque Generation

Throttle Area

ϑm

mα+

ϑaAα

Te

∆uζpm

pe ϑmωe pm

Load Torque

ωe pe mβ

+Tl

ωe

ulPl

Disturbance

Figure 2.5: Cause and effect diagram of the engine model.

17

Page 20: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

2.2.3 The Subsystems of the Plant

Most of the subsystems indicated by boxes in Fig. 2.5 are discussed in chapter 2 ofthe text book. Here, those results are adapted to the ISCS problem and a formaldescription of each block is given to facilitate the subsequent parameter identifica-tion and control system synthesis steps. The underlying physical principles of eachsubsystem are described in this section. The structure of the Simulink model is thesame as that of Fig. 2.5. The parameter identification is presented in Section 2.3.

Throttle Area

Object: Models the open area Aα as a function of the input signal uα(t) whichdefines how wide the throttle is opened.

Signals: Input: Control signal uα(t) ∈ [0, . . . , 100]Output: Open area Aα

[m2]

Assumptions: The dynamics of the throttle actuator may be neglected because thethrottle used for this engine is much faster than the dynamics of theengine speed we are interested in.

Equations: Affine Model

Aα (uα(t)) = α0 + α1 · uα(t)

Parameters: α0 To be identified[m2]

initial guess ∼ 3 · 10−6

α1 To be identified[m2]

initial guess ∼ 6 · 10−6

Throttle Air Mass Flow

Object: Models the air mass flow through the throttle which is caused by thepressure difference.

Signals: Input: Open area Aα [m2]Temperature upstream ϑa(t) [K]Pressure upstream pa(t) [Pa]Pressure downstream pm(t) [Pa]

Output: Air mass flow mα(t)[

kgs

]Assumptions: No friction in the flow. No inertial effects in the flow, i.e., the piping

around the valves is small compared to the receivers to which they areattached. Completely insulated condition, i.e., no additional energy,mass, etc. enters the system. All flow phenomena are zero dimensional,i.e., no spatial effects need to be considered.

18

Page 21: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Equations: Approximation

mα(t) ≈

Aα(t) · pa(t)√

R·ϑa(t)

1√2, if pm(t)

pa(t) <12

Aα(t) · pa(t)√R·ϑa(t)

√2pm(t)pa(t)

[1− pm(t)

pa(t)

], if pm(t)

pa(t) ≥12

Parameters: R 287[

Jkg·K

]

Intake Manifold

Object: Describes the emptying and filling dynamics of the intake manifold.

Signals: Input: Difference of air mass flows mα(t)− mβ(t)[

kgs

]Temperature in the intake manifold ϑm(t) [K]

Output: Intake manifold pressure pm(t) [Pa]

Assumptions: Spatial pressure and temperature distribution in the intake manifoldneglected (lumped parameter, zero dimensional model). Ideal gases.Slowly varying intake manifold temperature.

Equations: Total derivative of the ideal gas law for a slowly varying intake manifoldtemperature ( d

dtϑm ≈ 0)

d

dtpm(t) =

R · ϑm(t)

Vm

[mα(t)− mβ(t)

]

Parameters: R 287[

Jkg·K

]Vm To be identified

[m3]

initial guess ∼ 7 · 10−3

Engine Air Mass Flow

Object: Models the mass flow through the engine which is equal to the air massflow that exits the intake manifold.

Signals: Input: Intake manifold pressure pm(t) [Pa]Exhaust manifold pressure pe(t) [Pa]Intake manifold temperature ϑm(t) [K]Engine speed ωe(t)

[rads

]

19

Page 22: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Output: Mass flow out of the intake manifold mβ(t)[

kgs

]Assumptions: The pressure at the intake valves is equal to the pressure in the intake

manifold. The temperature drop due to the evaporation of the injectedfuel is neglected. The air/fuel ratio is assumed to be constant andstoichiometric (λ = 1). The engine is a four-stroke engine, i.e. oneengine cycle corresponds to two revolutions of the crank shaft, which isthe reason for the factor 1

2 in front of the equation for the fresh mixturemass flow.

Equations: Fresh mixture that enters the cylinder

me(t) =1

2· pm(t)

R · ϑm(t)· λl(pm, ωe) · Vd ·

ωe(t)

Air mass flow out of the intake manifold

mβ(t) =me(t)

1 + 1λ(t)·σ0

where σ0 = 14.67 is the stoichiometric air/fuel ratio for gasoline.Note: λ 6= λl! λ is associated with the air/fuel ratio, whereas λl repre-sents the volumetric efficiency.

Volumetric efficiency

λl(pm, ωe) = λlp(pm) · λlω(ωe)

and

λlp(pm) = Vc+Vd

Vd− Vc

Vd·(pe(t)pm(t)

) 1κ

λlω(ωe) = γ0 + γ1 · ωe(t)

where Vd is the engine’s displacement volume and Vc is its compressionvolume, i.e., the volume in the cylinder at TDC.

Parameters: R 287[

Jkg·K

]Vd 2.48 · 10−3

[m3]

Vc 2.48 · 10−4[m3]

σ0 14.7 [−]

κ 1.35 [−]

γ0 To be identified [−] initial guess ∼ 0.6

γ1 To be identified[

srad

]initial guess ∼ 0.002

20

Page 23: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Engine Torque Generation

Object: Models the torque produced by the engine.

Signals: Input: Air mass flow into the cylinder mβ(t)[

kgs

]Engine speed ωe(t)

[rads

]Intake manifold pressure pm(t) [Pa]Exhaust manifold pressure pe(t) [Pa]Ignition retardation ∆uζ(t) [◦CA]

Output: Engine torque Te(t) [Nm]

Assumptions: The engine is modeled using the Willans approximation. The air/fuelratio is constant at λ = 1. Engine speed independent friction.

Equations: Torque produced by the engine

Te(t) = pme ·Vd

= (e · pmϕ − pme0f − pme0g) · Vd

4πwhere

e · pmϕ = (η0 + η1 · ωe (t)) · eζ ·Hl

Vd·mϕ

= (η0 + η1 · ωe (t)) · eζ ·Hl

Vd· 4π · mϕ(t)

ωe(t)

= (η0 + η1 · ωe (t)) · eζ ·Hl

Vd· 4π

λ · σ0· mβ(t− τIPS)

ωe(t− τIPS)and

eζ = 1− kζ · (ζ (t− τseg/2)− ζMBT (t− τseg/2))2︸ ︷︷ ︸

∆uζ(t−τseg/2)2

the delays are defined as

τIPS =2π

ωe (t)

τseg =4π

5 · ωe (t)

and the friction and gas exchange losses are given by

pme0f = β0 ·4π

Vd

pme0g = pe(t)− pm(t)

21

Page 24: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Remarks: As delays occur within the feedback loop, they have an influence onthe dynamic behavior of the idle speed control system.Usually, the engine friction is assumed to be of the form pme0f = β0 +β2 ·ω2

e . However, in this specific case where only low engine speeds areconsidered, a constant friction gives good results.ζMBT is the ignition angle that leads to the highest possible efficiency(highest torque, MBT). All the measurement data you are providedwith was taken at this ignition angle. This means that eζ is equalto 1. The value of ζMBT itself is not required, since only the ignitionretardation ∆uζ is used. The parameter kζ was identified separatelyby the exercise supervisors and given.The torque produced by the engine does not respond immediately toan increase in the manifold pressure. The new engine torque willbe achieved only after the induction-to-power-stroke (IPS) delay τIPS

which corresponds approximately to the time required for one revolu-tion.The torque production acts as a discrete system with a sampling periodof τseg. The delay acting on the ignition command is on average halfthis sampling time.

Parameters: Vd 2.48 ·10−3[m3]

Hl 42.5 ·106[

Jkg

]kζ 2.3345 ·10−4

[1

(◦CA)2

]η0 To be identified [−] initial guess ∼ 0.3

η1 To be identified[

srad

]initial guess ∼ −3·10−4

β0 To be identified [Nm] initial guess ∼ 7

Engine Inertia

Object: Describes the dynamic behavior of the engine speed.

Signals: Input: Engine torque Te(t) [Nm]Load torque Tl(t) [Nm]

Output: Engine speed ωe(t)[

rads

]Assumptions: The inertia of the engine is constant, all internal friction phenomena

are included in Te.

Equations: Engine speed behavior

d

dtωe(t) =

1

Θe[Te(t)− Tl(t)]

Parameters: Θe To be identified[kg ·m2

]initial guess ∼ 0.2

22

Page 25: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Load Torque

Object: Models the load torque.

Signals: Input: On/off signal ul(t) [1/0]Load power Pl(t) [W]Engine speed ωe(t)

[rads

]Output: Load torque Tl(t) [Nm]

Assumptions: The generator has a constant efficiency ηgen.

Equations: Load torque

Tl =Pl

ωe · ηgen

Remarks: This block is only used to run simulations when designing the con-troller. It can obviously not be part of the controller as it describes theunpredictable disturbance and no feedforward control action is allowed.As shown in Fig. 2.6, the generator provides power even when theload is turned off. Auxiliaries such as the injectors or the ignitionsystem require electrical power which results in a generator currentIgen,aux.0 even when the load is not turned on, i.e. Iload = 0. In orderto calculate the power required to run the load, the auxiliary powerhas to be subtracted from the measured generator power which can bedone by applying an offset correction to the measured generator currentsignal. This has been done for you, such that you can use Pl directly.

Iload(t) = Igen(t)− Igen,aux

Pl = Ubat(t) · Iload(t)

Bonus Question: Which part of the model accounts for the auxiliarypower demand?

Parameters: ηgen 0.8 [−]

0 2 4 6 8 10 12 14 16 18 20 22

0

500

1,000

1,500

Time [s]

Gen

erat

orpo

wer

[W]

Load onMeasured generator powerGenerator power due to load

Figure 2.6: Generator power calculated from the measured generator current Igen andthe battery voltage Ubat.

23

Page 26: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

2.2.4 Remarks

All of these blocks form a mathematical description that approximates the dynamicbehavior of the idle speed system. The engine speed is limited to the range ofinterest, i.e., 70 - 200 rad

s .

2.2.5 Hints

• All of the measured signals are recorded at 1 kHz. The solver options in theSimulink configuration parameters should therefore be set to Type: Fixed-stepand Fixed-step size (fundamental sample time): 0.001 s. This is much fasterthan the modeled dynamics of the system and ensures consistent results.

• If an algebraic equation has several inputs and only one output, it is generallyeasier to use the Simulink block Fcn (search for ’Fcn’ in the Simulink LibraryBrowser) than establishing a complex arrangement of basic Simulink blocks.An implemented example can be found in the solution of the preliminaryintake manifold exercise.

• Each additional delay increases the complexity of any mathematical model.Therefore, add as few delays as possible to the system. In this case, two delaysare required.

• Use the block variable Transport Delay and set Select delay type to Variabletime delay for the description of the time delay.

• Specify the following simulation options in the parameter file or the parameterstructure:simopt = simset(’Solver’,’ode1’,’FixedStep’,1e-3,’SrcWorkspace’,

’current’);

24

Page 27: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

2.3 Milestone 2Parameter Identification and Validation

2.3.1 Task Description

In milestone 2, the parameters of the engine model created in milestone 1 have tobe identified using measurements taken on the real engine. This model will be usedto design a model-based idle speed controller in future milestones. Carefully readthe entire Section 2.3 before you start with the identification process.

2.3.2 Introduction

In principle, all of the parameters introduced in the last chapter could be esti-mated at once using nonlinear least-squares (LS) methods (for example the functionfminsearch in Matlab) with the error to be minimized defined by

E =N∑

i=1

[k1(pm,i − pm,i)

2 + k2(mα,i − ¯mα,i)2 + k3(ωe,i − ωe,i)

2

]. (2.1)

Here the variables pm,i, mα,i, ωe,i are the measured and pm,i, ¯mα,i, ωe,i are the pre-dicted system outputs, whereas i = 1, . . . , N are the measured data points. Theconstants ki are weighting factors that are chosen to normalize the three differentparts in the sum.

However, such a direct approach is unlikely to succeed, especially in the noisyenvironment of SI engines. It is difficult to find reasonable initial parameters andtherefore the solution will rarely converge towards the real parameters. Only pa-rameter values that locally minimize the cost function will be identified. Usually, amodular approach is more promising, i.e., the first subsystems in the causality chainare identified first using intermediate system outputs. Moreover, whenever possible,the problems should be reformulated such that equations result which are linear inthe parameters (lip), in which case a linear LS estimation becomes feasible2. Thisapproach is used in the following, starting with the throttle valve as a first element.

2.3.3 The Throttle Parameters

Since the throttle parameters can be identified via the linear LS procedure, noSimulink model is required.

Combining the subsystems defined in Section 2.2.3 the air mass flow can be ex-pressed as a function that linearly depends on the throttle model parameters.

Aα (uα(t)) = α0 + α1 · uα(t) = mα(t) ·√

2 ·R · ϑa(t)

pa(t)(2.2)

The key assumption is that pm(t)pa(t) ≤

12 , which can be guaranteed for this engine

when the measurements are taken with the engine running in idling conditions.

Applying the nomenclature defined in Appendix B, the following LS problem can

2For further information on the solution of linear LS problems see Appendix B.

25

Page 28: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

be formulated:

M ·~x = α0 +α1 ·uα(t) =

1 uα,11 uα,2. . . . . .1 uα,N

·[α0

α1

]; ~y =

mα,1 ·

√2·R·ϑa,1

pa,1

mα,2 ·√

2·R·ϑa,2

pa,2

. . .

mα,N ·√

2·R·ϑa,N

pa,N

, (2.3)

where the subscripts 1, . . . , N represent the discrete measurement samples. Themeasurements used for this identification should be of the quasi-static type in ordernot to have any dynamics distort the assumptions.

Figure 2.7: Comparison between measurements (crosses) and parametrized throttlemodel (solid line)

2.3.4 The Engine Mass Flow Parameters

Since the engine mass flow parameters can be identified via the LS procedure, noSimulink model is required.

In Section 2.2.3, the volumetric efficiency λl(pm, ωe) is introduced which is assumedto be a multi-linear function of the intake manifold pressure pm and the engine speedωe, i.e., λl(pm, ωe) = λlp(pm) · λlω(ωe). The unknown function is the engine speeddependent part λlω(ωe), which is modeled as an affine function. The equationsdescribing the engine mass flow behavior can be reformulated to

λlω(ωe) =4π ·RVd

· ϑm(t) · mα(t)

pm(t) · ωe(t) · λlp(pm)·(

1 +1

λ(t) · σ0

), (2.4)

by assuming that the air mass flow entering the intake manifold mα equals the airmass flow entering the cylinder mβ which corresponds to static conditions. There-fore, it is mandatory to use quasistatic measurements here.

26

Page 29: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

The following LS problem can be formulated:

M · ~x = γ0 + γ1 · ωe(t) =

1 ωe,1

1 ωe,2

. . . . . .1 ωe,N

· [γ0

γ1

]; ~y =

λlω,1

λlω,2

. . .λlω,N

, (2.5)

where the subscripts 1, . . . , N represent the discrete measurement samples and λlω

is defined by Eq. (2.4).

λlp(ω

e)[-]

λlw(ω

e)[-]

ωe [rpm]

λl(ωe,p

m)[-]

600 800 1000 1200 1400 1600 1800

600 800 1000 1200 1400 1600 1800

600 800 1000 1200 1400 1600 1800

0.5

0.6

0.7

0.8

0.9

0.75

0.8

0.85

0.6

0.8

1

1.2

Figure 2.8: Comparison between measurements (crosses) and parameterized volumetricefficiency model (solid line)

The volumetric efficiency does usually not take on values larger than 1 which istrue for the engine used here, as shown in the bottom plot in Fig. 2.83. However,since it is modeled as a multi-linear function the individual factors are allowed tobe outside the interval [0,. . . ,1] as they do not represent real physical efficiencies.

3It is possible to get values > 1 if the intake manifold is aerodynamically optimized so thatpressure waves supercharge the engine artificially.

27

Page 30: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

2.3.5 The Intake Manifold Volume

Since the parameter Vm cannot be identified with the linear LS procedure, a Simulinkmodel with the previously identified blocks Throttle Area, Throttle Air Mass Flowand Engine Air Mass Flow and the block of interest, Intake Manifold, is required.In order to optimize the performance of the complete model we recommend usingthe throttle air mass flow model to get the input to the Intake Manifold block in-stead of the measured mα signal. The only unknown parameter left in these firstfour blocks in the causality chain is the intake manifold volume Vm. As this is aparameter that has an influence on the model dynamics, it is necessary to use dy-namic measurements in order to identify it properly. Therefore, throttle steps wereapplied to the engine in idling conditions and the Matlab routine fminsearch wasused to identify the value of Vm that minimizes the error e =

∑Ni=1(pm(i)− pm(i))2.

The values pm(i) are obtained from the measurement and the values pm(i) are thepredicted system outputs. Finally, i = 1, . . . , N is the index of the individual datapoints. The engine speed ωe that is fed back in the model can be taken directlyfrom the measurements for identification purposes.

Time [s]

pm

[bar]

0 10 20 30 40 50 60 700.1

0.2

0.3

0.4

Figure 2.9: Comparison between the measured (gray) and the modeled (black) intakemanifold volume pressure pm.

Fig. 2.9 displays the agreement between model and measurements. Clearly, there isa reasonable range for possible values of Vm, which is several times larger than thedisplacement volume of the engine.

2.3.6 The Generator Efficiency

Since the load torque submodel represents the disturbance in the given problemsetting, it is not part of the model used for the model-based controller design. Yetit is useful when it comes to simulating a Load Torque with a reasonable amplitude inorder to test the performance of the controller. In the range of ωe ∈ [70, . . . , 200] rad

s ,a generator efficiency of ηgen = 0.7 is a good approximation for the generator’sefficiency. No further parameters have to be identified for this submodel.

2.3.7 The Engine Torque Generation and the Engine Inertia

A Simulink model with all the blocks of the causality chain is required for theidentification process. Physically meaningless engine speeds resulting during theidentification process can be avoided by limiting the engine speed signal with asaturation block to 20− 500 rad

s .

28

Page 31: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Deriving an expression of the engine friction pme0f is a rather difficult task. Althoughit is straightforward in theory, the practical realization requires a sophisticated dataacquisition system as well as a good understanding of the engine geometry. The keyidea is to relate the mechanical work acting on the cylinder during a cycle,

∫p dv,

to e · pmϕ, which is the normalized mechanical work as a function of the injectedfuel energy. This approach requires expensive, high-resolution in-cylinder pressuresensors, which are not available on the test bench for this exercise. As a result adifferent approach is used.

All of the cylinders of the engine were individually disabled, i.e., fuel was cut off toone individual cylinder alternatingly. It is possible to express the term pme0 in theWillans model as a function of the absolute values of the torques generated with allcylinders working and with one cylinder disabled, respectively. The results of themeasurements show that the friction can be assumed to be constant in the range ofinterest.

The remaining parameters in the subsystems Engine Torque Generation and EngineInertia are η0, η1, β0 and θe. They can be identified using a nonlinear optimiza-tion routine. This can lead to parameter values that are not necessarily physicallyreasonable but which will compensate for the errors made with the assumed formof the identified subsystems. Especially, the constant term of the thermodynamicefficiency η0 directly compensates for an inaccurate value of the friction parameterβ0.

2.3.8 Validation of the Model

An important step after the parameter identification is the validation of the modelwith the newly identified parameters. It is important to show that the parametersidentified in the last chapter yield a model that performs well when compared todifferent sets of measurements, especially data that was not used for the parameteridentification.

Time [s]

ωe[rpm]

0 10 20 30 40 50 601200

1400

1600

1800

2000

Figure 2.10: Comparison between measured (gray) and simulated (black) enginespeed ωe.

Fig. 2.10 shows that the model is able to predict the engine speed for an arbitrarythrottle input uα (here steps and ramps were used) reasonably well.

29

Page 32: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

2.3.9 Hints

• The MATLAB funtions fminsearch as well as fmincon can be used for thenonlinear optimization. The function fmincon provides an additional featureto define lower and upper bounds on the parameters. This can be useful toensure that the identified parameters are physically meaningful (e.g., ensuringa positive inertia). These optimization functions are very sensitive to theinitial conditions of the parameters. Make sure that you choose them wisely,otherwise your solution will be a local optimum instead of the global optimum.

• The load power Pl has been calculated for you and is stored as a field of themeasurement struct.

30

Page 33: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

2.4 Milestone 3Controller Synthesis

2.4.1 Task Description

In milestone 3, the engine model created in the previous milestones has to be nor-malized and linearized around a reasonable operating point. Based on this linearmodel, an idle speed controller is created in Simulink. In order to pass milestone3, the controller has to work in the Simulink environment. The nonlinear enginemodel can be used to represent the real engine when tuning the controller. Only inmilestone 4 will the controller be used on the real engine.

2.4.2 Normalization and Linearization

In order to apply the control theory presented in the previous control classes, alinear system representation is required. Therefore, the model is normalized andlinearized around reasonable nominal values of the inputs, the states and the out-puts. Note that the model which is to be linearized does not contain all of thesubsystems necessary to identify the model parameters. You will therefore have todelete certain subsystems shown in Fig. 2.5 and define your inputs and outputs.Hint: If you take a look at the controller structure, this should be a rather easy task.

See Appendix A.2.2 and Appendix A.2.3 for theoretical background on the normal-ization and linearization procedure. Before the linearization we will approximatethe delays using 4th-order Pade elements4. We will then use Matlab’s linmod com-mand to find the system matrices of the linearized system. While there are manyways of obtaining a linearized system using Matlab/Simulink, we recommend thefollowing approach:

1. Select meaningful nominal inputs and perform a steady-state simulation inorder to obtain the corresponding equilibrium values of the states, the outputs,the delay times and the delayed values.

2. If you haven’t already done so, make sure there are only two delay blocks leftin your model.Hint : You may have to rearrange the signal flow slightly to achieve this.

3. To limit the number of states of the linear model we approximate the delaysusing 4th-order Pade elements:

• Use Matlab’s pade function to approximate both delays.

• For each delay, build a Pade element model using Simulink’s State-Spaceblock.

• Derive and set the correct initial condition for each Pade element.

• Normalize the input and output of each Pade element.Bonus Question: Why do we not normalize the states of the Pade ele-ment?

4. Build a normalized version of your model using the previously found nominalvalues and the developed delay approximations. Make sure you do not forgetto normalize the model states and initialize them at their nominal values.Your normalized model should now have the form shown in Fig. 2.11.

4Note that a time delay is linear by nature. The condition for a system to be linear is: applyingthe input α1 ·u1(t) +α2 ·u2(t) will lead to the output α1 · y1(t) +α2 · y2(t), where α1,2 ∈ R. Thisis also known as the superposition property. A time delay does, however, have infinite order!

31

Page 34: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Nonlinear system with

normalized states

∆uζ [◦CA]

ωe [−]×ωe,nom

[rads

uα [−] ×uα,nom [%] ×

∆uζ [−]

∆uζ,nom [◦CA]

××

ωe

[rads

]uα [%]

Figure 2.11: Structure of the normalized nonlinear system which is used for the lin-earization.

5. Linearize the model using Matlab’s linmod command and extract the linearsystem matrices.

6. Check your system matrices. You should obtain a system with 10 states, 2inputs, 1 output and no feed-through. Think about the physical interpretationof the states.Hint: Look at the C matrix of your linearized system and think about howPade elements approximate your delays.

7. Check your system’s behavior, for example by analyzing its step response.Make sure it behaves in the way you expect.

8. Check the condition number of your system matrices using Matlab’s cond

function. What does this tell you about your system?

2.4.3 Controller Synthesis

The aim of this milestone is to design a model-based single-input multiple-output(SIMO) idle speed controller. The input is the difference between a predefinedreference engine speed and the current engine speed. The outputs are the commandsfor the throttle plate angle uα and the ignition retardation ∆uζ . We assume asmall sampling time Ts and therefore design a continuous-time controller that willbe discretized using an emulation method.

ISCS

Ignition Retardation∆uζ [◦CA]

ωe,ref

[rads

]ωe,act

[rads

] Error

Throttle Position

uα [% opened]

Figure 2.12: Basic structure of the idle speed controller.

The specifications for this control system are listed below:

• The reference speed varies between 70 and 200 rad/s.

• Load disturbances occur at random instances.

• The steady-state error in the engine speed caused by a constant load distur-bance and a change in the reference speed has to be zero.

• The engine speed may not drop below 50 rad/s in order to prevent the enginefrom stalling.

32

Page 35: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

• The overshoot of the engine speed after a load disturbance has to be reason-able.

• A minimum return difference µ = min |1 + L(jω)| = 0.5 has to be achievedin order to cope with model uncertainties and neglected nonlinearities.

Hint: Try to avoid a cross-over frequency higher than 4 rad/s of the open loop gainL(s) = P (s) ·C(s), such that the controller can cope with noisy signals on the testbench.

Hint: The ignition angle ∆uζ is limited to negative values at the test bench. Ifyour controller outputs positive values, they will be replaced by 0.

In this text, an LQGI approach is presented. At the end of the semester, youneed to have at least one working controller. See Section 2.5 for more informationabout the competition.

Design of an LQG Controller with Integral Action - LQGI

This is an instruction for designing a LQG controller with integral action, i.e.,LQGI. We assume a basic understanding of LQR and LQG, but there is a shorttheory part in Appendix A. Additional information can be found in the script of thelecture Control Systems II (Regelungstechnik II) by Prof. Lino Guzzella. Be awarethat integration of the system’s output is presented in Control Systems II, whereaswe use integration of the system’s input in this exercise, as it is better suited forthe given MISO system.

1. Plant Extension

Bs+ y∫

Cs

As

+

+

Ds

+

Be+ us∫

Ce

Ae

+

+

De

+u

Extension

∫KI

++

u

∆uζ

uα,s

∆uζ,s

x

can be rewritten as

Extension

v

Figure 2.13: Extension of the plant. The plant input u consist of the two channels uαand ∆uζ which describe the throttle input and the ignition retardation respectively. Thegoal of the extension is to augment the channel uα with integrative behavior, therefore, theindividual channels need to be extracted from the signal u, which is indicated schematically.

33

Page 36: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

The standard LQR controller tries to drive the system back to the equilibriumpoint if a disturbance is present. In order to avoid having a steady-stateerror, the controller has to be extended with an integrating part. As statedin Section 2.1 and shown in Fig. 2.3, the goal is to get back to the nominalignition retardation once the throttle plate angle has been adjusted to achievethe desired engine speed. Therefore, in a first step, the linearized system withthe matrices As, Bs, Cs, Ds (which represents the engine on the test bench) isextended by an integrator acting on the throttle plate angle signal, as shownin Fig. 2.13. As a consequence, the command signal of the throttle plate angleis not regulated back to zero since the integrator is summing the signal upand is charged during the adaption of the throttle plate angle.

The matrices of the extension are

Ae = 0, Be =[1 0

], Ce =

[KI

0

], De =

[1 00 1

](2.6)

As shown in Fig. 2.14, the series connection of the plant extension (index e)and the linearized system (index s) yields the extended plant with the newstate vector

x =

[xv

](2.7)

and the new system matrices

d

dtx =

[As BsCe

0 Ae

]︸ ︷︷ ︸

=:A

·[xv

]+

[BsDe

Be

]︸ ︷︷ ︸

=:B

·u (2.8)

y =[Cs DsCe

]︸ ︷︷ ︸=:C

·[xv

]+[DsDe

]︸ ︷︷ ︸=:D

·u (2.9)

where the inputs vector is

u =

[uα

∆uζ

](2.10)

Bs+

y

∫Cs

As

++

Ds

+

Be+

us

∫Ce

Ae

++

De

+

u

v v ˙x x

Extended Plant

Extension Plant

Figure 2.14: The series connection of the extension system and the linearized systemyields the extended plant.

In the following steps, the LQG controller is designed for this extended plant.

34

Page 37: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

2. Feedback Gain

In a second step, the state feedback gain K is designed. See Appendix A.3.2for more information. The two tuning parameters are r1, the penalization ofuα, and r2, the penalization of ∆uζ . Define the matrix R as

R =

[r1 00 r2

]with R = RT > 0 (2.11)

ri → 0: cheap control, use a lot of it (2.12)

ri →∞: expensive control, use little of it (2.13)

The penalization of the states is given according to the standard definition ofControl Systems II :

Q = CT · C with Q = QT ≥ 0 (2.14)

In Matlab the gain K can be calculated using the lqr command (type doc

lqr for further information):K = lqr(A,B,Q,R)

3. Observer

In a third step, a state observer is built because the LQR approach requires allsystem states. In reality, this is generally not possible without an observer.Fig. 2.15 shows the structure of an observer. Only the observer gain L isunknown since the system matrices A, B and C are the matrices derived instep 1.

An observer is designed by solving a Matrix-Riccati equation. In Matlab, useagain the command lqr to derive the observer gain L:L = lqr(A’,C’,B * B’, q)

The tuning parameter q can be used the following way:

q → 0: fast observer, trust measurement

q →∞: slow observer, trust model

B + y

-

∫C

A

+

L+

u

+

x

1

++ Ty

Nonlinear Model

T−1y

1+

y

T−1u

1+

-

-

Observer

Figure 2.15: Configuration to test the performance of the observer. The matrix Tu isused to normalize the inputs u, the matrix Ty is used to normalize the outputs y.

35

Page 38: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Tune the parameter q by comparing the observer output y to the output of thenonlinear model y. In addition, the parameters r1, r2 and q should be tunedsuch that the absolute value of the real part of the largest pole of the observer(A− LC) is approximately three times bigger than the absolute value of thereal part of the largest pole of the of the system (A − BK). Note also thatthe real parts of all observer poles should be negative to guarantee stability.

4. Controller Matrices

After obtaining all necessary parameters, the controller matrices ISCSAc,ISCSBc, ISCSCc and ISCSDc are derived in a fourth step. Since the systemon the test bench is represented by the system using only the matrices As, Bs,Cs and Ds, the LQG controller matrices have to be connected in series withthe extension matrices Ae, Be, Ce and De, see Fig. 2.16. This reults in thethe following controller matrices:

ISCSAc =

[Ae −BeK0 A−BK − LC

]ISCSBc =

[BeDc

−L

]ISCSCc =

[Ce −DeK

]ISCSDc =

[DeDc

],

−L + ∫−K

A-BK-LC

++

Dc

+Be

+ us∫Ce

Ae

++

De

+ue

Complete Controller

ExtensionLQG

Figure 2.16: Series connection of the LQG controller matrices and the extension matricesin order to get the matrices of the complete controller. The matrixDc of the LQG controlleris by definition a zero matrix with appropriate dimensions.

5. Discretization

In a fifth and final step the continuous controller is discretized. We rec-ommend that the controller is discretized using a Tustin emulation (Matlabcommand: c2d) with a sampling time of Ts = 0.001 s. The sampling timeneeds to be fast enough compared to the system dynamics (Ts <

π5·ωc ).

Resulting matrices: ISCSAd, ISCSBd, ISCSCd and ISCSDd.

Simulations

The behavior of the discretized controller can be simulated using the nonlinear en-gine model. Apply steps on the engine speed and on the load to check the stabilityand robustness of your controller. If you want us to check your controller, send itto one of the teaching assistants.

36

Page 39: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Hint: Try to implement noise in your simulation by using, for example, the sig-nal generator Band-Limited White Noise in Simulink.

Validation at the Test Bench

Once your controllers work in Matlab/Simulink, you have two opportunities to val-idate the behavior of your controllers on the IDSC test bench in room ML E44. Adoodle link will be sent to you in order to organize the test bench sessions.

The next chapter provides an overview of the required matrices to run your con-troller on the test bench.

Useful Matlab Commands

Some useful Matlab commands are: ssdata, ss, tf, margin, bode, nyquist,

lqr, c2d. Use the Matlab command doc to get detailed information about anycommand.

37

Page 40: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

38

Page 41: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

2.5 Milestone 4Competition

2.5.1 Rules

• The engine speed varies between 70 and 200 rads .

• The load is switched on/off randomly.

• The sampling time Ts is 1 ms.

• Two controllers can be submitted and will be tested.

• The controller with the lowest cost according to the provided cost functionwins.

2.5.2 Expected Files for the Competition

To implement your controller on the test bench we need the following discretizedmatrices of your controller with appropriate dimensions

• ISCS Ad (Dimension: 12× 12)

• ISCS Bd (Dimension: 12× 1)

• ISCS Cd (Dimension: 2× 12)

• ISCS Dd (Dimension: 2× 1)

as well as the normalization matrices

• ISCS Tu =

[uα,nom 0

0 ∆uζ,nom

]• ISCS Ty = ωe,nom

Save all these matrices in a file named controller1.mat (controller2.mat for anadditional controller, etc.) and send them to the teaching assistants.

2.5.3 Cost Function

Your controller should minimize a cost function that penalizes deviations from thereference speed, strong throttle actuation and high fuel consumption, i.e., large∆uζ,nom values. The cost function used to evaluate the performance of your con-troller is

J =1

1000·∫ (

0.2 · kmax2.5 · |ωe(t)− ωe,ref(t)|+

∣∣∣∣duα(t)

dt

∣∣∣∣ )dt

The factor kmax quantifies how much additional torque the engine can produce byacting on ∆uζ . As a large ∆uζ,nom decreases the engine’s efficiency, resulting in ahigher fuel consumption, this is penalized in the cost function. The factor kmax isgiven by

kmax =1

eζ=

1

1− kζ ·∆uζ,nom2

In the equations above, the throttle plate position uα(t) is given in [%] and is lim-ited to uα(t) ∈ [0, . . . , 100], the engine speed ωe is given in

[rads

]and ∆uζ,nom is

given in [◦CA]. The parameter kζ = 2.3345 · 10−4 1(◦CA)2 is the one used in theengine torque generation block.

39

Page 42: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

40

Page 43: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Appendix A

Introduction to Modelingand Control

A.1 Introduction

During the last few years we have experienced that some students lack the knowl-edge of some of the basic concepts of modeling and control theory. This chaptershould therefore be understood as a very brief summary of the important conceptsthat should be known when solving the idle speed control exercise.

In the first part, an introduction to modeling and control will be given while inthe second part the concept of the LQR/LQG control approach will be discussed.Obviously, this is not a comprehensive course on control. For interested studentswho did not get their Bachelor’s degree at ETH Zurich, we recommend the twocourses Control Systems I and II to get a better overview.

A.2 Modeling

A.2.1 General Form of First Principles Models

In this text, we will restrict ourselves to nonlinear, continuous-time and time-invariant systems which describe the vast majority of engineering problems.First principles models are mathematical models that describe physical principleswhich are generally stated using differential equations 1(difference equations in thediscrete-time case). Any n-th order differential equation can be rewritten as asystem of n 1st-order differential equations by introduction of additional physicalstates. This means that we can write any such systems in the following form:

d

dtz(t) = f(z(t), v(t)),

w(t) = g(z(t), v(t)).(A.1)

1Finding these equations is the most difficult part of control tasks and the main scope of theEngine Systems lecture. Some remarks on this topics are stated in the appendix of the text book.

41

Page 44: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

The following definitions apply:

z: The state vector, a n × 1-vector that contains all of the relevantsystem states.

v: The input vector, a m × 1-vector that contains all of the possiblesystem inputs.

w: The output vector, a p × 1-vector that contains all of the systemoutputs.

f : The system dynamics, a set of differential equations that describethe system dynamics according to physical principles.

g: The output dynamics, a system of differential equations that de-scribe the system output behavior according to physical principles.

A.2.2 Normalization

The normalization step makes the model numerically more stable, i.e., it can alsobe processed by low resolution computer processors. Model normalization can bedone in several ways. Here, a setpoint-based approach is followed, i.e., it is assumedthat the system usually operates around a constant nominal point such that for alllevel variables zi(t) with i = 1, ..., n there is a known and physically meaningfulnominal value zi,0 6= 0. Reference inputs vj,0 with j = 1, ...,m and nominal outputswk,0 with k = 1, .., p are associated to this nominal point z0. The normalization isusually done around a corresponding equilibrium point for given nominal constantinputs.

The normalization then consists of replacing zi(t), vj(t) and wk(t) by their normal-ized counterparts xi(t), uj(t) and yk(t) through the transformation

xi(t) =zi(t)

zi,0uj(t) =

vj(t)

vj,0yk(t) =

wk(t)

wk,0

The new variables xi(t), uj(t) and wk(t) will have no physical units and have magni-tude of approximately 1, if the system is close to its expected operating point. Thenormalization does not change the fundamental systems characteristics (stability,input-output behavior, etc.).

The system after the normalization has the form

d

dtx(t) = f0(x(t), u(t)),

y(t) = g0(x(t), u(t)).(A.2)

A.2.3 Linearization

A beautiful theory for the control of linear systems has been derived over the yearswhich, for example, makes it possible to analyze the stability properties of a closed-loop control system solely based on its open-loop properties. This is not the case fornonlinear control problems and therefore, in most cases, nonlinear control problemsare approximated by a linear system description using a first-order Taylor-seriesapproximation of the nonlinear system around a nominal operating point. Thisdoes of course limit the accuracy of the system description to regions around thenominal operating point. However, this is not an issue in most cases since we applya controller which makes sure that we stay in that region.

42

Page 45: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

The linearization of the nonlinear system using a Taylor-series approximation aroundthe nominal operating point x looks as follows:

f0(x) ≈ f0(x) +∂f0

∂x

∣∣∣∣x=x

· (x− x), where

∂f0

∂x=

∂f0,1∂x1

∂f0,1∂x2

...∂f0,1∂xn

... ...∂f0,n∂x1

∂f0,n∂x2

...∂f0,n∂xn

Usually, x is a stationary operating point x0 (the same setpoint used for the normal-ization) that is chosen according to some specifications (e.g., a given engine speedor a given relative engine load). The following equation holds for an equilibriumpoint.

d

dtx0 = f(x0, u0) = 0

Only small deviations from the normalized setpoints are analyzed in order to lin-earize the system, and the following new variables are introduced:

x(t) = x0 + δx(t) with |δx(t)| � 1,

u(t) = u0 + δu(t) with |δu(t)| � 1,

y(t) = y0 + δy(t) with |δy(t)| � 1.

Nonlinear Model

u0

Linearized Model

u

δu

y0

y

δy

Input

Output

Figure A.1: Linearization of the nonlinear model.

The introduced variables are illustrated in Fig. A.1. It follows that:

d

dtx = f(x0, u0)︸ ︷︷ ︸

=0

+∂f0

∂x|x=x0,u=u0︸ ︷︷ ︸

=:A

· (x− x0)︸ ︷︷ ︸=:δx

+∂f0

∂u|x=x0,u=u0︸ ︷︷ ︸

=:B

· (u− u0)︸ ︷︷ ︸=:δu

d

dtδx = A · δx+B · δu

y = g0(x0, u0)︸ ︷︷ ︸=y0

+∂g0

∂x|x=x0,u=u0︸ ︷︷ ︸

=:C

· (x− x0)︸ ︷︷ ︸=:δx

+∂g0

∂u|x=x0,u=u0︸ ︷︷ ︸

=:D

· (u− u0)︸ ︷︷ ︸=:δu

δy = C · δx+D · δu

43

Page 46: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

If we only consider deviations from the nominal (equilibrium) values and redefinethe variables2

x := δx = x− x0

u := δu = u− u0

y := δy = y − y0 ,

we get the linear time-invariant (LTI) state-space description:

d

dtx = Ax+Bu,

y = Cx+Du.(A.3)

A is the system matrix, B the input matrix, C the output matrix and D the through-put matrix (which is often equal to zero in physical systems).

A.2.4 Consequences for Inputs/Outputs of the System

If the normalization and linearization are performed with the same nominal andnon-zero values u0 for the input and y0 for the output, the dimensionless quantitiesδu and δy are connected to the physical values u and y in the following way:

δu =u− u0

u0, δy =

y − y0

y0(A.4)

A.2.5 A Simple Example: The Pendulum

Here, a small example will be given for a better understanding of the previous para-graphs. The normalization is not performed since it is not required in this case.

The simple system as illustrated in Fig. A.2 consists of a pendulum that is hungfrom a ceiling. It has a mass m that is concentrated at its lower end and is connectedto the ceiling with a weightless rod of length l. A torque Tc can be applied aroundthe point where it is attached to the ceiling which will deflect the pendulum. Theangle from a virtual vertical line is defined as θ.

Tc

θ l

m · g

Figure A.2: Pendulum.

2Note that the new variables are the differences between the calculated values and the nominalvalues. This will be of importance for the model and controller implementation.

44

Page 47: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Using Newton’s second law: φ·J = T+−T− and extracting the following quantities:

φ = θ The second derivative with respect to time of thedeflection angle,

J = ml2 The moment of inertia of the pendulum with re-spect to the rotational axis,

T+ = Tc The torque applied to the pendulum in positiveθ-direction,

T− = mgl sin(θ) The torque applied to the pendulum in negativeθ-direction,

the dynamics of this system can be stated as:

ml2θ = Tc −mgl sin(θ). (A.5)

This is a 2nd-order differential equation which can be formulated as a system of1st-order differential equations. First, we define the following system states andinputs, respectively:

x1 := θ The first state of the system.

x2 := θ The second state of the system.u := Tc

ml2 The input of the system.y := θ The output of the system (this means we measure the first state

only).

The following system description, according to Eq. (A.1) results:

x =

(x1

x2

)=

(x2

− gl sin(x1) + u

)= f(x, u) (A.6)

y = x1 = g(x, u) (A.7)

For the linearization, we choose the nominal point to be xs =(π4 , 0)

and thereforeus = g

l sin(π4 ). The matrices of the systems result as:

A =

[0 1

− gl · cos(π4 ) 0

]B =

[01

]C =

[1 0

]D = 0

A.2.6 Frequency Domain

In order to analyze a system, the frequency domain is a helpful tool. If a lin-ear time-invariant system is fed with a sinusoidal input signal u(t) = cos(ωt), thesystem will respond (after a transient part) with a steady-state part that has thesame frequency ω but another amplitude and phase lag. The response is of theform y(t) = κ(ω) · cos (ω · t+ ϕ(ω)). The so-called Bode plot can then be used toplot the amplitude κ(ω) and phase ϕ(ω) over the frequency ω. Bode diagrams areusually plotted with a logarithmic scale in the amplitude and a linear scale in thephase, such that a series connection can be visualized by simply adding the Bodediagrams of the two systems. Often the phase is given in degrees and the amplitudein dB (κdB = 20 · log10(κ)). A related tool is the Nyquist plot where the phaseand the amplitude is plotted within one figure.

45

Page 48: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Another way to get a frequency domain representation is the Laplace Transfor-

mation, where Σ(s) = Y (s)U(s) = C · (sI − A)−1 · B is the transfer function from the

input u to the output y.Check the Matlab commands bode and nyquist for frequency domain analysis aswell as the command step for time domain analysis. The Laplace transformationcan be performed with the command tf(ss(A,b,c,d)).

46

Page 49: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

A.3 Control

This section will be about designing an LQR/LQG controller for a linear system ofthe form shown in Eq. (A.3), preferably normalized as shown in Appendix A.2.2.

First, some general terms that are used in control theory will be described us-ing the structure of a control system shown in Fig. A.3.

C Pr e u y

−+

n

d

++

Figure A.3: Structure of a simple feedback control system.

P is the system we want to control (in our case, it is the linearizedand normalized version).

C is the controller we want to design.r is the reference signal which we want our system to follow.u is the output of the controller.d is one or many disturbance(s).y is the real output of the system.n is noise.e is the difference between the measured system output and the refer-

ence signal and, therefore, the error the controller should minimize.

A.3.1 Important Definitions

• The loop gain (or open loop transfer function) L(s) = P (s) ·C(s) is theseries interconnection of the controller and the controlled system (open loop)in the frequency domain. The Bode diagram allows us to analyze the closedloop behavior (nonlinear) by plotting the open loop transfer function (linear)as explained in some of the next definitions.

• The sensitivity S(s) = 11+L(s) is the closed loop transfer function from the

disturbance d to the system output y and, therefore, used to analyze the in-fluence of disturbances on the system’s output. Generally, S(s) should havea low amplitude (−20 dB or less) at low frequencies as disturbances are lowfrequency signals.

• The complementary sensitivity T (s) = L(s)1+L(s) is the closed loop transfer

function from the reference value r to the system output y. It can be used toanalyze the step response behavior. Generally, T (s) should have a low passbehavior (−20 dB

dec ) for frequencies higher than the crossover frequency (seenext definition) in order to guarantee noise suppression.

• The crossover frequency ωc can be seen in a Bode plot as the frequencyat which the open loop system L(s) crosses the 0 dB line (or in the Nyquistdiagram: the frequency at which the system crosses the unit circle for the first

47

Page 50: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

time). A rule of thumb is t90 ≈ 1.7ωc

, where t90 is defined as the time whenthe controlled system has reached 90% of the value of a reference step inputin the time domain and hence ωc is a helpful tool to analyze the speed of theclosed loop system.

• The phase margin (PM or ϕ) is defined as the angle at which the open-loop transfer function L(s) crosses the unit circle (in the Nyquist diagram).Hence, it is also the difference between the phase at the crossover frequencyand −180◦ in the Bode diagram. The most important rule is that if the PMof the open loop system is negative, the closed loop system will be unstable.A rule of thumb is ε ≈ 71◦−ϕ

117◦ , where ε is the maximal overshoot to a stepresponse in the time domain.

• The steady state error e∞ is defined as the difference between the desiredand the obtained value when the system is at steady state (most often, this istested by applying a step to the input). The steady state error is zero if theclosed loop system has an integrating behavior, i.e., it integrates the error eand applies an appropriate control action until e is zero. The complementarysensitivity T (s) of such a control system has an infinite magnitude at ω = 0.The magnitude in the Bode plot of T (s) therefore, tends to infinity at lowfrequencies.

• The minimum return difference µ = minω|1 + L(jω)| = 1

maxω|S(jω)| is the

minimal distance from the point (−1, 0j) in the complex plane, which is alsocalled the ’horror’ point. The closer the system gets to this horror point thehigher is the possibility that the system gets unstable in case of modeling er-rors. (When we have L(s) = −1, the denominator of the closed loop transferfunction T (s) is zero and, therefore, the system output will be undefined (or∞)).

• The Nyquist theorem says that the closed loop system T (s) is stable ifand only if γ = ρ + σ/2 holds, where γ is the number of encirclements ofthe open-loop transfer function L(s) around the -1 point (counter-clockwiseif ω = [−∞,∞]). Furthermore, ρ is the number of poles of L(s) with positivereal part and σ is the number of poles with real part equal to zero. TheNyquist theorem is a powerful result because it relates the poles of the open-loop transfer function L(s) to the stability of the closed-loop transfer functionT (s).

• The system is controllable if

rank(Rn) = n, with Rn =[B AB A2B .. An−1B

].

• The system is observable if

rank(On) = n, with On =

CCACA2

...

.

48

Page 51: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

A.3.2 Standard LQR Problem

The LQR method is based on a Matrix-Riccati equation (Eq. (A.8a)) and is optimalin terms of the cost function defined in Eq. (A.8b). The feedback part is assumedto depend on the states only: u(t) = −K · x(t). For further details, see the ControlSystems II script.

0 = Φ · B ·R−1 · BT · Φ− Φ · A− AT · Φ−Q (A.8a)

J(t) =

∫ ∞0

(xT ·Q · x+ uT ·R · u) dt (A.8b)

K = R−1 · BT · Φ = lqr(A hat,B hat,Q,R) (A.8c)

R = RT > 0 can be defined as R = r ·Im×m and Q = QT = CT ·C ≥ 0 is often used.

x and u are the states and inputs known from the equation x = A · x+ B · u. How-ever, one could choose totally different R and Q matrices (as long as R = RT > 0and Q = QT ≥ 0 hold). For example, different values of r can be chosen for everycontrol input. Similarly, Q can be chosen to penalize other states than the onesaddressed by Q = QT = CT · C. However, it makes sense to penalize the state ofinterest and, therefore, use this relationship.

Some aspects of the LQR controller are worth mentioning:

• The LQR controller is linear in the state variable x.

• K is time-invariant (only true for infinite-horizon LQR problems).

• The resulting closed-loop system matrix A− B ·K is a Hurwitz matrix, i.e.,all eigenvalues of A−B ·K have negative real parts.

• The minimum return difference µ is always greater or equal to 1 and, therefore,the phase margin is guaranteed to be greater than 60◦ (this can be seengeometrically in the Nyquist plot).

• The controller K is the optimal one for the chosen quadratic objective functionK, but might not be the ‘best’ one with respect to different criteria.

• In the idle speed exercise, the controller has to be extended with an integratingpart in order to have no steady state error. Details on this procedure are givenin Section 2.4.3 as it is of importance for the exercise. The integral action alsohelps us to implement and track the reference signal, as the standard LQRsystem only tries to bring the system back to the equilibrium point in case ofany disturbance.

49

Page 52: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

A.3.3 Observer or LQG Approach

If the states x are unknown (e.g., not measured), an observer has to be used toestimate them. This is done by another Riccati Equation (called the dual approach):

0 = ψ · CT · q−1 · C · ψ − ψ · AT − A · ψ − B · BT (A.9a)

LT = q−1 · C · ψ = lqr(A hat’,C hat’,B hat * B hat’, q) (A.9b)

Comparing this Riccati Equation with the one before, it is easy to see the analogybetween those two:

A→ AT

B → CT

Q = CT · C → B · BT

The system A,B,C has to be controllable (A,B) and observable (A,C) in order toguarantee a solution. The LQR approach (only state feedback) with the dynamicmatrix A−B ·K is asymptotically stable and robust (phase margin ≥ 60◦). Intro-ducing an observer still results in a stable system, but the minimal distance to thepoint −1 in the Nyquist diagram and the phase margin are not as good as with anLQR approach. However, the observer must be used to have access to the states.Therefore, a detailed analysis is necessary in order to make sure that your observeris robust enough. There are two options to design your observer (Both of them needa robustness analysis!):

• Design the poles of your observer (A−L ·C) to be three times faster than theone of the system (A−B ·K)

• Check whether your system reacts fast enough to a disturbance step input.

50

Page 53: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Appendix B

Least Squares Problem

Whenever possible, a parameter identification problem should be formulated suchthat it is linear in the parameters (lip). If this is the case, it can be solved as asystem of linear equations as presented in Eq. (B.1).

B.1 Solution of a Linear Least Squares Problem

The following algorithm can be used to provide the solution that minimizes the2-norm of the residual ~r.

M~x = ~y + ~r (B.1)

The variables in the equation above have the following dimensions: M ∈ Rm×n,~x ∈ R1×n, ~y ∈ Rm×1 and ~r ∈ Rm×1, where m >> n, as m is the number of samplesin one measurement (in our case in the order of 105) and n the number of parametersto be identified. M is the so-called regression matrix, and ~r the so-called residualthat comes into play because the equation system is over-determined. With thefollowing steps, the 2-norm of the residual ~r can be minimized:

||~r||2 = ||M~x− ~y|| = (M~x− ~y)T · (M~x− ~y) (B.2)

The 2-norm of the residual ~r is minimized if the derivative with respect to ~x is zero.For matrix calculus with A,B ∈ Rm×n, ~z ∈ Rm×1, we have the following calculationrules:

(A+B)T = AT +BT (A ·B)T = BT ·AT

d

dz(~zT ·A) = A

d

dz(A · ~z) = AT

Using these rules, we can derive the following expression:

~x =(MTM

)−1 ·MT~y . (B.3)

When static parameters are identified using quasistatic measurements, this ap-proach is very promising since it is accurate and does not require a high com-putational effort. However, reasonable results can only be obtained if the conditionof the regression matrix is low and therefore in most cases, a normalization stepshould be done preliminarily (see Appendix B.2 for a further discussion). In Mat-lab, the command lsqr solves this type of problem.

51

Page 54: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Remark: Several numerically more accurate approaches to solve an over-determinedsystem of linear equations exist (for example the QR method), but they do generallyrequire a better knowledge of algebra and more computational effort.

B.2 The Condition Number of a Matrix

Below, an expression for the condition of a square matrix is derived1. It will beshown how unavoidable numerical errors can lead to substantial errors when solvinga system of linear equations as presented in Eq. (B.4) on a computer.

A~z = ~b, where A ∈ Rn×n is regular and ~b 6= 0 . (B.4)

The linear equation system has the solution

~z = A−1b 6= 0 . (B.5)

We assume A to be exact and ~b to be inaccurate (this is always the case becausea computer system can only be accurate up to the machine epsilon eps which incommon 32 BIT systems is approximately 6 · 10−8; additionally, the measurement

data is inherently approximative), i.e., instead of ~b, the calculation is done with ~b,

leading to an absolute error of ∆~b := ~b−~b.More important than the absolute error is of course the relative error

δ~b :=1

||~b||∆~b. (B.6)

Thus, the equation system A~z = ~b has the (exact) solution ~z = A−1~b. The interest-

ing question is: How does the error in ~b influence the relative accuracy error of theresult δ~z := 1

||~z||∆~z ? The following answer can be found:

∆~z = ~z − ~z = A−1~b−A−1~b = A−1(~b−~b) = A−1∆~b

||δ~z|| =||~b|| · ||A−1∆~b|| · ||∆~b||||~z|| · ||∆~b|| · ||~b||

~b=A~z=||A~z||||~z||︸ ︷︷ ︸≤||A||

· ||A−1∆~b||||∆~b||︸ ︷︷ ︸≤||A−1||

·||δ~b||

||δ~z|| ≤ ||A|| · ||A−1|| · ||δ~b||

Definition:According to the inequality above, the term κ(A) := ||A|| · ||A−1|| is defined as thecondition of the matrix A.The following inequality holds: 1 = ||In|| = ||A ·A−1|| ≤ ||A|| · ||A−1|| = κ(A)Conclusion:The error in ~b can be amplified by the factor κ(A) in the solution.

If also A is not exact (A~z = ~b), one can show that

||δ~z|| ≤ κ(A)

1− κ(A)||δA||· (||δA||+ ||δ~b||).

This theory can be applied to a least squares problem as discussed in Appendix B.1:

1Source: Numerische Mathematik, Kaspar Nipp, Seminar fur angewandte Mathematik ETHZurich, Skript zur Vorlesung am Departement Maschinenbau und Verfahrenstechnik

52

Page 55: Exercise Instructions - ethz.ch file151-0567-00 Engine Systems Exercise Instructions Idle Speed Control of a 2.5-liter 5-Cylinder SI Engine Institute for Dynamic Systems and Control

Eq. (B.3) can be rewritten in the form of Eq. (B.4), with the following relations

A = MTM,

~b = MT~y.

Keeping in mind that κ(MTM) = κ(M)2, it becomes clear why least squares prob-lems should be performed with normalized data values in any case.

53