diff --git a/src/FDM/YASim/Model.cpp b/src/FDM/YASim/Model.cpp index 70546c9b2..d7bf3f636 100644 --- a/src/FDM/YASim/Model.cpp +++ b/src/FDM/YASim/Model.cpp @@ -210,6 +210,13 @@ void Model::setAir(const float pressure, const float temp, const float density) _rho = density; } +void Model::setAirFromStandardAtmosphere(const float altitude) +{ + _pressure = Atmosphere::getStdPressure(altitude); + _temp = Atmosphere::getStdTemperature(altitude); + _rho = Atmosphere::getStdDensity(altitude); +} + void Model::updateGround(State* s) { float dummy[3]; diff --git a/src/FDM/YASim/Model.hpp b/src/FDM/YASim/Model.hpp index dbb20870f..a57a57ce1 100644 --- a/src/FDM/YASim/Model.hpp +++ b/src/FDM/YASim/Model.hpp @@ -70,6 +70,7 @@ public: void setGroundEffect(const float* pos, const float span, const float mul); void setWind(float* wind) { Math::set3(wind, _wind); } void setAir(const float pressure, const float temp, const float density); + void setAirFromStandardAtmosphere(const float altitude); void updateGround(State* s); diff --git a/src/FDM/YASim/yasim-test.cpp b/src/FDM/YASim/yasim-test.cpp index 5b2b8e2f5..39cac4eba 100644 --- a/src/FDM/YASim/yasim-test.cpp +++ b/src/FDM/YASim/yasim-test.cpp @@ -54,9 +54,7 @@ void yasim_graph(Airplane* a, const float alt, const float kts, int cfg = CONFIG Model* m = a->getModel(); State s; - m->setAir(Atmosphere::getStdPressure(alt), - Atmosphere::getStdTemperature(alt), - Atmosphere::getStdDensity(alt)); + m->setAirFromStandardAtmosphere(alt); switch (cfg) { case CONFIG_APPROACH: @@ -131,9 +129,7 @@ void yasim_drag(Airplane* a, const float aoa, const float alt, int cfg = CONFIG_ Model* m = a->getModel(); State s; - m->setAir(Atmosphere::getStdPressure(alt), - Atmosphere::getStdTemperature(alt), - Atmosphere::getStdDensity(alt)); + m->setAirFromStandardAtmosphere(alt); switch (cfg) { case CONFIG_APPROACH: