Board index FlightGear Development Aircraft Autopilot and route manager

Why no Ki or Kd in PID controller?????

Designing a stable autopilot is one of the hardest things. Need help?

Why no Ki or Kd in PID controller?????

Postby Octal450 » Wed Jan 25, 2017 9:35 pm

As the title said, how come FGFS's PIDs don't use Ki or Kd?

I know PI simple has Ki.
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: Why no Ki or Kd in PID controller?????

Postby zakalawe » Thu Jan 26, 2017 12:24 am

My understanding is the original author, who was versed in control theory, felt the values provided in our PID controller were the ones normally used in industry and standard practice. I must admit I have never questions this statement, but I have often wondered about having simple Ki and Kd terms. The PI controller does have Ki (from memory), which gives a rather odd contrast between the two
zakalawe
 
Posts: 1259
Joined: Sat Jul 19, 2008 5:48 pm
Location: Edinburgh, Scotland
Callsign: G-ZKLW
Version: next
OS: Mac

Re: Why no Ki or Kd in PID controller?????

Postby curt » Thu Jan 26, 2017 12:36 am

The controller uses the Ti and Td parameters to control the integral and differential behavior. Roughly: Ki = Kp / Ti and Kd = Kp * Td. If you look around the web for basic PID tutorials and tuning tutorials you may see a few places that suggest that a controller with specific fixed Ti and Td values will have a specific behavior (in terms of convergence versus overshoot.) So the end result is you can pick Ti and Td ahead of time without knowing anything about your system and then tune a single Kp number to scale for your specific application. Often people suggest a value of 3 for Ti as a good balance between convergence speed and overshoot. PID tuning is a deep deep rabbit hole, but this is the logic behind the choice of configuration parameters.

All that said, in my own real world UAV work, I've moved to a more standard formulation of the PID controller and actually like it better. I haven't proposed it to the FlightGear project, but it might bring FlightGear gain tuning strategies more in line with the literature.

The velocity form of the PID algorithm (which is the flightgear default) doesn't suffer from any integrator wind up issues (one of it's strengths), but is very sensitive to a noisy input signal.
Aerospace Engineering and Mechanics
University of Minnesota
curt
Administrator
 
Posts: 1168
Joined: Thu Jan 01, 1970 1:00 am
Location: Minneapolis, MN

Re: Why no Ki or Kd in PID controller?????

Postby Octal450 » Thu Jan 26, 2017 4:25 am

Hmm. Interesting.
I think it might be a nice thing to add Ki and Kd, at least optionally.

I've noticied it's very very sensitive to noisy input signal, I'm trying to use a conditional max-rate-of-change to address this, as it cause some stability issues for really complex 3 or 4 stage PIDs I'm trying to build for ITAF.
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: Why no Ki or Kd in PID controller?????

Postby curt » Thu Jan 26, 2017 1:11 pm

Hi itouchpods, the pid code is constructed around the Ti and Td parameters, but there is an equivalency between Ti and Ki as well as Td and Kd via the formulas in my previous message. The advantage to this approach is that Kp becomes something like a global gain on the whole system. FlightGear does support a simple PI controller which is the more classic form, however, it's very simple and there are many improvements that could be made to it (for example I don't think it has any anti-integrator windup protection.) Longer term it would be good to improve the simple pi controller to be a full fledged pid controller in the classic form.

By the way, I'm slightly curious where you are using 4 cascading stages in your controller? I've never used more than 2.
Aerospace Engineering and Mechanics
University of Minnesota
curt
Administrator
 
Posts: 1168
Joined: Thu Jan 01, 1970 1:00 am
Location: Minneapolis, MN

Re: Why no Ki or Kd in PID controller?????

Postby Octal450 » Thu Jan 26, 2017 2:21 pm

Makes sense.

I'm doing this in for more realistic FLCH in my ITAF. In reality, FLCH CLB minimums is not a set pitch angle, but 100fpm. So I do it this way:

Target speed/10sec predict airspeed/mach to VS.
VS to target pitch degree.
Target pitch degree to elevator.

That is three 3 stage one.
The four stage is a secret. I can't leak it quite yet.
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: Why no Ki or Kd in PID controller?????

Postby Soitanen » Thu Jan 26, 2017 3:59 pm

