The simFlight Network Forums

# FS9 wrong model for atmosphere

## Recommended Posts

Dear all,

After many many years, I eventually noticed that there is a very severe problem in how the pressure at different altitude is computed in FS9; while the ISA atmosphere is decently simulated, with values of temperatures, pressures and densities correct up to at least 65000 ft, the mess starts with non-standard atmosphere. In particular it seems like that MS implemented the modification of the QNH as a mere subtraction from the pressure computed with the ISA model; this approach would be valid if the pressure vs altitude were a linear relation... which is absolutely not. The result is a huge mismatch between expected and computed values at high altitudes. The problem is not just cosmetics; the ambient pressure is used to compute a lot of things, from the power of the engines to the dynamic pressure, leading to huge errors in all flight dynamics. The proper way to compute the QNH variation would be to use the standard ISA model but instead on inputting the geometrical altitude in the formula, just use the pressure altitude (which is correctly computed by FS). With this erroneous approach there are grotesque results: for example, in a situation with a QNH of 977 hPa (equivalente of 1000 ft of difference from ISA), the pressure that you get at 50000 ft geometrical is not the one of 51000 ft in ISA but of something like 58000 ft! If with that QNH you fly above 70-something thousands, the pressure become NEGATIVE (as the pressure would be ~30 hPA - 36 hPa of difference from ISA at sea level). Funny that MS seemed aware of the problem, but instead of correcting it put a check and set the ambient pressure to 1013.2 hPa once the computation returns a negative number (great job!!).

A first question would be: are also newer simulators (FSX, P3D...) affected by this nasty problem? The way to check is easy: use AFDS, go a 90k feet, modify the QNH to 977, and read the pressure. If it is 1013.2 the problem is there.

I am trying to find at least a workaround for this problem, but it's not easy. The easiest I could think is to write a LUA script (or maybe a small module) to basically save the QNH in a variable, set the pressure to STD once passing (for example) 25000 ft and set it back to the original value below that altitude. Maybe by also imposing a smooth transition. But the trick of writing to the offset 0EC6 seems only working for the global weather, not the localized one. And I am afraid for the localized it is not so easy/possible to simply use a LUA script (am I wrong?).

A second possibility would be to patch the reponsible DLL. Not easy, but maybe possible. The problem is that i couldn't really locate the one that may be involved. I tried to disassemble those that looked more promising and/or containing some constants that I think to be involved in the ISA pressure calculations (like the number 5.256), but the disassembled code is very hard to interpret and I got stuck quickly. The best guess i have up to now was to look in the weather.dll. But I found at least 37 points where this constant appears and none of them had the impact i hoped (although some of them altered the computation somehow). The naive idea would be to find where the hellish subtraction is performed and instead of passsing the pointer (or whatever) to the QNH, just pass a 0.... that is equivalent to always compute the ambient pressure as in standard ISA, which is wrong at low altitudes, but it will lead to much less significant errors in the flight dynamics than the current but. Maybe here Pete might help, as he might know which DLL is involved and maybe which memory locations are used to point to the QNH. If the problem is present also in more modern simulators, maybe a more collective work could be considered (i doubt many would care too much if the problem is restricted to FS9 and those old crocodiles, like me, still using it).

Thanks in advance for any possible feedback.

Bests,

A.

##### Share on other sites

14 hours ago, Arrex2 said:

A first question would be: are also newer simulators (FSX, P3D...) affected by this nasty problem?

No idea - no one has reported this.

14 hours ago, Arrex2 said:

But the trick of writing to the offset 0EC6 seems only working for the global weather, not the localized one.

I am not sure about in FS9 (that is now very old!), but looking at this in FSX & P3D (FSUIPC4-6), this offset holds the simvar SEA LEVEL PRESSURE, and is the barometric pressure at sea level and cannot be set (i.e. read-only), and it is not available in MSFS2020 / FSUIPC7. I suspect that this is the same in FSUIPC3, although that is no longer supported and I don't have the source files to check.

14 hours ago, Arrex2 said:

Maybe here Pete might help, as he might know which DLL is involved and maybe which memory locations are used to point to the QNH.

Pete retired several years ago and will certainly not be willing to look into anything related to FS9 - I am pretty sure he doesn't even have this any more.

I think you would be better off re-directing your question to avsim.com.

Regards,

John

##### Share on other sites

4 hours ago, John Dowson said:

No idea - no one has reported this.

thanks for the reply John. Yes the same applied to FS9. There are threads on fsdeveloper that study the ISA atmosphere, but indeed they all do it in standard conditions, so I guess nobody noticed, at least in FS9. I don't have FSX or P3D to try out...

4 hours ago, John Dowson said:

I am not sure about in FS9 (that is now very old!), but looking at this in FSX & P3D (FSUIPC4-6), this offset holds the simvar SEA LEVEL PRESSURE, and is the barometric pressure at sea level and cannot be set (i.e. read-only), and it is not available in MSFS2020 / FSUIPC7. I suspect that this is the same in FSUIPC3, although that is no longer supported and I don't have the source files to check.

Interesting... read only.... it actually "works" by writing to it..... but only for global weather. And maybe "works" is a big word; didn't check long enough if it can create any sort of problem...

4 hours ago, John Dowson said:

Pete retired several years ago and will certainly not be willing to look into anything related to FS9 - I am pretty sure he doesn't even have this any more.

I think you would be better off re-directing your question to avsim.com.

Sure I understand. And the question was not if he can do something (FS9 and FSUIPC 3.x are long gone!), but if he by chance remembers in which DLL to look for, to restrict a bit my chase....

Edited by Arrex2
##### Share on other sites

22 minutes ago, Arrex2 said:

And the question was not if he can do something (FS9 and FSUIPC 3.x are long gone!), but if he by chance remembers in which DLL to look for, to restrict a bit my chase....

If you tag him with the @Pete Dowson notation he may respond...I can also ask him to take a look the next time we chat, but I doubt he will remember much from that long ago... He stopped hacking into the dlls over 10 years ago, and many things have changed since then,,,

John

##### Share on other sites

• 2 weeks later...

BTW.... i managed to find and "correct" the problem. The file was weather.dll. If anybody interested, please contact me

• 1

## Create an account

Register a new account