]> git.mxchange.org Git - flightgear.git/blob - src/Environment/environment.hxx
Add Nasal Vs. 1.5
[flightgear.git] / src / Environment / environment.hxx
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 - 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., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #ifndef _ENVIRONMENT_HXX
25 #define _ENVIRONMENT_HXX
26
27 #include <simgear/compiler.h>
28
29 #ifdef SG_HAVE_STD_INCLUDES
30 #  include <cmath>
31 #else
32 #  include <math.h>
33 #endif
34
35
36 /**
37  * Model the natural environment.
38  *
39  * This class models the natural environment at a specific place and
40  * time.  A separate instance is necessary for each location or time.
41  *
42  * This class should eventually move to SimGear.
43  */
44 class FGEnvironment
45 {
46
47 public:
48
49   FGEnvironment();
50   FGEnvironment (const FGEnvironment &environment);
51   virtual ~FGEnvironment();
52
53   virtual void copy (const FGEnvironment &environment);
54
55   virtual void read (const SGPropertyNode * node);
56   
57   virtual double get_visibility_m () const;
58
59   virtual double get_temperature_sea_level_degc () const;
60   virtual double get_temperature_degc () const;
61   virtual double get_dewpoint_sea_level_degc () const;
62   virtual double get_dewpoint_degc () const;
63   virtual double get_pressure_sea_level_inhg () const;
64   virtual double get_pressure_inhg () const;
65   virtual double get_density_slugft3 () const;
66
67   virtual double get_wind_from_heading_deg () const;
68   virtual double get_wind_speed_kt () const;
69   virtual double get_wind_from_north_fps () const;
70   virtual double get_wind_from_east_fps () const;
71   virtual double get_wind_from_down_fps () const;
72
73   virtual double get_turbulence_magnitude_norm () const;
74   virtual double get_turbulence_rate_hz () const;
75
76   virtual void set_visibility_m (double v);
77
78   virtual void set_temperature_sea_level_degc (double t);
79   virtual void set_temperature_degc (double t);
80   virtual void set_dewpoint_sea_level_degc (double d);
81   virtual void set_dewpoint_degc (double d);
82   virtual void set_pressure_sea_level_inhg (double p);
83   virtual void set_pressure_inhg (double p);
84
85   virtual void set_wind_from_heading_deg (double h);
86   virtual void set_wind_speed_kt (double s);
87   virtual void set_wind_from_north_fps (double n);
88   virtual void set_wind_from_east_fps (double e);
89   virtual void set_wind_from_down_fps (double d);
90
91   virtual void set_turbulence_magnitude_norm (double t);
92   virtual void set_turbulence_rate_hz (double t);
93
94   virtual double get_elevation_ft () const;
95   virtual void set_elevation_ft (double elevation_ft);
96
97 private:
98
99   void _recalc_hdgspd ();
100   void _recalc_ne ();
101
102   void _recalc_sl_temperature ();
103   void _recalc_alt_temperature ();
104   void _recalc_sl_dewpoint ();
105   void _recalc_alt_dewpoint ();
106   void _recalc_sl_pressure ();
107   void _recalc_alt_pressure ();
108   void _recalc_density ();
109
110   double elevation_ft;
111
112   double visibility_m;
113
114                                 // Atmosphere
115   double temperature_sea_level_degc;
116   double temperature_degc;
117   double dewpoint_sea_level_degc;
118   double dewpoint_degc;
119   double pressure_sea_level_inhg;
120   double pressure_inhg;
121   double density_slugft3;
122
123   double turbulence_magnitude_norm;
124   double turbulence_rate_hz;
125
126   double wind_from_heading_deg;
127   double wind_speed_kt;
128
129   double wind_from_north_fps;
130   double wind_from_east_fps;
131   double wind_from_down_fps;
132
133 };
134
135 void interpolate (const FGEnvironment * env1, const FGEnvironment * env2,
136                   double fraction, FGEnvironment * result);
137
138 #endif // _ENVIRONMENT_HXX