Introduction to Proportional, Integral
Control: First Order Systems
By Brian D. Storey
1. Introduction
Control theory is important for nearly all engineering disciplines. One of the sim-
plest control systems, for those who grow up in hot climates with central air con-
ditioning, is the thermostat. Nearly everyone has set the dial to the temperature
you want and then heard the air conditioning turn itself on and off to maintain
a house at a comfortable level. This is only one example. Modern aircraft are full
of complex control systems that maintain a steady aircraft during takeoff, landing,
and flight. The recent scooter ’IT’ has a control system that keeps the two-wheeled
scooter balanced and responds when the users leans in a certain direction. In all
these systems the system takes measurements of the current state, and through
software, hardware, or both the system moves to the desired state.
In this course we will only be providing an introduction to control theory. Ad-
vanced control theory can be quite complex and rely on advanced mathematical
techniques. In this course we will concentrate mostly on building the systems and
implementing simple software control algorithms. The control method that we will
discuss is referred to as PI control (Proportional, Integral). PI control uses a com-
bination of three simple control methods to maintain a set point.
This document will explain PI algorithms and we will implement them in the
simulation of control of first order systems: specifically, we will work through the ex-
ample of a first order thermal system. We will discuss how the proportional, integral,
and derivative terms work independently and then how they work in combination.
2. First order thermal control
To introduce PI control we will use a simple example, the control of temperature
of a resistance heater, specifically the coil on your hot plate. We will have one
measurement of the temperature and we will be able to control the electrical power
that we supply to the heater. We will describe the equations that govern this system
and discuss how the three different control strategies work.
(a) Equations
The total amount of thermal energy, Q (Joules), contained in a solid block of
material is given as
Q = mCP T (2.1)
where m is the mass of the material (Kg), Cp is the specific heat (J/KgK), and T is
the temperature in Kelvin, We will assume that a single temperature characterizes
the temperature of the heater, a good approximation under many circumstances.
TEX Paper
2 PI Control
The rate of heat loss per unit area, q 00 (Watts/m2 ), can be estimated from the law
for convective heat loss
qc00 = h(T − Tair ) (2.2)
where h is a called the convection coefficient and can be found empirically and T air
is the temperature of the ambient air. The heat flux is assumed to pass uniformly
through the surface area A of the coil A. This equation can also be thought of as
saying that the rate of heat flow (current) is equal to the difference in temperature
(voltage) divided by the thermal resistance,
T − Tair
qc00 A = Q̇c = (2.3)
R
where R = 1/hA. This equation is the heat transfer version of Ohm’s Law.
We will also be supplying power to the resistance heater: note that we will
control the power, P, supplied to the heater (not the voltage or current). An energy
balance tells us that the amount of power supplied to the heater minus the amount
lost through convection is equivalent to the time rate of change of the thermal
energy contained in the heater. Translating these word into equations yields
dT T − Tair
mCp =P − . (2.4)
dt R
Note that in the above equation we used the fact that the mass and specific heat
are constant material properties. The equation can be rearranged as
dT P T − Tair
= − . (2.5)
dt mCp τ
where
τ = RmCp . (2.6)
and the constant RmCp has units of seconds. The constant τ is the time scale that
the system responds. High thermal resistance or large thermal mass means that the
system will respond very slow, which makes intuitive sense.
For analytical convenience we will also define a temperature difference function
Θ = T − Tair . Making this substitution in equation 2.5 yields
dΘ Θ
= P∗ − , (2.7)
dt τ
where we define P ∗ = P/mCp in order to make the notation compact. If we assume
that initially the heater is at the same temperature as the air then the initial
condition is Θ = 0.
Equation 2.7 has two constant parameters that are unknown, the power supplied
to the heater divided by the thermal mass (P ∗ ) and the time constant of heating.
We can find both of these parameters by fitting the experimental data.
(b) Constant maximum power behavior
It is useful to consider how the system behaves under constant power input.
Assume that the initial condition is Θ = 0 and you have set the maximum power
PI Control 3
500
450
400
350
Temperature (K)
300
250
200
150
100
Model
Data
50
0
0 50 100 150 200 250 300
time (S)
Figure 1. Behavior of thermal system under constant, maximum power supply. This figure
is plotting equation 2.9 with a P ∗ of 4.6 and τ = 100 (solid line). The parameters were
chosen to match experimental measurements (dashed line).
on the heater, how does the system behave? The general solution to the case of
constant power (P ∗ ) can be found by combining the homogeneous and particular
solutions to Equation 2.7
Θ = P ∗ τ + Ce−t/τ , (2.8)
where C is a constant of integration. Using the initial condition that Θ(t = 0) = 0
yields
Θ = P ∗ τ (1 − e−t/τ ). (2.9)
For the reader with less experience solving differential equations analytically, do not
worry. This solution can be traced out using the numerical methods (i.e. Euler’s
method) we have discussed in previous chapters.
Without solving the equation (either analytically or numerically) we can investi-
gate the governing equation 2.7 and see that the equilibrium point (dΘ/dt = 0) will
be reached when the power input balances the heat loss (Θ = P ∗ τ ). The solution
shows that the temperature reaches this final state exponentially.
In the real system we do not know the value for P ∗ or τ , we must determine them
experimentally. Using our data acquisition system, a thermocouple, and an amplifier
circuit, we can measure the temperature evolution of the hot plate coils: we have
done this in a previous lab assignment. We can conduct the experiment of turning
the plate on and watching the temperature rise, logging the real temperature as a
function of time. We can then fit the equation 2.9 to the data to get an estimate of
these quantities (P ∗ and τ ). The result of this fit is shown in figure 1.
(c) P is for Proportional
Proportional control means that the system responds in proportion to how far
you are from the set point. If we are far from the set point we turn up the power to
get there quicker. We decrease the power input as we get closer to the desired set
4 PI Control
point. To control the power to our heater smoothly in experiments we will use pulse
width modulation, turning the heater on and off very rapidly. Implementation of
this technique will be discussed in lab.
An example of proportional control occurs when you are driving onto a freeway
entrance ramp. As you enter the ramp you push the gas hard so that you can
accelerate to your set point (55 mph). As you approach the speed limit (I know you
would never speed) you ease off the accelerator. The driver takes the car smoothly
from 0 to 55 mph, not through a series of maximum acceleration and no acceleration.
Good driving is an example of proportional control.
Returning to equation 2.7 we consider the case where P ∗ is no longer a constant
but varies proportionally to the set point. We will consider the case where the
power is varied as P ∗ = (Θset − Θ)/τp where τp is the time constant of proportional
control. Making the substitution into equation 2.7 yields
dΘ Θset − Θ Θ
= − . (2.10)
dt τp τ
Rearranging the equation yields
µ ¶
dΘ Θset 1 1
= − + Θ, (2.11)
dt τp τ τp
an equation that looks much like the constant power equation 2.7
First we note that the equilibrium point of this proportional controller is ob-
tained by setting dΘ/dt = 0 in equation 2.11 which yields
1
τp
Θeq = Θset 1 1 . (2.12)
τp + τ
or
τ
Θeq = Θset . (2.13)
τp + τ
We can see that the set point is never really reached. In the limit of very short
proportional time constant then the final temperature almost, but not quite, reaches
the set point.
The plot of this solution to equation 2.11 will look very similar to the one of
constant power only final state that the system will obtain is given above. Also
note that the time scale over which the system reaches the final state is given as
τsystem = 1/(1/τp +1/τ ). If we make the proportional time scale very small, then the
system will move to the set point very quickly. You can solve the above expression
analytically or numerically to convince yourself that these statements are true.
Note that in our system of the hot plate, P ∗ = (Θset − Θ)/τp can not be strictly
true. There is a maximum value that P ∗ may achieve. Also if we were to overshoot
the set point, P ∗ could not be negative. There is a range where the controller is
proportional, beyond that the power is either on full or completely off. Therefore,
we really have a limit to the power supplied to the controller. While previously we
said that the power supplied to the heater was always proportional to the distance
from the set point, we now note that this is not quite right. The real relationship
between the power supplied and the temperature measured is shown in figure 2 for
different values of τp .
PI Control 5
4.5
τp=20
4
3.5
τp=40
3
P*
2.5
τp=100
2
1.5
0.5
0
0 100 200 300 400 500
Temperature (K)
Figure 2. Power supplied to the heater as a function of temperature measured. The set
∗
point is 300K and Pmax is 4.6. The range of temperatures where the output is proportional
to the distance from the set point is known as the proportional band.
The behavior of our system to such proportional control is shown in Figure 3. In
this figure we use the value for power and system time constant that were obtained
from the experimental data in the previous section. The set point was placed at
220 C with a proportional time constant, τp = 20 seconds. In the figure we show
how the ’ideal’ proportional controller works as well as the controller with limited
power output. We see that the power limited controller follows the maximum power
curve early, then deviates to quickly flatten to a constant value.
Note that the final state is about 183 C while the set point was 220 C. Note that
equation 2.13 predicted that the final equilibrium temperature for the parameters
we chose would be Θeq = 220(100/(100 + 20)) = 183. This constant offset is one
of the shortcomings of a purely proportional controller. For first order systems the
controller will never achieve the set point. It might seem that the controller can be
set to have a very fast time constant and therefore the controller will almost reach
the set point, and reach it quite quickly. While this is technically true, we will see
that once we introduce more complex systems, a high gain proportional controller
has some real difficulties, namely serious overshoot. Since most real systems are not
truly first order we will see that setting the gain very high is a bad idea.
(d ) I is for Integral
Integral control means that the system will respond in proportion to the integral
of the error over time. This type of control will adjust for the constant offset of a
proportional controller: the controller will turn up the power if the system is sitting
far from the set Rpoint for a long time. Precisely, the power to the controller will
vary as P ∗ = τ12 (Θset − Θ)dt where τI is the integral time constant.
I
Let’s analyze the behavior of a purely integral controller for our first order
6 PI Control
500
450
Constant Power
400
350
Temperature (K)
300
250
200
Ideal
Actual
150
100
50
0
0 50 100 150 200 250 300
time (S)
Figure 3. Behavior of system with proportional control. We show the system with P ∗ = 4.6,
τ = 100, under constant power (dashed-dot line), the ’ideal’ proportional control with
τp = 20 (dashed), and the control with τp = 20 but a limit to the maximum power (solid).
The solid line is representative of the actual system, the rate of increase is limited by the
maximum amount of power that the heater can put out.
system: the governing equation would be
dΘ 1 Θ
Z
= 2 (Θset − Θ)dt − (2.14)
dt τI τ
Taking the derivative of the above expression provides a second order differential
equation for Θ
d2 Θ Θset − Θ 1 dΘ
= − . (2.15)
dt 2 τI2 τ dt
Now we see that the solution has both first and second order components. This
indicates that the solution will have both exponential and sinusoidal (oscillatory)
behavior. The solution to the oscillatory part of the equation will have a term that
will vary as Θ = sin(t/τI ), therefore the solution should display oscillations with a
period of 2πτI .
Since we have already covered numerical methods, we will use simulation to look
at the behavior of the integral controller. A convenient way to model the system
numerically is to write the equation 2.15 as the coupled system
dΘ Θ
=P− (2.16)
dt τ
dP Θset − Θ
= (2.17)
dt τI2
As with the proportional control we know that with our system power is limited
between 4.6 (max power) and 0. Therefore, our hot plate system can not have true
integral control. In modeling these equations to account for a limit on maximum
PI Control 7
400
Ideal
350 Real
300
Temperature (K)
250
200
150
100
50
0
0 100 200 300 400 500 600 700 800
time (S)
Figure 4. Example of first order system response to integral control with integral time
constant of τI = 20. Note the decaying, oscillatory approach to the set point. We show
the result of an ideal integral controller and the control with our system which has limited
maximum power and no negative power when the system exceeds the set point. Note that
the oscillations of the ’ideal’ integral controller have a period of 2πτI .
power and the fact that no negative power mechanism exist we could write equation
2.16 as
dΘ Θ
= max(min(P, 4.6), 0) − (2.18)
dt τ
where min and max refer to minimum and maximum functions.
The result of a simulation of integral control using the integration time scale of
20 seconds is shown in figure 4. We show the result using an ideal integral controller
(equation 2.16) and the actual system with power limits (equation 2.16). We see
that the oscillations do in fact appear: these oscillations are one of the problems
with integral control. The benefit of the integral controller is that the set point is
eventually reached.
(e) PI Control
We have thus far seen each of the components of PI control in action. P allows us
to quickly move to the set point when we are very far away, I allows us to accurately
stay around the set point - compensating for the proportional offset problem. In
most cases we chose to use a mixture of P and I to make a robust controller.
The parameters must be chosen to optimize the controller for the system at hand.
We will turn to picking the best controller later in the course. For a simple first
order system, the best controller is simply a proportional controller with a very
strong gain. However, a little time lag in the system would make this controller
very unstable! We will see this poor performance of the high gain proportional
controller when we turn to the coupled second order system.
We can use numerical simulation to provide insight into the performance of PI
control to the first order system. The general system that we will model will be the
8 PI Control
two PI control terms added to the system that we have been thus far simulating.
dΘ Θset − Θ 1 Θ
Z
= + 2 (Θset − Θ)dt − (2.19)
dt τp τI τ
In order to solve this equation numerically we can introduce a new equation for the
power from the integral controller, namely
dΘ Θset − Θ PI Θ
= + 2 − (2.20)
dt τp τI τ
dPI
= (Θset − Θ) (2.21)
dt
This coupled system of equations is identical to equation 2.19.
Thus far we have discussed the control system in terms of model equations and
looking at the predicted system performance. A few difficulties occur when the
control is done in a real environment. The main issue is noise. If measurement that
we are controlling off of is very noisy we can introduce errors into our system. It is
easy to imagine the derivative of temperature with time in a noisy environment can
be artificially large and fluctuating. We will want to run the measurement signal
we are using to control through a filter, such as the virtual shock absorber, in order
to control off a smooth signal.