Jump to content
The simFlight Network Forums

FSUIPC and Fuel Status in KG


Recommended Posts

Hello,

i just tried to read the variables from the fuelstatus from an aircraft in the FS2004 9.1.

I want to display the actual fuel status for the tanksL Left, Center and right in KG. I used for example the 0B80 variable, but this only shows me how big the tank is and not the actual filling.

What variables i have to use??

And the second thing was i wanted the figure out the actual filling in % in each tank from my PMDG aircraft. But also the 0B7C variable didnt showed the right value, also not with multiply it with 128.

please give me an advise how i can do this.

thanks

Mark

Link to comment
Share on other sites

I want to display the actual fuel status for the tanksL Left, Center and right in KG. I used for example the 0B80 variable, but this only shows me how big the tank is and not the actual filling.

What variables i have to use??

Look just above that line, to 0B7C. See? Every tank has a capacity value and a "% full" value. Apart from the tanks at offsets 0B7C to 0BA8 (the original FS98 ones), there are more at offsets 1244-1260, in the same format.

And the second thing was i wanted the figure out the actual filling in % in each tank from my PMDG aircraft. But also the 0B7C variable didnt showed the right value, also not with multiply it with 128.

You misunderstand. As documented, the % values are actually given as 128 x 65536 times the proportion. They aren't really percentages in fact (but they are described like that in FS). By DIVIDING by 128 x 65536 you get a proportion between 0 and 1. 0=empty, 1=full. I think this is corerect, anyway (I've not used them). If so, multiply by 100 for a proper percentage.

The way these are described comes from MS toolkits and early FS5/95/98 documentation by others before me.

Please try to use FSInterrogate for these sorts of questions. In general it is pretty good at deriving the correct value, and you can see how it works -- you can see the formulae it uses and get your results the same way. This is the main reason these development tools are provided.

Regards,

Pete

Link to comment
Share on other sites

maxmax20,

here are some example code lines (written in Delphi) to get the kg value for the center tank.

Factor_LbsToKg: Single = 0.4535924;

Fuel_Lvl_C: LongInt;

Fuel_Cap_C: Longword;

FuelWeight: Smallint;

Fuel_kg_C: Single;

FSUIPC_Read($0B74, 4, @Fuel_Lvl_C, dwResult);

FSUIPC_Read($0B78, 4, @Fuel_Cap_C, dwResult);

FSUIPC_Read($0AF4, 2, @FuelWeight, dwResult);

// Fuel Weight is calculated as follows:

//

// - how many gallons? (Max Capacity * Percent filled)

// - multiply with Fuel Weight to get lbs

// - convert to kg by using 'Factor_LbsToKg'

Fuel_kg_C := Fuel_Cap_C * ((Fuel_Lvl_C * 100 / (128 * 65536)) / 100)

* (FuelWeight / 256)

* Factor_LbsToKg;

Note that this is certainly not the most elegant solution but it works well for me 8)

Good luck!

CATIII

Link to comment
Share on other sites

You misunderstand. As documented, the % values are actually given as 128 x 65536 times the proportion. They aren't really percentages in fact (but they are described like that in FS). By DIVIDING by 128 x 65536 you get a proportion between 0 and 1. 0=empty, 1=full. I think this is corerect, anyway (I've not used them). If so, multiply by 100 for a proper percentage.

thanks pete, the % status is working well. Now i can display the status on my LCD :lol:

@CAT III

thanks for the code lines.

i will try this.

greetings

Mark

Link to comment
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
×
×
  • 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.