You are on page 1of 10

(https://pidexplained.

com/)

PID Controller Explained


by DC - PID Explained
(https://pidexplained.com/author/admin/) | Posted on
November 24, 2018 (https://pidexplained.com/pid-controller-
explained/)

c A PID (Proportional Integral Derivative) controller works by


controlling an output to bring a process value to a desired set
point.

c See post “WHAT IS A PID CONTROLLER?


(https://pidexplained.com/what-is-pid/)” for a basic example of
a PID controller. And also the PID Simulator
(https://pidexplained.com/pid-simulator/) page to use a live
PID Simulator!

Before we dive into the PID controller, there is a few terms that
need de ned:

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if
PID Controller Terms:
you wish. Cookie settings ACCEPT
Set Point
The set point is normally a user entered value, in cruise control
it would be the set speed, or for a heating system, it would be
the set temperature.

Process Value
The process value is the value that is being controlled. For cruise
control this would be the actual vehicle speed, or in a heating
system, this would be the current temperature of the system.

Output
The output is the controlled value of a PID controller. In cruise
control, the output would be the throttle valve, in a heating
system, the output might be a 3 way valve in a heating loop, or
the amount of fuel applied to a boiler.

Error
The error value is the value used by the PID controller to
determine the how to manipulate the output to bring the
c process value to the set point.

Error = Setpoint – Process Value

PID Controller Explained!


The basic explanation of a PID controller. The PID controller is
continuously monitoring the error value, and using this value,
calculates the proportional, the integral and the derivative
values. The controller then adds these three values together to
create the output.

Below we will dive into the proportional, integral and derivative


This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if
as three separate equations, then add them together to create
the output, but rst, we needyou
to wish. Cookie
talk about settings
the user ACCEPT
input values
in the PID controller… the gain settings (P-Gain, I-Gain and D-
Gain).

Gain
Gain is the term used for “multiplication factor”. By adjusting the
-
gain settings (or multiplication factor) of the proportional, the
integral and the derivative, the user can control how much
e ect the PID controller has on the output, and how the
controller will react to di erent changes in the process value.

P or Proportional
The Proportional is
calculated by
multiplying the P-
Gain by the error.
The purpose of the
proportional, is to
have a large
immediate reaction
on the output to Tuning the Proportional Value

bring the process


c value close to the set point. As the error becomes less, the
in uence of the proportional value on the output becomes less.

The Proportional math looks like this:


c

P = Proportional | kP = Proportional Gain | SP = Set point | PV =


Process Value | Err = Error

Err = SP – PV

P = kP x Err

I or Integral
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if

you wish. Cookie settings ACCEPT


The Integral is calculated
by multiplying the I-Gain,
by the error, then
multiplying this by the
cycle time of the
controller (how often the
-
controller performs the
PID calculation) and Tuning the Integral Value
continuously
accumulating this value as the “total integral”.

Explained a little further, every time the controller performs the


PID calculation (example of a cycle time is every 100 ms), the
new calculated integral value, is added to the integral total. The
integral will normally not have as much immediate in uence on
the output as the proportional, but because the integral is
continuously accumulating overtime, the longer it takes for the
process value to reach the set point, the more e ect the integral
will have on the output.

And the Integral math:

I = Integral | kI = Integral Gain | dt = cycle time of the controller

c | It = Integral Total

I = kI x Err x dt

c It = It + I

D or Derivative
The derivative is
calculated by multiplying
the D-Gain by the ramp
rate of the process
value. The purpose of

Thisthe derivative
website uses is to
cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if
“predict” where the you wish. Cookie settings ACCEPT
process value is going,
and bias the output in
the opposite direction of
the proportional and
integral, to hopefully
prevent the controller
-
from over-shooting the
set point if the ramp
rate is to fast.

Explained a bit simpler,


if the process value is Tuning the Derivative Value
approaching the set
point to fast, the derivative will limit the output to prevent the
process value from overshooting the set point.

The Derivative Math:

D = Derivative | kD = Derivative Gain | dt = cycle time of the


controller | pErr = Previous Error

D = kD x (Err – pErr) / dt

c
Output
The PID controller output is calculated by simply adding the
Proportional, the Integral and the Derivative. Depending on
c the gain setting of these three values, will determine how much
e ect they will have on the output.

PID Controller Output Math:

Output = P + It + D

All together a PID control loop looks like this;


Err = Sp – PV
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if

you wish. Cookie settings ACCEPT


P = kP x Err
It = It + (Err x kI x dt)

D = kD x (pErr – Err) / dt

pErr = Err

- Output = P + It + D

Wait dt (100 ms), and perform loop again.

Tuning a PID controller


Check out this post to learn how to tune a PID controller
(https://pidexplained.com/how-to-tune-a-pid-controller/) and
how to set one up from scratch.

(https://www.microsoft.com/en-us/p/pid-
simulator/9nbcz6qq5djs?activetab=pivot:overviewtab)

c To practice PID control loops, download the PID Simulator App


(https://www.microsoft.com/en-us/p/pid-
simulator/9nbcz6qq5djs?activetab=pivot:overviewtab) from
the Microsoft Store! (https://www.microsoft.com/en-us/p/pid-
simulator/9nbcz6qq5djs?activetab=pivot:overviewtab)

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if

you wish. Cookie settings ACCEPT


What is a PID Controller

Watch this video for to learn more about PID controllers

Shop Related Products

Inkbird F Display PID Temperature Digital PID Temperature Controller


Controllers… (https://aax-us- 100-240V + max.… (https://aax-us-
c east.amazon- east.amazon-
$39.99
adsystem.com/x/c/QvRwHfE1wpS… $21.59
adsystem.com/x/c/QvRwHfE1wpS…
adId=B01N1ZUGUZ&creativeASIN…
(233) adId=B01LXRTWSU&creativeASIN…
(17)
20&linkCode=w41&ref- 20&linkCode=w41&ref-
refURL=https%3A%2F%2Fpidexpla… refURL=https%3A%2F%2Fpidexpla…
controller- controller-
c explained%2F&slotNum=0&imprT… explained%2F&slotNum=0&imprT…
nCq43lLbqU5CNiWSRaWg&adTyp… nCq43lLbqU5CNiWSRaWg&adTyp…

Inkbird AC 100 to 220V ITC-100VH bayite Temperature Controller


Outlet Digital PID The… (https://aax- BTC201 Pre-Wired Digital Out…
us-east.amazon- (https://aax-us-east.amazon-
$39.99
adsystem.com/x/c/QvRwHfE1wpS… $28.99 $30.99
adsystem.com/x/c/QvRwHfE1wpS…
adId=B01489AQAW&creativeASIN…
(70) adId=B01KEYDNKK&creativeASIN…
(869)
20&linkCode=w41&ref- 20&linkCode=w41&ref-
Ads by Amazon (https://aax-us-east.amazon-adsystem.com/x/c/QvRwHfE1wpSUc_ilAvuBNroAAAF0e1217gEAAAE0AW9jvsU/https://affiliate-
program.amazon.com/home/ads/ref=sm_n_au_dka_PK_logo?adId=logo&creativeASIN=logo&linkId=b1a4175047588a0754cf8f61e9d87917&tag=dconlineads-
20&linkCode=w41&ref-refURL=https%3A%2F%2Fpidexplained.com%2Fpid-controller-explained%2F&slotNum=0&imprToken=s-
nCq43lLbqU5CNiWSRaWg&adType=smart&adMode=auto&adFormat=grid&impressionTimestamp=1599797572780&ac-ms-src=nsa-ads&cid=nsa-ads)
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if
(https://aax-us-east.amazon-
adsystem.com/x/c/QvRwHfE1wpSUc_ilAvuBNroAAAF0e1217gEAAAE0AW9jvsU/https://www.amazon.com/adprefs/ref=sm_n_au_dka_PK_ac?
tag=dconlineads-20&linkCode=w41) you wish. Cookie settings ACCEPT
Uncategorized (https://pidexplained.com/category/uncategorized/)

PID Controller (https://pidexplained.com/tag/pid-controller/)

PID Example (https://pidexplained.com/tag/pid-example/)

- PID Explained (https://pidexplained.com/tag/pid-explained/)

PID made simple (https://pidexplained.com/tag/pid-made-simple/)

What is a PID controller (https://pidexplained.com/tag/what-is-a-

pid-controller/)

About the author


A licensed industrial electrician, licensed auto
mechanic, and PLC programmer. Passionate about
what I do, and love helping people learn!

c
Related Posts

July 22, 2020 July 22, 2020


PID for PID
c (https://pidexplained
Dummies Simulator
is-pid/)
(https://pidexp App!
for- (https://pidexp
November
dummies/) simulator-
24, 2018
app/)
What is a
PID
Controller?
(https://pidexp
is-pid/)
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if

you wish. Cookie settings ACCEPT


Comments
- RV (https://pidexplained.com/wp-login.php?
Log in to Reply
redirect_to=https%3A%2F%2Fpidexplained.com%2Fpid-controller-
explained%2F)
April 12, 2020 at 5:06 pm(https://pidexplained.com/pid-controller-
explained/#comment-9)
Thank you
This is one of the best PID explanations I’ve seen…
and I have seen MANY.

LogDC - PID
in to Explained
Reply (https://www.pidexplained.com)
(https://pidexplained.com/wp-login.php?
May 4, 2020 at 10:01 pm(https://pidexplained.com/pid-controller-
redirect_to=https%3A%2F%2Fpidexplained.com%2Fpid-controller-
explained%2F)
explained/#comment-12)
Thanks for the comment RV, your feedback is
appreciated!

LogHenri
in to Reply (https://pidexplained.com/wp-login.php?
January 22, 2020 at 1:00 pm(https://pidexplained.com/pid-
redirect_to=https%3A%2F%2Fpidexplained.com%2Fpid-controller-
explained%2F)
controller-explained/#comment-5)
c
Hi, what order of process did you use? I assume a
rstorder proces with an ajustable deadtime? It
would bij nice if the other parameters of the process
c were adjustable not only the deadtime.

LogDC - PID
in to Explained
Reply (https://www.pidexplained.com)
(https://pidexplained.com/wp-login.php?
January 28, 2020 at 11:19 pm(https://pidexplained.com/pid-
redirect_to=https%3A%2F%2Fpidexplained.com%2Fpid-controller-
explained%2F)
controller-explained/#comment-8)
Hi Henri, we would be glad to take this into
consideration for future updates. Can you provide
some input on the parameters that you would like
to cookies
This website uses see adjustable?
to improve your experience. We'll assume you're ok with this, but you can opt-out if

you wish. Cookie settings ACCEPT


LogDan
in to Reply (https://pidexplained.com/wp-login.php?
December 17, 2018 at 4:12 pm(https://pidexplained.com/pid-
redirect_to=https%3A%2F%2Fpidexplained.com%2Fpid-controller-
explained%2F)
controller-explained/#comment-2)
Great explanation!

Leave a Reply
You must be logged in (https://pidexplained.com/wp-
login.php?
redirect_to=https%3A%2F%2Fpidexplained.com%2Fpid-
controller-explained%2F) to post a comment.

Copyright PID Explained (https://pidexplained.com/). All rights reserved. | Powered by WordPress


(https://wordpress.org/) & Writers Blogily Theme (https://superbthemes.com/writers-blogily/)

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if

you wish. Cookie settings ACCEPT

You might also like