Beruflich Dokumente
Kultur Dokumente
By
Nicholas P. Teske
Committee in Charge:
Professor J. Karl Hedrick, Chairman
Professor Pravin Varaiya
Fall 2003
2
To Sidnee
3
Abstract
by
Nicholas P. Teske
The main function of an exhaust gas recirculation (EGR) valve is to allow post-
combustion gases to reenter the intake air stream and influence the combustion process.
By doing this, engineers have achieved reduced emissions and increased fuel economy.
There are three main types of EGR valves: pressure differential valves, solenoid driven
valves and variable-position electronic valves. The latter of the three is the basis of this
project.
Several types of controllers are derived and their performances are compared. The three
main controllers derived are a PID controller, an Input/State Linearization controller and
a Sliding Mode controller. Also, an Adaptive Sliding Mode controller is derived for
Observer are derived and compared. After the full controller/observer combination is
designed, it is then converted to C code and run on an external processor. This is done to
4
Acknowledgements
• Professor J. Karl Hedrick, my advisor and professor, for providing the knowledge to
study the topic of nonlinear control. I would also like to thank him for providing the
• Daniel M. Lamberson, my research partner, for everything ranging from help with
• Carlos Zavala for all his help with the hardware-in-the-loop experiment.
• Paul, Yvonne and Lauren Teske, for their unconditional support and guidance
5
Contents
Acknowledgements .................................................................................5
List of Tables...........................................................................................9
1 Introduction ......................................................................................10
1.1 Background ............................................................................................................. 10
1.2 Motivation............................................................................................................... 11
1.3 Organization............................................................................................................ 12
2 EGR Valve Model .............................................................................13
2.1 Introduction............................................................................................................. 13
2.2 Plant ........................................................................................................................ 13
2.3 System Equations .................................................................................................... 14
2.4 System Nonlinearity................................................................................................ 15
2.5 Model Uncertainty .................................................................................................. 17
3 Controllers ........................................................................................18
3.1 Introduction............................................................................................................. 18
3.2 PI and PID Control.................................................................................................. 19
3.2.1 System Linearization........................................................................................ 19
3.2.2 Application of the PID Controller.................................................................... 20
3.3 Input/State Linearization......................................................................................... 21
3.3.1 Input/State Linearization Controller Design .................................................... 21
3.3.2 Application of Input/State Linearization Controller ........................................ 22
3.4 Sliding Mode Control ............................................................................................. 24
3.4.1 Sliding Mode Controller Design ...................................................................... 24
3.4.2 Application of the Sliding Mode Controller .................................................... 25
3.5 Adaptive Sliding Mode Control.............................................................................. 27
3.5.1 Adaptive Sliding Mode Controller Design ...................................................... 28
3.5.2 Application of the Adaptive Sliding Mode Controller .................................... 29
3.5.3 Persistency of Excitation Requirement ............................................................ 31
3.6 Conclusion .............................................................................................................. 32
4 State Estimation................................................................................33
4.1 Introduction............................................................................................................. 33
4.2 Luenberger Observer............................................................................................... 34
6
4.2.1 Accessibility..................................................................................................... 34
4.2.2 Observability.................................................................................................... 35
4.2.3 Observer Pole Placement ................................................................................. 35
4.2.4 Application of the Luenberger Observer ......................................................... 38
4.2.4 Model Uncertainty ........................................................................................... 39
4.3 Sliding Observer ..................................................................................................... 41
4.3.1 Observer Design............................................................................................... 42
4.3.2 Model Uncertainty ........................................................................................... 42
4.3.3 Application of the Sliding Observer ................................................................ 43
4.4 Conclusion .............................................................................................................. 44
5 Hardware-In-The-Loop .....................................................................46
5.1 Introduction............................................................................................................. 46
5.2 Hardware-In-The-Loop Setup ................................................................................. 46
5.3 Controller Code Generation.................................................................................... 47
5.4 Hardware-In-The-Loop Simulation ........................................................................ 48
5.5 Hardware-In-The-Loop Results .............................................................................. 51
5.6 Conclusion .............................................................................................................. 54
6 Conclusion.........................................................................................55
7 Appendices ........................................................................................57
Appendix A.) Parameter values used in EGR model.................................................... 57
Appendix B.) Controller/Observer Performance Comparison...................................... 58
Appendix C.) Simulink Model of System and Controllers ........................................... 59
Appendix D.) Simulink Model Used In the HWIL Setup ............................................ 60
8 References .........................................................................................61
7
List of Figures
Figure 1.) Plant diagram with simplified model .............................................................. 14
Figure 2.) Magnetic flux (lambda) in Webers.................................................................. 16
Figure 3.) The effect of coil resistance on open-loop performance ................................. 17
Figure 4.) PI control vs. PID control................................................................................ 20
Figure 5.) I/S Linearization with an accurate and inaccurate coil resistance................... 23
Figure 6.) Effects of modeling error with a 50% bounded coil resistance parameter...... 26
Figure 7.) The effect on the system input of coil resistance parameter uncertainty ........ 27
Figure 8.) Adaptation law converges to 20.5 O, the value of the actual plant................. 30
Figure 9.) Adaptation law does not converge without constant system excitation.......... 31
Figure 10.) Estimated states converge to the actual states of the system. ........................ 37
Figure 11.) Results with a perfect observer and controller model................................... 38
Figure 11.) Loss of parameter convergence due to small model error............................. 40
Figure 12.) Model error in observer and controller.......................................................... 41
Figure 13.) State variables converge regardless of model error....................................... 43
Figure 14.) State convergence and acceptable control regardless of model error ........... 44
Figure 15.) Hardware-In- The-Loop setup ........................................................................ 47
Figure 16.) Simulink schematic of simulated PWM ........................................................ 48
Figure 17.) The intersection of the lines indicates when the voltage is shut off.............. 49
Figure 18.) Simulated system performance with PWM input. ........................................ 50
Figure 19.) Problems with the implementation of the PWM controller ......................... 52
Figure 20.) 5mm step input with controller running on MPC555. .................................. 53
8
List of Tables
9
1 Introduction
1.1 Background
Exhaust gas recirculation (EGR) systems have long been used in diesel applications.
They allow post combustion exhaust to reenter the intake stream and mix with the fresh
air/fuel mixture. The effect is reduced NOx levels by the reduction of overall combustion
temperatures. Recently EGR has been applied to gasoline engines for the primary
EGR requires precise valve control over a wide range of engine operating conditions
combined with reliable operation and maintained tolerances over the life of the vehicle.
As government emission and fuel consumption requirements grow tighter and tighter the
need for higher tolerance EGR valve control arises. The modern open-loop controllers
for gasoline engine EGR valves will soon become obsolete. With this precision
requirement the need for closed-loop control arises. The basis of this thesis is the
10
exploration and application of different control theories, all with the goal of high-
1.2 Motivation
One style of EGR valve that was popular in the past was the pressure differential valve.
It consisted of a diaphragm that would flex due to a pressure difference across it. The
vacuum source was typically the intake manifold. This flex would raise and lower a
valve allowing exhaust in the intake manifold. While the diaphragm could be tuned
fairly well, over time its performance would degrade causing unwanted performance
One solution to this problem, introduced with the advent of the computer controlled fuel
injection system, used the same diaphragm valve but in a different manner. A separate
computer controlled valve would regulate the amount of vacuum supplied to one side of
the diaphragm, in effect controlling the valve. This setup is still commonly used in many
One issue with this setup is the fact that the computer is not supplied with position data
from the valve. It simply supplies a specified vacuum and monitors the air-to-fuel ratio.
The approach taken in this study is the application of an electronic actuator. By using a
valve position sensor, the computer will then have exact information on the position of
the EGR valve and will be able to control more closely the effect of EGR on the engine.
11
1.3 Organization
Chapter 2 discusses the 3rd order plant dynamics and the nonlinearity associated with the
actuator windings.
discussed in this thesis are a PI/PID controller, an Input/State Linearization controller and
a Sliding Mode Controller. Each controller is used to actuate the valve in the same
manner and the performances are compared. Chapter 3 also investigates the application
of an adaptive controller to account for error in the resistance value of the nonlinear
controller model. Very little change in resistance causes large changes in the plant
dynamics, making it very important to know the exact value of the winding’s resistance.
Observer and a Sliding Observer. The two observer’s performances are compared.
controller and observer that were derived in chapters 3 and 4 will be compiled to C code
and run on an external processor. MATLAB will be used to run a simulation of the valve
that will be controlled by this external processor. Issues and results will be discussed.
12
2 EGR Valve Model
2.1 Introduction
An accurate model is necessary for both the nonlinear controllers and also both the
observers discussed later in this thesis. This chapter discusses the plant, the system
equations and the nonlinearities of the system. Also discussed are the effects of small
model changes and the large effects they can have on the system, reinforcing the need for
an accurate model.
2.2 Plant
The valve consists of a simple electric solenoid with a resistive and inductive element.
Figure 1 shows the plant schematic and the simplified model used for analysis:
13
Figure 1.) Plant diagram with simplified model
A voltage (V) is placed across the coil and current (i) is developed in its windings. This
current creates a magnetic field that causes the plunger to rise into the gap, compressing
the spring. The plunger’s motion is a function of the downward force created by the
compressed spring and any upward force from the magnetic field.
The following differential equations [1] describe the EGR valve model in Figure 1.
14
dx
=v (1.)
dt
dv δλ 1
= i − Kx − mg − F f sgn( v) (2.)
dt δx m
di δλ δx 1
= V − Ri − (3.)
dt δx δt δλ
L+
δi
y=x (4.)
position sensor. This makes the application of a linear controller fairly easy, but the lack
See reference Table 2 in Appendix A for a complete list of parameters and their values.
The magnetic flux (lambda) term is a nonlinear function of current and position and is
given by:
( )
λ = − 87.5i 2 + 105i x (5.)
δλ
= −87.5i 2 + 105i (6.)
δx
δλ
= (− 175i + 105)x (7.)
δi
15
This nonlinearity emerges from two different sources. First is the basic relationship
between current in the windings and magnetic flux. The second source of nonlinearity is
from the non-uniform medium in the middle of the coils. That is, the further out the
plunger is the more air (and less steel) is in the center of the windings. Figure 2 is a
When x is at 10mm the plunger is fully plunged and the entire medium within the coils is
steel. Lambda, for this system, was approximated with methods discussed in [1]. Table
16
This puts the EGR valve closed with the spring at its free-length and the coil holding
simply the weight of the plunger. See Appendix C for the Simulink schematic of the
plant dynamics.
In order to demonstrate the robustness of the following nonlinear control methods the
be known with some confidence but in the interest of discussion the plant value will be
assumed different than our controller value. Another reason it is important to be robust
with respect to variations in R is because very little change in R causes large changes in
plant behavior. Figure 3 represents the difference in open-loop response with the coil
As shown, with approximately 15% increase in coil resistance the plunger has moved
17
3 Controllers
3.1 Introduction
As stated in the introduction the need for feed-back control of the EGR valve will soon
become necessary due to the ever tightening government regulations on emissions and
fuel consumption. Open-loop control meets these current standards, but will soon be
obsolete. The following section explores a linear controller (PID) and two nonlinear
follows:
E ≡ 1000 * ( x − xd ) 2
(8.)
This error was evaluated for 100ms at a constant period of 10µs once the system had
reached steady state. Also, the error was calculated over the same trajectory for all the
controllers; a 7Hz sine wave with 4.5mm bias. This trajectory represents the fastest
18
response possible from the valve due to physical constraints. This error definition will let
the performance of the different controllers be compared on the same basis and identify
which controller is actually performing the best. Refer to Appendix B for a complete
To begin, a PI controller was derived for the system. The main application of a PI
operating point, but for our application this may be unusable. We are interested in the
full range of motion of the valve, not just small motion about an operating point.
point.
0 1 0
A = − 12000 0 383.34
5055.08 − 89.75 − 152.76
The real parts of the eigenvalues of this A matrix are all negative, indicating that the
system is stable at this operating point. Using this linearization the closed loop poles can
19
3.2.2 Application of the PID Controller
After the PI controller was designed and implemented it was found that the linear
controller was not able to control the nonlinear system to the desired performance. The
nonlinearities of the system overpowered the ability of the PI controller away from the
operating point. To address this problem derivative control was added. The derivative
term causes the controller to increase control effort initially, reducing the error more
quickly than with just the proportional and integral terms. Figure 4 shows the effect of
As shown, the PID controller controlled fairly well. The error as defined by equation (8)
20
The only problem with PID control is that the derivative term can be very hard to deal
with. When differentiating a sensor output any noise in the signal is amplified. For this
system a perfect sensor was assumed. Also, with the small error signals, large gains were
needed to attain the necessary actuation. These large gains will also amplify any noise
from the position sensor. The two preceding issues were significant enough to consider
nonlinear controllers.
The next methodology used to derive a controller was Input/Output Linearization. The
object of I/O Linearization is to use the control input to cancel out the nonlinearities of
the system and then control the system with a synthetic input to achieve the desired
output.
The following are the first three derivatives of the output, x, which yield the input (V) in
y=x (9.)
y& = x& = v (10.)
δλ 1
&y& = v& = i − Kx − mg − F f sgn( v ) (11.)
δx m
(
&y& = − 87.5i 3 + 105i 2 − Kx − mg − F f sgn( v) )1 (12.)
m
−K δλ δx 1 1 δ (F f sgn( v) )
&y&& = ( )
1
v + − 262i 2 + 210i − V − Ri −
δx δt
−
δλ m δt
= u (13.)
m m L+
δi
21
Since the system is a third-order system with a relative degree of three, Input/State and
Input/Output Linearization are essentially the same analyses [6]. Typically I/S
Linearization is not ideal for tracking control because the output is chosen to make the
system a desired relative degree [6]. For this system it was convenient that the ideal
output happened to be the parameter of interest. This is not always the case.
The following equations represent the input, V, and the synthetic input, u (state
feedback), respectively.
K δ (F f sgn( v ) )
u+ v+
V= m δt + Ri − (87.5i 2 − 105i ) v (14.)
ab
1
a = (−262i 2 + 210i ) (15.)
m
1
b= (16.)
L − (175i − 105) x
u = −K 1 ( z 1 − xd ) − K 2 ( z 2 − x& d ) − K 3 ( z 3 − &x&d ) + &x&&d (17.)
After I/S Linearization was performed the converted controllable canonical states are:
z1 = x (18.)
z2 = v (19.)
K1 , K2 and K3 were chosen to place the poles at –122.95. This gave the controller desired
Robustness to model uncertainty is one of the main problems with I/S Linearization. The
method is based on the assumption that the model is an accurate representation of the
22
actual plant. Figure 5 shows the effect of uncertain coil resistance. In this case, the
resistance in the plant was 15% more than the actual system.
Figure 5.) I/S Linearization with an accurate and inaccurate coil resistance
With the plant resistance more than the model resistance, not enough current is being
produced and friction is causing the plunger to hang up. The error for each plot,
calculated by (8), was 0.0458 and 21.9, respectively. From these results we can see that
I/S Linearization with a perfect model does achieve near perfect tracking. But, with 15%
error in the resistance model the error definition increases over 450 times. This result,
like the PID, was unacceptable. The controller must be immune to any coil resistance
uncertainty.
23
3.4 Sliding Mode Control
Often with highly nonlinear systems it can be very difficult to find an accurate model.
And in some cases it is necessary to use this uncertain model for control. Our second
type of nonlinear controller is a Sliding Mode Controller, which allows for bounded error
“push in the opposite direction of the error”. This principle is achieved by reducing the
Once the system reaches S the desired control objective will be reached asymptotically
[6].
n −1
d ~
S = + λ x (21.)
dt
&x& + 2λ~
S=~ x& + λ2 = &x& − &x&d + 2λ ( x& − x& d ) + λ2 ( x − x d ) (22.)
In order to make this surface attractive it was made to satisfy the following Lyapunov
function candidate.
24
1 2
L= S (23.)
2
To reach this relation a control input (V) must be defined to make S& = −η sgn( S ) . The
Kv 1 δF f
− η sgn( S ) + Rˆ iab − (87.5i 2 − 105)vab + + + &x&&d − c − λ2 ( v − x& d )
V= m m δt (25.)
ab
1
a = (−262i 2 + 210i ) (26.)
m
1
b= (27.)
L − (175i − 105) x
( 3 2 1
)
c = 2λ − 87.5i + 105i − Kx − mg − F f sgn( v ) − &x&d (28.)
m
The input contains an " Rˆ " term that represents the uncertain coil resistance. This term is
assumed to be bounded with a 50% error and entered in the input with the worst-case
scenario in mind (Rˆ − 0.5Rˆ sgn( S )). This makes the controller immune to coil resistance
Once the controller was applied to the system the robustness ability to model error was
tested. Figure 6 shows how exceeding the defined boundary causes the system to loose
accuracy.
25
Figure 6.) Effects of modeling error with a 50% bounded coil resistance parameter
The first two plots demonstrate the ability of the controller within the set error bounds.
The third plot shows the plant resistance exceeding the 50% error bounds and friction
the set bounds. The errors based on (8) for the first two plots were .0222 and .0949,
respectively. The error associated with the incorrect resistance model is over four times
higher than with the correct model. While this is significantly higher, overall both
controllers perform very well when compared to the 21.9 error associated with the I/S
Linearization controller with only 15% resistance inaccuracy. Refer to Appendix B for a
26
While these results are very good, the robustness to uncertainty does cause the controller
to chatter with higher amplitude and frequency. For our system there was no unmodeled
dynamics so the excess chatter was no problem. Figure 7 shows the increase in input
Figure 7.) The effect on the system input of coil resistance parameter uncertainty
This increase in input activity can be difficult to implement. The following section
The previous section explored three separate ways of applying closed-loop control to the
EGR valve. The last of these, Sliding Mode Control, even presented a method of dealing
27
with model uncertainty. While this is very useful because of the possibility of changing
parameters over time, it can cause unwanted performance such as excess heat and
possible premature failure. The following section explores the use of adaptive control to
accurately estimate unknown or changing parameters on-line, with the end goal being
reduced motor actuation and increasing the overall life of the motor. If the parameter that
contains the uncertainty is constant or slowly changing, adaptive control can be used to
identify the value of the parameter and reduce the control effort.
For this section the uncertain parameter will be the coil resistance. The parameter update
L= (
1 2
S + ρ∆R 2 ) (29.)
2
L = SS& + ρ∆R∆R&
& (30.)
&
L& = SS& + ρ∆R − Rˆ (31.)
&
L& = −ηS sgn( S ) − ∆R (iabS + Rˆ ρ ) (33.)
The term" − ∆R (iabS + R&ˆ ρ )" is then set to zero, making L& negative semidefinite and
28
R&ˆ = −
iabS
(34.)
ρ
Barbalat’s lemma can be used to show that the surface does converge to zero as time goes
to infinity. It is known that L& is negative semidefinite because we defined R&ˆ to force it
that way. This guarantees that R̂ and S are bounded. After finding L&& , Barbalat’s lemma
can be used to prove L&& is bounded and L& goes to zero [6]. We know, from section 3.4.1,
that S goes to zero. But since R&ˆ is a function of S there is no guarantee that ∆R goes to
zero, unless that system is constantly excited. S has to be nonzero in order for ∆R to
converge and persistent excitation provides this non-zero (but still near zero) S.
Once the controller was applied to the system the parameter tracking capability was
tested. Figure 8 shows the system response with an initial model resistance ( Rˆ ) of
29
Figure 8.) Adaptation law converges to 20.5 O, the value of the actual plant
As shown, the adaptive parameter eventually converges to the actual value in the plant.
The error associated with (8) for the adaptive sliding mode controller is .0462. This is a
50% reduction in error when compared to the sliding mode controller with the inaccurate
resistance model. It should be noted that the adaptive sliding mode controller started
with an initial resistance with 50% error in order to compare it the sliding mode
controller that also had 50% resistance error. Refer to Appendix B for a complete
30
3.5.3 Persistency of Excitation Requirement
One issue with adaptive control is the need for persistent excitation. If the plant were to
receive a step input as opposed to a sinusoid, the adaptation law might not converge due
to the lack of system excitation. Figure 9 shows the non-converging R̂ with a step input.
Figure 9.) Adaptation law does not converge without constant system excitation
As shown, the parameter update law does not converge to the proper value due to the lack
of system excitation. This is not a problem for the system because the EGR valve keeps
all states constantly changing as the driver requests varying levels of performance from
the vehicle.
31
3.6 Conclusion
Three different types of controllers were used to control the EGR valve, all yielding
different performance. First PI control was implemented, but was unable to achieve low
error tracking without the addition a derivative term, D, which is often problematic to
implement. Because of the need for higher tolerance control and also control over the
entire state space, Input/State Linearization was used. While I/S Linearization could
theoretically achieve zero error tracking, with any model error the tracking ability
degraded quickly. Because of this Sliding Mode Control was introduced. Sliding Mode
Control offers low error tracking even with model error. But, the benefit does not come
without a price. The controller robustness comes from a raised level of actuation.
Because of the need to lower the level of actuation while still achieving low error
tracking was important, Adaptive Sliding Mode Control was introduced. Adaptive
Sliding Mode Control tracks the unknown parameter in effect reducing the level of
actuation.
32
4 State Estimation
4.1 Introduction
The four control analyses performed above leave out a very important issue: sensor
measurements for state information. A wide range of sensors could be used to collect
state information. These sensor readings will contain noise and may have to be filtered.
Also, sensors can be expensive and unreliable. A method of dealing with the lack of state
information is state observers. Two common deterministic observers are the Luenberger
As with the controllers, an error definition is defined to compare the following observers.
E ≡ xˆ − x 2 + vˆ − v 2 + iˆ − i (35.)
2
This definition allows for the error in each state to be accounted for and compared. This
error was evaluated for 100ms at a constant period of 10µs. Also, the error was
calculated over the same desired trajectory for both the observers; a 7Hz sine wave with
4.5mm bias. This error definition will let the performance of the observers be compared
33
on the same basis and identify which observer is actually predicting more accurate state
The Luenberger Observer is a linear observer that can be applied to a linearized nonlinear
system. As with the PI control, the nonlinearities can often be too great or the desired
operating range can be too large to usefully implement a linear observer. The following
analysis discusses the process for the application of a Luenberger Observer to our system.
First, the Accessibility and Controllability around the equilibrium point have to be
verified.
4.2.1 Accessibility
The accessibility matrix, when full rank indicates that the system is controllable, is
calculated using Lie brackets [6]. The rank of the following matrix was checked.
But we are only concerned about this matrix at the following equilibrium point.
0 0 1519.6
C= 0 − 1519.6 41480.4
3.96 322.14 − 133244
This matrix is full rank, therefore the system fully accessible at the equilibrium point.
34
4.2.2 Observability
The observability matrix is calculated using Lie derivatives [6]. The following process
was used to find and check the rank of the observability matrix.
L0f x
1
G = L f x (37.)
L2f x
x
G= v
( −87.5i 3 + 105i 2 − kx − mg )
m
The observability matrix is the gradient of G.
1 0 0
Ο = ∇G = 0 1 0 (38.)
k 210i − 262.5i 2
− 0
m m
From observation the system is observable everywhere but at i = 0 [A] and i = 0.8 [A].
Our system is operating at an equilibrium point with i = 0.281 [A]. Also, our system will
never reach zero current because there is always a small amount to hold the valve in the
Now that we know the system is accessible and observable we can implement the
Luenberger Observer. The following equation shows the form of the observer [8].
35
xˆ& = Axˆ + BV + L[ y − Cxˆ ] (39.)
e& = ( A − LC ) e (41.)
If all the eigenvalues of (A-LC) have negative real parts the equation is asymptotically
stable. It should be noted that this means asymptotically stable for the linearized system,
0 1 0 L1 − L1 1 0
[
− 12000 0 383.34 − L2 1 0 0] = − 12000 − L2 0 383.34
5055.08 − 89.75 − 152.76 L3 5055.08 − L3 − 89.75 − 152.76
λ3 + ( L1 + 152 .76)λ 2 + (152 .76 L1 + L 2 + 46406 .6) λ + 34406 .6L1 + 152 .76 L 2 + 383 .34 L 3 − 104711
We are going to put the real parts of all three of our poles at -100. This will keep the
poles symmetric about the real axis. Therefore the characteristic equation needs to look
like:
The next step is to apply these gains to the nonlinear system. The following equations
represent the new Luenberger system that will estimate the states of the original system.
36
xˆ& = vˆ + L1 ( ~x ) (43.)
3 x) (45.)
L − (175iˆ − 105) xˆ
~
x = y − Cxˆ (46.)
The following plots show the actual states and the estimated states.
Figure 10.) Estimated states converge to the actual states of the system.
As expected, the estimated states converge to the actual states. The error defined by (35)
for the Luenberger Observer is 0. This zero error is purely theoretical and is expected for
37
During the simulation the system did not move far from the equilibrium point that was
used to linearize the system and solve for the observer gains. If the system were to leave
collected directly and unrealistically from the plant model, by the observed states. These
observed states will then be used to calculate the controller output. The following plot
shows the output of the system with the I/S Linearization controller running on observed
states.
38
As you can see near perfect tracking is achieved. The error calculated from (8) is 0.0458,
which is identically equal to the I/S Linearization controller with actual state information.
This is to be expected because of the zero error state tracking provided by the Luenberger
This assumption of a perfect model is almost never possible, though. Now that the
control is based on two independent but identical models any error will now have an even
larger effect. Model uncertainty and its effects on control will now be discussed.
observer model. Any small error in the model causes the estimated states to not
converge. This violates the whole basis of an observer; to predict accurate state
information. The following plots show the performance of the observer with a 10% error
39
Figure 11.) Loss of parameter convergence due to small model error
The error defined by (35) is 2.59. This is a huge increase in error, which is visually
noticeable from Figure 11. When these estimated states are used with the controller any
deviation from the real states would cause unwanted performance. The controller would
be driving the system to an incorrect setpoint with minimal error. This adds an element
of guaranteed error to the system. The need for accurate state information is crucial. The
following plots show the effect of 10% error in the coil windings resistance model in both
40
Figure 12.) Model error in observer and controller
The model error in the observer causes it to predict flawed state information. The model
error in the controller causes the incorrect tracking of the already incorrect state
information. This error build-up leads to poor control and possibly instability. The error
as defined by (8) is 39.2. This is an increase in error of over 850 times the perfect model
I/S Linearization controller. This error increase and the need for guaranteed performance
away from the equilibrium point force us to pursue a different avenue of state estimation.
The Sliding Observer is another tool used to predict state information. The major
difference between the Sliding Observer and the Luenberger Observer is the Sliding
41
Observer’s ability to deal with model uncertainty. Using the same basis as the Sliding
The Sliding Observer design is similar to the Luenberger design. In fact, the Luenberger
Observer is the basis for the Sliding Observer. The following equations represent the
~
x = y − Cxˆ (50.)
As you can see the only difference is the “sign” term at the end of each estimated state.
This “sign” term is the key to dealing with model uncertainty. The gains L1 , L2 and L3
are taken directly from the Luenberger observer to place the poles of the linearized
system at -100.
The discontinuous “sign” function changes the sign of a portion of the state estimation,
constantly adjusting states to track the proper value. Essentially it applies the same
principle as the Sliding Mode controller: “Push in the opposite direction of the error”.
Figure 13 shows the ability of the observer to correctly track states regardless of model
integrity.
42
Figure 13.) State variables converge regardless of model error
The sliding observer is able to accurately track the states. The error defined by (35) is
0.1467. This is a 94% increase in performance over the Luenberger observer with similar
conditions. This reduction in error is important because this information will be applied
Now that we have verified that the sliding observer is converging to accurate state
information it can be applied to the Sliding Mode Controller. It is applied in the same
fashion as the Luenberger Observer. The state information, taken directly from the
system and used in the controller, is replaced by the state information produced by the
observer. Figure 14 shows the output of the system with all observed state information.
43
Figure 14.) State convergence and acceptable control regardless of model error
The control with the model error is not perfect, but demonstrates the ability of the sliding-
surface controller in dealing with model uncertainty. The error defined by (8) is 4.8. This
is an 88% increase in performance over the I/S Linearization control with the Luenberger
Observer values. This small amount of error stems from the error build up discussed
earlier.
4.4 Conclusion
The application of the nonlinear controllers discussed in section 3 requires full state
information. To outfit the plant with sensors could be costly and difficult, in addition to
having to deal with noisy data. Because of these issues, state estimators were used to
44
predict the state information used in the nonlinear controllers. Two types of state
estimators were used, first being the Luenberger Observer. The Luenberger observer
uses a linear model to calculate the gains that are applied to the nonlinear observer. This
observer will predict zero-error state information with a perfect model but degrades
quickly with any model uncertainty. Because of this a Sliding Observer was
implemented, which demonstrates the ability to track accurate state information even
45
5 Hardware-In-The-Loop
5.1 Introduction
A nonlinear model-based controller that provides low-error tracking throughout the entire
state space and a nonlinear observer that provides this controller with accurate state
information have been designed and are ready to implement. While the EGR valve
discussed in this paper was not readily available for controller application, a Motorola
MPC555 processor was. This shortage of hardware induced a unique type of controller
Without the actual EGR valve with which to apply the control, an artificial one had to be
implemented from the simulation software. Figure 15 shows the setup for the hardware-
in-the-loop test.
46
Figure 15.) Hardware-In-The-Loop setup
A desktop PC, running a Matlab simulation of the EGR valve, outputs valve position data
via an analog out channel and accepts controller output via an analog input channel. The
MPC555 takes the position data and uses it to run the controller code and calculate the
controller output. The output is then converted into a PWM signal using hardware
associated with the MPC555 and sent to the analog input of the simulation PC. This
digital PWM signal is then synthetically amplified and used to control the simulated EGR
valve.
In an attempt to reduce the amount of error associated with controller code generation, a
software package, dSPACE, was used to convert the controller code directly from the
MATLAB simulation model. dSPACE simplifies the controls engineering process with
real-time tools for rapid control prototyping, production code generation, and hardware-
in-the-loop analysis and implementation [7]. TargetLink is the tool within dSPACE that
has the production code generation capability. It was used to take the controller
simulation in MATLAB and directly convert it to C code that could be compiled and sent
to the MPC555. This capability allows for reliable code generation without hours of
painstaking code writing and debugging. Also, one useful feature of TargetLink is that
47
the C code produced is legible and can be altered itself. This also saves time by not have
Before the actual implementation of the generated code can take place it is a good idea to
understand how the system will behave with a pulse width modulated (PWM) input as
opposed to a theoretical analog voltage input. The period of the PWM is 1ms and the
period of the simulated plant is 10µs. The difference in sampling rate is intended to
This Simulink diagram takes an input from the controller, which is an analog voltage, and
converts it to a percentage of the available voltage. This is the calculated duty cycle. It
also calculates exactly how far the simulation is into the current PWM period. This is
also a percentage. The PWM is initially on and when the percent into the PWM period
exceeds the percent duty cycle the voltage is switched off. Figure 17 represents this
process graphically.
48
Figure 17.) The intersection of the lines indicates when the voltage is shut off.
In this figure the green line represents the progress through the PWM period. When the
period just starts, say at 0.011s, the PWM is currently 0 percent through the period. As
the period progresses, the green line indicates how far along the period is. The flat blue
line indicates the required duty cycle for that period, calculated from the controller
output. Figure 18 shows the system performance and the corresponding PWM input.
49
Figure 18.) Simulated system performance with PWM input.
As you can see the performance does degrade slightly. The error based on (8) was 8.3.
This has to do with the fact that the PWM is run on a 1ms period. The reason the PWM
could not be run any faster is because the scheduler is actually running 100 times faster in
order to get good resolution within the PWM period. In simulation the PWM period
could be run as fast as we would like, but in real application that is not possible. PWM
performance is directly related to the capabilities of the processor. The 10µs scheduler
the MPC555 has dedicated hardware to calculate the PWM signal. Because of this a 1ms
50
PWM period can be reliably achieved. With the information from this simulated
hardware-in-the-loop analysis enough is known about the performance of the system with
a PWM input to apply the MPC555 processor and control the simulated valve. The
Initially the hardware-in-the-loop test seemed like a great method of demonstrating the
ability of the sliding mode controller/observer. After actually attempting the experiment
it was found to be more difficult than originally planned. The main problem was the
computer simulation of the valve. The valve is a low mass/high force system. Therefore
it yields extremely fast response times. Initially it was thought that a MATLAB
simulation running in real-time would be able to accurately represent the dynamics of the
We know from the simulated PWM analysis that the controller cannot control the valve
with a PWM period greater than 1ms. We also know the fastest rate that MATLAB can
run a real-time target is 100µs. With these limitations in mind it only makes sense to run
the valve simulation as fast as possible (10kHz) and run the PWM as slow as possible
(1kHz). After a simple division it becomes apparent that the simulation will only be
getting 10 points of input for every PWM period. This gives a max input error of 10%.
If the PWM is intended to have a duty cycle of 41% the controller will see a 50% duty
cycle due to the holding characteristics of the DIO card. It will always round the period
up to the nearest percentage that is a multiple of ten. The discrepancy in the input causes
51
confusion in the observer and controller. The observer is calculating state information
from an assumed input. The controller is then taking this incorrect information and
One positive effect of the real-time control was that the PWM period length would
slightly drift every period. This caused a reduction in the input error because the
beginning of the PWM period did not perfectly line up with beginning of the simulation
period. The effect was an error in the beginning of the PWM period that was generally
counteracted at the end of the period. Figure 19 graphically explains this situation.
In Figure 19 the red line represents the actual PWM signal. The blue line represents the
signal that the simulated valve will see. In both plots the duty cycle is 41%. Figure 19a
52
shows the effect of the scenario with no PWM drift. The duty cycle is at 41% and the
system is seeing 50%. This stems from the fact that the system only gets new input
information every 100µs. Figure 19b shows the situation involving the drifting PWM
period. The PWM duty cycle is still 41% and the controller is seeing a 40% duty cycle.
This is an instance when the error is greatly reduced, but as the PWM period keeps
drifting the error will keep increasing and decreasing cyclically. Figure 20 shows fixed
setpoint control using the MPC555 generated PWM to control the simulated system.
53
As one can see the control is unacceptable. The sinusoidal effect stems from the drifting
PWM period discussed above. As the PWM period drifts the input error is increasing and
decreasing causing the controller/observer to constantly play catch up. The error based
These is results are completely undesirable and demonstrate the need for the real valve
for an accurate test. But, with the implementation of the real valve comes the task of
dealing with the collection of real sensor data for the observer. This thesis does not go
5.6 Conclusion
In conclusion, the hardware-in-the-loop simulation did demonstrate the fact that the
controller was controlling despite the less-than-desirable setup. Changes to the setup
could be made to remedy the problems discussed above. The valve simulation could be
run in an environment that has the capability of a 10µs or even 1µs period. This would
probably involve another external processor running the valve simulation in addition to
one running the controller/observer. With this setup, two MPC555’s in parallel, the
continuous valve could be more accurately modeled. Possible further analysis could go
into the design of Kalman filter to deal with a real position sensor. With this addition a
real valve could be used, instead of a relatively slow computer simulation of one, and the
54
6 Conclusion
The preceding analysis discussed four methods for controlling an electric solenoid with
application to an EGR valve. A linear controller, which is intended for small motion
about an equilibrium point, was applied to this model to control throughout the entire
range of motion. It was expected that performance would be poor, but ended up better
than expected. One major issue was the use of a PID controller instead of a PI controller.
The addition of derivative control can often be difficult to implement. For this system PI
control was unable to achieve acceptable tracking error, but with the addition of a
Input/State Linearization was the first nonlinear controller implemented and was
the model is constantly changing. Error bounds were exceeded with only small changes
in model parameters.
55
Sliding Mode Control was the second nonlinear controller implemented and was also
successful with a perfect model. The difference with Sliding Mode Control is that model
uncertainty can be accounted for and zero error can still be maintained.
Adaptive Sliding Mode Control was the final nonlinear controller implemented and was
used to reduce actuator effort by using parameter update laws that converge to the actual
plants values.
After a satisfactory controller was defined, the need for state information became
apparent. Two types of observers were designed and tested, a nonlinear Luenberger
external processor for hardware-in-the-loop analysis. This analysis tested the system
under real-time control with a digital PWM input. While the conditions for a true
controller on the external processor was able to maintain some level of control.
56
7 Appendices
57
Appendix B.) Controller/Observer Performance Comparison
Table 3.) Controller/Observer performance comparison
Controller/Observer Error Def. Error Value
SMC w/ perfect model 8 0.0222
I/S Lin w/ perfect model 8 0.0458
I/S Lin + Luenberger Obs w/ perfect model 8 0.0458
Adap SMC w/ 50% initial resistance model error 8 0.0462
SMC w/ 50% error in resistance model 8 0.0949
SMC + SM Obs w/ 10% error in resistance model 8 4.8
SMC + SM Obs with simulated PWM 8 8.3
P.I.D. 8 10.6
I/S Lin w/ 15% error in resistance model 8 21.9
I/S Lin + Luenberger Obs w/ 10% error in resistance model 8 39.2
SMC + SM Obs with MPC555 generated PWM 8 53.2
Luenberger Observer w/ perfect model 35 0
SM Observer w/ 10% error in resistance model 35 0.1467
Luenberger Observer w/ 10% error in resistance model 35 2.59
58
Appendix C.) Simulink Model of System and Controllers
59
Appendix D.) Simulink Model Used In the HWIL Setup
60
8 References
[1] N.C. Cheung, K.W. Lim, M.F. Rahman, “Modeling a Linear and Limited Travel
Solenoid”, University of New South Wales, Australia, 1993.
[5] Blank, Dismon, Kochs, Sanders, Golden, “EGR and Air Management for Direct
Injection Gasoline Engines”, SAE 2002 World Congress, 2002-01-0707, Detroit,
MI, March 2002.
[6] J.-J. E. Slotine, Weiping Li, “Applied Nonlinear Control”, Prentice Hall (1991).
[7] http://www.dspaceinc.com
[8] Masayoshi Tomizuka, “Advanced Control Systems I”, Fall 2002 Reader.
61