Lecture 7 - ControlTheory - V1
Lecture 7 - ControlTheory - V1
2
Control Systems
• A control system manages, commands, directs, or regulates the
behavior of other devices or systems using control loops to produce
desired result
– Examples:
• Home heating/cooling system
• Car cruise control
• Robot navigation control
http://ideate.xsead.cmu.edu/gallery/projects/example-tutorial-pid-controller
3
Open-Loop Control Systems
• The control action is totally independent of the output of the system
Disturbances
System
Input Input Plant Output
Controller Or
Process
• These types of control systems are designed only for relatively
simple applications which have well defined input-output behaviors.
• Open-loop systems can deviate from desired output due to various
disturbances:
– Winds in case of aircraft
– Undulated road in case of cars
– Speed differences in wheels of robot (or slippage)
• The solution lies in making the input depend on previous outputs.
4
Closed-Loop Control Systems
• Also known as feedback control
– Output is continuously compared with the desired result
– The control output (system input) to the process is modified and adjusted to
reduce the deviation
– This forces the response to follow the reference
• Feedback control systems can be very robust against internal or
external disturbances. (When designed properly!)
Disturbances
System
Input + Error Input
Plant Output
−
Controller Or
Process
Sensor
5
Simple Open-loop Controller
• ON-OFF controller
– Temperature control of a chamber using a timer switch
– ON-OFF controller will switch the output on and off according to a set timer
System
Timer Input Output
Input
ON/OFF Heater
Switch
– Pros
• Simple and economical
Temperature
• Easy to maintain
• Stable
– Cons
• Inaccurate
• Unreliable
• Change due to disturbances cannot be corrected
6
Simple Closed-loop Controller
• ON-OFF controller
– Temperature control of a chamber using a temperature sensor and a switch
– ON-OFF controller will switch the output when the output crosses a setpoint.
System
Input + Error ON/OFF Input Output
Switch Heater
−
Temperature
Sensor
7
Closed-loop System: Terminologies
• Process Variable (PV) - the system parameter that needs to be
controlled, such as temperature (ºC), pressure (psi), flow rate (L/min)
• Sensor - used to measure the process variable and provide feedback to
the control system.
• The Set Point (SP) - the desired or command value for the process
variable, such as 100 ºC in the case of a temperature control system
• Error 𝑒 - the difference between the PV and the SP. Used by the
control system to determine the action to get desired output
Plant
SP + e = SP-PV Controller System input Or Output
− Process
PV
Sensor
8
Closed-loop System: Example
Speed
SP + e = SP-PV PWM Signal Output
Calculation DC Motor
− (Pi)
Rotary
PV
Encoder
9
Closed-loop System: Terminologies (cont.)
– Rise Time - the amount of time the system takes to go from 10% to 90% of
the steady-state or final value
– Percent Overshoot - the amount that the process variable overshoots the final
value, expressed as a percentage of the final value.
– Settling time - the time required for the process variable to settle to within a
certain percentage (commonly 5%) of the final value.
– Steady-State Error - the final difference between the process variable and set
point.
10
PID Controller
• A PID controller continuously calculates an error value 𝑒(𝑡) as the
difference between a desired setpoint (SP) and a measured process
variable (PV) and applies a correction based on Proportional,
Integral, and Derivative terms (hence the name PID)
• It is simply the sum of three parallel controllers operating on an error
signal to generate a combined control output 𝑢(𝑡).
Set-point (SP)
Process
Variable
(PV) Sensor
11
PID Controller
• The output of a PID controller has the following general form:
𝑡
𝑑
𝑢(𝑡) = 𝐾𝑝 𝑒 𝑡 + 𝐾𝑖 න 𝑒 𝑡 𝑑𝑡 + 𝐾𝑑 𝑒(𝑡)
0 𝑑𝑡
– 𝑢(𝑡): Control signal sent to the system
– 𝑒 𝑡 : Error Value (SP-PV)
– 𝐾𝑝 : Proportional constant that accounts for the present error value.
– 𝐾𝑖 : Integral constant that accounts for historical error values.
– 𝐾𝑑 : Derivative constant that accounts for future error values.
SP
PV Sensor
12
PID Controller
• Proportional control
– Used when the controller action is to be
proportional to the size of the process error
𝑃𝑜𝑢𝑡 = 𝐾𝑝 𝑒(𝑡)
– A high 𝐾𝑝 results in a large change in the output
and reduces rise time
– A high 𝐾𝑝 will reduce but never eliminate the
steady-state error.
– If the 𝐾𝑝 is too high, it introduces oscillations and
system can become unstable.
– A small 𝐾𝑝 results in a small output response to a
large input error, and a less responsive or less
sensitive controller.
13
PID Controller – Proportional Tuning
14
PID Controller
• Derivative control
– Derivative control is proportional to the rate of
change of the error signal.
𝑑
𝐷𝑜𝑢𝑡 = 𝐾𝑑 𝑒(𝑡)
𝑑𝑡
– It introduces an element of ‘prediction’ into the
control action.
– It has a damping effect and reduces the oscillations
caused by a large 𝐾𝑝 and improves settling time
– A derivative control 𝐾𝑑 will have the effect of
• Increasing the stability of the system
• Reducing the overshoot, and
• Improving the transient response.
15
PID Controller
• Steady-state error (SSE)
– The steady-state error is the difference between the desired final output and
the actual one.
– Because a non-zero error is required to drive it, a proportional controller
generally operates with a steady-state error.
– SSE may be mitigated by adding a compensating bias term to the setpoint
AND output, or it may be corrected dynamically by adding an integral term.
Velocity
Time (sec) 16
PID Controller
• Integral control
– An integral controller outputs a control signal
that is proportional to the integral of the error
𝑡
𝐼𝑜𝑢𝑡 = 𝐾𝑖 න 𝑒 𝜏 𝑑 𝜏
0
– It overcomes the shortcoming of proportional
control by eliminating steady-state offset without
the use of excessively large 𝐾𝑝 .
– The integral in a PID controller is the sum of the
instantaneous error over time and gives the
accumulated offset correction
– A very high value can cause the present value to
overshoot the setpoint and make the transient
response worse.
17
Example: Spring Damper System
• How change in 𝐾𝑝 affects the response
𝐾𝑝 = 24
𝐾𝑝 = 10
𝐾𝑝 = 5
𝐾𝑝 = 1
18
Example: Spring Damper System
• How change in 𝐾𝑑 affects the response keeping 𝐾𝑝 = 24
𝐾𝑑 = 0
𝐾𝑑 = 1
𝐾𝑑 = 2
𝐾𝑑 = 4 SSE
𝐾𝑑 = 9
19
Example: Spring Damper System
• How change in 𝐾𝑖 affects the response keeping 𝐾𝑝 = 24, 𝐾𝑑 = 9
𝐾𝑖 = 0
𝐾𝑖 = 2
𝐾𝑖 = 4
𝐾𝑖 = 10
20
PID Variants
• For a given control task, it is obviously not always necessary to adopt
all the three actions of PID controller.
• This gives rise to variations of the PID controller by setting respective
gains to be zero: P, PI, PD and PID Controllers
• PID Controller Tuning:
– The selection of the PID gains (Kp, Ki and Kd ) of the PID controllers is the
crucial issue in the overall controller design.
– The process is called “Tuning the Loop”.
– Simplest way of PID tuning is through trial and error using the following table:
PARAMETER RISE TIME OVERSHOOT SETTLING TIME S-S ERROR
Kp Decrease Increase Small Change Decrease
Ki Decrease Increase Increase Eliminate
Kd Small Change Decrease Decrease Small Change
21
PID Controller
• Categories of Loop Responses
– Under Damped
• PID is tuned to prevent oscillation but leads to
an overshoot of the PV followed by decaying
oscillation to finally settle at the Setpoint.
– Critically Damped
• An ideal situation where overshoot does not
occur, and the process responds to changes in a
controlled, non oscillatory manner.
– Over Damped
• The system responds in a controlled but sluggish
manner which will result in a loop performance
which is non ideal and unnecessarily slow.
22
Designing a PID Controller
23
Sample PID Algorithm
• Algorithm for digital implementation
24
PID-Hardware Demo
https://www.youtube.com/watch?v=fusr9eTceEo
25
Questions?