David Megginson wrote: > > Christian Mayer writes: > > > As I wrote before, there's a function in the WeatherCM code that > > calculates the air pressure based on the air pressure at a given > > altitude and at a given teperature profile. It is based on the well > > known (but incorrect) baryometric (SP?) formula but doesn't suffer from > > its limitations. When you feed it, the standard conditions it will > > return the standard atmosphere. > > > > When you adopt that code, you'll automagicly get the correct results. > > Does the code handle only pressure?
The code does only calculate air pressure. > There are a few fairly good > atmosphere models I can adapt (including the one in JSBSim); The code does comply with the international atmosphere models (IIRC JSBsim uses exactly the same data I used to verify the calculations) > I just > stuck with the tables for now because they keep the code fast and > simple. Tables are faster and simpler. But they aren't really flexible. When you are concerned about performance: How many pressure calculations do we need? Not more than a few per frame. And as the pressure changes are very small during a frame we can even cache the result. And alltogether the number of calculations that are done is very small. Probably the space overhead a table generates would be worse (cf. discusion about inlining code) > I want to be able to extrapolate both ways -- if the user > supplies a temperature or pressure at altitude, I want to be able to > extrapolate the temperature or pressure at sea level, and vice-versa. So the code is better suited for you than the tables. You give the code a temperature profile (which is basicly the table approach) and a pressure value at a give altitude (doesn't need to be sea level). Then you get valid numbers for any altitude that you want. CU, Christian PS: As the air pressure curve is similar to the e-function (e^altitude) it's nowhere linear and thus badly approximated by a table... -- The idea is to die young as late as possible. -- Ashley Montague _______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel