Jump to content
The simFlight Network Forums

FLOAT 64 - Offset 0918


Recommended Posts

Pete, I know you re not expert in VB6 but assumedly you could help me understand FLOAT 64.

VB Gurus help me if you can....

With offset 0918, bit 8 Engine 1 Fuel Flow PPH obviously tell that I need to convert it to FAKE 64.. so here what I did, following attempt from FSUIPC VB SDK docs and it didn't work... I am not sure I know how it should be factored up.

Dim Eng1FF64 As Currency  ' Fake64
Dim Eng1FFnum As Double

Call FSUIPC_Read(&H918, 8, VarPtr(Eng1FF64), dwResult)
Call FSUIPC_Process(dwResult)

Eng1FFNum = Eng1FF64 * 10000#  'so it can be converted 
Eng1FFNum = Eng1FFNum / (10001750# * 65536# * 65536#)

End Sub

I get a real strange number... I was expected to see ##.# in result, can anyone tell me if I factored up wrong for fuel flow or anything?

Link to comment
Share on other sites

Pete, I know you re not expert in VB6 but assumedly you could help me understand FLOAT 64.

Microsoft's term "FLOAT 64" just means "double" in C, or whatever your 64-bit floating point numbers are called in other languages.

With offset 0918, bit 8 Engine 1 Fuel Flow PPH obviously tell that I need to convert it to FAKE 64.

"FAKE 64" surely isn't VB's name for a standard 64-bit flloating point number? That sounds very very unlikely.

I am pretty sure VB supports standard Intel format floating point, otherwise many programs written in VB would be almost impossible. Please check your VB reference book(s).

These are standard Intel formats:

FLOAT64 = floating point 64 bit ("double" in C/C++)

FLOAT32 = floating point 32-bit ("float" in C/C++)

I suspect your "FAKE 64" is some sort of 64-bit fixed point integer, similar to "long long" or "_int64" in C/C++. You would use those for the 64-bit values for Latitude, Longitude and Altitude at offsets 0560, 0568 and 0570.

BTW, I see this in your code snippet:

/ (10001750# * 65536# * 65536#)

Why would you try to convert a fuel flow in pounds per hour as if it were a Latitude value in FS units? For it is only such latitudes which are converted in this way. Where are you getting this formula from?

Please do two things when working out access to an FSUIPC offset:

1. Check the programmer's guide in the SDK. Look up the varaible in the table. For instance, for offset 0918 it most clearly states that it is a "floating point double" as well as "(FLOAT64)". I would have thought that the words "floating point double" at least could be translated into whatever VB calls them.

You will also note then that there is absolutely no conversion from FS Latitude units mentioned for the Fuel Flow in PPH.

2. Use FSInterrogate, Please. This is capable of showing EXACTLY what is being read in several different formats, including floating point double. A version currently being developed will also add FLOAT32 and INT64 (your "FAKE 64" I suspect).

Regards

Pete

Link to comment
Share on other sites

Microsoft's term "FLOAT 64" just means "double" in C, or whatever your 64-bit floating point numbers are called in other languages.

Double in VB

Why would you try to convert a fuel flow in pounds per hour as if it were a Latitude value in FS units? For it is only such latitudes which are converted in this way. Where are you getting this formula from?

About formula, Honestly.. I don't know why.. and it came from no where I just thought I had hunch...

1. Check the programmer's guide in the SDK. Look up the varaible in the table. For instance, for offset 0918 it most clearly states that it is a "floating point double" as well as "(FLOAT64)". I would have thought that the words "floating point double" at least could be translated into whatever VB calls them.

I have always read SDK programmer guide... I absoutely have no problem reading it. Just until I encountered with situation on FLOAT (never had it calculated before), that confused me knowing what is need to be declared in VB compared to C++. Now I have learned something about it after going through lot of search engines.

You will also note then that there is absolutely no conversion from FS Latitude units mentioned for the Fuel Flow in PPH.

Yeah, I realize that now.... after what yousaid I changed code around a bit.

Dim Eng1FF as Double (not currency)

Dim Eng1FFNum as Variant (Not Double)

Eng1FFNum = Eng1FF / 1000

And it's working now... :D

2. Use FSInterrogate, Please. This is capable of showing EXACTLY what is being read in several different formats, including floating point double. A version currently being developed will also add FLOAT32 and INT64 (your "FAKE 64" I suspect).

For the fact, I couldn't reject of using FSInterrogate, I find its very useful.

But when it comes to field description.. there isn't much information on factoring up with float, that's where i got stuck. Just until I click read buffer and looked up at 'FLOAT64' and it show value of 10.##### so that's when I figured that it should be divied up to 1000 for jetliner Fuel Flow.

Sometimes things don't come in sense at first just until then it does.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

Loading...
 Share

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