Pitch channel can be easily controlled via normal load factor, that requires PID for elevator control. All other inputs can be calculated via normal equations, without magic PID controllers.
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 7:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: Why no Ki or Kd in PID controller?????

Postby Octal450 » Thu Jan 26, 2017 6:01 pm

Care to explain more about normal equations?
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: Why no Ki or Kd in PID controller?????

Postby Soitanen » Sun Jan 29, 2017 11:16 am

it0uchpods wrote in Thu Jan 26, 2017 6:01 pm:Care to explain more about normal equations?

Sure, I'll show in reverse direction.

1. Elevator control.
Input - target G-load
Reference - current G-load
Output - elevator position
Here we really need PID controller. Though in my 738 autopilot I use only simple PI controller without D.

2. G-load calculation.
Input - target pitch
Reference - current pitch
Output - target G-load
Simple gain + correction for bank angle (1/cos(roll)).

3. Target pitch calculation.
Input - target vertical speed, alpha, TAS.
Output - target pitch.
Expression, which uses relationship between TAS, alpha and vertical speed.

This chain is stable independent on any mode (VS, LVL CHG or something else). You just feed target VS into calculation and get aircraft follow this value.

4. This is calculation of vertical speed. It depends on selected AFDS mode. Simpliest - just VS hold.
If we say about LVL CHG, I use relationship between TAS, alpha, total thrust and total drag, weight of aircraft and target speed difference. You can see example in 738 737-fcc-a.xml lines 485-527. No PID. Earlier I used PID for this, but it's good for automatic, but bad for FD mode. If you don't follow FD bar very good, it start to go somewhere in bad position, due to nature of PID controller.
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 7:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: Why no Ki or Kd in PID controller?????

Postby Thorsten » Sun Jan 29, 2017 11:42 am

To give a visual picture of what Soitanen just said:

If you want to make a ball follow a certain curve, you can create a suitably formed trough, and it's always going to roll down the lowest point of that trough eventually - but it might oscillate around that or bounce now and then. It has a lot of dynamics. That's the PID controller.

However, if you know the curve up-front and don't need to adapt to anything, you can set it on a rail and simply move it along, giving it no dynamics. That's the equation.

You use a PID controller only if you need to adapt so something which you can't compute in your equation, otherwise it's an overkill.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Why no Ki or Kd in PID controller?????

Postby zakalawe » Sun Jan 29, 2017 3:44 pm

Soitanen wrote in Sun Jan 29, 2017 11:16 am:Sure, I'll show in reverse direction.

This chain is stable independent on any mode (VS, LVL CHG or something else). You just feed target VS into calculation and get aircraft follow this value.

4. This is calculation of vertical speed. It depends on selected AFDS mode. Simpliest - just VS hold.
If we say about LVL CHG, I use relationship between TAS, alpha, total thrust and total drag, weight of aircraft and target speed difference. You can see example in 738 737-fcc-a.xml lines 485-527. No PID. Earlier I used PID for this, but it's good for automatic, but bad for FD mode. If you don't follow FD bar very good, it start to go somewhere in bad position, due to nature of PID controller.

That's a really nice explanation, thanks for providing it!
zakalawe
 
Posts: 1259
Joined: Sat Jul 19, 2008 5:48 pm
Location: Edinburgh, Scotland
Callsign: G-ZKLW
Version: next
OS: Mac

Re: Why no Ki or Kd in PID controller?????

Postby Octal450 » Sun Jan 29, 2017 5:09 pm

I agree!
Thanks @Soitanen, @Thorsten

I'll try to work on this, and report how it goes.

Cheers
J
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: Why no Ki or Kd in PID controller?????

Postby curt » Sun Jan 29, 2017 5:19 pm

Beware, it seems like any time I have a conversation with anyone about PID and flight controllers it causes me a lot of work (and rework)! :-)
Aerospace Engineering and Mechanics
University of Minnesota
curt
Administrator
 
Posts: 1168
Joined: Thu Jan 01, 1970 1:00 am
Location: Minneapolis, MN

Re: Why no Ki or Kd in PID controller?????

Postby Octal450 » Tue Jul 04, 2017 3:08 am

-
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11


Return to Autopilot and route manager

Who is online

Users browsing this forum: No registered users and 1 guest