Jump to content
Sign in to follow this  
sergs

Setting fuel/payload externally of FSX from networked PC

Recommended Posts

Hello everybody,Firstly, unfortunately, programming is not my strong point, and I wonder if anybody would be kind enough to create what I hope would be a simple program.To be brief, my aim is to set the fuel/payload of the loaded aircraft externally of FSX from a second (networked) PC. I simply find it unrealistic to open up the FSX dialogue boxes and set the fuel/payload there during the turnarounds. I already run some well-known chart, flight-planning and performance-calculation programs from this second PC, thus leaving the main machine "FSX-only".I have loading data for various aircraft. The number of stations and fuel tanks varies for each aircraft. The data is in a single text file that covers only one aircraft at any one time (another utility writes this data to the text file based on the loading/fuel scenario), in the following format://station //weight1 (tab) 20002 (tab) 15005 (tab) 500//fuel tanks //weightcenter1 (tab) 0leftmain (tab) 2500rightmain (tab) 2500Would it be possible to take the weight value and inject it into the corresponding station/fuel tank in FSX (from the other PC)?Many thanks for reading and kind regards,Sergs

Share this post


Link to post
Share on other sites

Hi Sergs,I might be able to help you out, it shouldn't be too hard to create a program to do what you ask...All I have is a few questions about the file format. From what I understand is that the file (one file?) containing the information looks like:

//station //weight1

Share this post


Link to post
Share on other sites

Hi Klas!Firstly, thank you for your reply.Yes, the whitespace between the columns are a single tab character. (But if needed, the delimiter can be changed)All the stations in the aircraft.cfg are listed in the text file. E.g, if the aircraft.cfg has 15 stations, (0-14), then exactly that is in the txt file. (BTW, the last station number in my example from the previous post should be "3", not "5" ). Those stations with a weight of 0 are also shown, along with 0 in the weight column (i.e. the format is kept the same).As for the fuel tanks, yes, the names in the txt file match the ones in the aircraft.cfg:

center1    500leftmain   3000rightmain  3000

...with the corresponding fuel weight in lbs.NET Framework 3.5 is installed :( Kind Regards,Sergs

Share this post


Link to post
Share on other sites

Hi Sergs,Thanks for your reply. I have a working prototype, except for the reading of the files, right now I'm testing with hard coded values. I can set payload weights and fuel, though fuel has to be set in gallons (or another measure of volume). Luckily, FSX provides a value for "Fuel Weight Per Gallon", so it's not a big problem, it is a source of some rounding errors. For example, if I but 2000 lbs of fuel in the aircraft through my program, I only get 1990 lbs of fuel, but if I put 22000 lbs in, I get 21999 lbs. So far, the biggest error I've seen is 10 lbs, for the few values I've tried. If this is a big problem for you (which I guess it isn't, since if you land with only 10 lbs of fuel in every tank left, you haven't done your calculations right

Share this post


Link to post
Share on other sites

Hi Klas,Don't worry about the rounding errors. In real life, I have never seen an aircraft fuelled with less than about 50kg difference from the required amount, so this is infact a welcome "problem". And setting the values to be in gallons is not a problem either.Again, thank you for your work.

Share this post


Link to post
Share on other sites
Hi Klas,Don't worry about the rounding errors. In real life, I have never seen an aircraft fuelled with less than about 50kg difference from the required amount, so this is infact a welcome "problem". And setting the values to be in gallons is not a problem either.Again, thank you for your work.
You're welcome Sergs, always fun to write programs

Share this post


Link to post
Share on other sites

Hello again Sergs,Haven't heard from you for a couple of days, have you been able to try the app out?Anyway, I have been adding some features to make the app more useful to myself (and others I'm sure). Since I don't have the planner that creates the loading files, I have created an interface similar to what's in FSX to set fuel and payload. I have also changed some internal stuff.You can get version 0.2

Share this post


Link to post
Share on other sites

Hello Klas,Please accept my apologies for my unexplained absence. Unfortunately, re-establishing my internet connection after moving into a new house proved more difficult than I thought.I tried your program, and it works perfectly. The features you added in the second version are of course welcome too. I wonder if you might be able to add the following features:-ability to save the Host and Port fields so that they need not be re-entered every time.-an "auto" mode, perhaps called by an argument, e.g.

>"E:\EFSS\PayloadAndFuelLoader.exe", 1

where your app connects to FSX, loads the aircraft without any user involvement (using the saved Host and Port fields) and closes if successful.-increase the max stations to 24.One more quick question: is it possible to change the "reference_datum_position" and "empty_weight_CG_position" once the aircraft is actually loaded in FSX (without touching the aircraft.cfg), similarly to how your app changes the "station_load" fields?Once again, thank you for all your efforts.Kind RegardsSergs

Share this post


Link to post
Share on other sites
Hello Klas,Please accept my apologies for my unexplained absence. Unfortunately, re-establishing my internet connection after moving into a new house proved more difficult than I thought.
Hi Sergs,No worries, I understand :)
-ability to save the Host and Port fields so that they need not be re-entered every time.
I thought v0.2 did that automatically? It should have some file with the file ending .settings in the same directory as the .exe, which saves the values. Maybe it isn't working, I will look into that.
-an "auto" mode, perhaps called by an argument, e.g.-increase the max stations to 24.
Will do.
One more quick question: is it possible to change the "reference_datum_position" and "empty_weight_CG_position" once the aircraft is actually loaded in FSX (without touching the aircraft.cfg), similarly to how your app changes the "station_load" fields?
No, I believe those values are constant and set by the aircraft builder to match the real aircraft, or at least to make it behave as the real airplane does.

Share this post


Link to post
Share on other sites

Hi Klas,

I thought v0.2 did that automatically? It should have some file with the file ending .settings in the same directory as the .exe, which saves the values.
Sorry, yes, you're completely right, that was my oversight.Thanks for everything else.Sergs

Share this post


Link to post
Share on other sites

Good Evening Klas,Some aircraft, e.g. the PMDG MD11 have their own fuel loading facility. I wonder if it might be possible to create a "no-fuel loading" option in your app, where fuel data is not looked for in the .txt file or changed in FSX. Perhaps this could also be switched by another argument, similar to the "auto mode"?Many kind regards from LHR,Sergs

Share this post


Link to post
Share on other sites

Works precisely as it should, thank you very much indeed, Klas!Kind RegardsSergs

Share this post


Link to post
Share on other sites
One more quick question: is it possible to change the "reference_datum_position" and "empty_weight_CG_position" once the aircraft is actually loaded in FSX (without touching the aircraft.cfg), similarly to how your app changes the "station_load" fields?
NOOooo! That is a very, very bad idea. The reference_datum_position is always a fixed value, from which all other variables are derived...Likewise the empty_weight_CG position.

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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.
×
×
  • Create New...