Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi all, I created a spreadsheet (using LIbreOffice) with a macro to simulate the passenger and cargo loading aboard the aircraft. After I inserted the number of pax, the number of baggages and the fuel quantity, the macro simulate a random distribution of the pax aboard and the positioning of the baggage into the cargo holders of the plane following some company rules. After that, the spreadsheet calculates the longitudinal and lateral harms (from the datum) of the payload (pax and cargo) in function of its position inside the aircraft (I used a certain number of stations to consider the seat rows and cargo holders). At the end, the spreadsheet, using another macro, generate the aircraft.cfg file and save it inside the FS2004 aircraft folder to be used at the moment the aicraft is loaded into the simulator. In this way I obtained a precise position of the CoG of the aircraft simulating in a very realistic way the payload aboard.

 

Now the only problem for this system is that between one flight and another, to update the aircraft.cfg file with the new payload, I need to exit the flight and reload the aircraft after generating the new aircraft.cfg file by the macro.

 

I noticed that some ACARS distributed by some virtual companies (for example the VCRS by Ryr Virtual), give the possibility to load the payload using FSUIPC. So I discovered that there are some offsets that allow to work with the payload station values.

 

I'm not a programmer and it would be very difficult for me to create an application to do this, but could it be possible to create a macro for my spreadsheet that, working in combination with FSUIPC , could give the possibility to update the payload station variables (weight, lateral, longitudinal and vertical distance from datum) and the fuel instead of creating every time a new aircraft.cfg file?

 

Thanks in advance for any suggestions

 

 

Posted

Now the only problem for this system is that between one flight and another, to update the aircraft.cfg file with the new payload, I need to exit the flight and reload the aircraft after generating the new aircraft.cfg file by the macro.

Why not simply send the "Reload Aircraft" FS control? That's what I do! Works very well!

I'm not a programmer and it would be very difficult for me to create an application to do this, but could it be possible to create a macro for my spreadsheet that, working in combination with FSUIPC , could give the possibility to update the payload station variables (weight, lateral, longitudinal and vertical distance from datum) and the fuel instead of creating every time a new aircraft.cfg file?

I think trying to do this by macro would be very difficult, unwieldy and maybe impossible. Have you looked at Lua plug-ins instead? There are plenty of examples provided.

Or just use Reload Aircraft, as I said.

Pete

Posted

Thanks Pete, the "Reload Aircraft" FS control works well but not in the way I need. So I'm trying to create a .lua plugin. For the fuel I solved, the .lua plugin read the fuel quantity from a text file and then transfer it to FS using the appropriate OFFSETs. Now I have some problem to make something similar for the payload. I do not understand how to use the OFFSET "1400" related to the payload stations. I started trying to read and write it to a csv file (using the example you included in the "Example LUA plugins.zip" to understand how it is made, but I obtain only one number. The FSUIPC4 Offsets Status (I hope this document is usable also with FS2004) talks about payload stations so I expected to obtain a number of values from this OFFSET. What did I misunderstand?

 

In the same document seems to understand that it should be possible to modify the loadings of this offset, but using FS-interrogate on that offset, I noted that this is a READ only offset. 

 

Hope you could enlighten me a little bit more

 

Thanks and Merry Christmas

 

Andrea

Posted
The FSUIPC4 Offsets Status (I hope this document is usable also with FS2004) talks about payload stations so I expected to obtain a number of values from this OFFSET. What did I misunderstand?

 

For FS9 you should certainly NOT be using the FSUIPC4 document. The correct reference is the one supplied for FS9 and before, the "FSUIPC for Programmers" document!

 

However, in this case the FS9 entries are the same as those in FSX, altough I think the FS9 loadings don't correctly affect the aircraft balance or other weight values correctly until you go into the Payload menu in FS and ok out. There's a note to that effect.

 

I don't understand what you do not find clear in the description. Do you not see, in offset 13FC (actually immediately preceding the Payloads table) the count of actual stations available? Then, from 1400, there are that number of 48-byte entries, structured precisely as described -- i.e. each entry has 4 double floating point values (= 64-bit floats) and a 16 character name. 4x8 + 16 = 48. What isn't clear?

 

Of course it is all read-only except for the weight values, the first double in each table entry. You can't move or rename the payload positions.

 

Pete

  • 4 weeks later...
Posted

Dear Pete

 

When you write during a flight into the aircraft.cfg and you relaod the aircraft payload should be updated with new values in &H13FC + &H1400 etc. 

Anyway it does update weigths when you write values into the stations buffer. For me works perfectly, but I use only one aircraft.

I use buffers in VB6 to put the values  from FSUIPC. Then just handle the aircraft.cfg as an INI file to write down.

 

I can't get work weather and sounds ...,   see my separate post "METAR"

Peter

 

 

Posted

Anyway it does update weigths when you write values into the stations buffer. For me works perfectly, but I use only one aircraft.

I use buffers in VB6 to put the values  from FSUIPC. Then just handle the aircraft.cfg as an INI file to write down.

 

Sorry, the last part confuses me.

 

When you write fuel and payloads directly, is the balance changed accordingly? i.e. the CofG %MAC value?

Posted

Pete

Yes, can confirm: if I write into &H1400 + (offset &H30 per payload station) the weights, the CG in &H2EF8 changes. On my aircraft depending on 4 freight stations from 15 to 31% as described in the offset list. The fuel qty does not so influence the CG as they are quite close arranged around the CG.

 

The  last part:

Should move it to the other thread:

http://forum.simflight.com/topic/78022-reading-metar-in-fsx/?hl=metar

I can not get the weather working ...

 

Sorry for confusion

Peter

Posted

Yes, can confirm: if I write into &H1400 + (offset &H30 per payload station) the weights, the CG in &H2EF8 changes. On my aircraft depending on 4 freight stations from 15 to 31% as described in the offset list. The fuel qty does not so influence the CG as they are quite close arranged around the CG.

 

Aha! That's good news! In FS2004 and before, changes in payload and fuel loading didn't affect things like the CofG. You had to go into the FS payload menu and OK out to get the right routines called to do the recalculations. Seems they fixed that when adding the official Simconnect support for writing those values!

 

Pete

  • 5 weeks later...
Posted

Aha! That's good news! In FS2004 and before, changes in payload and fuel loading didn't affect things like the CofG. You had to go into the FS payload menu and OK out to get the right routines called to do the recalculations. Seems they fixed that when adding the official Simconnect support for writing those values!

 

Pete

 

Hi Pete, sorry if I write my feedback so late from my last post. I "studied" better the situation about the OFFSET 1400 (thanks to another post of yours I found searching in Internet) and so I wrote down a LUA script with which I solved my problem to update fuel and payload without closing FS9. In the LUA script I added a little code to quickly open FS payload menu and OK out (as you stated in your last post) and in this way I obtained the result I was searching for. The LUA script is generated by a macro into the Libreoffice spreadsheet with which I simulate and calculate the payload of my aircraft.

So thanks for your help and sorry if my english could be not so good...

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

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.