Debian Codegraph @

src/Environment/environment.hxx

raw symbols SCIP
1 // environment.hxx -- routines to model the natural environment.
2 //
3 // Written by David Megginson, started February 2002.
4 //
5 // Copyright (C) 2002 David Megginson - [email protected]
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 #ifndef _ENVIRONMENT_HXX
23 #define _ENVIRONMENT_HXX
24
25 #include <simgear/compiler.h>
26
27 #include <cmath>
28 #include <simgear/props/tiedpropertylist.hxx>
29
30 /**
31 * Model the natural environment.
32 *
33 * This class models the natural environment at a specific place and
34 * time. A separate instance is necessary for each location or time.
35 *
36 * This class should eventually move to SimGear.
37 */
38 class FGEnvironment
39 {
40
41 public:
42
43 FGEnvironment();
44 FGEnvironment (const FGEnvironment &environment);
45 virtual ~FGEnvironment();
46
47 FGEnvironment & operator = ( const FGEnvironment & other );
48
49 virtual void read (const SGPropertyNode * node);
50 virtual void Tie( SGPropertyNode_ptr base, bool setArchivable = true );
51 virtual void Untie();
52
53 virtual double get_visibility_m () const;
54
55 virtual double get_temperature_sea_level_degc () const;
56 virtual double get_temperature_degc () const;
57 virtual double get_temperature_degf () const;
58 virtual double get_dewpoint_sea_level_degc () const;
59 virtual double get_dewpoint_degc () const;
60 virtual double get_pressure_sea_level_inhg () const;
61 virtual double get_pressure_inhg () const;
62 virtual double get_density_slugft3 () const;
63
64 virtual double get_relative_humidity () const;
65 virtual double get_density_tropo_avg_kgm3 () const;
66 virtual double get_altitude_half_to_sun_m () const;
67 virtual double get_altitude_tropo_top_m () const;
68
69 virtual double get_wind_from_heading_deg () const;
70 virtual double get_wind_speed_kt () const;
71 virtual double get_wind_from_north_fps () const;
72 virtual double get_wind_from_east_fps () const;
73 virtual double get_wind_from_down_fps () const;
74
75 virtual double get_turbulence_magnitude_norm () const;
76 virtual double get_turbulence_rate_hz () const;
77
78 virtual void set_visibility_m (double v);
79
80 virtual void set_temperature_sea_level_degc (double t);
81 virtual void set_temperature_degc (double t);
82 virtual void set_dewpoint_sea_level_degc (double d);
83 virtual void set_dewpoint_degc (double d);
84 virtual void set_pressure_sea_level_inhg (double p);
85 virtual void set_pressure_inhg (double p);
86
87 virtual void set_wind_from_heading_deg (double h);
88 virtual void set_wind_speed_kt (double s);
89 virtual void set_wind_from_north_fps (double n);
90 virtual void set_wind_from_east_fps (double e);
91 virtual void set_wind_from_down_fps (double d);
92
93 virtual void set_turbulence_magnitude_norm (double t);
94 virtual void set_turbulence_rate_hz (double t);
95
96 virtual double get_elevation_ft () const;
97 virtual void set_elevation_ft (double elevation_ft);
98 virtual void set_altitude_half_to_sun_m (double alt);
99 virtual void set_altitude_tropo_top_m (double alt);
100
101 virtual bool set_live_update(bool live_update);
102
103 virtual void set_is_isa(bool isa);
104 virtual bool get_is_isa() const;
105
106 FGEnvironment & interpolate (const FGEnvironment & env2, double fraction, FGEnvironment * result) const;
107 private:
108 virtual void copy (const FGEnvironment &environment);
109 void _init();
110 void _recalc_hdgspd ();
111
112 void _recalc_sl_temperature ();
113 void _recalc_sl_dewpoint ();
114 void _recalc_sl_pressure ();
115
116 void _recalc_density_tropo_avg_kgm3 ();
117 void _recalc_ne ();
118 void _recalc_alt_dewpoint ();
119 void _recalc_density ();
120 void _recalc_relative_humidity ();
121 void _recalc_alt_pt ();
122
123 double elevation_ft;
124 double visibility_m;
125
126 // Atmosphere
127 double temperature_sea_level_degc;
128 double temperature_degc;
129 double dewpoint_sea_level_degc;
130 double dewpoint_degc;
131 double pressure_sea_level_inhg;
132 double pressure_inhg;
133 double density_slugft3;
134
135 double density_tropo_avg_kgm3;
136 double relative_humidity;
137 double altitude_half_to_sun_m;
138 double altitude_tropo_top_m;
139
140 double turbulence_magnitude_norm;
141 double turbulence_rate_hz;
142
143 double wind_from_heading_deg;
144 double wind_speed_kt;
145
146 double wind_from_north_fps;
147 double wind_from_east_fps;
148 double wind_from_down_fps;
149
150 bool live_update;
151 bool is_isa;
152 simgear::TiedPropertyList _tiedProperties;
153
154 };
155
156 #endif // _ENVIRONMENT_HXX