2009-04-20 14:20:05 +00:00
|
|
|
// FGAIThermal - FGAIBase-derived class creates an AI thermal
|
2004-03-03 20:26:06 +00:00
|
|
|
//
|
2009-04-20 14:20:05 +00:00
|
|
|
// Original by Written by David Culp
|
2004-03-03 20:26:06 +00:00
|
|
|
//
|
2009-04-20 14:20:05 +00:00
|
|
|
// An attempt to refine the thermal shape and behaviour by WooT 2009
|
|
|
|
//
|
|
|
|
// Copyright (C) 2009 Patrice Poly ( WooT )
|
2004-03-03 20:26:06 +00:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
2006-02-21 01:16:04 +00:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-03-03 20:26:06 +00:00
|
|
|
|
|
|
|
#ifndef _FG_AIThermal_HXX
|
|
|
|
#define _FG_AIThermal_HXX
|
|
|
|
|
|
|
|
#include "AIManager.hxx"
|
|
|
|
#include "AIBase.hxx"
|
|
|
|
|
|
|
|
#include <string>
|
2008-07-27 16:25:13 +00:00
|
|
|
using std::string;
|
2004-03-03 20:26:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
class FGAIThermal : public FGAIBase {
|
|
|
|
|
|
|
|
public:
|
2006-02-11 13:16:56 +00:00
|
|
|
FGAIThermal();
|
2004-03-03 20:26:06 +00:00
|
|
|
~FGAIThermal();
|
2012-03-04 14:30:08 +00:00
|
|
|
|
|
|
|
void readFromScenario(SGPropertyNode* scFileNode);
|
2006-02-11 13:16:56 +00:00
|
|
|
|
2018-05-23 08:46:05 +00:00
|
|
|
bool init(ModelSearchOrder searchOrder) override;
|
2012-03-04 14:30:08 +00:00
|
|
|
virtual void bind();
|
2006-02-11 13:16:56 +00:00
|
|
|
virtual void update(double dt);
|
2004-03-03 20:26:06 +00:00
|
|
|
|
2009-04-20 14:20:05 +00:00
|
|
|
inline void setMaxStrength( double s ) { max_strength = s; };
|
2012-03-04 14:30:08 +00:00
|
|
|
inline void setDiameter( double d ) { diameter = d; };
|
|
|
|
inline void setHeight( double h ) { height = h; };
|
|
|
|
inline void setMaxUpdraft( double lift ) { v_up_max = lift; };
|
2009-04-20 14:20:05 +00:00
|
|
|
inline void setMinUpdraft( double sink ) { v_up_min = sink; };
|
|
|
|
inline void setR_up_frac( double r ) { r_up_frac = r; };
|
2012-03-04 14:30:08 +00:00
|
|
|
|
2009-04-20 14:20:05 +00:00
|
|
|
inline double getStrength() const { return strength; };
|
2012-03-04 14:30:08 +00:00
|
|
|
inline double getDiameter() const { return diameter; };
|
|
|
|
inline double getHeight() const { return height; };
|
|
|
|
inline double getV_up_max() const { return v_up_max; };
|
2009-04-20 14:20:05 +00:00
|
|
|
inline double getV_up_min() const { return v_up_min; };
|
|
|
|
inline double getR_up_frac() const { return r_up_frac; };
|
2004-03-03 20:26:06 +00:00
|
|
|
|
2012-03-04 14:30:08 +00:00
|
|
|
virtual const char* getTypeString(void) const { return "thermal"; }
|
2009-04-20 14:20:05 +00:00
|
|
|
void getGroundElev(double dt);
|
|
|
|
|
2004-03-03 20:26:06 +00:00
|
|
|
private:
|
|
|
|
void Run(double dt);
|
2009-04-20 14:20:05 +00:00
|
|
|
double get_strength_fac(double alt_frac);
|
|
|
|
double max_strength;
|
2012-03-04 14:30:08 +00:00
|
|
|
double strength;
|
|
|
|
double diameter;
|
|
|
|
double height;
|
|
|
|
double factor;
|
2009-04-20 14:20:05 +00:00
|
|
|
double alt_rel;
|
|
|
|
double alt;
|
|
|
|
double v_up_max;
|
|
|
|
double v_up_min;
|
2012-03-04 14:30:08 +00:00
|
|
|
double r_up_frac;
|
2009-04-20 14:20:05 +00:00
|
|
|
double cycle_timer;
|
|
|
|
double dt_count;
|
|
|
|
double time;
|
|
|
|
double xx;
|
|
|
|
double ground_elev_ft; // ground level in ft
|
|
|
|
double altitude_agl_ft; // altitude above ground in feet
|
|
|
|
bool do_agl_calc;
|
|
|
|
bool is_forming;
|
|
|
|
bool is_formed;
|
|
|
|
bool is_dying;
|
|
|
|
bool is_dead;
|
|
|
|
SGPropertyNode_ptr _surface_wind_from_deg_node;
|
|
|
|
SGPropertyNode_ptr _surface_wind_speed_node;
|
|
|
|
SGPropertyNode_ptr _aloft_wind_from_deg_node;
|
|
|
|
SGPropertyNode_ptr _aloft_wind_speed_node;
|
|
|
|
|
2004-03-03 20:26:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _FG_AIThermal_HXX
|