| 1 | /***************************************************************************** |
| 2 | |
| 3 | Header: BalloonSim.h |
| 4 | Author: Christian Mayer |
| 5 | Date started: 01.09.99 |
| 6 | |
| 7 | -------- Copyright (C) 1999 Christian Mayer ([email protected]) -------- |
| 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 |
| 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 | 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 | #include <cfloat> |
| 44 | |
| 45 | /****************************************************************************/ |
| 46 | /* INCLUDES */ |
| 47 | /****************************************************************************/ |
| 48 | #include <simgear/math/SGMath.hxx> |
| 49 | |
| 50 | /****************************************************************************/ |
| 51 | /* DEFINES */ |
| 52 | /****************************************************************************/ |
| 53 | |
| 54 | /****************************************************************************/ |
| 55 | /* CLASS DECLARATION */ |
| 56 | /****************************************************************************/ |
| 57 | class balloon |
| 58 | { |
| 59 | private: |
| 60 | float dt; //in s |
| 61 | |
| 62 | SGVec3f gravity_vector; //in m/s*s |
| 63 | SGVec3f hpr; //the balloon isn't allways exactly vertical (e.g. during gusts); normalized |
| 64 | SGVec3f velocity; //current velocity; it gets iterated at each 'update' |
| 65 | SGVec3f position; //current position in lat/lon/alt |
| 66 | |
| 67 | float balloon_envelope_area; //area of the envelope |
| 68 | float balloon_envelope_volume; //volume of the envelope |
| 69 | |
| 70 | float wind_facing_area_of_balloon; |
| 71 | float wind_facing_area_of_basket; |
| 72 | |
| 73 | float cw_envelope; //wind resistance of the envelope |
| 74 | float cw_basket; //wind resistance of the bakset |
| 75 | |
| 76 | //all weights in kg |
| 77 | float weight_of_total_fuel; |
| 78 | float weight_of_envelope; |
| 79 | float weight_of_basket; //weight of all the unmovable stuff such as the basket, the burner and the empty tanks |
| 80 | float weight_of_cargo; //passengers and anything left (e.g. sand bags that are thrown away to give additional lift) |
| 81 | |
| 82 | float fuel_left; //as a percentage |
| 83 | float max_flow_of_fuel_per_second; //in percent per second |
| 84 | float current_burner_strength; |
| 85 | |
| 86 | float lambda; //waermeuebergangskoeffizient (heat transmission coefficent?!?) for the envelope |
| 87 | float l_of_the_envelope; //the thickness of the envelope (in m) |
| 88 | |
| 89 | float T; //tempereature inside the balloon |
| 90 | |
| 91 | float ground_level; |
| 92 | |
| 93 | public: |
| 94 | balloon(); //constructor for initializing the balloon |
| 95 | |
| 96 | void update(); //dt = time in seconds since last call |
| 97 | void set_burner_strength(const float bs); |
| 98 | |
| 99 | void getVelocity(SGVec3f& v) const; |
| 100 | void setVelocity(const SGVec3f& v); |
| 101 | |
| 102 | void getPosition(SGVec3f& v) const; |
| 103 | void setPosition(const SGVec3f& v); |
| 104 | |
| 105 | void getHPR(SGVec3f& angles) const; //the balloon isn't allways exactly vertical |
| 106 | void setHPR(const SGVec3f& angles); //the balloon isn't allways exactly vertical |
| 107 | |
| 108 | void setGroundLevel(const float altitude); |
| 109 | |
| 110 | float getTemperature(void) const; |
| 111 | float getFuelLeft(void) const; |
| 112 | |
| 113 | void set_dt(const float new_dt) { dt = new_dt; } |
| 114 | }; |
| 115 | |
| 116 | /****************************************************************************/ |
| 117 | #endif /*BalloonSim_H*/ |