ContTROL So.utions, Inc
BV nseter
PID for Dummies
“personally have afew hundred dollars worth
cf books on controls 1D algorthms, and Be Fee i quero
10 tuning, Since I 3m an engineer, stand a eg ee
hance of understanding some of But where rm
0 you go you want to understand PID
witout Pnb? fan Paacoct has wren some
very goou mateal about PID wrich simples
Understancing. What flloms here san exearpe
from nis laos Culde to PID Agortrms,
Teprirted with is permission. {cont make &
time of tis endorsement. 1 smply provide
fs introduction aecause I found Hans
mater tobe an exealent smplfied
Glscusson of PID." is Rogerson
ix of 1/0 points and a soft PLC with
‘raphical programming that inclu
Web enabled,
programming In BASIC!
Check it out here!
Anatomy Of A Feedback Control System
Here is the classic block diagram of a process under PID Contra
Setpoint (5°)
What's going on this diagram?
‘The Setpoint (SP) isthe value that we want the process tobe
For example, the temperature control system in our house may have a SP of 22°C. This means that
“we want the heating and cooling process In our house to achieve a steady temperature of as close to 22°C as possible”‘The PID controller looks at the setgeint and compares it with the actual value ofthe Process Variable (PV). Back in our house the box of
electronics that is the PID controler in our Heating and Cooling system looks atthe value of the temperature sensor inthe room and sees how
ose fs to 22°C,
If the SP and the Pv are the same then the contrller isa very happy tle box. It doesn't have to de anything, it wil set its output to zero.
Howover, If theres a cisparty between the SP and the PV we have an error and corrective action Is needed In our house tis will ether be
cooling or heating depending on whether tne P is higher or lower than the SP respectively
Let’s imagine the temperature PV in our house is higher
1an the SP, Tes too hot, The air-con i switched on and the temperature drops.
‘The sensor picks up the lower temperature, feeds thet back tothe controller, the controler sees that the “temperature error” is nat as great
because the PV (temperature) has dropped and the aircon is turned down aIitle
This process Is repeated until the house has cooled down to 22°C and there is no error,
‘Then a disturbance hits the system and the controller has to kick in again
In our house the disturbance may be the sun beating down on the rof, raising the temperature ofthe ar inside.
So that’s a really, really basic overview ofa simple feedback control system, Sounds dead simple eh?
Understanding the controller
Unfortunately n the real world we need a controller that Isa bit more complicated than the one described above, if we want top performance
form our loops. To understand wy, me wil be doing some "thought experments” whare we are the controller.
When we have gone through these thought experiments we will appreciat
Wwiny 2 PID algorithm is needed and why/how it works to contrl the
We wil be using the analogy of changing lanes on a freeway on a windy cay. We are the érver, and therefore the controller of the process of
changing the car's poston
Here's the Block Diagram we used before, with the labels changed to represent the car-on-windy-fraeway control lop.
Notice how Important closing the feedback loop I, If we removed the feedback loop we WoUH be In “open loop control, and would have to
control the car's position with our eyes elosed
‘Thankfully we are under “Closed loop control” ~slng our eyes for postion feedback
[As we saw in the nouse-temperature example the controler takes the both te PV and SP signals, which i then puts through a black box to
faletate 9 cantraller output. That controler output is sent to an actuator which moves Lo actualy control the process.
We are interested here in what the black box actually does, which is that it applies 1, 2 oF 3 caleulatons tothe SP and Measured PY signals
+ Proportional (P)
+ tneegrat (1)
+ Derivative (0)
Under The Hood Of The PID Controller
Here's @ simplified block diagram af what the PID controler does:Calculate control actions
‘and multiply each by Error
add up all 3
(subtract PV
from SP)
Controller
Output
1 is really very simple in operation, The PV is subtracted from the SP to create the Error, The eror is simply multiplied by one, two oral of
caleated P, Land D actions (depencing which ones are turned on), Then the resulting "error x contrl actions” are added together and sent
controller output.
‘These 3 modes are used in diferent combinations:
Sometimes used
IO - Sometimes used
D ~ rare as hen’s teeth but can be useful for controlling servemtors.
Derivatives
660 into the control room ofa process plant and ask the operator:
"Whats the derwative of reactor 4's pressure?”
‘And the response wil typically be:
“Bugger off smart arse!”
However go in and ask:
“What's the rate of change of reactor 4's pressure?”
‘And the operator will examine the pressure trend and say something lke
“About 5 PSI every 10 minutes”
He's just performed calculus on the pressure trene! (don tll him though or he'll want a pay raise)
So derivative is just a mathematical term meaning rte-of-change, That’ ll here is ti
Integrals without the Math
Ist any wonder that so many people run scare from the concest of integrals and integration, when ths isa typical definition?Integral
From kei he es enciopedia
Ts atic ie about te cance o ikea in ates For the got of mb, eee negor For ater ses, eo.
Imtegration iss findemertsl concert in cowie, specially i the Feld of scale and, ore bossy,
aerate ania Gian a fiction fof el vale and an teil (22 ef he el ne, the egal
fs
is defied inforal tobe the stgnad tes of a regan inthe plane Bounded by the ora af the ans, and he
ands 6
“Tha ter egal ray alae fer othe ton of sider, fection Fase dries th gen ution fa
tha casei called an indefaiteftegral, whe the integeala dacusced inthis ate ave terme definite
grals Some authors rata a dcition ateen artaniatas an nda intel,
de
‘Tha piles of intertion wee forulsedindsandety by Isa Nein and Gti Let ithe at
severeerth cetuy. Thought ureamertl theorem of c8cuue, which thay ineevendarty developed, ragrion
is connectee wh dete ston fe coninuaustelsusd function defined ans coseu anal [a2 ten, ance
ariariestie FoF is levn the sei acrl of avert items gen 6)
[ feyer= PO) - Feo.
Wat tnet2r?
1 You understood that you are a smarter person than me.
Here's plan English definition:
The integral ofa signal isthe sum of all the mstantaneous values thatthe signal has been, from whenever you started counting untl you stop
counting.
‘0 I you ae to plot your signal on a trend and your signal s sampled every second, and let's say you are measuring temperature, Ifyou were to
Superimpase the integral af the signal over the fst 5 seconds ~ it would Took Ike ths
fa
‘ine (secs)
‘The green line is your temperature, the red circles are where your control system has samp the temperature and the blue area isthe integral
of tye temperature signa. isthe sum af the 5 temperature valves over the time period that you are interested in. In numerical terms it's the
Sum of the areas of each of te blue rectanales:
o3ecs
(19 x 1)(14a)+(13e0) +01240)+(411)
‘The curious units (degrees Celslus x seconds) are because we have fo multiply @ temperature by atime ~ but the units aren't important,
[As you can probably remember from schoo! ~the Integral turns out to be the area under the curve, When we have real world systems, We
‘actually get en approximation tothe area under the curve, which as you can see from the diagram gets better, the faster we sample.
Proportional control
Here's a diagram of te controller when we have enabled only P contro:(subtract PV
from SP)
SP Controller
Output
Error | (multiply Error
In Proportional Only mods, the controler simaly multiplies the Error by the Propertional Gain (Kp) to get the controller
‘The Proportional Gain I the setting that we tune to got our desired performance from 2" only" controller
A match made in heaven: The P + I Controller
1f we put Proportional and Integral Action together, we get the humble PI controller. The Diagram below shows how the algorithm ina PL
controler is calelated.
(subtract PV
from SP) 4
spt En Re Controler
Output
pv
‘The tricky ting about Integral Acton is that I will relly screw up your process unless you know exactly how much Integral ation to apply
‘A good PID Tuning technique wil calculate exactly how much Intagal to apply for your specie pracess- but how is the Integral Acton adjusted
in the fist place?
Adjusting the Integral Action
‘The way to adjust how much Integral Acton you have is by adjusting aterm called "minutes per repeat”. Not @ very intultive name Is I?
‘So where does tis strange name come from? Its a measure of how long it will take for the Integral Action to match the Proportional Action
the proportional box onthe diagram above is 20%, the repeat time isthe time i will take forthe output ofthe
Integral box to get to 20% too,
‘nd the important point to note is thatthe "bigger"
re, so the "minutes per repeat” value willbe smaller.
al action, the quicker ie wil 9
nis 20% value, Thats wll take fewer minutes to getIn other words the smaller the "minutes per repeat” is the bigge
integral act
To make things a bit more intultive alt of controllers use an alternative uit of "repeats per minute” which Is obviously the Inverse of “minutes
per repeat”
‘The ice thing about “repeats per minute" is thatthe bigger it's - the bigger the resulting Integral action is
Derivative Action — predicting the future
(0K, so the combination of P and I action seems to cover allthe bases ané doa pretty good jo of controlling our system. That is the reason that
PL contrllers are the most prevalent. They do the job well encugh and keep things simple. Grea.
aut engineers being engineers are always looking te tweak performance.
‘They €o this ina PID loop by adding the final Ingredient: Derivative Action
So acing derivative acton can allow you to have bigger P and I gains and still keep the loop stable, giving you a faster response and better loop
performance.
I you think about it, Derivative action improves the contralle action because it predicts what is yet to happen by projecting the current rate of
change into the future. This means that is not using the current measured value, buta future measured value
‘The units used for derivative action describe how far into the future you want to leak... If derivative action is 20 seconds, the derivative term
will project the current rate of range 20 seconds Into the future
‘The big problem with D contol that if you have noise on your signal (which looks lke a Bunch of spkes with steep sis) this confuses the hell
cut ofthe algorithm. It looks atthe slope ofthe noise-spe and tanks
Holy crap! This process is changing quickly, lets pile on the D Action!”
‘And your control output jumps all over the place, messing up your control
(F course you can try and fier the noise
but my advice is that, unless PI controls realy slow, don't worry about switching D on.
[Another note from Jim: "Whether learning about PIO ang how the parameters affect perfermance, or trying to tune a process, simulation Is an
imaoreant tol for geting PID right. Finn Peacock has 2 simulation tool avalable that runs in Merosof€ Excel. Over the years, 1have written alot
of aiferen simulation programs while developing PID algorterms for everything rom industrial process controls to sclentineresearen apparatus
fn the NASA Space Shuttle, If this spreac sheet had deen avalabla then, f would nave saved me a lot of time. You can get a copy af tis
simulation tool (screen shot below) as part of the Pro paccege avaiable from Finn Peacock st www nceuning ict, You can al sign up fOr
Finn's free 7-day PID course via email at this link: hita://pidtuning.net/learn-pid-contrald.himl. Again, I con't make a cme off this.
Just found i valuable and wanted co pass Italongis
be
He
le
li
le
li
Ea
le
ls
E
H