Hi All, I have been communicating off and on with both John Denker and Roy Vegard Ovesen off list concerning this topic. I am running an edit of John's most recent altimetry patch and have modified kap140.nas, altimeter.cxx, and altimeter.hxx so that the altitude capture in the kap140 is using the same atmosphere model as the altimeter. It is also using the altimeter.cxx as the encoder, bypassing encoder.cxx. When near sea level, the cvs encoder.cxx did not report the same pressure altitude as the altimeter with kollsman set to 29.92. By replacing the encoder.cxx with the new altimeter.cxx, this is fixed.
Why does the kap140 need info from the altimeter other than the pressure altitude? The altitude capture in the current cvs kap140.nas used altFt = pressureAltitude + hpartial * (baroSetting - 29.92) and compared this to the target altitude. The problem with this is two fold. The second term is a linear approximation to the h(baroSetting,29.92). But h( , ) was the function before altAlert in kap140.nas. It used two transcendental functions each frame and was not the same function now used by John to model the atmosphere (close in the troposphere, but not the same). The attached patch uses the PA (rounded to the nearest 10 ft.) from the new altimeter.cxx and a baro-offset = kollsman offset with baro setting replacing the altimeter setting. Why is that necessary? Well, there are three different numbers that matter. There is the "Alt inhg" returned by metar. There is the "setting" the pilot puts in the kollsman window, and there is the baro setting the pilot enters in the KAP140. The KAP140 must use the baro setting and the PA returned by the encoding altimeter to get the term altFt it compares to the target altitude. It has access to the static pressure according to the KAP140 manual, but could use a power function approximation similar to what John's altimeter uses to compute the baro offset w/o knowing the static pressure. Then altFt = PA - baroOffset. The patch attached models the following pilot errors "correctly". Case 1: Pilot enters the QNH in baro setting on the KAP140 but does not enter QNH correctly in the kollsman window of the altimeter. If he sets the target altitude and arms it, the AC will still capture the right altitude, but the indicated altitude will be wrong. Case 2: Pilot enters QNH correctly in the kollsman window on the altimeter, but sets baro setting wrong. Even if he sets the target altitude right and arms it, the AC will capture the wrong altitude. For example, if the baro setting is 29.92, the KAP140 will capture PA which is only correct if QNH = 29.92. But since he got QNH right in the kollsman window, the indicated altitude will be correct, telling him he captured the wrong altitude. I modified John's code so the altimeter picks up baro setting from /autopilot/KAP140/settings/baro-setting-inhg and uses this to compute baroOffset using the same interpolation function model, _altimeter.kollsman_ft(baro_setting). I also rearranged the truncation of pressure altitude in John's code so the indicated altitude is computed before the pressure altitude is rounded and saved. John, you may have already caught and corrected this bug. I consider this combined patch to be a significant improvement to FlightGear. Where you will notice the improvement the most is 1) Mountain airports with QNH != 29.92, 2) Flying down glide slopes to a mountain airport (indicated DH will be close to accurate, often avoiding a crash situation should you fly the approach with the present cvs.) 3) The captured altitude for the KAP140 will be as accurate as it is with real autopilots. I am sure John can point out other situations the new atmosphere model improves. I want both John and Roy to try this patch before we consider submitting it to cvs. Of course, anyone can try it and comment. Is the encoder used anywhere other than by the KAP140? If so, we should use a separate instantiation as suggested by John. Regards, -- Dave Perry
altimetry.tar.gz
Description: application/compressed-tar
------------------------------------------------------------------------- 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