Designing the Control System

advertisement
Lab 3: PI Control of Incubator
In the previous laboratory we found that a simple first-order model of the incubator has the transfer
function
Θ
𝐢𝑝
=
𝑁 𝑠+𝑝
where N is the PWM value given to the heater resistor, p is the system time constant (or rather, its
inverse) and C gives the magnitude of the response in Fahrenheit.
Our task for this lab is to design a suitable control system for the incubator. As we learned in class,
the first-order system is best controlled through a combination of proportional and integral control.
Temperature
Setpoint
s
+
E
𝐾𝑝 +
𝐾𝑖
𝑠
N
𝐢𝑝
𝑠+𝑝
Temperature
(Output)
A control system for the incubator is shown above. The error for the system is given by
𝐸(𝑠) = Θ𝑠 − Θ
And the output of the controller (and input to the incubator) is
𝑁 = (𝐾𝑝 +
𝐾𝑖
) (Θ𝑠 − Θ)
𝑠
Of course, the maximum allowable value for N is 255 - this puts a limit on the values that we can
use for Kp and Ki. Solving for the transfer function of the controlled system gives
𝐾𝑝 𝑠 + 𝐾𝑖
Θ
= 2
Θ𝑠 𝑠 + (1 + 𝐾𝑝 𝐢)𝑝𝑠 + 𝐾𝑖 𝐢𝑝
This is a second-order system with numerator dynamics (there is at least one power of s in the
numerator). In exploring the behavior of the controlled system, we will ignore the numerator
dynamics for the moment. The standard form for the second-order transfer function is
𝑋
πœ”π‘›2
=
𝑋𝑖𝑛 𝑠 2 + 2πœπœ”π‘› 𝑠 + πœ”π‘›2
1
so that
πœ”π‘›2 = 𝐾𝑖 𝐢𝑝
(1)
2πœπœ”π‘› = (1 + 𝐾𝑝 𝐢)𝑝
(2)
To arrive at suitable values for Kp and Ki, we must take a slight detour into the realm of second-order
systems.
Behavior of Second Order Systems
The transfer function of the most basic second order system is given by
𝑋
πœ”π‘›2
=
𝑋𝑖𝑛 𝑠 2 + 2πœπœ”π‘› 𝑠 + πœ”π‘›2
where ζ is the damping ratio and ωn is the natural frequency. Applying a unit step input to the
system results in
1
πœ”π‘›2
𝑋= ( 2
)
𝑠 𝑠 + 2πœπœ”π‘› 𝑠 + πœ”π‘›2
Looking at Row 24 in the Laplace transform table, the step response of the second-order system is
π‘₯(𝑑) = 1 −
πœ”π‘› −πœπœ” 𝑑
𝑛 sin(πœ” 𝑑 + πœ‘)
𝑒
𝑑
πœ”π‘‘
(3)
where
πœ”π‘‘ = πœ”π‘› √1 − 𝜁 2
is the damped natural frequency and φ is the phase angle. Of course, this response is only valid for
underdamped systems, where ζ is less than 1.
The response of the second order system to a step input is shown in the figure below, for a variety
of damping ratios. As you can see, a low damping ratio produces large oscillations, and takes a long
time to settle down, while a high damping ratio hardly oscillates at all. On the other hand, the low
damping ratios reach the setpoint quickly (although they overshoot it soon afterward) and the high
damping ratios take longer to reach the setpoint.
Settling Time
We can define a few performance parameters for the second order system. First, we might be
interested in how long it takes the system to “settle out” to its steady-state value. The exponential
term in Equation (3) gives the “envelope” of the oscillations and determines how quickly they die
out. If we define the time constant, τ,
2
Step response of second order system
1.8
= 0.1
1.6
= 0.3
= 0.5
1.4
= 0.7
Response
1.2
1
0.8
= 0.9
0.6
0.4
0.2
0
0
5
10
15
20
25
Time(s)
𝜏=
then the oscillations decay to
𝑒 −πœπœ”π‘›πœ = 𝑒
30
35
40
45
50
1
πœπœ”π‘›
1
)
−πœπœ”π‘› (
πœπœ”π‘›
= 0.3679
or 37% of their peak value after one time constant has elapsed. Usually, we define the settling time to
be four time constants so that
4
)
−πœπœ”π‘› (
πœπœ”
𝑛
𝑒
= 0.0183
the oscillations have decayed to less than 2% of their peak value after the settling time has elapsed.
Maximum Overshoot
We are also interested in the maximum overshoot: the peak value reached by the system at the
beginning of its oscillations. The time required to reach the maximum overshoot can be found by
taking the time derivative of Equation (3) and setting it to zero.
𝑑π‘₯ πœπœ”π‘›2 −πœπœ” 𝑑
𝑛 sin(πœ” + πœ‘) − πœ” 𝑒 −πœπœ”π‘› 𝑑 cos(πœ” 𝑑 + πœ‘) = 0
=
𝑒
𝑑
𝑛
𝑑
𝑑𝑑
πœ”π‘‘
3
[
πœπœ”π‘›
sin(πœ”π‘‘ 𝑑 + πœ‘) − cos(πœ”π‘‘ 𝑑 + πœ‘)] 𝑒 −πœπœ”π‘›π‘‘ = 0
πœ”π‘‘
since the exponential function never reaches zero, we conclude that the quantity inside the brackets
must be zero.
πœπœ”π‘›
sin(πœ”π‘‘ 𝑑 + πœ‘) − cos(πœ”π‘‘ 𝑑 + πœ‘) = 0
πœ”π‘‘
Using the definition of damped natural frequency gives
𝜁
√1 − 𝜁 2
sin(πœ”π‘‘ 𝑑 + πœ‘) − cos(πœ”π‘‘ 𝑑 + πœ‘) = 0
Looking at the entry in Row 24, we see that the quantity in front of the sine function is the inverse
of the phase angle
1
sin(πœ”π‘‘ 𝑑 + πœ‘) − cos(πœ”π‘‘ 𝑑 + πœ‘) = 0
tan πœ‘
Now use the trigonometric sum formulas to separate out the quantities inside parentheses
1
(sin πœ”π‘‘ 𝑑 cos πœ‘ + cos πœ”π‘‘ 𝑑 sin πœ‘) − cos πœ”π‘‘ 𝑑 cos πœ‘ + sin πœ”π‘‘ 𝑑 sin πœ‘ = 0
tan πœ‘
Divide through by cos πœ‘
1
(sin πœ”π‘‘ 𝑑 + cos πœ”π‘‘ 𝑑 tan πœ‘) − cos πœ”π‘‘ 𝑑 + sin πœ”π‘‘ 𝑑 tan πœ‘ = 0
tan πœ‘
sin πœ”π‘‘ 𝑑
+ cos πœ”π‘‘ 𝑑 − cos πœ”π‘‘ 𝑑 + sin πœ”π‘‘ 𝑑 tan πœ‘ = 0
tan πœ‘
sin πœ”π‘‘ 𝑑
+ sin πœ”π‘‘ 𝑑 tan πœ‘ = 0
tan πœ‘
sin πœ”π‘‘ 𝑑 + sin πœ”π‘‘ 𝑑 tan2 πœ‘ = 0
sin πœ”π‘‘ 𝑑 +
1 − 𝜁2
sin πœ”π‘‘ 𝑑 = 0
𝜁2
sin πœ”π‘‘ 𝑑 = 0
This is an amazingly simple result after so long a derivation! For this to be true, we must have
4
πœ”π‘‘ 𝑑𝑛 = π‘›πœ‹
or
𝑑𝑛 =
π‘›πœ‹
πœ”π‘‘
This gives the times of each peak (or trough) in the oscillations. Since we first set out to find the
maximum overshoot, we are really only interested in the first peak
𝑑𝑝 =
πœ‹
πœ”π‘‘
Substitute this into Equation (3) to find the peak value
π‘₯(𝑑𝑝 ) = 1 −
π‘₯(𝑑𝑝 ) = 1 −
π‘›πœ‹
πœ”π‘› −πœπœ”
πœ”π‘‘ πœ‹
𝑒 πœ”π‘‘ sin (
+ πœ‘)
πœ”π‘‘
πœ”π‘‘
πœ”π‘›
πœ”π‘› √1 − 𝜁 2
π‘₯(𝑑𝑝 ) = 1 +
𝑒
−
1
√1 − 𝜁 2
πœπœ”π‘› πœ‹
πœ”π‘› √1−𝜁 2
𝑒
−
πœπœ‹
√1−𝜁 2
sin(πœ‹ + πœ‘)
sin(πœ‘)
To find sin(πœ‘), let us draw a triangle using the definition of tan(πœ‘). The hypotenuse of the
triangle is found using the Pythagorean theorem
2
𝜁 2 + (√1 − 𝜁 2 ) = 1
1
√1 − 𝜁 2
Thus, we have
sin πœ‘ = √1 − 𝜁 2
𝜁
The maximum overshoot is then
π‘₯(𝑑𝑝 ) = 1 + 𝑒
−
πœπœ‹
√1−𝜁 2
As the damping ratio approaches 1, the peak value also approaches 1, as expected. Note that the
peak input was found for a unit step input. Often we are interested in the maximum percentage
overshoot, regardless of the magnitude of the step input. In this case, we define
𝑀𝑝 = 100% ⋅ 𝑒
−
πœπœ‹
√1−𝜁 2
5
Rise Time
We are also interested in how long it takes the system to initially reach its steady-state value, before
the oscillations begin. Since the steady-state value is 1 for the unit step input, we can use Equation
(3) to find
1=1−
0=
πœ”π‘› −πœπœ” 𝑑
𝑛 π‘Ÿ sin(πœ” 𝑑 + πœ‘)
𝑒
𝑑 π‘Ÿ
πœ”π‘‘
πœ”π‘› −πœπœ” 𝑑
𝑛 π‘Ÿ sin(πœ” 𝑑 + πœ‘)
𝑒
𝑑 π‘Ÿ
πœ”π‘‘
As before, the exponential function never reaches zero, so that
sin(πœ”π‘‘ π‘‘π‘Ÿ + πœ‘) = 0
πœ”π‘‘ π‘‘π‘Ÿ + πœ‘ = π‘›πœ‹
π‘‘π‘Ÿ =
π‘›πœ‹ − πœ‘
πœ”π‘‘
This formula can be used to find the time of each crossing of the steady-state value. Of course, we
are mainly interested in the first crossing, where n = 1. The table below summarizes some of the
important formulas we’ve derived so far for the second-order system.
Table 1: Handy formulas for second-order systems
Quantity
Variable
Formula
Natural frequency
πœ”π‘›
π‘˜
√
π‘š
Damping ratio
𝜁
Damped natural frequency
πœ”π‘‘
πœ”π‘› √1 − 𝜁 2
Settling time
𝑑𝑠
4
πœπœ”π‘›
Rise time
π‘‘π‘Ÿ
πœ‹−πœ‘
πœ”π‘‘
Peak time
𝑑𝑝
πœ‹
πœ”π‘‘
Maximum percent overshoot
𝑀𝑝
𝑏
2√π‘˜π‘š
100% ⋅ 𝑒
−
πœπœ‹
√1−𝜁 2
6
Designing the Control System
Recall that the transfer function for the incubator system (with PI control) is given by
𝐾𝑝 𝑠 + 𝐾𝑖
Θ
= 2
Θ𝑠 𝑠 + (1 + 𝐾𝑝 𝐢)𝑝𝑠 + 𝐾𝑖 𝐢𝑝
Using the formulas derived above, we find that
𝜁=
πœ”π‘› = √𝐾𝑖 𝐢𝑝
(1 + 𝐾𝑝 𝐢)𝑝
2√𝐾𝑖 𝐢𝑝
To determine the gains Kp and Ki, we must specify two of the parameters of the second order
response. As a first guess, let us try setting the maximum overshoot to 1.1 (or 10% above the
steady-state value) and the settling time to 1000s. Rearrange the maximum overshoot equation to
solve for damping ratio
(ln 𝑀)2
𝜁=√ 2
= 0.5912
πœ‹ + (ln 𝑀)2
for 10% (0.1) overshoot. The settling time is
𝑑𝑠 =
4
πœπœ”π‘›
so that
πœ”π‘› =
4
rad
= 0.00677
πœπ‘‘π‘ 
s
Substitute these values into Equations (1) and (2) to find suitable values for Kp and Ki. For the
parameters given, we have
𝐾𝑝 = 1.2845
𝐾𝑖 = 0.0354
We can use these values in the Simulink simulation shown below
7
Response of Incubator System
Input to Heating Resistor
25
140
120
20
15
80
N
Theta (deg)
100
60
10
40
5
20
0
0
200
400
600
Time (s)
800
1000
0
1200
0
200
400
600
Time (s)
800
1000
1200
The results are shown in the plots above. We must plot the PWM value sent to the heating resistor
to make sure it doesn’t exceed 255. In this case, we are comfortably below 255 - the maximum
value sent to the resistor is 120 or so. Given this low number, you may wish to increase the
performance of the controller by lowering the settling time. A settling time of 400 seconds results in
the plots below.
Input to Heating Resistor
250
20
200
15
150
N
Theta (deg)
Response of Incubator System
25
10
100
5
50
0
0
100
200
300
Time (s)
400
500
600
0
0
100
200
300
Time (s)
400
500
600
8
Download