]> git.mxchange.org Git - flightgear.git/blob - src/FDM/Balloon/BalloonSim.h
Fix a numeric_limits problem for older stdc++ libraries.
[flightgear.git] / src / FDM / Balloon / BalloonSim.h
1 /*****************************************************************************
2
3  Header:       BalloonSim.h     
4  Author:       Christian Mayer
5  Date started: 01.09.99
6
7  -------- Copyright (C) 1999 Christian Mayer (fgfs@christianmayer.de) --------
8
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17  details.
18
19  You should have received a copy of the GNU General Public License along with
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21  Place - Suite 330, Boston, MA  02111-1307, USA.
22
23  Further information about the GNU General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25
26 FUNCTIONAL DESCRIPTION
27 ------------------------------------------------------------------------------
28 Header for the hot air balloon simulator
29
30 HISTORY
31 ------------------------------------------------------------------------------
32 01.09.1999 Christian Mayer      Created
33 03.10.1999 Christian Mayer      cleaned  the code  by moveing  WeatherDatabase 
34                                 calls inside the update()
35 *****************************************************************************/
36
37 /****************************************************************************/
38 /* SENTRY                                                                   */
39 /****************************************************************************/
40 #ifndef BalloonSim_H
41 #define BalloonSim_H
42
43 /****************************************************************************/
44 /* INCLUDES                                                                 */
45 /****************************************************************************/
46 #include <plib/sg.h>
47                 
48 /****************************************************************************/
49 /* DEFINES                                                                  */
50 /****************************************************************************/
51
52 /****************************************************************************/
53 /* CLASS DECLARATION                                                        */
54 /****************************************************************************/
55 class balloon
56 {
57 private:
58     float dt;                           //in s
59
60     sgVec3 gravity_vector;              //in m/s*s
61     sgVec3 hpr;                         //the balloon isn't allways exactly vertical (e.g. during gusts); normalized
62     sgVec3 velocity;                    //current velocity; it gets iterated at each 'update'
63     sgVec3 position;                    //current position in lat/lon/alt
64
65     float balloon_envelope_area;        //area of the envelope
66     float balloon_envelope_volume;      //volume of the envelope
67
68     float wind_facing_area_of_balloon;
69     float wind_facing_area_of_basket;
70
71     float cw_envelope;                  //wind resistance of the envelope
72     float cw_basket;                    //wind resistance of the bakset
73
74     //all weights in kg
75     float weight_of_total_fuel;
76     float weight_of_envelope;
77     float weight_of_basket;             //weight of all the unmovable stuff such as the basket, the burner and the empty tanks
78     float weight_of_cargo;              //passengers and anything left (e.g. sand bags that are thrown away to give additional lift)
79
80     float fuel_left;                    //as a percentage
81     float max_flow_of_fuel_per_second;  //in percent per second 
82     float current_burner_strength;
83
84     float lambda;                       //waermeuebergangskoeffizient (heat transmission coefficent?!?) for the envelope
85     float l_of_the_envelope;            //the thickness of the envelope (in m)
86
87     float T;                            //tempereature inside the balloon
88
89     float ground_level;
90
91 public:
92     balloon();                          //constructor for initializing the balloon 
93
94     void update();                      //dt = time in seconds since last call
95     void set_burner_strength(const float bs);
96
97     void getVelocity(sgVec3 v) const;
98     void setVelocity(const sgVec3 v);
99
100     void getPosition(sgVec3 v) const;
101     void setPosition(const sgVec3 v);
102
103     void getHPR(sgVec3 angles) const;   //the balloon isn't allways exactly vertical
104     void setHPR(const sgVec3 angles);   //the balloon isn't allways exactly vertical
105
106     void setGroundLevel(const float altitude);
107
108     float getTemperature(void) const;
109     float getFuelLeft(void) const;
110
111     void set_dt(const float new_dt) { dt = new_dt; }
112 };
113
114 /****************************************************************************/
115 #endif /*BalloonSim_H*/