Jump to content

Sign in to follow this  
ark

Poor Man's Autothrottle

Recommended Posts

Posted (edited)

After reading a bit about PID (Proportional, Integral, Derivative) controllers I decided to take a crack at a simple autothrottle ( A/T ) controller in the form of a Lua script called AutoThrottle.lua.   You need a registered copy of FSUIPC to run the script.

To try out the controller put the script in your modules folder and use FSUIPC in the usual way to assign a key or button to Lua AutoThrottle to activate it. When activated a window will open asking for a target IAS between 50 and 500 Kts.

e5889ccbc6.JPG

Of course you need to use a target IAS that is reasonable for the a/c. If the A/T is running you will need to call the script again to change the target IAS, or to turn the A/T off by entering a * instead of an airspeed value. The script should work for turbojet a/c with up to 4 engines (have only tried this on the Lear35 and Falcon50, however) . The script assumes standard FSX or P3D coding, so addon a/c with special coding may not work. For example, I've had one report that it doesn't work with the Aerosoft CRJ.

It is best that the AP is on and the a/c is stable and reasonably close to your target IAS when the A/T is activated. If you ask for large IAS changes it can take a while for the IAS to finally settle down.

When the A/T is running you will see a green bar across the top of your screen with the target A/T IAS.

e0194059ab.JPG

Edit: The green bar can be resized and dragged to where you want it with the mouse, which I find convenient.

If interested in playing around with this a zip file with the script is available here:

https://www.dropbox.com/s/ia0k97e823hs86r/Autothrottle Lua Script.zip?dl=0

Al

Edited by ark
  • Upvote 1

Share this post


Link to post
Share on other sites
Posted (edited)

In contrast to my post above, I have also tried writing a XML (vs Lua script) 2D popup form of the PID based Autothrottle (A/T) that doesn't require FSUIPC and looks like this when you pop it up:

cacd624bb0.png

The A/T currently shows up in the lower left corner of your screen like this, but that location is easily changed and the popup can also be dragged to a new location.

5db952270a.JPG

To use the A/T you have to make some entries into the aircraft’s Panel folder, which is a folder in the a/c’s main directory. It may just be called “Panel”, as in the case of the Lear35 and Falcon50, or something similar. Before making any changes I would suggest you make a backup of the Panel folder by copying it and then pasting it back into the same location – you will get a backup labeled panel-copy which you can later rename back to just panel (or whatever its original name was) to restore everything back to the way it was.

Inside the Panel folder you should have a file called panel.cfg. If you open this file in a text editor at the top you should have some window titles that look something like this:

[Window Titles]

Window00=CONTROL_PANEL

Window01=AIRCRAFT_OPTIONS

Window02=Flight1 Garmin GTN750 U1

Window03=INSTRUCTIONS

Window04=WX Advantage Radar

Window05=Autothrottle

Note in the above I have added the entry Window05=Autothrottle where I numbered it 05 because that was the next number available in the list (note to popup up the gauge you would then have to use Shift+6). If it turns out you you can’t use a number of 08 or less because they are all used, then it may be best to comment out a window you don't really need and replace it with the AT entry.

After modifying the Window title list you have to go down in the panel.cfg file where you will find Window entries for all of the listed window titles. Continuing with our example here, after the [Window05] entry I have added an entry for the new Window05 that looks like this:

[Window05]

size_mm = 100,100 

window_size = 0.12

position = 6

backround_color = 0,0,0

visible = 1

ident = Autothrottle

sizeable = 0

gauge00 = AutoThrottle!AT, 0,0,100,100

 

You then have to save the panel.cfg file.

Finally, you need to paste a folder called AutoThrottle (paste the whole folder "as is") into you Panel folder. This folder is  inside a zip file available here https://www.dropbox.com/s/lcx89iqoums71bj/AutoThrottle XML.zip?dl=0  

 Instead of pasting the AutoThrottle folder into the plane's Panel folder, you could instead paste it into the sim's Gauges folder. That way it will be available to other planes. However, you still have to modify each plane's panel.cfg file as above.

To use the AT, once the plane is loaded you should be able to pop up the A/T with Shift+n, where n is a number one greater than the new window number – it would be shift+6 in the case of the example above.

In flight, after getting the a/c setup in cruise at your target indicated airspeed (IAS), use your mouse to set an A/T value (the mouse wheel changes the IAS by 10s, left and right clicks by 1s).  Once a target IAS is set , turn the A/T on by left clicking on the On/Off button (Green is on) and see what happens. Use at your own risk, no guarantees! As with the Lua script A/T version above, standard FSX/P3D coding is assumed for turbojet aircraft and the AT may not work with addon a/c that utilize special engine/thrust coding.

Al

 

Edited by ark
  • Upvote 1

Share this post


Link to post
Share on other sites

ARK, 

Let me guess - you must be in quarantine, right?😉

Seriously, thanks for this new app... 

Share this post


Link to post
Share on other sites
Posted (edited)

