Jump to content
The simFlight Network Forums

Offset 2834 8 bit Battery voltage / DC volts


Metall4You

Recommended Posts

Hello

would like to display the volt number from the offset 2834 8 bits. I get a value that I want to convert so that I get the volts displayed as in the IRS display / DC volts. what is the formula? 
I didn't find anything in FSUIPC for Programmers. thank you for your decision. 

Greetings Ramon

Link to comment
Share on other sites

Hi Ramon.

3 hours ago, Metall4You said:

would like to display the volt number from the offset 2834 8 bits. I get a value that I want to convert so that I get the volts displayed as in the IRS display / DC volts. what is the formula? 

Offset 0x2834 holds the simvar ELECTRICAL BATTERY VOLTAGE, and from the MSFS documentation:

  ELECTRICAL BATTERY VOLTAGE

The battery voltage. Use a battery index when referencing.

Volts  

i.e. it should already be in volts so no conversion needed - just read it as a double.

3 hours ago, Metall4You said:

I didn't find anything in FSUIPC for Programmers. thank you for your decision. 

What are you looking for?

Cheers,

John

Link to comment
Share on other sites

Hi John

I have the same problem as Ramon. SC-Pascal has a very limited function range and is not able by itself to convert Float64 to e.g. a 2-Byte word. In my case it is the heading at $02D0,4    I need it for my WetCompass.

I read only the upper nibbles of this value to simplify conversion, but it is still very complicate. Is there a chance, that all Float values can be converted to reasonable Bytes/Words to be used in further script calculations resp. displays?

Best regards

Urs

Link to comment
Share on other sites

8 minutes ago, Alpin-Flier said:

I read only the upper nibbles of this value to simplify conversion, but it is still very complicate. Is there a chance, that all Float values can be converted to reasonable Bytes/Words to be used in further script calculations resp. displays?

You can try adding the same simvar (ELECTRICAL BATTERY VOLTAGE) to a free user offset as another type that can be read/converted using SC-Pascal. I am not 100% sure on this (and won't have time to look into this until next week), but you could try adding this as a a 32-bit float (F32) or as an integer (I32) if they can be read in SC-Pascal. I think the original 64-bit double value would then be converted or cast to the defined type. See page 34 on how to add simvars to FSUIPC offsets.

Any issues let me know, and I will take a deeper look next week.

John

  • Thanks 1
Link to comment
Share on other sites

Hi John
Thank you very much for answering. I think I should be more precise. Some values are output from PMDG resp. Simconnect as Float32 resp. Float64. When you need the values for calculations and/or displays, it is very difficult to convert them to integers in a program like SC-Pascal. The following vars are concerned in the PMDG B737:

Offset Mapping for PMDG 737-700
6474 4 FLT32 FUEL_FuelTempNeedle
64E8 4 FLT32 APU_EGTNeedle
6548 8 FLT32 x 2 AIR_DuctPress[2] PSI
6550 8 FLT32 x 2 AIR_DuctPressNeedle[2] Value - PSI
6558 4 FLT32 AIR_CabinAltNeedle Value - ft
655C 4 FLT32 AIR_CabinDPNeedle Value - PSI
6560 4 FLT32 AIR_CabinVSNeedle Value - ft/min
6564 4 FLT32 AIR_CabinValveNeedle Value - 0(closed) .. 1(open)
65C4 4 FLT32 MCP_IASMach Mach if < 10.0
660C 8 FLT32 x 2 MAIN_TEFlapsNeedle[2]
661C 4 FLT32 MAIN_BrakePressNeedle

General offsets
02CC 8 FLT64 WISKEY COMPASS INDICATION
Other interesting values as the AC/DC voltages and currents (see Ramons question)

With the FSInterrogate tool I can see the correct values in the FLT32 resp. FLT64 columns. It would be very helpful, if these values could be duplicated to new offsets as integers. Let's take the Wiskey Compass as an exemple: Take the FLT64 from 02CC (0 to 359,xxxx..°)and multiply it by 100 => 0 to 35999 This value is then output with a 2-byte integer. The user can divide it by 100 (possible with every program) and display 0.00 to 359.99 . Similar with Flaps controlling servos.

Just an idea, possibly helping also other users of FSUIPC. Thank you very much for attention and best regards
Urs

 

Link to comment
Share on other sites

So you cannot read 32-bit floats or 64-bit double floats from C-Pascal? I find that quite strange...

1 hour ago, Alpin-Flier said:

With the FSInterrogate tool I can see the correct values in the FLT32 resp. FLT64 columns. It would be very helpful, if these values could be duplicated to new offsets as integers. Let's take the Wiskey Compass as an exemple: Take the FLT64 from 02CC (0 to 359,xxxx..°)and multiply it by 100 => 0 to 35999 This value is then output with a 2-byte integer. The user can divide it by 100 (possible with every program) and display 0.00 to 359.99 . Similar with Flaps controlling servos.

I cannot possibly allocated fixed offsets for this when they will only be used for a specific aircraft and dor such a small subset of users. But, as I said, there are mechanisms provided for the user to do this - if its a standard simvar that is held in the offset, you can dd the same simvar as a different type, i.e. as an integer, using the mechanism provided and documented in the Advanced User guide (page 34). If its a PMDG offset, then you would need a lua script (registered version of FSUIPC only) to monito that offset and pick up any changes (using the event.offset function, as already suggested) amd convertt the value to the required type and then write that value back to an offset free for general use.

I can help with both of these, but you should try to do this yourself first.

Note that I am away this weekend (the wife's birthday), and so will be unavailable from a few hours time until Monday morning, so I can help further then if you are having issues.

John

  • Thanks 1
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.