• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Variable Comparison and Number Formats

Messages
159
Country
us-colorado
I want to compare (A:KOHLSMAN SETTING HG, inHG) to (A:SEA LEVEL PRESSURE, inHG) with an accuracy of two decimal places, e.g., 29.92 compared to 29.93. To do this it would be helpful to know the number format used to store these sim variables in the computer, and how these stored values are “rounded” to obtain their displayed values to two decimal places. For example, since I would assume they are represented in the computer to more than two decimal places, then one approach might be to multiply them by 100 and round to the nearest integer before comparison. This assumes the sim rounds them to the nearest 2 decimal places before display as well.
So the question is how are these variables represented in the sim, and how best to compare them to two decimal places?

Thx,
Al
 
I usually just create an Element section in any random gauge and display a String statement of that variable to more than 2 digits. This will tell you that answer. But I have never heard of numeric FS variables that are limited to 2 decimal places, so I think you are safe there.
 
Hi,
You could use the near operator, for example:
(A:KOHLSMAN SETTING HG, inHG) 100 * near

Then, to compare both vars:
(A:KOHLSMAN SETTING HG, inHG) 100 * near (A:SEA LEVEL PRESSURE, inHG) 100 * near == if{ ... }

Tom
 
Hi,
You could use the near operator, for example:
(A:KOHLSMAN SETTING HG, inHG) 100 * near

Then, to compare both vars:
(A:KOHLSMAN SETTING HG, inHG) 100 * near (A:SEA LEVEL PRESSURE, inHG) 100 * near == if{ ... }

Tom

Yes, using near is exactly what I was going to try. Hopefully the sim rounds values in a similar fashion for display.

Thanks for the responses.
Al
 
If in doubt use number instead of inHG. This will usually return the actual figure used by the sim.

In the case of sea level pressure I get 101320.013428 for (A:SEA LEVEL PRESSURE,number) which looks like the pressure in millibars x 100.

Using inhg the result is 29.919870 and using millibars it is obviously 1013.200134

Kohlsman setting stores its values in the same way as sea level pressure, ie mb * 100 to 6 decimal places.

If you display the value to 2 decimal places then it looks like FSX will round up or down to the nearest decimal place. So 1013.200134 becomes 1013.20 while 1013.206134 becomes 1013.21. Or when working in inhg 29.919870 is displayed as 29.92.
 
Last edited:
If in doubt use number instead of inHG. This will usually return the actual figure used by the sim.

In the case of sea level pressure I get 101320.013428 for (A:SEA LEVEL PRESSURE,number) which looks like the pressure in millibars x 100.

Using inhg the result is 29.919870 and using millibars it is obviously 1013.200134

Kohlsman setting stores its values in the same way as sea level pressure, ie mb * 100 to 6 decimal places.

If you display the value to 2 decimal places then it looks like FSX will round up or down to the nearest decimal place. So 1013.200134 becomes 1013.20 while 1013.206134 becomes 1013.21. Or when working in inhg 29.919870 is displayed as 29.92.
My guess was that FSX was rounding to the nearest two decimal places. So far multiplying the pressures by 100 and using near to round to the nearest integer before comparing seems to be working.
Thanks for the info -- very interesting.
Al
 
I needed to do a conversion to be able to calculate airfield QFE. In doing so I discovered that the sims calculate 1 millibar to be the equivalent of 29.54545 feet. So now the AP and everything else associated with pressure runs on L:vars. Just in case though I do have an error check routine to compare with A.vars but it doesn't seem to have a significant rôle.
 
I needed to do a conversion to be able to calculate airfield QFE. In doing so I discovered that the sims calculate 1 millibar to be the equivalent of 29.54545 feet. So now the AP and everything else associated with pressure runs on L:vars. Just in case though I do have an error check routine to compare with A.vars but it doesn't seem to have a significant rôle.
My application is a simple reminder to the pilot to set the altimeter to the current sea level pressure if below 18000ft or to 29.92 if at or above 18000 ft (the US transition altitude) by flashing the needed altimeter setting, so a simple comparison is sufficient.
Thx,
Al
 
Back
Top