// #include <conio.h>
#include <math.h>
+#include <simgear/constants.h>
+
#include <Aircraft/aircraft.hxx>
-#include <Include/fg_constants.h>
-#include <Main/options.hxx>
-#include <WeatherCM/FGLocalWeatherDatabase.h>
#include "BalloonSim.h"
-#include "sg.h"
+#include <plib/sg.h>
/****************************************************************************/
/********************************** CODE ************************************/
/* size for hot air balloons */
/************************************************************************/
- balloon_envelope_area = 4.0 * (8.8 * 8.8) * FG_PI;
- balloon_envelope_volume = (4.0/3.0) * (8.8 * 8.8 * 8.8) * FG_PI;
+ balloon_envelope_area = 4.0 * (8.8 * 8.8) * SGD_PI;
+ balloon_envelope_volume = (4.0/3.0) * (8.8 * 8.8 * 8.8) * SGD_PI;
- wind_facing_area_of_balloon = FG_PI * (8.8 * 8.8);
+ wind_facing_area_of_balloon = SGD_PI * (8.8 * 8.8);
wind_facing_area_of_basket = 2.0; //guessed: 2 m^2
cw_envelope=0.45; //a sphere in this case
{
/************************************************************************/
/* I'm simplifying the balloon by reducing the simulation to two */
- /* points: */
+ /* points: */
/* the center of the basket (CB) and the center of the envelope (CE) */
- /* */
- /* ce */
- /* I */
- /* I */
- /* cg (=center of gravity) */
- /* I */
- /* cb */
+ /* */
+ /* ce */
+ /* I */
+ /* I */
+ /* cg (=center of gravity) */
+ /* I */
+ /* cb */
/* */
/* On each center are forces acting: gravity and wind resitance. CE */
/* additionally got the lift (=> I need to calculate the weight of the */
/* later, but currently was my main concern to get it going... */
/************************************************************************/
- sgVec3 v;
-
- //get the current wind velocity and store it in v
- //Point3D temp = WeatherDatabase->get(position).Wind;
- //sgSetVec3(v, temp.x(), temp.y(), temp.z());
- sgCopyVec3(v, WeatherDatabase->get(position).Wind );
-
- sgSubVec3(v, velocity);
- float speed = sgLengthVec3(v);
-
- // calculate the density of the gas inside
- double rho = WeatherDatabase->get(position).AirPressure / (287.14 * T);
-
- // calculate the mass of the air
- double mAir = rho * balloon_envelope_volume;
-
- // loss of energy by cooling down:
- float k = 1.0 / (1.0/4.8 + 1.0/(4.8+3.4*speed) + l_of_the_envelope/lambda);
- float Q = k * balloon_envelope_area * (dt/3600.0) * (WeatherDatabase->get(position).Temperature - T); //(dt/3600.0) = time since last call in hours
+ // I realy don't think there is a solution for this without WeatherCM
+ // but this is a hack, and it's working -- EMH
+ double mAir = 0;
+ float Q = 0;
// gain of energy by heating:
if (fuel_left > 0.0) //but only with some fuel left ;-)
sgVec3 fTotal, fFriction, fLift;
sgScaleVec3(fTotal, gravity_vector, mTotal);
- sgScaleVec3(fFriction, v, cw_envelope * wind_facing_area_of_balloon * WeatherDatabase->getAirDensity(position) * speed / 2.0); //wind resistance
- sgScaleVec3(fLift, gravity_vector, -balloon_envelope_volume * WeatherDatabase->get(position).AirPressure / (287.14 * WeatherDatabase->get(position).Temperature));
sgAddVec3(fTotal, fLift);
sgAddVec3(fTotal, fFriction);
// care for the ground
if (position[2] < (ground_level+0.001) )
- velocity[2] = ground_level;
+ position[2] = ground_level;
//return results
sgAddVec3(position, dTotal);