Re: [Flightgear-devel] Pressure errors in FGEnvironment

2002-06-05 Thread David Megginson

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?  There are a few fairly good
atmosphere models I can adapt (including the one in JSBSim); I just
stuck with the tables for now because they keep the code fast and
simple.  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.


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



re: [Flightgear-devel] Pressure errors in FGEnvironment

2002-06-05 Thread David Megginson

Andy Ross writes:

  Nonetheless, I think I found the problem.  In converting the YASim
  table to the new format, its values were re-encoded as deltas from sea
  level conditions, with sea level pressure defined as 29.92 inches of
  mercury.

I've fixed that now -- everything is encoded as factors instead.  It
seems OK at lower altitudes, but please let me know how it affects the
747.


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] Pressure errors in FGEnvironment

2002-06-05 Thread Christian Mayer

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



Re: [Flightgear-devel] Pressure errors in FGEnvironment

2002-06-05 Thread Tony Peden


--- Christian Mayer [EMAIL PROTECTED] wrote:
 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...

Depends on how many points are in the 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
 
 


__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] Pressure errors in FGEnvironment

2002-06-05 Thread Christian Mayer

Tony Peden wrote:
 
  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...
 
 Depends on how many points are in the table.

Yes. You can solve all problems with raw iron...

I don't know how feelable the sudden performance drops are when you
arrive in a new part of the table...

CU,
Christian


--
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



Re: [Flightgear-devel] Pressure errors in FGEnvironment

2002-06-05 Thread Tony Peden

On Wed, 2002-06-05 at 14:15, Christian Mayer wrote:
 Tony Peden wrote:
  
   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...
  
  Depends on how many points are in the table.
 
 Yes. You can solve all problems with raw iron...
 
 I don't know how feelable the sudden performance drops are when you
 arrive in a new part of the table...

There's two ways to implement the model with tables.  One is the brute
force approach that LaRCsim uses.  It maintains a tables of T,p, and rho
as a function of altitude and interpolates as needed.  The second comes
up when you implement the model as specified by ICAO, that uses a table
of constants that get plugged into one of two equations (depending on
whether or not the region is isothermal).  JSBSim uses the latter.

The first will require a lookup and interpolation every frame its
executed while the second may not require a lookup (the table only
has eight breakpoints even if it does) and will incur the cost of
evaluating the equations (they are e^x, I've no idea how much FPU/CPU
time they incur).

I don't really know, but I'd guess it's a toss up.

 
 
 CU,
 Christian
 
 
 --
 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
-- 
Tony Peden
[EMAIL PROTECTED]
We all know Linux is great ... it does infinite loops in 5 seconds. 
-- attributed to Linus Torvalds


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



re: [Flightgear-devel] Pressure errors in FGEnvironment

2002-05-31 Thread David Megginson

Andy Ross writes:

  Nonetheless, I think I found the problem.  In converting the YASim
  table to the new format, its values were re-encoded as deltas from sea
  level conditions, with sea level pressure defined as 29.92 inches of
  mercury.  But in the FGEnvironment constructor, I see the following
  initializer:
  
  pressure_sea_level_inhg(28),
  
  Now, 28 in. Hg is a reasonable sea level pressure.  But it's not the
  same one that the table is assuming.  At sea level, it's off by only
  about 2 inches.  But at altitude, it's off by a whopping TWO inches! :)

Actually, the value being used is the one set in preferences.xml,
28.5, but you're still almost certainly right.  I'll change both to
29.92, but there's more to consider.

The idea is that users should be able to set any reasonable sea-level
pressure and see reasonable behaviour -- that's why I set the tables
up with deltas rather than absolute values.  I can see, now, how that
would be a problem at higher altitudes, but what should we see?  If
the altimeter setting at ground level is 28inHG or 31inHG, what would
you expect at, say, 20,000 ft?  Would a factor rather than an offset
most appropriate?


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] Pressure errors in FGEnvironment

2002-05-31 Thread Andy Ross

