Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hey guys,

Using VB.NET, I'm trying to get the aircraft's current fuel weight to work. I looked for an offset to do just that, with no luck. I also tried doing some math, like subtraction of Offset 126C and Offset 3BFC. That came back as a wacky number, and I am lost of what to do next. Is there any recommended way of finding the aircraft's fuel?

Here's my offset code, maybe I'm doing something wrong.

  
Dim totalweight As New FSUIPC.Offset(Of Short)(&H126C)
Dim zerofuelweight As New FSUIPC.Offset(Of Short)(&H3BFC)

Thanks,

Jeremy

Posted

Using VB.NET, I'm trying to get the aircraft's current fuel weight to work. I looked for an offset to do just that, with no luck.

I assume you mean FSUIPC3 with FS9 or before? FSUIPC4 does provide a specific offset for total fuel weight for FSX, ESP and Prepar3D. It's in offset 126C, as listed.

I also tried doing some math, like subtraction of Offset 126C and Offset 3BFC. That came back as a wacky number

If this is with FSUIPC3 I'm not surprised as 126C isn't assigned to anything useful. What do you think is there?

Here's my offset code, maybe I'm doing something wrong.

  
Dim totalweight As New FSUIPC.Offset(Of Short)(&H126C)
Dim zerofuelweight As New FSUIPC.Offset(Of Short)(&H3BFC)

Well, more errors. As well as 126C being an unknown quantity, you have 3BFC being treated as a "short" when it is clearly documented as being 4 bytes = 32 bits = integer, not a 2 byte 16 bit short.

If you are using FSX and FSUIPC4 then the total fuel weight is already given to you in offset 126C, no computation necessary. It too is a 32-bit integer.

You need to be a little more careful looking up this information. And make sure you are using a current edition of the offset lists, please.

Pete

Posted (edited)

Hi Pete,

Since I'm using FS9, 3.99, which I assume is FSUIPC3, is there a way to get fuel values in both FSUIPC3 and FSUIPC4?

Edited by JeremyJ
Posted

Since I'm using FS9, 3.99, which I assume is FSUIPC3, is there a way to get fuel values in both FSUIPC3 and FSUIPC4?

Yes, get the total weight, from 30C0, and subtract from that the ZFW, which you found. note that they are in different numerical forms and units.

What was that business with 126C, though. What did you read to get that? Please do use the correct references. And you would be able to find all the relevant ones by simply searching on the word "weight". There aren't all that many! ;-)

Regards

Pete

Posted (edited)

What was that business with 126C, though. What did you read to get that? Please do use the correct references.

With 126C, I thought that would help with the fuel. But I didn't read correctly. I'll try again with the subtraction like you suggested/

Edited by JeremyJ
Posted

Using the 126C, I changed the Short to Integer

Dim fuelweight As New FSUIPC.Offset(Of Integer)(&H126C)

It doesn't release any errors, but it simply comes back as "1". I'll try again with the subtraction like you suggested/

I thought you said you were using FS9 and FSUIPC 3.99! And as I said there's nothing assigned to offset 126C in FSUIPC3!

Please re-read the earlier reply!

Pete

Posted

I thought you said you were using FS9 and FSUIPC 3.99! And as I said there's nothing assigned to offset 126C in FSUIPC3!

Please re-read the earlier reply!

Pete

I understood that after posting. The post was edited. My apologies. I did get the 30C0 Offset working,

Dim currentweight As New FSUIPC.Offset(Of Double)(&H30C0)

But the zero fuel weight is still giving wacky numbers.

Dim zerofuelweight As New FSUIPC.Offset(Of Integer)(&H3BFC)
zfw = zerofuelweight.Value * 256

Posted

But the zero fuel weight is still giving wacky numbers.

Dim zerofuelweight As New FSUIPC.Offset(Of Integer)(&H3BFC)
zfw = zerofuelweight.Value * 256

As documented, the ZFW is supplied as a value in pounds multiplied by 256, so, tell me, why are you multiplying by another 256?

Pete

Posted

As documented, the ZFW is supplied as a value in pounds multiplied by 256, so, tell me, why are you multiplying by another 256?

Pete

I took out the multiplication by 256, but is still reading way too high. The value is 509440, and the gross weight only is 2308.

Posted

I took out the multiplication by 256, but is still reading way too high. The value is 509440, and the gross weight only is 2308.

If you want it in pounds, not in pounds * 256, don't you think you need to divide by 256? Why not refer to the documentation yet again which tells you what you get?

This is becoming a bit silly.

Regards

Pete

Posted

That works Pete, Thanks for the help. Sorry about the frustration I probably caused, the Zero Fuel Weight documentation didn't really specify that the * 256 wasn't needed for this case. I assumed multiplying by 256 would be needed to find the total lbs.

Posted

That works Pete, Thanks for the help. Sorry about the frustration I probably caused, the Zero Fuel Weight documentation didn't really specify that the * 256 wasn't needed for this case. I assumed multiplying by 256 would be needed to find the total lbs.

The * 256 indicates that the units are pounds * 256. The documentation is correct and informative. All of the offsets have descriptions which tell you what is provided, NOT how you convert it -- that latter is up to you, to suit your needs.

Here you get units of 1/256ths of a pound, so to get whole pounds you obviously have to divide by 256.

What is confusing you, still, about this? How do you reckon the "the * 256 wasn't needed for this case"? Which cases is it needed for?

I think you need to get this sorted, unless you aren't going to do anything else.

Regards

Pete

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.