Jump to content
The simFlight Network Forums

Making mistake with FUEL Capacity ? -VB-


Recommended Posts

Hi Gentlemen ,

1)Using Visual Basic i try to get the centre tank FUEL capacity info from FS

At Aircraft Specifitaions in FS it says for Boeing 737-400 that is FUEL capacity is 5,311 US gal.

Then i enter the read code for fuel Capacity offset 0B78 ( HB78)

when i read it it show me that the capacity is 2313 ( Pete had write that the result is in US Gal mod)

So why is the real capacity that writes in FS 5.311 is dşfferent from what i get 2313

2) Again using VB thy to get fuel level of centre tank using offset HB74

. When try the code in VB it shows sometimes - values or sometimes + values around 23000 and counts down very quickjly

Any ideas for this 2 problems ?

Link to comment
Share on other sites

Using Visual Basic i try to get the centre tank FUEL capacity info from FS

At Aircraft Specifitaions in FS it says for Boeing 737-400 that is FUEL capacity is 5,311 US gal.

Then i enter the read code for fuel Capacity offset 0B78 ( HB78)

when i read it it show me that the capacity is 2313 ( Pete had write that the result is in US Gal mod)

So why is the real capacity that writes in FS 5.311 is dşfferent from what i get 2313

Have you checked the values against what FS reports in the Aircraft-Fuel menu? Please do. It reports 2313 US Gallons for the centre tank!

Your value of 5311 is the TOTAL capacity of all three tanks -- this is confirmed by Boeing references.

Again using VB thy to get fuel level of centre tank using offset HB74. When try the code in VB it shows sometimes - values or sometimes + values around 23000 and counts down very quickjly

The value for the level is NEVER negative. Maybe you are treating it as a signed integer when in fact it is unsigned? A percentage value ranges from 0 to 100, it cannot be negative.

A 100% full tank is a large positive number, 8388608. i.e. 128 * 65536. If you treat it as an unsigned number, divide it by 65536 and 128 then you will get 1 for 100%. Multiply by 100 before dividing for a more accurately descriptive 100.

Regards,

Pete

Link to comment
Share on other sites

Ok pete You were correct. Now it is working .

One more question for you ..

can i find the spent fuel (used fuel) by the level of tanks :

For example if the center tank capacity is 5000 and level of the current center tank is %10 so: %90 used

divide 5000 with 100 = 50 THAN 50x90 = 4500 used

Correct ?

2) but couldnt do the level again. it is negative someitmes.. tihs is the code for level

Dim fuel8 As Integer

Dim dwResult8 As Long

Call FSUIPC_Read(&HB74, 4, VarPtr(fuel8), dwResult8)

Call FSUIPC_Process(dwResult8)

Text36.Text = fuel8

End Sub

Link to comment
Share on other sites

can i find the spent fuel (used fuel) by the level of tanks :

For example if the center tank capacity is 5000 and level of the current center tank is %10 so: %90 used

divide 5000 with 100 = 50 THAN 50x90 = 4500 used

Correct ?

Yes, but only if the tank was full when you started. Normally you only fill the tanks enough for the journey, allowing for taxiing, alternates, reserves, and so on. Only for a full range full load would you start with full tanks.

but couldnt do the level again. it is negative someitmes.. tihs is the code for level

If you are seeing negatives your code is wrong. If you are using signed values in your code then large numbers may seem negative. If VB doesn't support unsigned numbers then you need to work out some way of dealing with it.

It isn't much use showing me VB I'm afraid, I don't know it (and from all the problems it seems to cause, I don't want to know it :wink: ). The Intel processors (in fact all processors I know) support unsigned numbers, as does C/C++ and most other languages as far as I know.

Maybe some other VB programmers will help you out with this.

BTW PLEASE use the supplied utilities to help you out. FSInterogate can be very instructive. It displays these things in a variety of formats and will probably show you where you are going wrong.

Regards,

Pete

Link to comment
Share on other sites

Yes, but only if the tank was full when you started. Normally you only fill the tanks enough for the journey, allowing for taxiing, alternates, reserves, and so on. Only for a full range full load would you start with full tanks.

So no other ways to get spent fuel ?

Roger Pete Thanks . So lets wait until a vb programmer helps me out :wink:

Link to comment
Share on other sites

ah got it

at program startup i can calculate the ful loaded = x

and calculate it again when the flight done = y

THAN x-y = fuel used

So i only need help from other VB programmers about the levels of the tanks

..( my problem is described above with the code .. )

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.