Proportional-Integral Control
ENCE361 Embedded Systems 1
Course Coordinator: Le Yang (
[email protected])
Lecturer: Ciaran Moore (
[email protected])
Lui Holder-Pearson (
[email protected])
Department of Electrical and Computer Engineering
1
Where we’re going today
• Introduction to control systems
• Proportional control
• Integral control
• Digital PI control
2
Introduction to Control Systems
• Control system = interconnection of components forming a configuration
that provides a desired system response
• Process: a series of task together transforming inputs to outputs
• Actuator (mover): take control signal and convert the source of energy into
(mechanic) move
• Controller: produce the control signal in a format suitable as input to actuator
Desired Control
response signal Input Output
Controller Actuator Process
Feedback
Plant
Source of Energy 3
Example: Liquid Level System
• Design input valve control to
maintain a constant height
• Process: water tank
• ‘Input’ = input flow + output flow
• System output = water height
• Actuator = input valve
• Controller takes info from float and
sends signal to input valve
4
From http://www.cs.wayne.edu/~hzhang/courses/8260b/Lectures/4-0%20-%20ControlTheory-Tutorial-for-CS-IBM.pdf
Open-Loop Control System
• Use a controller or actuator to directly control the process
Desired Input Output
response
Actuator Process
Source of Energy
• Conceptually simple and easy
• Example: toaster, old microwave oven, washing machine
• Design an open-loop control system requires accurate knowledge on
the plant (actuator + process)
• Unreliable when there are unexpected variations in the system
5
Closed-Loop Control System
• Open-loop control system does not monitor the system output but
simply assumes it works as expected
• Closed-loop control system uses a sensor (e.g., yourself ) to feed
system output back to adjust controller behavior adaptively
Desired Control
response signal Input Output
Controller Actuator Process
Feedback System output
Sensor
Error signal = desired response – system output 6
Where we’re going today
• Introduction to control systems
• Proportional control
• Integral control
• Digital PI control
7
Proportional Control
• Proportional (P) control monitors
error signal e(t) = desired response x(t) – system output m(t)
• Proportional controller drives actuator in proportional to e(t)
• Controller output is
𝑐 𝑡 = 𝑘𝑝 𝑒 𝑡 = 𝑘𝑝 (𝑥 𝑡 − 𝑚(𝑡))
• 𝑘𝑝 : proportional control gain
1, 𝑒 𝑡 >𝑇
• 𝑐 𝑡 = ൞ 0, 𝑒 𝑡 <0
𝑘𝑝 𝑒 𝑡 , 0 < 𝑒 𝑡 < 𝑇
8
Offset Error (1)
• Proportional controller drives actuator in proportional to e(t)
• Controller output is
𝑐 𝑡 = 𝑘𝑝 𝑒 𝑡 = 𝑘𝑝 (𝑥 𝑡 − 𝑚(𝑡))
• At equilibrium, we have
𝑚(𝑡) = 𝑘𝑝 𝑒 𝑡 = 𝑘𝑝 (𝑥 𝑡 − 𝑚(𝑡))
𝑘𝑝
𝑚(𝑡) = 𝑥 𝑡 ≠ 𝑥(𝑡)
𝑘𝑝 + 1
9
Offset Error (2)
• Proportional control has offset error
• Increasing gain 𝑘𝑝 (blue)
• Faster response
• Decrease offset error
• Increase overshoot
• Decreasing gain 𝑘𝑝 (dashed)
• Slower response
• Increase offset error
• Decrease overshoot
10
Where we’re going today
• Introduction to control systems
• Proportional control
• Integral control
• Digital PI control
11
Integral Control (1)
• Problem of proportional control
• Controller output solely depends on instantaneous error signal
• Offset error always exists
𝑘𝑝
𝑚(𝑡) = 𝑥 𝑡 ≠ 𝑥(𝑡)
𝑘𝑝 + 1
• Increasing gain 𝑘𝑝 reduces offset error at the cost of increased overshoot and possible instability
• Naïve solution: manual reset
𝑘𝑝 +1
• To achieve 𝑚(𝑡) = 𝑥(𝑡), provide a scaled response 𝑡 = 𝑥′
𝑥 𝑡 such that
𝑘𝑝
𝑘𝑝 ′
𝑘𝑝 𝑘𝑝 + 1
𝑚 𝑡 = 𝑥 𝑡 = ∗ 𝑥(𝑡) = 𝑥(𝑡)
𝑘𝑝 + 1 𝑘𝑝 + 1 𝑘𝑝
12
Integral Control (2)
• Integral control: an automatic approach to correct offset error 𝑒 𝑡
• Controller output depends on the integral of error signal e(t)
𝑡
𝑐 𝑡 = 𝑘𝑖 −∞ 𝑒 𝜏 𝑑𝜏
• 𝑘𝐼 is the integral control gain
• If there is an offset error (i.e., 𝑒 𝑡 is non-zero)
• Integral control would increases 𝑐 𝑡 to correct it
• Even if 𝑒 𝑡 is zero, 𝑐 𝑡 can still be non-zero!
• Proportional-Integral (PI) control
• Integrating error signal 𝑒 𝑡 = 𝑥 𝑡 − 𝑚(𝑡) may reduce noise in measured
system output 𝑚(𝑡)
• Recall digital signal conditioning in Lectures 5-7
13
Integral Control (3)
• Integral controller output depends on entire history of the error signal
• It could introduce overshoot and even oscillation
• Example: a positive 𝑒 𝑡 persists increased integral control output
𝑒 𝑡 = 0 but positive integral control output persists overshoot
a negative 𝑒 𝑡 reduced integral control output
𝑒 𝑡 = 0 but negative integral control output persists oscillation
14
Digital Realization of Integral Control
• How to implement error integration in C code?
• Sampling with is needed to approximate numerically the integral using summation
Error signal : 𝑒 𝑡 𝑒 𝑛𝑇𝑠 , 𝑇𝑠 : sampling interval
Control Signal: 𝑐 𝑡 𝑐 𝑛𝑇𝑠 , possible DAC needed before output
𝑡
𝑐 𝑡 = 𝑘𝑖 −∞ 𝑒 𝜏 𝑑𝜏
𝐸 𝑛𝑇𝑠 = 𝐸 (𝑛 − 1)𝑇𝑠 + 𝑇𝑠 ∙ 𝑒 𝑛𝑇𝑠 , Approximated integral of error
𝑐 𝑛𝑇𝑠 = 𝑘𝑖 ∙ 𝐸 𝑛𝑇𝑠 , Amplify control signal
Numerical integration with ZOH
15
Where we’re going today
• Introduction to control systems
• Proportional control
• Integral control
• Digital PI control
16
Digital PI Control
Block diagram of
PI controller
• PI controller output:
𝑡
𝑐 𝑡 = 𝑘𝑝 𝑒 𝑡 + 𝑘𝑖 න 𝑒 𝜏 𝑑𝜏
−∞
• Digital PI controller output:
𝑐 𝑛𝑇𝑠 = 𝑘𝑝 𝑒 𝑛𝑇𝑠 + 𝑘𝑖 𝐸 𝑛 − 1 𝑇𝑠 + 𝑇𝑠 ∙ 𝑒 𝑛𝑇𝑠
𝐸(𝑛𝑇𝑠 ) = 𝐸 𝑛 − 1 𝑇𝑠 + 𝑇𝑠 ∙ 𝑒 𝑛𝑇𝑠
17
Output Saturation & Integral Windup
• Controller output has no limits on its
magnitude
• Actuator may not be able to “follow”
controller output
• Fundamental limitation, due to e.g., power
and physical constraints
• Further demands from controller output
have no effect
• With integral control, the accumulated error and control output can be
very large, causing significant overshoot
• Integral windup
18
More on https://www.oreilly.com/library/view/feedback-control-for/9781449362638/ch10.html
Digital Realization
// Proportional control
// Integral control
// Derivative control
// PID control signal c(t)
// Update previous error sample
// Accumulate error signal only if controller output
// falls within [OUTPUT_MIN, OUTPUT_MAX]
19
PI Control Tuning (1)
• Rise time: time taken for m(t) to go from
10% to 90% of its steady value
• Overshoot:
(max value – steady value)/steady value *100%
• Settling time: time taken for m(t) to be
bounded within a tolerance of say, 2% of its
steady value
• Steady-state error: difference between
the steady value of m(t) and desired
response x(t)
20
From http://www.mee.tcd.ie/~corrigad/3c1/control_ho2_2012_students.pdf
PI Control Tuning (2)
Effects of Increasing Gains
Rise Time Overshoot Settling Time Steady-state
Error
Proportional control gain Decrease Increase Small change Decrease
𝑘𝑝
Integral control gain Decrease Increase Increase Eliminate
𝑘𝑖
21
Digital Realization
// Error signal integration
// Previous error sample
// Error signal integration
// Error signal time derivative
// Proportional control
// Integral control
// Derivative control
// Update previous error sample
// Control signal c(t)
22