On Tue, 2007-01-23 at 18:48 +0100, Roy Vegard Ovesen wrote:

> Just updated from CVS (HEAD (OSG)), and it seems to me that the
> autopilots are 
> working. I tried the KAP140, and the generic in the pa28-161. Both
> worked 
> fine in heading mode, and the followed the bug on the HSI.
> 
I just did a cvs update -dP for both simgear and the fgfs source (osg
branch) and the "new version" kap140 works with the one quirk; to get
the heading bug to work requires going to the debug gui and reloading
the autopilot config.

Here is the version with the differential approximation for altFt.  I
think this is exactly what you asked for in


> What I'm asking for is an equation to convert from pressure altitude
> to ASL 
> altitude. Something like
>  ASL_alt = f(pressure_alt, ref_pressure)
> 

1)  Add the partial derivative function before altAlert:

hPartial = func {
  p0 = arg[1];    # Units of p0 must match units of delta p
  p = arg[0];     # Units of p must match units of delta p
  t0 = 288.15;    # [K]
  LR = -0.0065;    # [K/m]
  g = -9.80665;    # [m/s²]
  Rd = 287.05307; # [J/kg K]
  gamma = (Rd*LR)/g;

  z = -(t0/LR)*gamma*pow((p/p0),gamma)/p0;
  return z;
}

2)  Replace the computation of altFt in altAlert with

  pressureAltitude = getprop(encoder, "pressure-alt-ft");
  hPartBaro = hPartial(baroSettingInhg, 29.92) / 0.3048006;
#  print("hPartBaro = ",hPartBaro);
  altFt = pressureAltitude + hPartBaro * (baroSettingInhg - 29.92);

Notice:
1)  altFt = f(pressure_alt, baro_setting)
2)  requires only one call of pow (i.e. exp and ln)

I will send you the working kap140.nas with these changes off-list.  It
is working well here.  

Regards,
-- 
Dave Perry 


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