The simFlight Network Forums

# Fuel Offsets

## Recommended Posts

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)(&amp;H126C)
Dim zerofuelweight As New FSUIPC.Offset(Of Short)(&amp;H3BFC)```

Thanks,

Jeremy

##### Share on other sites

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)(&amp;H126C)
Dim zerofuelweight As New FSUIPC.Offset(Of Short)(&amp;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

##### Share on other sites

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
##### Share on other sites

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

##### Share on other sites

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
##### Share on other sites

Using the 126C, I changed the Short to Integer

`Dim fuelweight As New FSUIPC.Offset(Of Integer)(&amp;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!

Pete

##### Share on other sites

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!

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)(&amp;H30C0)`

But the zero fuel weight is still giving wacky numbers.

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

##### Share on other sites

But the zero fuel weight is still giving wacky numbers.

```Dim zerofuelweight As New FSUIPC.Offset(Of Integer)(&amp;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

##### Share on other sites

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.

##### Share on other sites

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

##### Share on other sites

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.

##### Share on other sites

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

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.