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 legoboyvdlp » Thu Jun 02, 2016 5:54 pm

GitHub has the latest updates pulled from Hyde's upstream.
User avatar
legoboyvdlp
 
Posts: 7091
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: FLCH like real planes!

Postby Octal450 » Fri Jun 03, 2016 12:24 am

@tikibar
Your 757 does not do this!
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby tikibar » Fri Jun 03, 2016 12:41 am

Perhaps you could be a little more specific...
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 Jun 03, 2016 1:50 am

@tikibar
It seems to climb at 1000fpm, and uses thrust to keep speed, even though I set FLCH mode.
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby swwon » Fri Jun 03, 2016 1:59 am

it0uchpods wrote in Thu Jun 02, 2016 5:00 pm:@swwon
let me see, where is the latest 777? (im an idiot)

https://gitlab.com/fg777_seattle/fg777_seattle
swwon
 
Posts: 232
Joined: Sun Nov 22, 2015 10:32 am
Version: 2016.2.1
OS: Windows 10

Re: FLCH like real planes!

Postby tikibar » Fri Jun 03, 2016 4:18 am

It behaves like that if (1) you're within 500 ft of the target altitude, (2) you press SPD after you enter FLCH mode, or (3) you have an old version.
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 Jun 03, 2016 8:28 pm

@tikibar
I'll update it again and ill see. strange.
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby Octal450 » Wed Jun 15, 2016 5:40 am

I built a system for determining thrust modes, and JWOCKY and I are rebuilding every flight phase away from Generics, Generics are horrible.

This systems will be in all planes equipped with the Standard IT-AUTOFLIGHT configuration, I hope it will not take too long to get this working.
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby Octal450 » Wed Jun 15, 2016 10:32 pm

the FLCH system is working very well, tikibar, maybe you want to look in it-autoflight.xml, you can change the speed knobs as much as you want, and switch from mach to ias and he works.
Thanks JWOCKY for all the help!

Pushed today or tomarrow to IT-AUTOFLIGHT GIT REPO.
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 16, 2016 5:22 am

What plane is this that you pushed? I'd like to see if I need to download a newer version?
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 16, 2016 6:50 am

@swonn
Currently its in testing on the A340-600VIP. Once its more stable, and working across more models, the following planes will get the drop in compatible upgrade: A340 (-200, -313X, -600HGW, -600VIP), A350XWB, MD-88, MD-90, B717, A310, L1011, and a few more

Drop in upgrades is not support in the new V2.10 coming soon, since it includes new modes that require changes to MCP and PFD. However, everything else is drop in compatible, just replace autoflight.nas, autoflight-logic.nas, it-autoflight.xml, and autopilot-dlg.xml.

But I suggest you wait one day or so, and I think it will be pushed to many planes.

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

Re: FLCH like real planes!

Postby Octal450 » Tue Jul 12, 2016 3:37 am

And it's fully stable. FLCH works like a dream, of course still tuning to come, but it works within 5kt.

All my planes will eventually receive this update soon.

First coming to the MD-88/MD-90, A340s, CSeries.

and I implement the FLCH systems to the MD-11 and MD-10-Family soon.

Have a nice day,
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes! ACHIVED READ PAGE 3

Postby Octal450 » Wed Jul 20, 2016 3:40 am

GOT IT!
I also managed to solve the increase/decrease speed thing using umin and umax.

Here is my FLCH controller for the ITAF V3.0.0 Beta 2. It's up on the ITAF repo.

