Board index FlightGear Development Aircraft Autopilot and route manager

FLCH like real planes! ACHIVED READ PAGE 3

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

Re: FLCH like real planes!

Postby Octal450 » Fri May 20, 2016 1:26 am

@tikibar
Thx.
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby Octal450 » Fri May 20, 2016 1:44 am

@tikibar
It is working... sort of.
It now works, but the speed varies from 260-235kt. In your 757, when there is FLCH mode, does the thrust go to full/idle??? This is what I simulate in mine. How do I tune it to fly correct???

my current setup:
Code: Select all
<!-- Elevator Trim Controller for FLCH -->

  <pid-controller>
    <name>Elevator Control</name>
    <debug>false</debug>
    <enable>
      <prop>/autopilot/locks/altitude</prop>
      <value>altitude-with-ias</value>
    </enable>
    <input>
      <prop>/orientation/pitch-deg</prop>
    </input>
    <reference>
      <prop>/autopilot/internal/target-pitch-deg</prop>
    </reference>
    <output>
      <prop>/controls/flight/elevator-trim</prop>
    </output>
    <config>
      <Kp>-0.015</Kp>
      <beta>1.0</beta>
      <alpha>0.1</alpha>
      <gamma>0.0</gamma>
      <Ti>1.0</Ti>
      <Td>0.00001</Td>
      <u_min>
        <value>-0.8</value>
      </u_min>
      <u_max>
        <value>0.8</value>
      </u_max>
    </config>
  </pid-controller>
 
    <filter>
        <name>Elevator control filter</name>
        <debug>false</debug>
        <feedback-if-disabled>true</feedback-if-disabled>
        <initialize-to>output</initialize-to>
      <enable>
          <prop>/autopilot/locks/altitude</prop>
          <value>altitude-with-ias</value>
      </enable>
        <input>
            <property>/controls/flight/elevator-trim-filter</property>
        </input>
        <output>/controls/flight/elevator-trim</output>
        <type>noise-spike</type>
        <max-rate-of-change>0.5</max-rate-of-change>
    </filter>
   
<!-- Altitude with IAS (controls/switches/vertset = 4)
 
  <pid-controller>
    <name>Speed with pitch IAS</name>
    <debug type="bool">false</debug>
    <enable>
      <prop>/autopilot/locks/altitude</prop>
      <value>altitude-with-ias</value>
    </enable>
    <input>
      <prop>autopilot/internal/lookahead-10-sec-airspeed-kt</prop>
    </input>
    <reference>
      <prop>/autopilot/settings/target-speed-kt</prop>
    </reference>
    <output>
      <prop>/autopilot/internal/target-pitch-deg</prop>
    </output>
    <config>
   <Kp>-0.08</Kp>
   <beta>1</beta>
   <alpha>0.1</alpha>
   <gamma>0</gamma>
   <Ti>10</Ti>
   <Td>0.00001</Td>
    <u_min>-10</u_min>
    <u_max>15</u_max>
    </config>
  </pid-controller>
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby tikibar » Fri May 20, 2016 8:26 pm

Are you working with a YASim aircraft? If you are, you shouldn't need dedicated controllers for the elevators. All the different vertical modes should be outputting the target pitch value, and that becomes the input for the elevator trim controller. What you have above labeled as "Elevator Control" and "Elevator control filter" should be the last items in the vertical control section.

For tuning, Kp is going to have the biggest immediate effect, but Ti and Td are also important. I'd leave Td alone until it's pretty much good. Then I'd probably still leave Td alone. It may (or may not) help to google PID controllers and learn a bit about the theory behind them. Make sure to wear your math hat. It won't make you an expert, but might give you a fair idea of what the numbers are trying to do. I have a PhD in a science/engineering field, and even though I have a reasonable understanding of the math involved, I still wind up adjusting the parameters pretty wildly until I get a working solution. I think PID controllers are more of an art with mathematical constraints. That said, I used the same parameters in the 757 and 767, and they perform well in both aircraft.

As for the thrust targets, there's a whole nasal bit in AFDS.nas that selects thrust modes settings depending on what is going on. For the 757/767, the thrust modes are selectable from a cockpit panel. For the 747-8 and the MD-11, the FADEC does this automatically, so there's more work there getting that all together. Long story short, it's takeoff thrust below 400 ft agl, then climb thrust (which gets adjusted a couple of times through the climb eventually reaching maximum), then it switches to speed with thrust mode for the cruise phase, though cruise thrust is available too. Descent is accomplished with flight idle thrust. Step climbs use maximum continuous thrust (CON) mode. FLCH engages most of these modes automatically.
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 514
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: FLCH like real planes!

