Author Topic: Explnation of PID control.  (Read 3225 times)

Offline Julian

  • Administrator
  • Oil baron
  • *******
  • Posts: 6389
    • Used Cooking Oil Collection website
  • Location: East Surrey, UK.
Explnation of PID control.
« on: April 13, 2014, 06:05:22 PM »
Been doing a bit of idle Googling and came across this explanation of the function of a PID controller.  It's probably the best I've read yet, putting things in mechanical terms that are just about comprehendable ...


Your PID algorithm has proportional, integral and derivative components. I think of it in terms of a mechanical system, like the classic 'mass spring damper' model of a car suspension system. The proportional component corresponds to the spring. When you increase the gain on this component, the system moves more quickly in response to an input. The derivative component is the damper. When you increase the gain on this component, it opposes any movement. The integral component is like a ride height leveler. When you increase the gain on this component, the system is quicker to eliminate long-term errors.

All three components have a part to play but you need to find the right balance between them. At the moment it sounds as if your system is under damped and you are looking for critical damping, so you need to increase the damping (derivative) component a little. If the response becomes sluggish, you've gone too far. Usually, the optimum damping is the minimum necessary to prevent overshoots. Note that the proportional and derivative components interact with each other and if you change the proportional component you may need to adjust the derivative component again to get back to critical damping.
Used Cooking Oil Collection website ... http://www.surreyusedcookingoilcollection.palmergroup.co.uk

Offline Tony

  • Administrator
  • Oil baron
  • *******
  • Posts: 5110
  • Fo' shizzle, biodizzle
    • Southampton Waste Oil Collection
  • Location: Southampton
Re: Explnation of PID control.
« Reply #1 on: April 13, 2014, 06:32:19 PM »
One of my crazy jobs was doing PID control for underwater vehicles, manned and unmanned (pipeline surveying, towing barges for target practise).  The PIDs controlled thrusters and various flying surfaces in many different configurations, and the challenge was tuning the many PIDs to play nicely in all configurations.  Not just for correct thrust or angle given a demand, but for correct vehicle movement without overshoot, and without overshoot off a target track in three dimensions.

The extra fun bit was that I wrote the PID software too rather than use any 3rd party kit, all running on a little embedded micro.

So from my experience:

P = proportional - the further from the setpoint, the greater the energy put in to returning to that set point.  It is instantaneous with no history.
I = integral - a historic factor that can be used to either get more force returning to the set point, or contribute to damping to prevent overshoot.
D = differential - used to absorb long term errors (offset from a setpoint that would otherwise be there)
« Last Edit: April 13, 2014, 06:35:45 PM by Tony »

Offline Bill

  • Oil stirrer
  • **
  • Posts: 93
  • Location: Leicester
Re: Explnation of PID control.
« Reply #2 on: April 13, 2014, 07:42:02 PM »
Wow!
Anyone else think that autotune on a PID controler is a great idea?
Still forever scrabbling up the learning curve.
Seat Altea 2004 & Fiat Scudo 2004 both 100%BD
Both sold
Skoda fabia 2012 on B50 since 2017

Offline Tony

  • Administrator
  • Oil baron
  • *******
  • Posts: 5110
  • Fo' shizzle, biodizzle
    • Southampton Waste Oil Collection
  • Location: Southampton
Re: Explnation of PID control.
« Reply #3 on: April 13, 2014, 08:00:10 PM »
Definitely!

Though in our case PID is overkill really, it's not like it will overshoot a temperature set-point due to momentum like a motor or vehicle would.

Really we only need the P component for heating oil.

Offline Julian

  • Administrator
  • Oil baron
  • *******
  • Posts: 6389
    • Used Cooking Oil Collection website
  • Location: East Surrey, UK.
Re: Explnation of PID control.
« Reply #4 on: April 13, 2014, 08:14:07 PM »
One of my crazy jobs was doing PID control for underwater vehicles, manned and unmanned (pipeline surveying, towing barges for target practise).  The PIDs controlled thrusters and various flying surfaces in many different configurations, and the challenge was tuning the many PIDs to play nicely in all configurations.  Not just for correct thrust or angle given a demand, but for correct vehicle movement without overshoot, and without overshoot off a target track in three dimensions.

The extra fun bit was that I wrote the PID software too rather than use any 3rd party kit, all running on a little embedded micro.

So from my experience:

P = proportional - the further from the setpoint, the greater the energy put in to returning to that set point.  It is instantaneous with no history.
I = integral - a historic factor that can be used to either get more force returning to the set point, or contribute to damping to prevent overshoot.
D = differential - used to absorb long term errors (offset from a setpoint that would otherwise be there)

You've kept that chunk of expertise quiet for a long time ... you know there's a big hole in the wiki where HC started a page on PIDs (or was that why you kept it quiet?)
Used Cooking Oil Collection website ... http://www.surreyusedcookingoilcollection.palmergroup.co.uk

Offline therecklessengineer

  • Administrator
  • Oil obsessive
  • *****
  • Posts: 648
Re: Explnation of PID control.
« Reply #5 on: April 14, 2014, 08:04:01 AM »
Agreed, PID is way overkill for what we use. However, it's so standard in industry that the controllers are dirt cheap - that's more the reason why we use them.

I've tuned a few PID control loops by hand as well, although nothing like Tony's achievement. Most recently, a control loop around a cooling system for various bits of plant incorporating a 3-way proportional valve and a pump with a variable speed drive fitted. The result is quite pleasing - slashed the electrical consumption of the plant by about 15%.

It's really quite difficult to explain their operation without delving into some heavy maths. What helps me tune one is imagining I am standing in front of the controls and the only information I have about the plant is what is coming in from the sensor(s) attached to the controller. Which knob do you twiddle, which way and how hard to keep the set point?

If you twiddle hard to bring the set point back under control, you need more P.
If you have to back off to reduce overshoot, less P

If the set point is tracking close, but a little off, you need more I.
If over time, the system 'hunts' you need less I.

If after twiddling hard to recover the set point from above, you need to twiddle back again to stop overshoot, you want more D.
If all hell has broken loose and it's uncontrollable, you need less D.

There are more accurate methods, but generally that involves some logging and later analysis of the system, but the above normally gets a system reasonably responsive.

Offline Julian

  • Administrator
  • Oil baron
  • *******
  • Posts: 6389
    • Used Cooking Oil Collection website
  • Location: East Surrey, UK.
Re: Explnation of PID control.
« Reply #6 on: April 14, 2014, 08:44:29 AM »
Another potential author for the PID page!
Used Cooking Oil Collection website ... http://www.surreyusedcookingoilcollection.palmergroup.co.uk

Offline therecklessengineer

  • Administrator
  • Oil obsessive
  • *****
  • Posts: 648
Re: Explnation of PID control.
« Reply #7 on: April 14, 2014, 09:22:35 AM »
I volunteer Tony.  :P