PID Algorithm: Fully Explained
PID Algorithm: Fully Explained
PID Algorithm
Fully Explained
Control Algorithms
• Feedback control
– Advantages : Measures the final product or variable
and so does not need an exact knowledge of the
process to work effectively
– Disadvantages : Deviation from the target must have
occurred before feedback control system will function
(this is a problem if controlling quality hence the
introduction of feed-forward techniques)
Concept of Feedback
Temperature
Feedback
PV Water
Temperature
SP ?
Desired
Temperature
Error =
E Actual- I’m too
Desired
hot!
Control
Algorithm
Move valve
to left
H C
No action
Move valve
to right
Definitions
• Process Variable
– The measured value of the variable to be controlled
e.g. obtained from orifice plate or thermocouple
– Given in engineering units
• Setpoint
– The required value of the process variable may be set
by the operator or by the output of another controller
(cascaded)
– Always abbreviated to SP
– Same units as PV
Definitions continued
• Error
– Measure of how far the process variable is from the setpoint
– Always abbreviated to “E”
– Usually defined as PV-SP
• Manipulated Variable
– The variable that is adjusted to correct any error
– Usually abbreviated to “MV” or even just “M”
– Output to valve or OP
– Units 0-100% or -5% to 105%
– Air to open or air to close
– Direct or Reverse Acting
Temperature
Fuel
with “deadband”
Temperature Deadtime
Temp overshoot
Time
Proportional control
• Change in controller output proportional to change in
error
– MV = Kc*E + C
– Where MV= manipulated variable
– E = error
– Kc = controller gain
– C= valve position at zero error (0.5 or 50%)
• Proportional band = 100/Kc
– % change in error required to move valve full scale
• Proportional only control results in offset
– Never reaches SP
• Action is instantaneous (proportional kick)
– As soon as error is produced, control action is taken
Advanced Control Techniques PID 4-10
Hi-Spec Solutions
Local Proportional Controller
Zero
Adjustment
Proportional
Band
Error = PV-SP
Setpoint decrease
MV = valve position
Proportional action
Time
Advanced Control Techniques PID 4-12
Hi-Spec Solutions
Increasing Gain
PV SP
Pivot
Fin
Flow in (supply)
SP
Integral Control
• Used to Remove Offset
• Rate of change of controller output is proportional
to error
t
Kc
Ti edt
0
• Kc = gain as used in proportional only control
• Ti = reset/integral time (mins)
• 1/Ti sometimes used (repeats/min)
• As long as error exists, integral action will work to
eliminate the error
Advanced Control Techniques PID 4-15
Hi-Spec Solutions
Error = PV-SP
Setpoint decrease
MV = valve position Ti
Equal to proportional
Proportional action Action
Time
PV SP
Derivative control
• Change in controller output proportional to rate of change of
error
MV = Kc.Td.(dE/dt)
Where Td = derivative time
• Derivative action amplifies measurement noise
• Very effective if deadtime present and often under-rated
– But problems if noisy signal
– Sensitive to tuning errors
– Provides an additional “pulse” to push the control in the right
direction
Error = PV-SP
MV = valve position Td
Derivative action
Equal to an equivalent
proportional action
Time
Digital Form
MVn = MVn-1 + K[(En-En-1)+(TS/TI)En + (TD/TS)(En.-2*En-1+En-2)]
(when TI=0, Integral term is dropped)
Tuning Objective
• Flow control
– Constant flow required
– Very fast response to setpoint or load disturbance
– Tune as fast as possible without causing excessive
oscillation or valve wear
• Level control
– Keep feed to next unit as constant as possible
– Tune as slow as possible
– Do not tune so slow as to empty or fill vessel !
Split-range controllers
0-50 50-100
PC output PC output
0 50 100 0 50 100
Tuning Criteria ( 2)
• IAE and ISE do not always penalize oscillations
sufficiently with respect to time
– leading to tuning too tight
• ITSE tends to weight large errors excessively
– leading to tuning too tight
• ITAE good choice
– gives best tuning constants, developed by Louisiana
State University
• But in computer-based tuning packages It depends
on the computer algorithm used for tuning which
method is most appropriate
Advanced Control Techniques PID 4-32
Hi-Spec Solutions
00 00
0
( Error * time)dt ( f ( MV overshoot)dt
0
MV Overshoot
PV
SP
MV
Proportional
Kick
Control Kc Ti Td
P only 0.5 Ku - -
PI only 0.45 Ku 0.833 Pu -
PID 0.8 Ku 0.5 Pu 0.125 Pu
PID tight 0.6 Ku 0.5 Pu 0.125 Pu
PID reduced overshoot 0.33 Ku 0.5 Pu 0.33 Pu
PID no overshoot 0.2 Ku 0.33 Pu 0.5 Pu
Where :
Ku is the ultimate gain that produces steady oscillation
Pu is the ultimate period between successive oscillations (in minutes)
Td is often over-estimated by this method (can try Deadtime/10)
Ziegler-Nichols tuning
P only
Kc = /(Kp *)
PI
Kc = 0.9 /(Kp* )
Ti = 3.*
PID
Kc = 1.2. /(Kp* )
Ti = 2*
Td= 0.5*
Td is often over-estimated by this method (can try Deadtime/10)
A B A B A B
P 0.49 -1.084 - - - -
Where Y=A
Wind-up
• Integral action can lead to a phenomena called
wind-up which is best illustrated by an example
• Occurs when a secondary in a cascade hits an OP
limit, but SP to controller (from primary) is still
increasing because primary is not at SP
• SP of secondary increases but to no effect
– When SP needs to decrease in the future, has a long way to
go before it can really move the secondary
– Can get wind-up high or low
– leads to poor control
Wind-up example
• Fuel pressure falls causing flow controller to open
control valve
• If valve opens fully and flow is still below SP
temperature will start to fall
• TC increases FC setpoint but with no result
• FC setpoint increased till at maximum or high limit
(wound-up) SP
TC
• If fuel pressure suddenly increases, fuel flow will
increase to above that required (valve wide open FC
setpoint high) SP
Windup-protection
• Traditional analogue systems
– batch switches
– external reset feedback
• DCS have built-in techniques
– Control algorithm reduces problem
– Clamps against changes in same direction of wind-up
– Integral action is suspended until control moves away
from wind-up
Control Initialization
• When controller is first put on automatic the
following happens:
SP = PVn (optional)
PVn-1 = PVn
PVn-2 = PVn
En = PVn - SP = 0
En-1 = PVn-1 - SP = 0
En-2 = PVn-2 - SP = 0
delta MV =0
MVn = current output = MVn-1
Tracking
• When controller in MANUAL
SP = PVn (PV tracking)
MVn = current output (OP tracking)
Tracking similar to initialization
only difference is history is not set to zero in tracking
SP initialization/SP tracking
• Configurable option when loop put in AUTO
• SP fixed
– SP remains at previous desired value
– Control moves output till PV = SP
– may bump process if it is a fast loop
• SP changed
– Setpoint changed so SP = PV
– Control algorithm does not move valve
– Operator must reset SP if desired
– No bump
• Be consistent
– do not surprise the operators
AC
AC SP
PV
Initialization Recommendations
• Fix SP for
– Level controllers
– Critical pressure controllers
– Critical temperature controllers
– Analyzer controllers
– Constraint controllers
– Model based inferential controllers
• Change SP for
– Flow controllers
– Non-critical pressure controllers
– Non-critical temperature controllers
• Some systems change SP only within SP clamps
• Be consistent
Other Algorithms
• Modifications can be made to standard PID
• Most common is replace error by PV in proportional
and derivative terms
– Used when tuning for load rather than SP changes
– Reduces proportional “kick” when SP changes
– Allows higher controller gain to be set for improved load
response
– Integral action still allows PV to “ramp” back to the SP
• Equation given by :
PV*
SP
PV
Algorithm selection
• 4 possibilities
– SP response proportional on error (use for MVPC)
› Fastest approach to SP
› use for all secondaries
– SP response proportional on PV
› Compromise
– Load response proportional on error
› Do not use, “worst of both worlds”
– Load response proportional on PV
› Best load response
› use for some primaries if setpoint rarely changed
Traditional Methods
• Technical problems
– Do not limit MV overshoot
– Developed for QAD which is not that good
– Developed for load tuning not SP tuning
– Developed for analogue PID not modern day PID
• Practical problems
– Time consuming
– Experience, skill shortage
– Selection of correct criteria/algorithm
• Results in control performance not optimum
• Consider only as a starting point
Advanced Control Techniques PID 4-61
Hi-Spec Solutions
Profit PID
• Honeywell has developed a computer method
called Profit PID (robust PID)
– This provides a complete tuning environment on the
PC for obtaining optimal tuning for your PID
Controllers
– Use for difficult PID loops
– Particularly those that are to be incorporated as the
“ultimate secondaries” of advanced or multivariable
control schemes
• This is covered later in the course as an example of
computer-based methods
Advanced Control Techniques PID 4-63
Hi-Spec Solutions
Kc = KcEU* PVrange
MVrange
Tuning Guidelines
• Tune filter first
• Simple fast loops can be tuned by trial and error
only (e.g. most flow controllers)
• Use established tuning method e.g. open loop
• Monitor performance and use experienced trial and
error
• Document results to refer back to later
Setup
Can Import
Tag List as
text file
Main
Functions
Or enter tag
manually
Conclusion
• There is more to PID than meets the eye
• There are several options for configuration under
different circumstances
• Trial and error is still useful but is often slow and
laborious
• Trial and error gave way to open loop steps and
Ziegler-Nichols involving calculating dynamics
which has now given way to computer-based
techniques for “difficult” loops