PID controllers use 3 key parameters that can be adjusted if necessary to tune the performance. If you try one of the A/Ts above I be interested to hear how it works (or doesn't work) with different aircraft and sims.

Thx,

Al

Edited by ark

Share this post


Link to post
Share on other sites

Hi Al,

I tried your AT with the Aerosoft DC8 and it works great. During final approach, in critically low speeds, the AT appears to over control the throttles, but I am not sure if it's inherent with the aircraft or the AT needs more fine tuning. I used to work with speed controllers and PID, and they are not easy to program without considerable math or trial and error.

tc

Share this post


Link to post
Share on other sites
Posted (edited)
16 minutes ago, flyforever said:

Hi Al,

I tried your AT with the Aerosoft DC8 and it works great. During final approach, in critically low speeds, the AT appears to over control the throttles, but I am not sure if it's inherent with the aircraft or the AT needs more fine tuning. I used to work with speed controllers and PID, and they are not easy to program without considerable math or trial and error.

tc

Hi tc,

It sounds like you know a lot more than I do about PID controllers -- thanks for the feedback. Which A/T controller were you using -- the Lua script or the XML gauge, and what sim?

Thx,

Al

Edited by ark

Share this post


Link to post
Share on other sites
Posted (edited)

A poorer man's AT is to use FSX's built-in function via CTRL-R, which toggles the autothrottle on and off at the current airspeed.  You will have to set  autothrottle_available=1 in the aircraft.cfg if it's been set to 0 by the developer.  In XML you can do it via K:AP_AIRSPEED_HOLD.  You can also set and read the held speed via other events and variables. 

I've done something similar to you in xml (for Dave Maltby's Trident in FSX, where I wanted the autothrottle to control only engines 1 and 3 as was apparently done in real life), but the autothrottle is one of the things the sim does pretty well and I never managed to tune the PID to work reliably without hunting under different conditions. 

Edited by lzamm

Share this post


Link to post
Share on other sites
1 hour ago, ark said:

Hi tc,

It sounds like you know a lot more than I do about PID controllers -- thanks for the feedback. Which A/T controller were you using -- the Lua script or the XML gauge, and what sim?

Thx,

Al

That was a long time ago, in my younger days. It's the xml guage, p3d 4.5. I'll try it on a few more aircrafts and report.

The DC8 has very touchy throttles. That's why I found the AT particularly interesting.

tc

Share this post


Link to post
Share on other sites
Posted (edited)
50 minutes ago, flyforever said:

That was a long time ago, in my younger days. It's the xml guage, p3d 4.5. I'll try it on a few more aircrafts and report.

The DC8 has very touchy throttles. That's why I found the AT particularly interesting.

tc

tc,

By any chance do you have the Aerosoft CRJ? I am trying to help a fella who has the Aerosoft CRJ and apparently the Lua script form of the A/T didn't work -- I was thinking maybe Aerosoft uses some special code for engine control. Since the XML A/T worked on the Aerosoft DC-8 (much different a/c, I understand), maybe there is a chance the XML A/T will work on the CRJ as well.

Al

Edited by ark

Share this post


Link to post
Share on other sites
Posted (edited)
2 hours ago, lzamm said:

A poorer man's AT is to use FSX's built-in function via CTRL-R, which toggles the autothrottle on and off at the current airspeed.  You will have to set  autothrottle_available=1 in the aircraft.cfg if it's been set to 0 by the developer.

Yep, that is correct, in fact CTRL+ R locks the throttles. One difference between that and A/T operation is that to transition to a new IAS setting rather than just "dialing in" the new A/T speed, you have to turn off the speed hold (CTRL+R again) and hand fly the a/c to the new speed, and than re-engage speed hold with CTRL+R. But certainly doable and way better than no speed hold at all.

Al

Edited by ark

Share this post


Link to post
Share on other sites

Hi Al! Your Poor Man's Autothrottle utility is great. I have tested in the Realair Turbine Duke V2 so far (Windows 10 FSX SE) with excellent results. I tried both the LUA script and the XML gauge but I think that the XML gauge works better. I will try in other aircraft and let you know how it goes. Excellent job!! Thanks!

Best Regards,

Roberto

  • Like 1

Share this post


Link to post
Share on other sites

I tried it in the lear just after takeoff and hand some surging / hunting issues - I think I need to get it trimmed out closer to target speed - will try again stabilized in level flight  (I was using the lua script)

Share this post


Link to post
Share on other sites
Posted (edited)
2 hours ago, Ralvarez232 said:

 I tried both the LUA script and the XML gauge but I think that the XML gauge works better.

The Lua script and the XML code implement the same algorithm. However, I think the Lua script has lower execution priority with the sim and so may get delayed at times if the sim is particularly busy. The other difference is the Lua script checks and updates the IAS info about 2 times/sec, while the XML code does so about 18 times/sec. There is a parameter at the top of the Lua script called update_interval which is currently set to 0.5 (seconds). If you like to experiment, you could change the update_interval with a text editor to 0.1 seconds to see if it makes any difference. That would increase the script update rate to about 10 times/sec although it would not raise the execution priority wrt a busy sim.  

I wrote the Lua script A/T first to see if I could get something that seemed to work. However, I prefer using the XML gauge since the 'dial' makes it convenient to adjust the A/T IAS setting as needed.

Thanks for the feedback,

Al 

Edited by ark
  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
  • Donation Goals

    AVSIM's 2020 Fundraising Goal

    Donate to our annual general fundraising goal. This donation keeps our doors open and providing you service 24 x 7 x 365. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. We reset this goal every new year for the following year's goal.


    28%
    $7,035.00 of $25,000.00 Donate Now
×
×
  • Create New...