FlightGear next
environment.cxx
Go to the documentation of this file.
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
22#ifdef HAVE_CONFIG_H
23# include <config.h>
24#endif
25
26#include <cmath>
27
28#include <simgear/props/props.hxx>
29#include <simgear/math/SGMath.hxx>
30
31#include <Main/fg_props.hxx>
32
33#include "environment.hxx"
34#include "atmosphere.hxx"
35
36
38// Atmosphere model.
40
41#ifdef USING_TABLES
42
43// Calculated based on the ISA standard day, as found at e.g.
44// http://www.av8n.com/physics/altimetry.htm
45
46// Each line of data has 3 elements:
47// Elevation (ft),
48// temperature factor (dimensionless ratio of absolute temp),
49// pressure factor (dimensionless ratio)
50static double atmosphere_data[][3] = {
51 { -3000.00, 1.021, 1.1133 },
52 { 0.00, 1.000, 1.0000 },
53 { 2952.76, 0.980, 0.8978 },
54 { 5905.51, 0.959, 0.8042 },
55 { 8858.27, 0.939, 0.7187 },
56 { 11811.02, 0.919, 0.6407 },
57 { 14763.78, 0.898, 0.5697 },
58 { 17716.54, 0.878, 0.5052 },
59 { 20669.29, 0.858, 0.4468 },
60 { 23622.05, 0.838, 0.3940 },
61 { 26574.80, 0.817, 0.3463 },
62 { 29527.56, 0.797, 0.3034 },
63 { 32480.31, 0.777, 0.2649 },
64 { 35433.07, 0.756, 0.2305 },
65 { 38385.83, 0.752, 0.2000 },
66 { 41338.58, 0.752, 0.1736 },
67 { 44291.34, 0.752, 0.1506 },
68 { 47244.09, 0.752, 0.1307 },
69 { 50196.85, 0.752, 0.1134 },
70 { 53149.61, 0.752, 0.0984 },
71 { 56102.36, 0.752, 0.0854 },
72 { 59055.12, 0.752, 0.0741 },
73 { 62007.87, 0.752, 0.0643 },
74 { 65000.00, 0.752, 0.0557 },
75 { 68000.00, 0.754, 0.0482 },
76 { 71000.00, 0.758, 0.0418 },
77 { 74000.00, 0.761, 0.0362 },
78 { 77000.00, 0.764, 0.0314 },
79 { 80000.00, 0.767, 0.0273 },
80 { 83000.00, 0.770, 0.0237 },
81 { 86000.00, 0.773, 0.0206 },
82 { 89000.00, 0.777, 0.0179 },
83 { 92000.00, 0.780, 0.0156 },
84 { 95000.00, 0.783, 0.0135 },
85 { 98000.00, 0.786, 0.0118 },
86 { 101000.00, 0.789, 0.0103 },
87 { -1, -1, -1 }
88};
89
90static SGInterpTable * _temperature_degc_table = 0;
91static SGInterpTable * _pressure_inhg_table = 0;
92
93static void
94_setup_tables ()
95{
96 if (_temperature_degc_table != 0)
97 return;
98
99 _temperature_degc_table = new SGInterpTable;
100 _pressure_inhg_table = new SGInterpTable;
101
102 for (int i = 0; atmosphere_data[i][0] != -1; i++) {
103 _temperature_degc_table->addEntry(atmosphere_data[i][0],
104 atmosphere_data[i][1]);
105 _pressure_inhg_table->addEntry(atmosphere_data[i][0],
106 atmosphere_data[i][2]);
107 }
108}
109#endif
110
111
113// Implementation of FGEnvironment.
115
116void FGEnvironment::_init()
117{
118 is_isa = false;
119 live_update = false;
120 elevation_ft = 0;
121 visibility_m = 32000;
122 temperature_sea_level_degc = 15;
123 temperature_degc = 15;
124 dewpoint_sea_level_degc = 5; // guess
125 dewpoint_degc = 5;
126 pressure_sea_level_inhg = 29.92;
127 pressure_inhg = 29.92;
128 density_slugft3 = 0;
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 altitude_half_to_sun_m = 1000;
137 altitude_tropo_top_m = 10000;
138#ifdef USING_TABLES
139 _setup_tables();
140#endif
141 _recalc_density();
142 _recalc_relative_humidity();
143 live_update = true;
144}
145
147{
148 _init();
149}
150
152{
153 _init();
154 copy(env);
155}
156
161
163{
164 copy( other );
165 return *this;
166}
167
168void
169FGEnvironment::copy (const FGEnvironment &env)
170{
171 elevation_ft = env.elevation_ft;
172 visibility_m = env.visibility_m;
173 temperature_sea_level_degc = env.temperature_sea_level_degc;
174 temperature_degc = env.temperature_degc;
175 dewpoint_sea_level_degc = env.dewpoint_sea_level_degc;
176 dewpoint_degc = env.dewpoint_degc;
177 pressure_sea_level_inhg = env.pressure_sea_level_inhg;
178 wind_from_heading_deg = env.wind_from_heading_deg;
179 wind_speed_kt = env.wind_speed_kt;
180 wind_from_north_fps = env.wind_from_north_fps;
181 wind_from_east_fps = env.wind_from_east_fps;
182 wind_from_down_fps = env.wind_from_down_fps;
183 turbulence_magnitude_norm = env.turbulence_magnitude_norm;
184 turbulence_rate_hz = env.turbulence_rate_hz;
185 pressure_inhg = env.pressure_inhg;
186 density_slugft3 = env.density_slugft3;
187 density_tropo_avg_kgm3 = env.density_tropo_avg_kgm3;
188 relative_humidity = env.relative_humidity;
189 altitude_half_to_sun_m = env.altitude_half_to_sun_m;
190 altitude_tropo_top_m = env.altitude_tropo_top_m;
191 live_update = env.live_update;
192 is_isa = env.is_isa;
193}
194
195static inline bool
196maybe_copy_value (FGEnvironment * env, const SGPropertyNode * node,
197 const char * name, void (FGEnvironment::*setter)(double))
198{
199 const SGPropertyNode * child = node->getNode(name);
200 // fragile: depends on not being typed
201 // as a number
202 if (child != 0 && child->hasValue() &&
203 child->getStringValue()[0] != '\0') {
204 (env->*setter)(child->getDoubleValue());
205 return true;
206 } else {
207 return false;
208 }
209}
210
211void
212FGEnvironment::read (const SGPropertyNode * node)
213{
214 bool live_update = set_live_update( false );
215 maybe_copy_value(this, node, "visibility-m",
217
218 maybe_copy_value(this, node, "elevation-ft",
220
221 if (!maybe_copy_value(this, node, "temperature-sea-level-degc",
223 if( maybe_copy_value(this, node, "temperature-degc",
225 _recalc_sl_temperature();
226 }
227 }
228
229 if (!maybe_copy_value(this, node, "dewpoint-sea-level-degc",
231 if( maybe_copy_value(this, node, "dewpoint-degc",
233 _recalc_sl_dewpoint();
234 }
235 }
236
237 if (!maybe_copy_value(this, node, "pressure-sea-level-inhg",
239 if( maybe_copy_value(this, node, "pressure-inhg",
241 _recalc_sl_pressure();
242 }
243 }
244
245 maybe_copy_value(this, node, "wind-from-heading-deg",
247
248 maybe_copy_value(this, node, "wind-speed-kt",
250
251 maybe_copy_value(this, node, "turbulence/magnitude-norm",
253
254 maybe_copy_value(this, node, "turbulence/rate-hz",
256
257 const SGPropertyNode* child = node->getNode("atmosphere/is-isa");
258 if (child != 0 && child->hasValue()) {
259 set_is_isa(child->getBoolValue());
260 }
261
262 // calculate derived properties here to avoid duplicate expensive computations
263 _recalc_ne();
264 _recalc_alt_pt();
265 _recalc_alt_dewpoint();
266 _recalc_density();
267 _recalc_relative_humidity();
268
269 set_live_update(live_update);
270}
271
272void FGEnvironment::Tie( SGPropertyNode_ptr base, bool archivable )
273{
274 _tiedProperties.setRoot( base );
275
276 _tiedProperties.Tie( "visibility-m", this,
279
280 _tiedProperties.Tie("elevation-ft", this,
283
284 _tiedProperties.Tie("temperature-sea-level-degc", this,
287
288 _tiedProperties.Tie("temperature-degc", this,
291
292 _tiedProperties.Tie("dewpoint-sea-level-degc", this,
295
296 _tiedProperties.Tie("dewpoint-degc", this,
299
300 _tiedProperties.Tie("pressure-sea-level-inhg", this,
303
304 _tiedProperties.Tie("pressure-inhg", this,
307
308 _tiedProperties.Tie("atmosphere/altitude-half-to-sun", this,
311
312 _tiedProperties.Tie("atmosphere/altitude-troposphere-top", this,
315
316 _tiedProperties.Tie("wind-from-heading-deg", this,
319
320 _tiedProperties.Tie("wind-speed-kt", this,
323
324 _tiedProperties.Tie("wind-from-north-fps", this,
327
328 _tiedProperties.Tie("wind-from-east-fps", this,
331
332 _tiedProperties.Tie("wind-from-down-fps", this,
335
336 _tiedProperties.Tie("turbulence/magnitude-norm", this,
339
340 _tiedProperties.Tie("turbulence/rate-hz", this,
343
344 _tiedProperties.setAttribute( SGPropertyNode::ARCHIVE, archivable );
345
346 _tiedProperties.Tie("temperature-degf", this,
348
349 _tiedProperties.Tie("density-slugft3", this,
351
352 _tiedProperties.Tie("relative-humidity", this,
354
355 _tiedProperties.Tie("atmosphere/density-tropo-avg", this,
357
358 _tiedProperties.Tie("atmosphere/is-isa", this,
361}
362
364{
365 _tiedProperties.Untie();
366}
367
368double
370{
371 return visibility_m;
372}
373
374double
376{
377 return temperature_sea_level_degc;
378}
379
380double
382{
383 return temperature_degc;
384}
385
386double
388{
389 return (temperature_degc * 9.0 / 5.0) + 32.0;
390}
391
392double
394{
395 return dewpoint_sea_level_degc;
396}
397
398double
400{
401 return dewpoint_degc;
402}
403
404double
406{
407 return pressure_sea_level_inhg;
408}
409
410double
412{
413 return pressure_inhg;
414}
415
416double
418{
419 return density_slugft3;
420}
421
422double
424{
425 return relative_humidity;
426}
427
428double
430{
431 return density_tropo_avg_kgm3;
432}
433
434double
436{
437 return altitude_half_to_sun_m;
438}
439
440double
442{
443 return altitude_tropo_top_m;
444}
445
446double
448{
449 return wind_from_heading_deg;
450}
451
452double
454{
455 return wind_speed_kt;
456}
457
458double
460{
461 return wind_from_north_fps;
462}
463
464double
466{
467 return wind_from_east_fps;
468}
469
470double
472{
473 return wind_from_down_fps;
474}
475
476double
478{
479 return turbulence_magnitude_norm;
480}
481
482double
484{
485 return turbulence_rate_hz;
486}
487
488double
490{
491 return elevation_ft;
492}
493
495{
496 return is_isa;
497}
498
499void
501{
502 visibility_m = v;
503}
504
505void
507{
508 temperature_sea_level_degc = t;
509 if (dewpoint_sea_level_degc > t)
510 dewpoint_sea_level_degc = t;
511 if( live_update ) {
512 _recalc_alt_pt();
513 _recalc_density();
514 }
515}
516
517void
519{
520 temperature_degc = t;
521 if( live_update ) {
522 _recalc_sl_temperature();
523 _recalc_sl_pressure();
524 _recalc_alt_pt();
525 _recalc_density();
526 _recalc_relative_humidity();
527 }
528}
529
530void
532{
533 dewpoint_sea_level_degc = t;
534 if (temperature_sea_level_degc < t)
535 temperature_sea_level_degc = t;
536 if( live_update ) {
537 _recalc_alt_dewpoint();
538 _recalc_density();
539 }
540}
541
542void
544{
545 dewpoint_degc = t;
546 if( live_update ) {
547 _recalc_sl_dewpoint();
548 _recalc_density();
549 _recalc_relative_humidity();
550 }
551}
552
553void
555{
556 pressure_sea_level_inhg = p;
557 if( live_update ) {
558 _recalc_alt_pt();
559 _recalc_density();
560 }
561}
562
563void
565{
566 pressure_inhg = p;
567 if( live_update ) {
568 _recalc_sl_pressure();
569 _recalc_density();
570 }
571}
572
573void
575{
576 wind_from_heading_deg = h;
577 if( live_update ) {
578 _recalc_ne();
579 }
580}
581
582void
584{
585 wind_speed_kt = s;
586 if( live_update ) {
587 _recalc_ne();
588 }
589}
590
591void
593{
594 wind_from_north_fps = n;
595 if( live_update ) {
596 _recalc_hdgspd();
597 }
598}
599
600void
602{
603 wind_from_east_fps = e;
604 if( live_update ) {
605 _recalc_hdgspd();
606 }
607}
608
609void
611{
612 wind_from_down_fps = d;
613 if( live_update ) {
614 _recalc_hdgspd();
615 }
616}
617
618void
620{
621 turbulence_magnitude_norm = t;
622}
623
624void
626{
627 turbulence_rate_hz = r;
628}
629
630void
632{
633 elevation_ft = e;
634 if( live_update ) {
635 _recalc_alt_pt();
636 _recalc_alt_dewpoint();
637 _recalc_density();
638 _recalc_relative_humidity();
639 }
640}
641
642void
644{
645 altitude_half_to_sun_m = alt;
646 if( live_update ) {
647 _recalc_density_tropo_avg_kgm3();
648 }
649}
650
651void
653{
654 altitude_tropo_top_m = alt;
655 if( live_update ) {
656 _recalc_density_tropo_avg_kgm3();
657 }
658}
659
661{
662 is_isa = isa;
663}
664
665void
666FGEnvironment::_recalc_hdgspd ()
667{
668 wind_from_heading_deg =
669 atan2(wind_from_east_fps, wind_from_north_fps) * SGD_RADIANS_TO_DEGREES;
670
671 if( wind_from_heading_deg < 0 )
672 wind_from_heading_deg += 360.0;
673
674 wind_speed_kt = sqrt(wind_from_north_fps * wind_from_north_fps +
675 wind_from_east_fps * wind_from_east_fps)
676 * SG_METER_TO_NM * SG_FEET_TO_METER * 3600;
677}
678
679void
680FGEnvironment::_recalc_ne ()
681{
682 double speed_fps =
683 wind_speed_kt * SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600);
684
685 wind_from_north_fps = speed_fps *
686 cos(wind_from_heading_deg * SGD_DEGREES_TO_RADIANS);
687 wind_from_east_fps = speed_fps *
688 sin(wind_from_heading_deg * SGD_DEGREES_TO_RADIANS);
689}
690
691// Intended to help with the interpretation of METAR data,
692// not for random in-flight outside-air temperatures.
693void
694FGEnvironment::_recalc_sl_temperature ()
695{
696
697#if 0
698 {
699 SG_LOG(SG_ENVIRONMENT, SG_DEBUG, "recalc_sl_temperature: using "
700 << temperature_degc << " @ " << elevation_ft << " :: " << this);
701 }
702#endif
703
704 if (elevation_ft * atmodel::foot >= ISA_def[1].height) {
705 SG_LOG(SG_ENVIRONMENT, SG_ALERT, "recalc_sl_temperature: "
706 << "valid only in troposphere, not " << elevation_ft);
707 return;
708 }
709
710 double temperature_shift = elevation_ft * atmodel::foot * ISA_def[0].lapse;
711
712 if (is_isa) {
713 // The "International Standard Atmosphere" METAR scenario in use
714 temperature_sea_level_degc = 15.0;
715 temperature_degc = temperature_sea_level_degc - temperature_shift;
716 } else {
717 // Clamp: temperature of the stratosphere, in degrees C:
718 double t_strato = ISA_def[1].temp - atmodel::freezing;
719 temperature_sea_level_degc = temperature_degc < t_strato
720 ? t_strato
721 : temperature_degc + temperature_shift;
722
723 // Alternative implemenation:
724 // temperature_sea_level_inhg = T_layer(0., elevation_ft * foot,
725 // pressure_inhg * inHg, temperature_degc + freezing, ISA_def[0].lapse) - freezing;
726 }
727}
728
729void
730FGEnvironment::_recalc_sl_dewpoint ()
731{
732 // 0.2degC/1000ft
733 // FIXME: this will work only for low
734 // elevations
735 dewpoint_sea_level_degc = dewpoint_degc + (elevation_ft * .0002);
736 if (dewpoint_sea_level_degc > temperature_sea_level_degc)
737 dewpoint_sea_level_degc = temperature_sea_level_degc;
738}
739
740void
741FGEnvironment::_recalc_alt_dewpoint ()
742{
743 // 0.2degC/1000ft
744 // FIXME: this will work only for low
745 // elevations
746 dewpoint_degc = dewpoint_sea_level_degc + (elevation_ft * .0002);
747 if (dewpoint_degc > temperature_degc)
748 dewpoint_degc = temperature_degc;
749}
750
751void
752FGEnvironment::_recalc_sl_pressure ()
753{
754 using namespace atmodel;
755#if 0
756 {
757 SG_LOG(SG_ENVIRONMENT, SG_ALERT, "recalc_sl_pressure: using "
758 << pressure_inhg << " and "
759 << temperature_degc << " @ " << elevation_ft << " :: " << this);
760 }
761#endif
762 pressure_sea_level_inhg = P_layer(0., elevation_ft * foot,
763 pressure_inhg * inHg, temperature_degc + freezing, ISA_def[0].lapse) / inHg;
764}
765
766// This gets called at frame rate, to account for the aircraft's
767// changing altitude.
768// Called by set_elevation_ft() which is called by FGEnvironmentMgr::update
769
770void
771FGEnvironment::_recalc_alt_pt ()
772{
773 using namespace atmodel;
774#if 0
775 {
776 static int count(0);
777 if (++count % 1000 == 0) {
778 SG_LOG(SG_ENVIRONMENT, SG_ALERT,
779 "recalc_alt_pt for: " << elevation_ft
780 << " using " << pressure_sea_level_inhg
781 << " and " << temperature_sea_level_degc
782 << " :: " << this
783 << " # " << count);
784 }
785 }
786#endif
787 double press = pressure_inhg * inHg;
788 double temp = temperature_degc + freezing;
789 std::tie(press, temp) = PT_vs_hpt(elevation_ft * foot,
790 pressure_sea_level_inhg * inHg, temperature_sea_level_degc + freezing);
791 temperature_degc = temp - freezing;
792 pressure_inhg = press / inHg;
793}
794
795void
796FGEnvironment::_recalc_density ()
797{
798 const double pressure_psf = pressure_inhg * 70.7487;
799
800 // adjust for humidity
801 // calculations taken from USA Today (oops!) at
802 // http://www.usatoday.com/weather/basics/density-calculations.htm
803 const double temperature_degk = temperature_degc + 273.15;
804 const double pressure_mb = pressure_inhg * 33.86;
805 const double vapor_pressure_mb =
806 6.11 * pow(10.0, 7.5 * dewpoint_degc / (237.7 + dewpoint_degc));
807
808 if ((pressure_mb <= 0.0) || (vapor_pressure_mb <= 0.0)) {
809 density_slugft3 = 0.0;
810 return;
811 }
812
813 double virtual_temperature_degk = temperature_degk / (1 - (vapor_pressure_mb / pressure_mb) * (1.0 - 0.622));
814 double virtual_temperature_degr = virtual_temperature_degk * 1.8;
815
816 density_slugft3 = pressure_psf / (virtual_temperature_degr * 1718);
817 _recalc_density_tropo_avg_kgm3();
818}
819
820// This is used to calculate the average density on the path
821// of sunlight to the observer for calculating sun-color
822void
823FGEnvironment::_recalc_density_tropo_avg_kgm3 ()
824{
825 const double pressure_mb = pressure_inhg * 33.86;
826 const double vaporpressure = 6.11 * pow(10.0, ((7.5 * dewpoint_degc) / (237.7 + dewpoint_degc)));
827 const double virtual_temp = (temperature_degc + 273.15) / (1 - 0.379 * (vaporpressure/pressure_mb));
828
829 if ((pressure_mb <= 0.0) || (virtual_temp <= 0.0)) {
830 density_tropo_avg_kgm3 = 0.0;
831 return;
832 }
833
834 double density_half = (100 * pressure_mb * exp(-altitude_half_to_sun_m / 8000))
835 / (287.05 * virtual_temp);
836 double density_tropo = (100 * pressure_mb * exp((-1 * altitude_tropo_top_m) / 8000))
837 / ( 287.05 * virtual_temp);
838
839 density_tropo_avg_kgm3 = ((density_slugft3 * 515.379) + density_half + density_tropo) / 3;
840}
841
842void
843FGEnvironment::_recalc_relative_humidity ()
844{
845/*
846 double vaporpressure = 6.11 * pow(10.0, ((7.5 * dewpoint_degc) / ( 237.7 + dewpoint_degc)));
847 double sat_vaporpressure = 6.11 * pow(10.0, ((7.5 * temperature_degc)
848 / ( 237.7 + temperature_degc)) );
849 relative_humidity = 100 * vaporpressure / sat_vaporpressure ;
850
851 with a little algebra, this gets the same result and spares two multiplications and one pow()
852*/
853 double a = (7.5 * dewpoint_degc) / ( 237.7 + dewpoint_degc);
854 double b = (7.5 * temperature_degc) / ( 237.7 + temperature_degc);
855 relative_humidity = 100 * pow(10.0,a-b);
856}
857
858bool
860{
861 bool b = live_update;
862 live_update = _live_update;
863 return b;
864}
865
866
868// Functions.
870
871static inline double
872do_interp (double a, double b, double fraction)
873{
874 double retval = (a + ((b - a) * fraction));
875 return retval;
876}
877
878static inline double
879do_interp_deg (double a, double b, double fraction)
880{
881 a = fmod(a, 360);
882 b = fmod(b, 360);
883 if (fabs(b-a) > 180) {
884 if (a < b)
885 a += 360;
886 else
887 b += 360;
888 }
889 return fmod(do_interp(a, b, fraction), 360);
890}
891
894 double fraction, FGEnvironment * result) const
895{
896 // don't calculate each internal property every time we set a single value
897 // we trigger that at the end of the interpolation process
898 bool live_update = result->set_live_update( false );
899
900 result->set_visibility_m
902 env2.get_visibility_m(),
903 fraction));
904
908 fraction));
909
913 fraction));
914
918 fraction));
919
923 fraction));
924
925 result->set_wind_speed_kt
927 env2.get_wind_speed_kt(),
928 fraction));
929
930 result->set_elevation_ft
932 env2.get_elevation_ft(),
933 fraction));
934
938 fraction));
939
943 fraction));
944
945 // calculate derived properties here to avoid duplicate expensive computations
946 result->_recalc_ne();
947 result->_recalc_alt_pt();
948 result->_recalc_alt_dewpoint();
949 result->_recalc_density();
950 result->_recalc_relative_humidity();
951
952 result->set_live_update(live_update);
953
954 return *result;
955}
956
957// end of environment.cxx
#define p(x)
#define i(x)
const ISA_layer ISA_def[]
double P_layer(const double height, const double href, const double Pref, const double Tref, const double lapse)
pair< double, double > PT_vs_hpt(const double hh, const double _p0, const double _t0)
Model the natural environment.
virtual double get_turbulence_rate_hz() const
virtual bool set_live_update(bool live_update)
virtual double get_dewpoint_degc() const
virtual void set_dewpoint_degc(double d)
virtual void Untie()
virtual double get_relative_humidity() const
virtual void set_is_isa(bool isa)
virtual void set_turbulence_magnitude_norm(double t)
virtual double get_temperature_degf() const
virtual double get_pressure_inhg() const
virtual void set_wind_speed_kt(double s)
virtual double get_visibility_m() const
virtual void set_altitude_half_to_sun_m(double alt)
virtual void set_wind_from_east_fps(double e)
virtual double get_dewpoint_sea_level_degc() const
virtual void Tie(SGPropertyNode_ptr base, bool setArchivable=true)
virtual void set_dewpoint_sea_level_degc(double d)
FGEnvironment & operator=(const FGEnvironment &other)
virtual double get_wind_from_north_fps() const
virtual void set_wind_from_heading_deg(double h)
virtual void set_wind_from_down_fps(double d)
virtual ~FGEnvironment()
virtual void set_altitude_tropo_top_m(double alt)
virtual bool get_is_isa() const
virtual double get_wind_speed_kt() const
virtual double get_altitude_tropo_top_m() const
virtual double get_temperature_sea_level_degc() const
virtual double get_wind_from_heading_deg() const
virtual void read(const SGPropertyNode *node)
virtual double get_temperature_degc() const
virtual void set_wind_from_north_fps(double n)
FGEnvironment & interpolate(const FGEnvironment &env2, double fraction, FGEnvironment *result) const
virtual double get_density_tropo_avg_kgm3() const
virtual double get_wind_from_east_fps() const
virtual void set_elevation_ft(double elevation_ft)
virtual double get_pressure_sea_level_inhg() const
virtual double get_elevation_ft() const
virtual void set_pressure_sea_level_inhg(double p)
virtual double get_altitude_half_to_sun_m() const
virtual void set_pressure_inhg(double p)
virtual void set_visibility_m(double v)
virtual double get_wind_from_down_fps() const
virtual double get_density_slugft3() const
virtual double get_turbulence_magnitude_norm() const
virtual void set_turbulence_rate_hz(double t)
virtual void set_temperature_sea_level_degc(double t)
virtual void set_temperature_degc(double t)
double lapse
double temp
static bool maybe_copy_value(FGEnvironment *env, const SGPropertyNode *node, const char *name, void(FGEnvironment::*setter)(double))
static double do_interp_deg(double a, double b, double fraction)
static double do_interp(double a, double b, double fraction)
const char * name
const double inHg(101325.0/760 *1000 *inch)
const double freezing(273.15)
const double foot(12 *inch)