Author: Christian Mayer
Date started: 28.05.99
- ---------- Copyright (C) 1999 Christian Mayer (vader@t-online.de) ----------
+ -------- Copyright (C) 1999 Christian Mayer (fgfs@christianmayer.de) --------
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
08.06.1999 Christian Mayer Added international air preasure formula
16.06.1999 Durk Talsma Portability for Linux
20.06.1999 Christian Mayer added lots of consts
+11.10.1999 Christian Mayer changed set<> to map<> on Bernie Bright's
+ suggestion
+19.10.1999 Christian Mayer change to use PLIB's sg instead of Point[2/3]D
+ and lots of wee code cleaning
+15.12.1999 Christian Mayer changed the air pressure calculation to a much
+ more realistic formula. But as I need for that
+ the temperature I moved the code to
+ FGPhysicalProperties
*****************************************************************************/
/****************************************************************************/
/****************************************************************************/
/* INCLUDES */
/****************************************************************************/
-#include "FGWeatherDefs.h"
#include <math.h>
+
+#include "FGWeatherDefs.h"
/****************************************************************************/
/* DEFINES */
/* CLASS DECLARATION */
/* NOTE: The value stored in 'value' is the air preasure that we'd have at */
/* an altitude of 0.0 The correct airpreasure at the stored altitude */
-/* gets calulated when getValue() is called. */
+/* gets calulated in FGPhyiscalProperties as I need to know the */
+/* temperatures at the different altitudes for that. */
/****************************************************************************/
class FGAirPressureItem
{
private:
- WeatherPrecition value;
+ WeatherPrecision value; //that's the airpressure at 0 metres
+
protected:
public:
- FGAirPressureItem(const WeatherPrecition& v) {value = v;}
- FGAirPressureItem() {value = FG_WEATHER_DEFAULT_AIRPRESSURE;}
+ FGAirPressureItem(const WeatherPrecision v) {value = v; }
+ FGAirPressureItem() {value = FG_WEATHER_DEFAULT_AIRPRESSURE;}
- //WeatherPrecition getValue(WeatherPrecition alt) { return value * pow(1.0 - 0.0065*alt/288.0, 5.255); };
+ WeatherPrecision getValue() const
+ {
+ return value;
+ };
- WeatherPrecition getValue(const WeatherPrecition& alt) const
+ void setValue(WeatherPrecision p)
{
- return (WeatherPrecition)((value / 101325.0) *
- (
- 1.01325e5 + alt * (-1.19459535223623e1 + alt * (5.50461110007561e-4 + alt * (-1.13574703113648e-8 + alt * 8.61601726143988e-14)))
- ));
+ value = p;
};
-
- FGAirPressureItem& operator*=(const WeatherPrecition& arg);
+
+ FGAirPressureItem& operator*=(const WeatherPrecision arg);
FGAirPressureItem& operator+=(const FGAirPressureItem& arg);
FGAirPressureItem& operator-=(const FGAirPressureItem& arg);
friend FGAirPressureItem operator-(const FGAirPressureItem& arg);
};
-inline FGAirPressureItem& FGAirPressureItem::operator*= (const WeatherPrecition& arg)
+inline FGAirPressureItem& FGAirPressureItem::operator*= (const WeatherPrecision arg)
{
value *= arg;
return *this;