Hi --

I made an /object/ to calculate the Kollsman shift.


# Calculate Kollsman shift/ft versus setting/inHg
# Computationally efficient if, for any given instance
# of this class, the setting is not being changed often.
# Typical usage:
#  kxx = atmo.Kollsman.new();
#  kyy = atmo.Kollsman.new();
#  print (kxx.shift(29.92));    # calculates
#  print (kyy.shift(30.92));    # calculates
#  print (kxx.shift(29.92));    # uses cached value
#  print (kyy.shift(30.92));    # uses cached value

Kollsman = {
   new : func { { parents : [Kollsman] } },
   ft : nil,
   set : nil,
   shift : func(setting) {
     if (setting == me.set) {return me.ft ~ "xx"}
     me.set = setting;
     me.ft = 145442.156 * (1 - math.exp(math.ln(me.set/29.921260) * 
0.1902632365))
   }
};







On 02/26/2007 08:30 AM, Dave Perry wrote:

> So only the altimeter can compute the kollsman shift via "your oracle"?

I'm pretty sure my altimeter code does not use an oracle.  The
C++ code uses C++ code to calculate the Kollsman shift.  This
is the conventional and appropriate approach.

In close analogy, I recommend that the autopilot .nas code
should use .nas code to calculate the Kollsman shift.  This is
the conventional and appropriate approach.

It is also more realistic (as previously discussed), simpler, and
more self-documenting.

    There *do* exist exceptional cases where it is appropriate for
    the .nas code to escape to C++ or beyond ... e.g. math.atan2() ...
    but I see not the slightest evidence that the Kollsman shift
    calculation is in this category.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to