Fix calculate temerature for ISA METAR scenario
This commit is contained in:
parent
4be74c8df5
commit
459242b9db
5 changed files with 9 additions and 6 deletions
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "environment.hxx"
|
#include "environment.hxx"
|
||||||
#include "atmosphere.hxx"
|
#include "atmosphere.hxx"
|
||||||
|
#include "environment_mgr.hxx"
|
||||||
#include "climate.hxx"
|
#include "climate.hxx"
|
||||||
|
|
||||||
// Based on "World Map of the Köppen-Geiger climate classification"
|
// Based on "World Map of the Köppen-Geiger climate classification"
|
||||||
|
@ -99,8 +100,6 @@ void FGClimate::bind()
|
||||||
_tiedProperties.Tie( "snow-level-m", &_snow_level);
|
_tiedProperties.Tie( "snow-level-m", &_snow_level);
|
||||||
_tiedProperties.Tie( "wind-speed-mps", &_wind_speed);
|
_tiedProperties.Tie( "wind-speed-mps", &_wind_speed);
|
||||||
_tiedProperties.Tie( "wind-direction-deg", &_wind_direction);
|
_tiedProperties.Tie( "wind-direction-deg", &_wind_direction);
|
||||||
|
|
||||||
_tiedProperties.Tie("is-isa", &_is_isa);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGClimate::unbind ()
|
void FGClimate::unbind ()
|
||||||
|
@ -216,7 +215,7 @@ void FGClimate::update(double dt)
|
||||||
// calculate sea level parameters from ground level parameters
|
// calculate sea level parameters from ground level parameters
|
||||||
// adapted from metarproperties.cxx
|
// adapted from metarproperties.cxx
|
||||||
FGEnvironment dummy;
|
FGEnvironment dummy;
|
||||||
dummy.set_is_isa(_is_isa);
|
dummy.set_is_isa(globals->get_subsystem<FGEnvironmentMgr>()->getEnvironment().get_is_isa());
|
||||||
dummy.set_live_update(false);
|
dummy.set_live_update(false);
|
||||||
dummy.set_elevation_ft(_gl.elevation_m*SG_METER_TO_FEET);
|
dummy.set_elevation_ft(_gl.elevation_m*SG_METER_TO_FEET);
|
||||||
dummy.set_dewpoint_degc(_gl.dewpoint);
|
dummy.set_dewpoint_degc(_gl.dewpoint);
|
||||||
|
|
|
@ -192,8 +192,6 @@ private:
|
||||||
double _wind_direction = -99999.0; // wind direction in degrees
|
double _wind_direction = -99999.0; // wind direction in degrees
|
||||||
|
|
||||||
char _metar[256] = "";
|
char _metar[256] = "";
|
||||||
|
|
||||||
bool _is_isa = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _FGCLIMATE_HXX
|
#endif // _FGCLIMATE_HXX
|
||||||
|
|
|
@ -354,6 +354,10 @@ void FGEnvironment::Tie( SGPropertyNode_ptr base, bool archivable )
|
||||||
|
|
||||||
_tiedProperties.Tie("atmosphere/density-tropo-avg", this,
|
_tiedProperties.Tie("atmosphere/density-tropo-avg", this,
|
||||||
&FGEnvironment::get_density_tropo_avg_kgm3); //ro
|
&FGEnvironment::get_density_tropo_avg_kgm3); //ro
|
||||||
|
|
||||||
|
_tiedProperties.Tie("atmosphere/is-isa", this,
|
||||||
|
&FGEnvironment::get_is_isa,
|
||||||
|
&FGEnvironment::set_is_isa);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGEnvironment::Untie()
|
void FGEnvironment::Untie()
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <cstring> // for strlen
|
#include <cstring> // for strlen
|
||||||
|
|
||||||
#include "metarproperties.hxx"
|
#include "metarproperties.hxx"
|
||||||
|
#include "environment_mgr.hxx"
|
||||||
#include "fgmetar.hxx"
|
#include "fgmetar.hxx"
|
||||||
#include "environment.hxx"
|
#include "environment.hxx"
|
||||||
#include "atmosphere.hxx"
|
#include "atmosphere.hxx"
|
||||||
|
@ -291,6 +292,7 @@ void MetarProperties::setMetar( SGSharedPtr<FGMetar> m )
|
||||||
|
|
||||||
{ // calculate sea level temperature, dewpoint and pressure
|
{ // calculate sea level temperature, dewpoint and pressure
|
||||||
FGEnvironment dummy; // instantiate a dummy so we can leech a method
|
FGEnvironment dummy; // instantiate a dummy so we can leech a method
|
||||||
|
dummy.set_is_isa( globals->get_subsystem<FGEnvironmentMgr>()->getEnvironment().get_is_isa() );
|
||||||
dummy.set_elevation_ft( _station_elevation );
|
dummy.set_elevation_ft( _station_elevation );
|
||||||
dummy.set_temperature_degc( _temperature );
|
dummy.set_temperature_degc( _temperature );
|
||||||
dummy.set_dewpoint_degc( _dewpoint );
|
dummy.set_dewpoint_degc( _dewpoint );
|
||||||
|
|
|
@ -194,7 +194,7 @@ Item {
|
||||||
_config.setArg("metar", _weatherScenarios.metarForItem(index))
|
_config.setArg("metar", _weatherScenarios.metarForItem(index))
|
||||||
|
|
||||||
var isISA = _weatherScenarios.nameForItem(index) == "International Standard Atmosphere";
|
var isISA = _weatherScenarios.nameForItem(index) == "International Standard Atmosphere";
|
||||||
_config.setProperty("/environment/climate/is-isa", isISA);
|
_config.setProperty("/environment/atmosphere/is-isa", isISA);
|
||||||
}
|
}
|
||||||
|
|
||||||
// either way, set the scenario name since Local-Weather keys off
|
// either way, set the scenario name since Local-Weather keys off
|
||||||
|
|
Loading…
Add table
Reference in a new issue