]> git.mxchange.org Git - flightgear.git/blob - src/Environment/environment.cxx
just in case that someone does not like ridge lift at all, set the property
[flightgear.git] / src / Environment / environment.cxx
1 // environment.cxx -- routines to model the natural environment
2 //
3 // Written by David Megginson, started February 2002.
4 //
5 // Copyright (C) 2002  David Megginson - david@megginson.com
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 //
21 // $Id$
22
23
24 #ifdef HAVE_CONFIG_H
25 #  include <config.h>
26 #endif
27
28 #include <math.h>
29
30 #include <simgear/constants.h>
31 #include <simgear/debug/logstream.hxx>
32 #include <simgear/math/interpolater.hxx>
33 #include <simgear/props/props.hxx>
34 #include <simgear/environment/visual_enviro.hxx>
35
36 #include <Main/fg_props.hxx>
37
38 #include "environment.hxx"
39
40
41 \f
42 ////////////////////////////////////////////////////////////////////////
43 // Atmosphere model.
44 ////////////////////////////////////////////////////////////////////////
45
46 // Calculated based on the ISA standard day, as found at e.g.
47 // http://www.av8n.com/physics/altimetry.htm
48
49 // Each line of data has 3 elements:
50 //   Elevation (ft), 
51 //   temperature factor (dimensionless ratio of absolute temp), 
52 //   pressure factor (dimensionless ratio)
53 static double atmosphere_data[][3] = {
54  {  -3000.00,   1.021,  1.1133 },
55  {      0.00,   1.000,  1.0000 },
56  {   2952.76,   0.980,  0.8978 },
57  {   5905.51,   0.959,  0.8042 },
58  {   8858.27,   0.939,  0.7187 },
59  {  11811.02,   0.919,  0.6407 },
60  {  14763.78,   0.898,  0.5697 },
61  {  17716.54,   0.878,  0.5052 },
62  {  20669.29,   0.858,  0.4468 },
63  {  23622.05,   0.838,  0.3940 },
64  {  26574.80,   0.817,  0.3463 },
65  {  29527.56,   0.797,  0.3034 },
66  {  32480.31,   0.777,  0.2649 },
67  {  35433.07,   0.756,  0.2305 },
68  {  38385.83,   0.752,  0.2000 },
69  {  41338.58,   0.752,  0.1736 },
70  {  44291.34,   0.752,  0.1506 },
71  {  47244.09,   0.752,  0.1307 },
72  {  50196.85,   0.752,  0.1134 },
73  {  53149.61,   0.752,  0.0984 },
74  {  56102.36,   0.752,  0.0854 },
75  {  59055.12,   0.752,  0.0741 },
76  {  62007.87,   0.752,  0.0643 },
77  {  65000.00,   0.752,  0.0557 },
78  {  68000.00,   0.754,  0.0482 },
79  {  71000.00,   0.758,  0.0418 },
80  {  74000.00,   0.761,  0.0362 },
81  {  77000.00,   0.764,  0.0314 },
82  {  80000.00,   0.767,  0.0273 },
83  {  83000.00,   0.770,  0.0237 },
84  {  86000.00,   0.773,  0.0206 },
85  {  89000.00,   0.777,  0.0179 },
86  {  92000.00,   0.780,  0.0156 },
87  {  95000.00,   0.783,  0.0135 },
88  {  98000.00,   0.786,  0.0118 },
89  { 101000.00,   0.789,  0.0103 },
90  { -1, -1, -1 }
91 };
92
93 static SGInterpTable * _temperature_degc_table = 0;
94 static SGInterpTable * _pressure_inhg_table = 0;
95
96 static void
97 _setup_tables ()
98 {
99   if (_temperature_degc_table != 0)
100       return;
101
102   _temperature_degc_table = new SGInterpTable;
103   _pressure_inhg_table = new SGInterpTable;
104
105   for (int i = 0; atmosphere_data[i][0] != -1; i++) {
106     _temperature_degc_table->addEntry(atmosphere_data[i][0],
107                                       atmosphere_data[i][1]);
108     _pressure_inhg_table->addEntry(atmosphere_data[i][0],
109                                    atmosphere_data[i][2]);
110   }
111 }
112
113
114 \f
115 ////////////////////////////////////////////////////////////////////////
116 // Implementation of FGEnvironment.
117 ////////////////////////////////////////////////////////////////////////
118
119 void FGEnvironment::_init()
120 {
121     elevation_ft = 0;
122     visibility_m = 32000;
123     temperature_sea_level_degc = 15;
124     temperature_degc = 15;
125     dewpoint_sea_level_degc = 5; // guess
126     dewpoint_degc = 5;
127     pressure_sea_level_inhg = 29.92;
128     pressure_inhg = 29.92;
129     turbulence_magnitude_norm = 0;
130     turbulence_rate_hz = 1;
131     wind_from_heading_deg = 0;
132     wind_speed_kt = 0;
133     wind_from_north_fps = 0;
134     wind_from_east_fps = 0;
135     wind_from_down_fps = 0;
136     thermal_lift_fps = 0;
137     ridge_lift_fps= 0;
138     altitude_half_to_sun_m = 1000;
139     altitude_tropo_top_m = 10000;
140     _setup_tables();
141     _recalc_density();
142     _recalc_relative_humidity();
143     
144 }
145
146 FGEnvironment::FGEnvironment()
147 {
148     _init();
149 }
150
151 FGEnvironment::FGEnvironment (const FGEnvironment &env)
152 {
153     _init();
154     copy(env);
155 }
156
157 FGEnvironment::~FGEnvironment()
158 {
159 }
160
161 void
162 FGEnvironment::copy (const FGEnvironment &env)
163 {
164     elevation_ft = env.elevation_ft;
165     visibility_m = env.visibility_m;
166     temperature_sea_level_degc = env.temperature_sea_level_degc;
167     temperature_degc = env.temperature_degc;
168     dewpoint_sea_level_degc = env.dewpoint_sea_level_degc;
169     dewpoint_degc = env.dewpoint_degc;
170     pressure_sea_level_inhg = env.pressure_sea_level_inhg;
171     wind_from_heading_deg = env.wind_from_heading_deg;
172     wind_speed_kt = env.wind_speed_kt;
173     wind_from_north_fps = env.wind_from_north_fps;
174     wind_from_east_fps = env.wind_from_east_fps;
175     wind_from_down_fps = env.wind_from_down_fps;
176     thermal_lift_fps = env.thermal_lift_fps;
177     ridge_lift_fps= env.ridge_lift_fps;
178     turbulence_magnitude_norm = env.turbulence_magnitude_norm;
179     turbulence_rate_hz = env.turbulence_rate_hz;
180 }
181
182 static inline bool
183 maybe_copy_value (FGEnvironment * env, const SGPropertyNode * node,
184                   const char * name, void (FGEnvironment::*setter)(double))
185 {
186     const SGPropertyNode * child = node->getNode(name);
187                                 // fragile: depends on not being typed
188                                 // as a number
189     if (child != 0 && child->hasValue() &&
190         child->getStringValue()[0] != '\0') {
191         (env->*setter)(child->getDoubleValue());
192         return true;
193     } else {
194         return false;
195     }
196 }
197
198 void
199 FGEnvironment::read (const SGPropertyNode * node)
200 {
201     maybe_copy_value(this, node, "visibility-m",
202                      &FGEnvironment::set_visibility_m);
203
204     if (!maybe_copy_value(this, node, "temperature-sea-level-degc",
205                           &FGEnvironment::set_temperature_sea_level_degc))
206         maybe_copy_value(this, node, "temperature-degc",
207                          &FGEnvironment::set_temperature_degc);
208
209     if (!maybe_copy_value(this, node, "dewpoint-sea-level-degc",
210                           &FGEnvironment::set_dewpoint_sea_level_degc))
211         maybe_copy_value(this, node, "dewpoint-degc",
212                          &FGEnvironment::set_dewpoint_degc);
213
214     if (!maybe_copy_value(this, node, "pressure-sea-level-inhg",
215                           &FGEnvironment::set_pressure_sea_level_inhg))
216         maybe_copy_value(this, node, "pressure-inhg",
217                          &FGEnvironment::set_pressure_inhg);
218
219     maybe_copy_value(this, node, "wind-from-heading-deg",
220                      &FGEnvironment::set_wind_from_heading_deg);
221
222     maybe_copy_value(this, node, "wind-speed-kt",
223                      &FGEnvironment::set_wind_speed_kt);
224
225     maybe_copy_value(this, node, "elevation-ft",
226                      &FGEnvironment::set_elevation_ft);
227
228     maybe_copy_value(this, node, "turbulence/magnitude-norm",
229                      &FGEnvironment::set_turbulence_magnitude_norm);
230
231     maybe_copy_value(this, node, "turbulence/rate-hz",
232                      &FGEnvironment::set_turbulence_rate_hz);
233 }
234
235
236 double
237 FGEnvironment::get_visibility_m () const
238 {
239   return visibility_m;
240 }
241
242 double
243 FGEnvironment::get_temperature_sea_level_degc () const
244 {
245   return temperature_sea_level_degc;
246 }
247
248 double
249 FGEnvironment::get_temperature_degc () const
250 {
251   return temperature_degc;
252 }
253
254 double
255 FGEnvironment::get_temperature_degf () const
256 {
257   return (temperature_degc * 9.0 / 5.0) + 32.0;
258 }
259
260 double
261 FGEnvironment::get_dewpoint_sea_level_degc () const
262 {
263   return dewpoint_sea_level_degc;
264 }
265
266 double
267 FGEnvironment::get_dewpoint_degc () const
268 {
269   return dewpoint_degc;
270 }
271
272 double
273 FGEnvironment::get_pressure_sea_level_inhg () const
274 {
275   return pressure_sea_level_inhg;
276 }
277
278 double
279 FGEnvironment::get_pressure_inhg () const
280 {
281   return pressure_inhg;
282 }
283
284 double
285 FGEnvironment::get_density_slugft3 () const
286 {
287   return density_slugft3;
288 }
289
290 double
291 FGEnvironment::get_relative_humidity () const
292 {
293   return relative_humidity;
294 }
295
296 double
297 FGEnvironment::get_density_tropo_avg_kgm3 () const
298 {
299   return density_tropo_avg_kgm3;
300 }
301
302 double
303 FGEnvironment::get_altitude_half_to_sun_m () const
304 {
305   return altitude_half_to_sun_m;
306 }
307
308 double
309 FGEnvironment::get_altitude_tropo_top_m () const
310 {
311   return altitude_tropo_top_m;
312 }
313
314 double
315 FGEnvironment::get_wind_from_heading_deg () const
316 {
317   return wind_from_heading_deg;
318 }
319
320 double
321 FGEnvironment::get_wind_speed_kt () const
322 {
323   return wind_speed_kt;
324 }
325
326 double
327 FGEnvironment::get_wind_from_north_fps () const
328 {
329   return wind_from_north_fps;
330 }
331
332 double
333 FGEnvironment::get_wind_from_east_fps () const
334 {
335   return wind_from_east_fps;
336 }
337
338 double
339 FGEnvironment::get_wind_from_down_fps () const
340 {
341   return wind_from_down_fps;
342 }
343
344 double
345 FGEnvironment::get_thermal_lift_fps () const
346 {
347   return thermal_lift_fps;
348 }
349
350 double
351 FGEnvironment::get_ridge_lift_fps () const
352 {
353   return ridge_lift_fps;
354 }
355
356 double
357 FGEnvironment::get_turbulence_magnitude_norm () const
358 {
359   if( sgEnviro.get_turbulence_enable_state() )
360     if (fgGetBool("/environment/params/real-world-weather-fetch") == true)
361       return sgEnviro.get_cloud_turbulence();
362   return turbulence_magnitude_norm;
363 }
364
365 double
366 FGEnvironment::get_turbulence_rate_hz () const
367 {
368   return turbulence_rate_hz;
369 }
370
371 double
372 FGEnvironment::get_elevation_ft () const
373 {
374   return elevation_ft;
375 }
376
377 void
378 FGEnvironment::set_visibility_m (double v)
379 {
380   visibility_m = v;
381 }
382
383 void
384 FGEnvironment::set_temperature_sea_level_degc (double t)
385 {
386   temperature_sea_level_degc = t;
387   if (dewpoint_sea_level_degc > t)
388       dewpoint_sea_level_degc = t;
389   _recalc_alt_temperature();
390   _recalc_density();
391 }
392
393 void
394 FGEnvironment::set_temperature_degc (double t)
395 {
396   temperature_degc = t;
397   _recalc_sl_temperature();
398   _recalc_density();
399   _recalc_relative_humidity();
400 }
401
402 void
403 FGEnvironment::set_dewpoint_sea_level_degc (double t)
404 {
405   dewpoint_sea_level_degc = t;
406   if (temperature_sea_level_degc < t)
407       temperature_sea_level_degc = t;
408   _recalc_alt_dewpoint();
409   _recalc_density();
410 }
411
412 void
413 FGEnvironment::set_dewpoint_degc (double t)
414 {
415   dewpoint_degc = t;
416   _recalc_sl_dewpoint();
417   _recalc_density();
418   _recalc_relative_humidity();
419 }
420
421 void
422 FGEnvironment::set_pressure_sea_level_inhg (double p)
423 {
424   pressure_sea_level_inhg = p;
425   _recalc_alt_pressure();
426   _recalc_density();
427 }
428
429 void
430 FGEnvironment::set_pressure_inhg (double p)
431 {
432   pressure_inhg = p;
433   _recalc_sl_pressure();
434   _recalc_density();
435 }
436
437 void
438 FGEnvironment::set_wind_from_heading_deg (double h)
439 {
440   wind_from_heading_deg = h;
441   _recalc_ne();
442 }
443
444 void
445 FGEnvironment::set_wind_speed_kt (double s)
446 {
447   wind_speed_kt = s;
448   _recalc_ne();
449 }
450
451 void
452 FGEnvironment::set_wind_from_north_fps (double n)
453 {
454   wind_from_north_fps = n;
455   _recalc_hdgspd();
456 }
457
458 void
459 FGEnvironment::set_wind_from_east_fps (double e)
460 {
461   wind_from_east_fps = e;
462   _recalc_hdgspd();
463 }
464
465 void
466 FGEnvironment::set_wind_from_down_fps (double d)
467 {
468   wind_from_down_fps = d;
469   _recalc_hdgspd();
470 }
471
472 void
473 FGEnvironment::set_thermal_lift_fps (double th)
474 {
475   thermal_lift_fps = th;
476   _recalc_updraft();
477 }
478
479 void
480 FGEnvironment::set_ridge_lift_fps (double ri)
481 {
482   ridge_lift_fps = ri;
483   _recalc_updraft();
484 }
485
486 void
487 FGEnvironment::set_turbulence_magnitude_norm (double t)
488 {
489   turbulence_magnitude_norm = t;
490 }
491
492 void
493 FGEnvironment::set_turbulence_rate_hz (double r)
494 {
495   turbulence_rate_hz = r;
496 }
497
498 void
499 FGEnvironment::set_elevation_ft (double e)
500 {
501   elevation_ft = e;
502   _recalc_alt_temperature();
503   _recalc_alt_dewpoint();
504   _recalc_alt_pressure();
505   _recalc_density();
506   _recalc_relative_humidity();
507 }
508
509 void
510 FGEnvironment::set_altitude_half_to_sun_m (double alt)
511 {
512  altitude_half_to_sun_m = alt;
513  _recalc_density_tropo_avg_kgm3();
514 }
515
516 void
517 FGEnvironment::set_altitude_tropo_top_m (double alt)
518 {
519  altitude_tropo_top_m = alt;
520  _recalc_density_tropo_avg_kgm3();
521 }
522
523
524 void
525 FGEnvironment::_recalc_hdgspd ()
526 {
527   double angle_rad;
528
529   if (wind_from_east_fps == 0) {
530     angle_rad = (wind_from_north_fps >= 0 ? SGD_PI_2 : -SGD_PI_2);
531   } else {
532     angle_rad = atan(wind_from_north_fps/wind_from_east_fps);
533   }
534   wind_from_heading_deg = angle_rad * SGD_RADIANS_TO_DEGREES;
535   if (wind_from_east_fps >= 0)
536     wind_from_heading_deg = 90 - wind_from_heading_deg;
537   else
538     wind_from_heading_deg = 270 - wind_from_heading_deg;
539
540 #if 0
541   // FIXME: Windspeed can become negative with these formulas.
542   //        which can cause problems for animations that rely
543   //        on the windspeed property.
544   if (angle_rad == 0)
545     wind_speed_kt = fabs(wind_from_east_fps
546                          * SG_METER_TO_NM * SG_FEET_TO_METER * 3600);
547   else
548     wind_speed_kt = (wind_from_north_fps / sin(angle_rad))
549       * SG_METER_TO_NM * SG_FEET_TO_METER * 3600;
550 #else
551   wind_speed_kt = sqrt(wind_from_north_fps * wind_from_north_fps +
552                        wind_from_east_fps * wind_from_east_fps) 
553                   * SG_METER_TO_NM * SG_FEET_TO_METER * 3600;
554 #endif
555 }
556
557 void
558 FGEnvironment::_recalc_ne ()
559 {
560   double speed_fps =
561     wind_speed_kt * SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600);
562
563   wind_from_north_fps = speed_fps *
564     cos(wind_from_heading_deg * SGD_DEGREES_TO_RADIANS);
565   wind_from_east_fps = speed_fps *
566     sin(wind_from_heading_deg * SGD_DEGREES_TO_RADIANS);
567 }
568
569 void
570 FGEnvironment::_recalc_updraft ()
571 {
572   wind_from_down_fps = thermal_lift_fps + ridge_lift_fps ;
573 }
574
575 void
576 FGEnvironment::_recalc_sl_temperature ()
577 {
578   // If we're in the stratosphere, leave sea-level temp alone
579   if (elevation_ft < 38000) {
580     temperature_sea_level_degc = (temperature_degc + 273.15)
581         / _temperature_degc_table->interpolate(elevation_ft)
582       - 273.15;
583   }
584 }
585
586 void
587 FGEnvironment::_recalc_alt_temperature ()
588 {
589   if (elevation_ft < 38000) {
590     temperature_degc = (temperature_sea_level_degc + 273.15) *
591         _temperature_degc_table->interpolate(elevation_ft) - 273.15;
592   } else {
593     temperature_degc = -56.49;  // Stratosphere is constant
594   }
595 }
596
597 void
598 FGEnvironment::_recalc_sl_dewpoint ()
599 {
600                                 // 0.2degC/1000ft
601                                 // FIXME: this will work only for low
602                                 // elevations
603   dewpoint_sea_level_degc = dewpoint_degc + (elevation_ft * .0002);
604   if (dewpoint_sea_level_degc > temperature_sea_level_degc)
605     dewpoint_sea_level_degc = temperature_sea_level_degc;
606 }
607
608 void
609 FGEnvironment::_recalc_alt_dewpoint ()
610 {
611                                 // 0.2degC/1000ft
612                                 // FIXME: this will work only for low
613                                 // elevations
614   dewpoint_degc = dewpoint_sea_level_degc + (elevation_ft * .0002);
615   if (dewpoint_degc > temperature_degc)
616     dewpoint_degc = temperature_degc;
617 }
618
619 void
620 FGEnvironment::_recalc_sl_pressure ()
621 {
622   pressure_sea_level_inhg =
623     pressure_inhg / _pressure_inhg_table->interpolate(elevation_ft);
624 }
625
626 void
627 FGEnvironment::_recalc_alt_pressure ()
628 {
629   pressure_inhg =
630     pressure_sea_level_inhg * _pressure_inhg_table->interpolate(elevation_ft);
631 }
632
633 void
634 FGEnvironment::_recalc_density ()
635 {
636   double pressure_psf = pressure_inhg * 70.7487;
637   
638   // adjust for humidity
639   // calculations taken from USA Today (oops!) at
640   // http://www.usatoday.com/weather/basics/density-calculations.htm
641   double temperature_degk = temperature_degc + 273.15;
642   double pressure_mb = pressure_inhg * 33.86;
643   double vapor_pressure_mb =
644     6.11 * pow(10.0, 7.5 * dewpoint_degc / (237.7 + dewpoint_degc));
645   double virtual_temperature_degk = temperature_degk / (1 - (vapor_pressure_mb / pressure_mb) * (1.0 - 0.622));
646   double virtual_temperature_degr = virtual_temperature_degk * 1.8;
647
648   density_slugft3 = pressure_psf / (virtual_temperature_degr * 1718);
649   _recalc_density_tropo_avg_kgm3();
650 }
651
652 // This is used to calculate the average density on the path 
653 // of sunlight to the observer for calculating sun-color
654 void
655 FGEnvironment::_recalc_density_tropo_avg_kgm3 ()
656 {
657   double pressure_mb = pressure_inhg * 33.86;
658   double vaporpressure = 6.11 * pow(10.0, ((7.5 * dewpoint_degc) / (237.7 + dewpoint_degc)));
659
660   double virtual_temp = (temperature_degc + 273.15) / (1 - 0.379 * (vaporpressure/pressure_mb));
661
662   double density_half = (100 * pressure_mb * exp(-altitude_half_to_sun_m / 8000))
663       / (287.05 * virtual_temp);
664   double density_tropo = (100 * pressure_mb * exp((-1 * altitude_tropo_top_m) / 8000))
665       / ( 287.05 * virtual_temp);
666
667   density_tropo_avg_kgm3 = ((density_slugft3 * 515.379) + density_half + density_tropo) / 3;
668 }
669
670 void
671 FGEnvironment::_recalc_relative_humidity ()
672 {
673   double vaporpressure = 6.11 * pow(10.0, ((7.5 * dewpoint_degc) / ( 237.7 + dewpoint_degc)));
674   double sat_vaporpressure = 6.11 * pow(10.0, ((7.5 * temperature_degc)
675       / ( 237.7 + temperature_degc)) );
676   relative_humidity = 100 * vaporpressure / sat_vaporpressure ;
677 }
678
679
680
681 ////////////////////////////////////////////////////////////////////////
682 // Functions.
683 ////////////////////////////////////////////////////////////////////////
684
685 static inline double
686 do_interp (double a, double b, double fraction)
687 {
688     double retval = (a + ((b - a) * fraction));
689     return retval;
690 }
691
692 static inline double
693 do_interp_deg (double a, double b, double fraction)
694 {
695     a = fmod(a, 360);
696     b = fmod(b, 360);
697     if (fabs(b-a) > 180) {
698         if (a < b)
699             a += 360;
700         else
701             b += 360;
702     }
703     return fmod(do_interp(a, b, fraction), 360);
704 }
705
706 void
707 interpolate (const FGEnvironment * env1, const FGEnvironment * env2,
708              double fraction, FGEnvironment * result)
709 {
710     result->set_visibility_m
711         (do_interp(env1->get_visibility_m(),
712                    env2->get_visibility_m(),
713                    fraction));
714
715     result->set_temperature_sea_level_degc
716         (do_interp(env1->get_temperature_sea_level_degc(),
717                    env2->get_temperature_sea_level_degc(),
718                    fraction));
719
720     result->set_dewpoint_degc
721         (do_interp(env1->get_dewpoint_sea_level_degc(),
722                    env2->get_dewpoint_sea_level_degc(),
723                    fraction));
724
725     result->set_pressure_sea_level_inhg
726         (do_interp(env1->get_pressure_sea_level_inhg(),
727                    env2->get_pressure_sea_level_inhg(),
728                    fraction));
729
730     result->set_wind_from_heading_deg
731         (do_interp_deg(env1->get_wind_from_heading_deg(),
732                        env2->get_wind_from_heading_deg(),
733                        fraction));
734
735     result->set_wind_speed_kt
736         (do_interp(env1->get_wind_speed_kt(),
737                    env2->get_wind_speed_kt(),
738                    fraction));
739
740     result->set_elevation_ft
741         (do_interp(env1->get_elevation_ft(),
742                    env2->get_elevation_ft(),
743                    fraction));
744
745     result->set_turbulence_magnitude_norm
746         (do_interp(env1->get_turbulence_magnitude_norm(),
747                    env2->get_turbulence_magnitude_norm(),
748                    fraction));
749
750     result->set_turbulence_rate_hz
751         (do_interp(env1->get_turbulence_rate_hz(),
752                    env2->get_turbulence_rate_hz(),
753                    fraction));
754 }
755
756 // end of environment.cxx