Code: Select all
   <pid-controller>
      <name>FLIGHT LEVEL CHANGE</name>
      <debug>false</debug>
      <enable>
         <prop>/it-autoflight/locks/pitch</prop>
         <value>it-flch</value>
      </enable>
      <input>
         <condition>
            <equals>
               <property>/it-autoflight/apthrmode</property>
               <value>0</value>
            </equals>
         </condition>
         <prop>/autopilot/internal/lookahead-10-sec-airspeed-kt</prop>
      </input>
      <input>
         <condition>
            <equals>
               <property>/it-autoflight/apthrmode</property>
               <value>1</value>
            </equals>
         </condition>
         <prop>/velocities/mach</prop>
         <scale>15.0</scale>
      </input>
      <reference>
         <condition>
            <equals>
               <property>/it-autoflight/apthrmode</property>
               <value>0</value>
            </equals>
         </condition>
         <prop>/it-autoflight/settings/target-speed-kt</prop>
      </reference>
      <reference>
         <condition>
            <equals>
               <property>/it-autoflight/apthrmode</property>
               <value>1</value>
            </equals>
         </condition>
         <prop>/it-autoflight/settings/target-mach</prop>
         <scale>10.0</scale>
      </reference>
      <output>
         <prop>/it-autoflight/settings/target-pitch-deg</prop>
      </output>
      <config>
         <Kp>-0.25</Kp>       <!-- proportional gain -->
         <beta>1.0</beta>    <!-- input value weighing factor -->
         <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
         <gamma>0.0</gamma>  <!-- input value weighing factor for -->
         <!-- unfiltered derivative error -->
         <Ti>10.0</Ti>        <!-- integrator time -->
         <Td>0.00001</Td>    <!-- derivator time -->
            <u_min>
                <condition>
                    <greater-than>
                        <property>/it-autoflight/settings/target-altitude-ft-actual</property>
                        <property>/instrumentation/altimeter/indicated-altitude-ft</property>
                    </greater-than>
                </condition>
                <value>3.0</value>
            </u_min>
            <u_min>
                <condition>
                    <less-than>
                        <property>/it-autoflight/settings/target-altitude-ft-actual</property>
                        <property>/instrumentation/altimeter/indicated-altitude-ft</property>
                    </less-than>
                </condition>
                <value>-15.0</value>
            </u_min>
            <u_max>
                <condition>
                    <greater-than>
                        <property>/it-autoflight/settings/target-altitude-ft-actual</property>
                        <property>/instrumentation/altimeter/indicated-altitude-ft</property>
                    </greater-than>
                </condition>
                <value>20.0</value>
            </u_max>
            <u_max>
                <condition>
                    <less-than>
                        <property>/it-autoflight/settings/target-altitude-ft-actual</property>
                        <property>/instrumentation/altimeter/indicated-altitude-ft</property>
                    </less-than>
                </condition>
                <value>0.0</value>
            </u_max>
      </config>
   </pid-controller>

   <pid-controller>
      <name>IT-CONTROLLER: FLCH</name>
      <debug>false</debug>
      <enable>
         <prop>/it-autoflight/locks/pitch</prop>
         <value>it-flch</value>
      </enable>
      <input>
         <prop>/orientation/pitch-deg</prop>
      </input>
      <reference>
         <prop>/it-autoflight/settings/target-pitch-deg</prop>
      </reference>
      <output>
         <prop>/controls/flight/elevator-trim-filter</prop>
      </output>
      <config>
         <Kp>-0.08</Kp>      <!-- proportional gain -->
         <beta>1.0</beta>    <!-- input value weighing factor -->
         <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
         <gamma>0.0</gamma>  <!-- input value weighing factor for -->
         <!-- unfiltered derivative error -->
         <Ti>10.0</Ti>        <!-- integrator time -->
         <Td>0.00001</Td>    <!-- derivator time -->
         <u_min>-1.0</u_min> <!-- minimum output clamp -->
         <u_max>1.0</u_max>  <!-- maximum output clamp -->
      </config>
   </pid-controller>


And the thrust system:

Code: Select all
<!-- IDLE THR -->
 <pid-controller>
    <name>IDLE</name>
    <debug>false</debug>
    <enable>
      <prop>/it-autoflight/locks/throttle</prop>
      <value>it-idle</value>
    </enable>
    <input>
      <prop>/velocities/airspeed-kt</prop>
    </input>
    <reference>
      <prop>/it-autoflight/settings/idlethr</prop>
    </reference>
    <output>
      <prop>/controls/engines/engine[0]/throttle</prop>
      <prop>/controls/engines/engine[1]/throttle</prop>
      <prop>/controls/engines/engine[2]/throttle</prop>
      <prop>/controls/engines/engine[3]/throttle</prop>
      <prop>/controls/engines/engine[4]/throttle</prop>
      <prop>/controls/engines/engine[5]/throttle</prop>
      <prop>/controls/engines/engine[6]/throttle</prop>
      <prop>/controls/engines/engine[7]/throttle</prop>
    </output>
    <config>
      <Kp>0.1</Kp>        <!-- proportional gain -->
      <beta>1.0</beta>    <!-- input value weighing factor -->
      <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
      <gamma>0.0</gamma>  <!-- input value weighing factor for -->
                          <!-- unfiltered derivative error -->
      <Ti>10.0</Ti>       <!-- integrator time -->
      <Td>0.00001</Td>    <!-- derivator time -->
      <u_min>0.0</u_min>  <!-- minimum output clamp -->
      <u_max>1.0</u_max>  <!-- maximum output clamp -->
    </config>
  </pid-controller>
 
  <!-- CLB THR -->
 <pid-controller>
    <name>CLB</name>
    <debug>false</debug>
    <enable>
      <prop>/it-autoflight/locks/throttle</prop>
      <value>it-clb</value>
    </enable>
    <input>
      <prop>/velocities/airspeed-kt</prop>
    </input>
    <reference>
      <prop>/it-autoflight/settings/clbthr</prop>
    </reference>
    <output>
      <prop>/controls/engines/engine[0]/throttle</prop>
      <prop>/controls/engines/engine[1]/throttle</prop>
      <prop>/controls/engines/engine[2]/throttle</prop>
      <prop>/controls/engines/engine[3]/throttle</prop>
      <prop>/controls/engines/engine[4]/throttle</prop>
      <prop>/controls/engines/engine[5]/throttle</prop>
      <prop>/controls/engines/engine[6]/throttle</prop>
      <prop>/controls/engines/engine[7]/throttle</prop>
    </output>
    <config>
      <Kp>0.1</Kp>        <!-- proportional gain -->
      <beta>1.0</beta>    <!-- input value weighing factor -->
      <alpha>0.1</alpha>  <!-- low pass filter weighing factor -->
      <gamma>0.0</gamma>  <!-- input value weighing factor for -->
                          <!-- unfiltered derivative error -->
      <Ti>10.0</Ti>       <!-- integrator time -->
      <Td>0.00001</Td>    <!-- derivator time -->
      <u_min>0.0</u_min>  <!-- minimum output clamp -->
      <u_max>1.0</u_max>  <!-- maximum output clamp -->
    </config>
  </pid-controller>


Code: Select all
# FLCH Thrust Mode Selector
var flchthrust = func {
  var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
  var alt = getprop("/it-autoflight/settings/target-altitude-ft-actual");
  var vertm = getprop("/it-autoflight/apvertmode");
  if (vertm == 4) {
    if (calt < alt) {
     setprop("/it-autoflight/apthrmode2", 2);
    } else if (calt > alt) {
      setprop("/it-autoflight/apthrmode2", 1);
    } else {
     setprop("/it-autoflight/apthrmode2", 0);
     setprop("/it-autoflight/apvertset", 3);
   }
  } else {
   setprop("/it-autoflight/apthrmode2", 0);
   flchtimer.stop();
  }
}

# Thrust Modes
setlistener("/it-autoflight/apthrmode2", func {
  var thrmode2 = getprop("/it-autoflight/apthrmode2");
  if (thrmode2 == 0) {
   setprop("/it-autoflight/thr", 1);
   setprop("/it-autoflight/idle", 0);
   setprop("/it-autoflight/clb", 0);
   thr_master();
  } else if (thrmode2 == 1) {
   setprop("/it-autoflight/thr", 0);
   setprop("/it-autoflight/idle", 1);
   setprop("/it-autoflight/clb", 0);
   idle_master();
  } else if (thrmode2 == 2) {
   setprop("/it-autoflight/thr", 0);
   setprop("/it-autoflight/idle", 0);
   setprop("/it-autoflight/clb", 1);
   clb_master();
  }
});


flchthrust(); is in a timer:
Code: Select all
var flchtimer = maketimer(0.5, flchthrust);


Which is started by pushing the flch switch:
Code: Select all
else if (vertset == 4) { #apvertset is on a listener. FLCH button should set apvertset to 4.
    var altinput = getprop("/it-autoflight/settings/target-altitude-ft");
   setprop("/it-autoflight/settings/target-altitude-ft-actual", altinput);  # so the altitude change is registered by autoflight.
   setprop("/it-autoflight/alt", 0);    # logic stuff
   setprop("/it-autoflight/vs", 0);    # logic stuff
   setprop("/it-autoflight/app", 0);    # logic stuff
   setprop("/it-autoflight/app1", 0);    # logic stuff
   setprop("/it-autoflight/altc", 0);    # logic stuff
   setprop("/it-autoflight/flch", 1);    # logic stuff
   setprop("/it-autoflight/apvertmode", 4);    # logic stuff
   setprop("/it-autoflight/aphldtrk2", 2);    # logic stuff
   setprop("/it-autoflight/apilsmode", 0);    # logic stuff
   flchtimer.start();  # starts the flch timer.
    flch_master();  # runs the code to enable the speed with pitch controller.
  }


Gonna build an SDK to help devs implement and MCP and PFD. :)

Took me forever, but she runs nice. Got him in the KC-137R/EC-137R. EC-137R has him hooked to the 777 PFD. I did remove some stuff though.

Cheers!
Josh
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes! ACHIVED READ PAGE 3

Postby Octal450 » Sat Mar 11, 2017 6:13 pm

Alright
I've built a newer version of this controller that goes
SPEED predict 10sec/MCP speed: TARGET FPS
Current FPS/TARGET FPS: TARGET PITCH
Current PITCH/TARGET PITCH: MASTER PITCH (elevator+autotrim)

This always ensures when climbing, it never goes under 100fpm and when descending, never goes over -100fpm.

Available in the ITAF Version 155 and later (not yet available) and soon after, in the MD-11.

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

Re: FLCH like real planes! ACHIVED READ PAGE 3

Postby Hooray » Sat Mar 11, 2017 6:31 pm

Note that, depending on your goals, you may want to read up on how VNAV is commonly implemented on real airliners/jet aircraft using a so called "performance database" and how the availability of said data may impact VNAV implementation details inside a simulation like FlightGear: http://wiki.flightgear.org/Implementing ... FlightGear
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11340
Joined: Tue Mar 25, 2008 8:40 am

PreviousNext

Return to Autopilot and route manager

Who is online

Users browsing this forum: No registered users and 1 guest