Postby Octal450 » Fri May 20, 2016 9:07 pm

@tikibar
I am using my own AFDS file called autoflight.nas I have build the thrust system already. I have also programmed a complete nasal FADEC, and it works well. I studied the MD-88 and MD-11 very much, and know its systems quite well. Regarding the pid controllersOnly the FLCH modes have that stuff, the rest of the controllers output directly to the elevator trim, but I will change it all soon, then these will be renamed to do every one.

I need to make the controller react earlier, and a bit quicker, I adjust KP up or down?
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby tikibar » Sat May 21, 2016 5:27 am

Kp should probably go up a little, but you don't want to make it overly sensitive. Otherwise small changes to the speed input could cause it to pitch down while you're trying to climb. Slow and smooth reaction is key in a speed with pitch mode.
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 514
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: FLCH like real planes!

Postby Thorsten » Sat May 21, 2016 5:32 am

Kp should probably go up a little, but you don't want to make it overly sensitive.


Which is where the derivative term comes in - if you up that as well as the proportional term, you get earlier proportional response and earlier damping (derivative) to reduce sensitivity again.
Thorsten
 
Posts: 11087
Joined: Mon Nov 02, 2009 8:33 am

Re: FLCH like real planes!

Postby Octal450 » Sat May 21, 2016 5:44 pm

@Tikibar
I'll give that a try. In your planes, how well does it generally work? Does it hold the speed within 5kt or so? I've been to busy to try it out.

@Thorsten
I only know the terms by KP TD TI etc. Can you say me which ones those are?
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby Thorsten » Sat May 21, 2016 5:48 pm

P: proportional
D: derivative
I: integration

JSBSim calls the parameters with a k in front kp, kd, and ki, not sure how the FG autopilot calls them.
Thorsten
 
Posts: 11087
Joined: Mon Nov 02, 2009 8:33 am

Re: FLCH like real planes!

Postby tikibar » Tue May 24, 2016 8:41 pm

@itouchpods - it works very well as long as you don't make drastic changes to the target speed. If you change it from 220 to 280 on a climb, it will pitch down to gain speed. That's where the pilot has to have his or her head in the game. I usually move it up 10 kts at a time and it keeps climbing with no sudden moves.
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 514
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: FLCH like real planes!

Postby Octal450 » Tue May 24, 2016 11:51 pm

It should be modified to check the V/S, so the minimum V/S in climb is for example 400fpm, and in descent maximum is -400fpm.
Then if it gets to those values it freezes the trim. I might build a controller (either a filter, or nasal script) that does this.
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby tikibar » Wed May 25, 2016 2:22 am

I think that's a good idea. I'm not sure how it would work since the speed with pitch only knows about the pitch angle and doesn't care about vertical speed.
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 514
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: FLCH like real planes!

Postby Soitanen » Wed May 25, 2016 6:52 am

You could check my LVL CHG implementation in 737-800. Commit from 24 may have new algorithm based on physics and not using PID controllers. It gives good speed hold in automatic mode and good work of flight directors, if plane is flown by hands and pilot do not follow commands very well. In this case if PID controller is used pitch FD bar is going far from really needed pitch.
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 6:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: FLCH like real planes!

Postby Octal450 » Wed May 25, 2016 3:34 pm

@Soitanen
I take a look.

@tikibar
Well, perhaps include a nasal controller. Have it check the vertical speed every so often, and if it gets to a certain value, switch to another pid controller that keeps the elevator trim frozen...?
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby swwon » Thu Jun 02, 2016 2:37 pm

Doesn't the newest 777 do what youre trying to do pretty well?
swwon
 
Posts: 232
Joined: Sun Nov 22, 2015 10:32 am
Version: 2016.2.1
OS: Windows 10

Re: FLCH like real planes!

Postby Octal450 » Thu Jun 02, 2016 5:00 pm

@swwon
let me see, where is the latest 777? (im an idiot)
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

PreviousNext

Return to Autopilot and route manager

Who is online

Users browsing this forum: No registered users and 1 guest