]> git.mxchange.org Git - flightgear.git/blob - src/AIModel/AIThermal.hxx
Merge branch 'next' of git://gitorious.org/fg/flightgear into next
[flightgear.git] / src / AIModel / AIThermal.hxx
1 // FGAIThermal - FGAIBase-derived class creates an AI thermal
2 //
3 // Original by Written by David Culp
4 //
5 // An attempt to refine the thermal shape and behaviour by WooT 2009
6 //
7 // Copyright (C) 2009 Patrice Poly ( WooT )
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 // General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22
23 #ifndef _FG_AIThermal_HXX
24 #define _FG_AIThermal_HXX
25
26 #include "AIManager.hxx"
27 #include "AIBase.hxx"
28
29 #include <string>
30 using std::string;
31
32
33 class FGAIThermal : public FGAIBase {
34
35 public:
36
37         FGAIThermal();
38         ~FGAIThermal();
39         
40         void readFromScenario(SGPropertyNode* scFileNode);
41
42         virtual bool init(bool search_in_AI_path=false);
43         virtual void bind();
44         virtual void unbind();
45         virtual void update(double dt);
46
47         inline void setMaxStrength( double s ) { max_strength = s; };
48         inline void setDiameter( double d ) { diameter = d; };
49         inline void setHeight( double h ) { height = h; };
50         inline void setMaxUpdraft( double lift ) { v_up_max = lift; };
51         inline void setMinUpdraft( double sink ) { v_up_min = sink; };
52         inline void setR_up_frac( double r ) { r_up_frac = r; };
53         
54         inline double getStrength() const { return strength; };
55         inline double getDiameter() const { return diameter; };
56         inline double getHeight() const { return height; };
57         inline double getV_up_max() const { return v_up_max; };
58         inline double getV_up_min() const { return v_up_min; };
59         inline double getR_up_frac() const { return r_up_frac; };
60
61         virtual const char* getTypeString(void) const { return "thermal"; }
62         void getGroundElev(double dt);
63         
64
65 private:
66
67         void Run(double dt);
68         double get_strength_fac(double alt_frac);
69         double max_strength;
70         double strength;
71         double diameter;
72         double height;
73         double factor;
74         double alt_rel;
75         double alt;
76         double v_up_max;
77         double v_up_min;
78         double r_up_frac;
79         double cycle_timer;
80         double dt_count;
81         double time;
82         double xx;
83         double ground_elev_ft; // ground level in ft
84         double altitude_agl_ft; // altitude above ground in feet
85         bool do_agl_calc;
86         bool is_forming;
87         bool is_formed;
88         bool is_dying;
89         bool is_dead;
90         SGPropertyNode_ptr _surface_wind_from_deg_node;
91         SGPropertyNode_ptr _surface_wind_speed_node;
92         SGPropertyNode_ptr _aloft_wind_from_deg_node;
93         SGPropertyNode_ptr _aloft_wind_speed_node;
94
95 };
96
97
98
99 #endif  // _FG_AIThermal_HXX