David Megginson wrote:
 The idea is that users should be able to set any reasonable sea-level
 pressure and see reasonable behaviour -- that's why I set the tables
 up with deltas rather than absolute values.  I can see, now, how that
 would be a problem at higher altitudes, but what should we see?  If
 the altimeter setting at ground level is 28inHG or 31inHG, what would
 you expect at, say, 20,000 ft?  Would a factor rather than an offset
 most appropriate?

Obviously, getting this truly correct is a meteorology problem that
requires bunches of scientists and a supercomputer or two to solve.

But I'd argue that using a factor would be saner from a flight
simulation perspective -- if the sea level pressure at a location is
95% of nominal, then the pilot would naively expect that the air
density at all altitudes would be 95% of nominal.  Certainly the use
of an offset mechanism is going to be surprising, and for the extremes
of sea level pressure will lead to super-hurricanes up at altitude.

Actually, I'm fairly certain that high altitude phenomena tend to
smooth out pressure differences down below, so in fact the relative
difference between pressures at the flight levels should actually be
less than that at sea level.  Maybe you could try a factor that
asymptotically approaches 1.0 as altitude increases?  I don't have
much background in meteorology, though.

Andy

-- 
Andrew J. RossNextBus Information Systems
Senior Software Engineer  Emeryville, CA
[EMAIL PROTECTED]  http://www.nextbus.com
Men go crazy in conflagrations.  They only get better one by one.
 - Sting (misquoted)


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] Pressure errors in FGEnvironment

2002-05-31 Thread Christian Mayer

Andy Ross wrote:
 
 David Megginson wrote:
  The idea is that users should be able to set any reasonable sea-level
  pressure and see reasonable behaviour -- that's why I set the tables
  up with deltas rather than absolute values.  I can see, now, how that
  would be a problem at higher altitudes, but what should we see?  If
  the altimeter setting at ground level is 28inHG or 31inHG, what would
  you expect at, say, 20,000 ft?  Would a factor rather than an offset
  most appropriate?
 
 Obviously, getting this truly correct is a meteorology problem that
 requires bunches of scientists and a supercomputer or two to solve.
 
 But I'd argue that using a factor would be saner from a flight
 simulation perspective -- if the sea level pressure at a location is
 95% of nominal, then the pilot would naively expect that the air
 density at all altitudes would be 95% of nominal.  Certainly the use
 of an offset mechanism is going to be surprising, and for the extremes
 of sea level pressure will lead to super-hurricanes up at altitude.
 
 Actually, I'm fairly certain that high altitude phenomena tend to
 smooth out pressure differences down below, so in fact the relative
 difference between pressures at the flight levels should actually be
 less than that at sea level.  Maybe you could try a factor that
 asymptotically approaches 1.0 as altitude increases?  I don't have
 much background in meteorology, though.

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.

CU,
Christian

PS: Based on the formula the phenomena won't smooth out.

--
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



[Flightgear-devel] Pressure errors in FGEnvironment

2002-05-30 Thread Andy Ross

I wrote:
 First, the air pressures returned from the environment system don't
 agree with the standard atmosphere that YASim uses to do its
 calibration

Heh, funny that.  The new environment manager *is* using YASim's
numbers. :)

Nonetheless, I think I found the problem.  In converting the YASim
table to the new format, its values were re-encoded as deltas from sea
level conditions, with sea level pressure defined as 29.92 inches of
mercury.  But in the FGEnvironment constructor, I see the following
initializer:

pressure_sea_level_inhg(28),

Now, 28 in. Hg is a reasonable sea level pressure.  But it's not the
same one that the table is assuming.  At sea level, it's off by only
about 2 inches.  But at altitude, it's off by a whopping TWO inches! :)

This value can be set from other places, so I'm not 100% sure this is
the problem.  I can't test fgfs right now because my fiancee is laying
out wedding invitations on the good computer.  But it looks pretty
suspicious.  I'd suggest:

-pressure_sea_level_inhg(28),
+pressure_sea_level_inhg(29.92),

Andy

-- 
Andrew J. RossNextBus Information Systems
Senior Software Engineer  Emeryville, CA
[EMAIL PROTECTED]  http://www.nextbus.com
Men go crazy in conflagrations.  They only get better one by one.
 - Sting (misquoted)


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel