1 // environment.hxx -- routines to model the natural environment.
3 // Written by David Megginson, started February 2002.
5 // Copyright (C) 2002 David Megginson - david@megginson.com
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.
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.
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.
24 #ifndef _ENVIRONMENT_HXX
25 #define _ENVIRONMENT_HXX
27 #include <simgear/compiler.h>
29 #ifdef SG_HAVE_STD_INCLUDES
37 * Model the natural environment.
39 * This class models the natural environment at a specific place and
40 * time. A separate instance is necessary for each location or time.
42 * This class should eventually move to SimGear.
50 FGEnvironment (const FGEnvironment &environment);
51 virtual ~FGEnvironment();
53 virtual void copy (const FGEnvironment &environment);
55 virtual void read (const SGPropertyNode * node);
57 virtual double get_visibility_m () const;
59 virtual double get_temperature_sea_level_degc () const;
60 virtual double get_temperature_degc () const;
61 virtual double get_temperature_degf () const;
62 virtual double get_dewpoint_sea_level_degc () const;
63 virtual double get_dewpoint_degc () const;
64 virtual double get_pressure_sea_level_inhg () const;
65 virtual double get_pressure_inhg () const;
66 virtual double get_density_slugft3 () const;
68 virtual double get_relative_humidity () const;
69 virtual double get_density_tropo_avg_kgm3 () const;
70 virtual double get_altitude_half_to_sun_m () const;
71 virtual double get_altitude_tropo_top_m () const;
73 virtual double get_wind_from_heading_deg () const;
74 virtual double get_wind_speed_kt () const;
75 virtual double get_wind_from_north_fps () const;
76 virtual double get_wind_from_east_fps () const;
77 virtual double get_wind_from_down_fps () const;
79 virtual double get_turbulence_magnitude_norm () const;
80 virtual double get_turbulence_rate_hz () const;
82 virtual void set_visibility_m (double v);
84 virtual void set_temperature_sea_level_degc (double t);
85 virtual void set_temperature_degc (double t);
86 virtual void set_dewpoint_sea_level_degc (double d);
87 virtual void set_dewpoint_degc (double d);
88 virtual void set_pressure_sea_level_inhg (double p);
89 virtual void set_pressure_inhg (double p);
91 virtual void set_wind_from_heading_deg (double h);
92 virtual void set_wind_speed_kt (double s);
93 virtual void set_wind_from_north_fps (double n);
94 virtual void set_wind_from_east_fps (double e);
95 virtual void set_wind_from_down_fps (double d);
97 virtual void set_turbulence_magnitude_norm (double t);
98 virtual void set_turbulence_rate_hz (double t);
100 virtual double get_elevation_ft () const;
101 virtual void set_elevation_ft (double elevation_ft);
102 virtual void set_altitude_half_to_sun_m (double alt);
103 virtual void set_altitude_tropo_top_m (double alt);
107 void _recalc_hdgspd ();
110 void _recalc_sl_temperature ();
111 void _recalc_alt_temperature ();
112 void _recalc_sl_dewpoint ();
113 void _recalc_alt_dewpoint ();
114 void _recalc_sl_pressure ();
115 void _recalc_alt_pressure ();
116 void _recalc_density ();
118 void _recalc_density_tropo_avg_kgm3 ();
119 void _recalc_relative_humidity ();
125 double temperature_sea_level_degc;
126 double temperature_degc;
127 double dewpoint_sea_level_degc;
128 double dewpoint_degc;
129 double pressure_sea_level_inhg;
130 double pressure_inhg;
131 double density_slugft3;
133 double density_tropo_avg_kgm3;
134 double relative_humidity;
135 double altitude_half_to_sun_m;
136 double altitude_tropo_top_m;
138 double turbulence_magnitude_norm;
139 double turbulence_rate_hz;
141 double wind_from_heading_deg;
142 double wind_speed_kt;
144 double wind_from_north_fps;
145 double wind_from_east_fps;
146 double wind_from_down_fps;
150 void interpolate (const FGEnvironment * env1, const FGEnvironment * env2,
151 double fraction, FGEnvironment * result);
153 #endif // _ENVIRONMENT_HXX