PID controller

Status
Not open for further replies.

Thread Starter

Ian0

Joined Aug 7, 2020
13,112
AAC is always a good place for recommending books.
Any recommendations for a good book on PID controller theory and implementation.
 

strantor

Joined Oct 3, 2010
6,875

tindel

Joined Sep 16, 2012
939
... is either too theoretical or too dumbed down.
I agree with you on dumbed down - there's way too much of that out there with our 1 minute attention spans. (AAC is guilty of this)

I don't know how you can properly design a PID controller without knowing the theory behind it. Once you learn the theory then it's not too hard to tune-in a system if you've designed in the proper hooks to do so.

For in depth theory:
Franklin, Powell & Emami-Naeini, Feedback Control of Dynamic Systems, 8th Edition | Pearson

This used to be a great article, but it looks like the figures are missing for me... but maybe not for you
What's All This P-I-D Stuff, Anyhow? | Electronic Design

This guy has a good series on PID

This book is a great to have on hand from an analog perspective - I don't remember specifics, but there is probably some PID stuff in it.
Analog Circuit Design: Art, Science and Personalities (EDN Series for Design Engineers): Williams, Jim: 9780750696401: Amazon.com: Books
 

crutschow

Joined Mar 14, 2008
38,400
If you want to do feedback control with a micro, I suggest also reading about Fuzzy Logic.
It's relatively easy to understand, and more readily handles non-linear control systems (as many systems are).
PID is based on the premise that the system is linear.
Here's a good tutorial.
 

MrChips

Joined Oct 2, 2009
34,698
I can give you a quick introduction to PID control.

P = proportional
I = integral
D = derivative

You can make a controller with P alone, PI, PD, or PID.

Let us use a temperature controller for an oven as an example.
Ttarget is the temperature you wish to attain.
T is the present measured temperature
Terror = Ttarget - T

In a controller, the goal is to bring Terror to zero as quickly and smoothly as possible.
For this we need to develop three parameters or multipliers (i.e. gain):
Kp
Ki
Kd

P controller

V = Kp x Terror

where V represents the voltage (or controlling parameter) applied to the system to reach the target.
Here we can see that we need to increase the voltage when the error is large. We reduce the voltage to zero when the target is reached.

PI controller

V = Kp x Terror + Ki x sum(Terror)

In the P controller, we can imagine that when the target temperature is attained, the temperature will tend to drift away if the controller voltage V is set to zero. We need to maintain a steady voltage to maintain the status quo. That is where the integral term comes into play.

What is the integral?
The integral is the summation over time of repeated error measurements. When we are far away from the target the error is large. When we have reached the target the error will oscillate about zero. Over time the integral will settle to a finite value that represents this DC offset that needs to be applied to the controlling voltage.

PID controller

V = Kp x Terror + Ki x sum(Terror) + Kd x rate_of_change(Terror)

The derivative term introduces the rate of change of the error.
Rate of change is measured as ΔTerror/Δtime

Imagine that this is a heated oven and someone opens the door of the oven.
The temperature falls suddenly. The rate of change is a measurement of how quickly the temperature changed over a given time, for example, 5 seconds.

The derivative term allows the controller to make quick corrections due to perturbations, i.e. rapidly changing conditions.

So that is a PID controller in a nutshell.

Tuning a PID controller involves performing various tests or via trial and error in order to determine the appropriate values for Kp, Ki, and Kd.

Edit:
If your K values are too low, the system will be slow to reach the target or may never reach the target.
If your K values are too high, the system will overshoot the target and may oscillate about the target.
Choosing the right values of K will allow the system to reach the target as quickly as possible and not overshoot or oscillate.
 

MisterBill2

Joined Jan 23, 2018
27,311
You can go to the "Automation Direct" website and study the application notes for their controllers. It will not make you an expert, but you will understand more. And it is free.
 

Thread Starter

Ian0

Joined Aug 7, 2020
13,112
Thanks everyone.
Bob Pease’s article is, as always, brilliant.
I located an old edition of Franklin, Powell & Emami-Naeini, for £4.35, which is rather better that the £253 that they wanted for a new copy, and decided it was really time I owned a copy of Jim Williams’ book.

Then I decided to have a go, and applied it to a thyristor battery charger, with pretty good results.
Would I be expecting the Integral and Derivative terms to be quite small?

One thing I did learn is that a battery charger seems to be at its least stable where it is transitioning from constant current to constant voltage.
That must be the point where the output impedance changes from almost infinite to almost zero.
 

crutschow

Joined Mar 14, 2008
38,400
That must be the point where the output impedance changes from almost infinite to almost zero.
That's the type of non-linear condition, that a PID controller may need additional circuitry to handle.
Perhaps a change in the PID parameters are needed when the transition is made.
 

tindel

Joined Sep 16, 2012
939
Thanks everyone.
Bob Pease’s article is, as always, brilliant.
I located an old edition of Franklin, Powell & Emami-Naeini, for £4.35, which is rather better that the £253 that they wanted for a new copy, and decided it was really time I owned a copy of Jim Williams’ book.
Glad you found that post helpful :D Old editions will generally get the job done!

Then I decided to have a go, and applied it to a thyristor battery charger, with pretty good results.
Would I be expecting the Integral and Derivative terms to be quite small?
Depends on the plant - every plant is different and we clearly don't know your plant. It also depends on where your integral and derivative terms are sourced (Kp, Ki, Kd vs Tp, Ti, Td, digital vs analog, etc.)
 

Thread Starter

Ian0

Joined Aug 7, 2020
13,112
That's the type of non-linear condition, that a PID controller may need additional circuitry to handle.
Perhaps a change in the PID parameters are needed when the transition is made.
I never thought it was the best thing to try it out on! It was just convenient.
I thought it was so non-linear it might have a hard time. A bit more fiddling with the derivative and I could have a very good charger.
 

Thread Starter

Ian0

Joined Aug 7, 2020
13,112
I was struck by how much this resembles the type III compensation amplifier for switched mode power supplies.
(Figure 32 in https://www.ti.com/seclit/ml/slup340/slup340.pdf )
Rcomp is ”proportional”, Ccomp is “integral”, and Cff is “differential”
Even Chf fits, as it is the single sample period delay.
I suppose it stands to reason, really.
 

MisterBill2

Joined Jan 23, 2018
27,311
Considering that a switching power supply is a digital version of a regulated power supply, which IS a feedback servo system, the similarity is certainly to be expected. And good thinking, as well.
 

tindel

Joined Sep 16, 2012
939
I was struck by how much this resembles the type III compensation amplifier for switched mode power supplies.
(Figure 32 in https://www.ti.com/seclit/ml/slup340/slup340.pdf )
Rcomp is ”proportional”, Ccomp is “integral”, and Cff is “differential”
Even Chf fits, as it is the single sample period delay.
I suppose it stands to reason, really.
While they do resemble each other - they are NOT the same. Further analysis will show that Type III only allows for real poles/zeros while PID can implement complex poles/zeros.
 

crutschow

Joined Mar 14, 2008
38,400
I was struck by how much this resembles the type III compensation amplifier for switched mode power supplies.
Yes.
To analyze the feedback loop dynamics of a switching converter, the PWM converter can be linearized by substituting a linear control-voltage to output-voltage control block (with the assumption that the switching frequency is so high that it doesn't significantly affect the loop).
 
Status
Not open for further replies.
Top