On Mon, 2007-02-12 at 01:41 -0500, John Denker wrote: > On 02/11/2007 11:29 PM, Dave Perry wrote: > > > By the way, I agree that the current algorithm in altimeter.cxx is > > wrong. This evening, I had time to look at your posted patch and I > > think it would give the right hi. > > It is, for now, restricted to the troposphere (36000 feet and below). > Extending it would be straightforward ... but see remarks below. > > > It does require two calls to ln() and > > exp() (i.e. the pow function). Have you thought of just using the C > > term in equation (15) and PA = pressure altitude which is already being > > computed. That would only require one call to pow(). Or since > > > > C = ( hi offset from PA) > > > > only varies with S, compute a replacement table for delta h in terms of > > S and interpolate that table. Then current hi = PA + interp(S). > > I considered that, but: > > 1) It's only a factor-of-two improvement,
If by improvement you mean improvement in computation time, since you would only compute the table once for all when you modify the code, it should be better than a factor of two improvement since the interpolation should be much less time than a call to pow(). > and > > 2) This code ought not exist at all. > > It's hard for me to get excited about optimizing something that > needs to be thrown out and redesigned. > > It does not make sense for altimeter.cxx to be implementing its > own model of the atmosphere; instead it should be making a > structured call to some sort of atmosphere model module. This > and related issues are discussed at > http://www.av8n.com/fly/fgfs/README.altimetry.html > > That document has more questions than answers; if anybody has > answers please let us know. After reading that README, one might go to the two layer approach. But that should not change much from a pilot's point of view since 36000 > 18000 ft, so anywhere in the world, S should be 29.92. As long as we have one altimeter model, a pilot at FL200 will be at the same level as any other pilot at FL200. Also, with this correction to altimeter.cxx, you should be at the field elevation on the ground if you set the local altimeter setting. So even going to a two level model seems to me to be over kill. No mater how detailed we make such an atmosphere model, it is still very different than the real atmosphere. My PhD thesis developed numerical algorithms to recognize the onset of chaos in n dimensional dynamical systems (as well as other transitions in stability of solutions) as parameters changed in the system. Should we someday have the compute power to model the fluid dynamics with very precise boundary conditions and initial conditions in time, the model would soon radically diverge from the real weather. This is sometimes referred to as the "butterfly effect" and strong dependence on initial conditions. Even the best models today cannot tell us what the weather will be like in Denver two days from now. The Lorenz equations which motivated the initial investigations of chaos were developed by Lorenz, a numerical meteorologist. So I propose that we implement the interpolation of C(s) proposed in my last note. I am not an experienced C++ programmer, but have much experience doing numerical analysis in C, Pascal, and Fortran. I am sure I can do this and if I have C++ questions, I can get help on the list. What about your disagreement with the statement that S = barometric pressure that would make hi = 0 MSL which is taught in most ground schools and is an easy consequence of equation (13) in you reference? Regards, Dave ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel