Page 1 of 4

PID controllers / autopilot stability

Posted: 26 Oct 2006, 20:19
by TobyV
I was thinking of posting this a while ago, but since an issue to do with autopilot stability was brought up in another thread, I thought it might be useful to make a short post on Proportional Integral & Derivative (PID) controllers. I cant claim to be an expert in this area or that what I have put here is 100% accurate, but hopefully it might help some people to sort autopilot niggles. A PID controller is a very common form of control device containing three terms; proportional, integral and derivative. As part of a closed loop (feedback) control system, these terms each have a "gain" which determines how they effect the control system. If the gain is zero, it is equivalent to that term being missing from the controller. In the real world, they could be implemented by various circuits built around a 741 Operational Amplifier (Op-Amp) chip.

Image

On the x axis of all four graphs is time, t=0 being when the desired level (this could be an altitude, heading speed etc in the case of the autopilot) is selected. On the y axis is the variable to be set, the "desired level" being what has been asked of it, e.g. 20,000ft on an autopilot. The proportional term is the basic term of the controller. If used alone it will never quite achieve the desired level, but will have a steady state error. The addition of the integral term eliminates the steady state error but may introduce an overshoot/ undershoot of the desired level. An integral term can be used alone to bring the variable to its desired level slowly but with no overshoot. The introduction of the derivative term in a PI controller can help to alleviate overshoot and undershoot and bring the variable to its desired level quicker.

Image

If the gains are set incorrectly then an instability may occur. Possible undesirable situations include the failure of the control to acquire the desired level at all, a steady oscillation about the desired level or worst off, oscillating divergence.

To reduce the time taken for the desired level to be achieved, try increasing the Proportional gain.

To reduce the time taken for the desired level to be achieved when it is already close to it, try increasing the integral gain.

To reduce the time taken for the variable to settle out to its desired level, try increasing the derivative gain.

To alleviate a large overshoot of the desired level, try reducing the proportional and integral gains.

If an instability occurs, try reducing all gains and start over!

Obviously there are other factors that influence the whole control system and so there are no magic combinations of gains that will work for all systems!

Posted: 26 Oct 2006, 22:43
by speedbird591
And your point being, Toby? :lol:

Actually, I'm seriously impressed here. Dunno what you're talking about or what I ought to do about it, but I'm seriously impressed, sir.

Ian :smile:

Posted: 26 Oct 2006, 22:46
by DaveB
Seconded Ian. Haven't a clue what its about but second time of looking, I see bits of paper with sine waves on. Impresses me no end :lol:

ATB

DaveB :tab:

Posted: 26 Oct 2006, 22:55
by Garry Russell
:k:

Garry

Posted: 26 Oct 2006, 23:00
by speedbird591
Garry Russell wrote::k:

Garry
Garry's just worried whether it's in the correct forum :lol:

Posted: 26 Oct 2006, 23:05
by MALTBY D
Ha ha, wasted on this uncultured lot. :lol:

I should point out that I asked Toby to post his explaination of PID systems in another thread way over yonder ->
I didn't even know what a PID was, but I do now.

If you look in aircraft.cfg you will see mention of proportional, integral & derivative in the [autopilot] section.

Now, what was the first bit again...

Posted: 26 Oct 2006, 23:12
by MALTBY D
BTW most FS aircraft use proportional & integral, which may explain why the average FS aircraft captures the ILS like in the second of the four pictures.
Not bad, but it could perhaps be better.

I tried using the derivative settings before (Trident autoland), but it never seemed to do much.
Never really knew what it was for though.

DM

Posted: 26 Oct 2006, 23:15
by AlexP
:smile: :shock: :worried: :redface: :dunno:

Might take a few passes (and a few less beers) to fully grasp this!!!

AlexP

Posted: 26 Oct 2006, 23:29
by speedbird591
MALTBY D wrote:If you look in aircraft.cfg you will see mention of proportional, integral & derivative in the [autopilot] section.
OK, done that. I chose the Tinmouse as it is excellent at intercepting the ILS without weaving. Here is the relevant excerpt:

nav_proportional_control=15.00
nav_integrator_control=0.125
nav_derivative_control=9.0
nav_integrator_boundary=0.50
nav_derivative_boundary=5.0
gs_proportional_control=25.00
gs_integrator_control=1.00
gs_derivative_control=0.00
gs_integrator_boundary=0.50
gs_derivative_boundary=0.00

So is this all the FDE writer has done to improve this aspect of FS9? I guess it can't be quite so straightforward otherwise everybody would have done it :worried:

EDIT: The Tinmouse does rely on using the FSUIPC module quite a bit. Perhaps this is the magic ingredient.

Ian

Posted: 26 Oct 2006, 23:32
by TobyV
Ok to sum it up in a nutshell, and I'm typing this after a few beers, this stuff is in the aircraft.cfg and it affects the way your autopilot works (in each a/c). If you select a particular altitude and it takes a long time to achieve that alt, e.g. perhaps your a/p overshoots its designated altitude or is slow to repsond or perhaps it oscillates about the altitude you have input; these variables control how your autopilot behaves and assuming M$ have defined the mathematics correctly, it should behave like a real-world PID controller... which is how a basic analogue autopilot would probably behave. If the likes of DM and RP understand it, you have nothing to worry about :smile: :wink: