1
0
Fork 0

Fix calculate temerature for ISA METAR scenario

This commit is contained in:
Roman Ludwicki 2023-09-16 15:37:00 +02:00 committed by James Turner
parent 4be74c8df5
commit 459242b9db
5 changed files with 9 additions and 6 deletions

View file

@ -20,6 +20,7 @@
#include "environment.hxx"
#include "atmosphere.hxx"
#include "environment_mgr.hxx"
#include "climate.hxx"
// 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( "wind-speed-mps", &_wind_speed);
_tiedProperties.Tie( "wind-direction-deg", &_wind_direction);
_tiedProperties.Tie("is-isa", &_is_isa);
}
void FGClimate::unbind ()
@ -216,7 +215,7 @@ void FGClimate::update(double dt)
// calculate sea level parameters from ground level parameters
// adapted from metarproperties.cxx
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_elevation_ft(_gl.elevation_m*SG_METER_TO_FEET);
dummy.set_dewpoint_degc(_gl.dewpoint);

View file

@ -192,8 +192,6 @@ private:
double _wind_direction = -99999.0; // wind direction in degrees
char _metar[256] = "";
bool _is_isa = false;
};
#endif // _FGCLIMATE_HXX

View file

@ -354,6 +354,10 @@ void FGEnvironment::Tie( SGPropertyNode_ptr base, bool archivable )
_tiedProperties.Tie("atmosphere/density-tropo-avg", this,
&FGEnvironment::get_density_tropo_avg_kgm3); //ro
_tiedProperties.Tie("atmosphere/is-isa", this,
&FGEnvironment::get_is_isa,
&FGEnvironment::set_is_isa);
}
void FGEnvironment::Untie()

View file

@ -13,6 +13,7 @@
#include <cstring> // for strlen
#include "metarproperties.hxx"
#include "environment_mgr.hxx"
#include "fgmetar.hxx"
#include "environment.hxx"
#include "atmosphere.hxx"
@ -291,6 +292,7 @@ void MetarProperties::setMetar( SGSharedPtr<FGMetar> m )
{ // calculate sea level temperature, dewpoint and pressure
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_temperature_degc( _temperature );
dummy.set_dewpoint_degc( _dewpoint );

View file

@ -194,7 +194,7 @@ Item {
_config.setArg("metar", _weatherScenarios.metarForItem(index))
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