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 FGAIThermal(); 37 ~FGAIThermal(); 38 39 void readFromScenario(SGPropertyNode* scFileNode); 40 41 bool init(ModelSearchOrder searchOrder) override; 42 virtual void bind(); 43 virtual void update(double dt); 44 setMaxStrength(double s)45 inline void setMaxStrength( double s ) { max_strength = s; }; setDiameter(double d)46 inline void setDiameter( double d ) { diameter = d; }; setHeight(double h)47 inline void setHeight( double h ) { height = h; }; setMaxUpdraft(double lift)48 inline void setMaxUpdraft( double lift ) { v_up_max = lift; }; setMinUpdraft(double sink)49 inline void setMinUpdraft( double sink ) { v_up_min = sink; }; setR_up_frac(double r)50 inline void setR_up_frac( double r ) { r_up_frac = r; }; 51 getStrength() const52 inline double getStrength() const { return strength; }; getDiameter() const53 inline double getDiameter() const { return diameter; }; getHeight() const54 inline double getHeight() const { return height; }; getV_up_max() const55 inline double getV_up_max() const { return v_up_max; }; getV_up_min() const56 inline double getV_up_min() const { return v_up_min; }; getR_up_frac() const57 inline double getR_up_frac() const { return r_up_frac; }; 58 getTypeString(void) const59 virtual const char* getTypeString(void) const { return "thermal"; } 60 void getGroundElev(double dt); 61 62 private: 63 void Run(double dt); 64 double get_strength_fac(double alt_frac); 65 double max_strength; 66 double strength; 67 double diameter; 68 double height; 69 double factor; 70 double alt_rel; 71 double alt; 72 double v_up_max; 73 double v_up_min; 74 double r_up_frac; 75 double cycle_timer; 76 double dt_count; 77 double time; 78 double xx; 79 double ground_elev_ft; // ground level in ft 80 double altitude_agl_ft; // altitude above ground in feet 81 bool do_agl_calc; 82 bool is_forming; 83 bool is_formed; 84 bool is_dying; 85 bool is_dead; 86 SGPropertyNode_ptr _surface_wind_from_deg_node; 87 SGPropertyNode_ptr _surface_wind_speed_node; 88 SGPropertyNode_ptr _aloft_wind_from_deg_node; 89 SGPropertyNode_ptr _aloft_wind_speed_node; 90 91 }; 92 93 #endif // _FG_AIThermal_HXX 94