From 5e99f92a0f27b3d16c413b3dc9e416324a08c6bc Mon Sep 17 00:00:00 2001 From: Henning Stahlke Date: Sat, 22 Apr 2017 15:06:02 +0200 Subject: [PATCH] YASim: conver Airplane::setupState from static to const --- src/FDM/YASim/Airplane.cpp | 3 ++- src/FDM/YASim/Airplane.hpp | 2 +- src/FDM/YASim/yasim-test.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/FDM/YASim/Airplane.cpp b/src/FDM/YASim/Airplane.cpp index 68ae0d9fb..03a50e454 100644 --- a/src/FDM/YASim/Airplane.cpp +++ b/src/FDM/YASim/Airplane.cpp @@ -300,7 +300,8 @@ void Airplane::setFuelFraction(float frac) } } -void Airplane::setupState(const float aoa, const float speed, const float gla, State* s) +// used by runCruise, runApproach, solveHelicopter and in yasim-test +void Airplane::setupState(const float aoa, const float speed, const float gla, State* s) const { float cosAoA = Math::cos(aoa); float sinAoA = Math::sin(aoa); diff --git a/src/FDM/YASim/Airplane.hpp b/src/FDM/YASim/Airplane.hpp index 8ee625fd5..8acb9beb9 100644 --- a/src/FDM/YASim/Airplane.hpp +++ b/src/FDM/YASim/Airplane.hpp @@ -100,7 +100,7 @@ public: float getApproachElevator() const { return _approachElevator.val; } const char* getFailureMsg() const { return _failureMsg; } - static void setupState(const float aoa, const float speed, const float gla, yasim::State* s); // utility + void setupState(const float aoa, const float speed, const float gla, yasim::State* s) const; void loadApproachControls() { loadControls(_approachControls); } void loadCruiseControls() { loadControls(_cruiseControls); } diff --git a/src/FDM/YASim/yasim-test.cpp b/src/FDM/YASim/yasim-test.cpp index 9e40dc233..6bc0df8e3 100644 --- a/src/FDM/YASim/yasim-test.cpp +++ b/src/FDM/YASim/yasim-test.cpp @@ -74,7 +74,7 @@ void yasim_graph(Airplane* a, const float alt, const float kts, int cfg = CONFIG for(int deg=-15; deg<=90; deg++) { float aoa = deg * DEG2RAD; - Airplane::setupState(aoa, kts * KTS2MPS, 0 ,&s); + a->setupState(aoa, kts * KTS2MPS, 0 ,&s); m->getBody()->reset(); m->initIteration(); m->calcForces(&s); @@ -148,7 +148,7 @@ void yasim_drag(Airplane* a, const float aoa, const float alt, int cfg = CONFIG_ printf("#kts, drag\n"); for(int kts=15; kts<=150; kts++) { - Airplane::setupState(aoa, kts * KTS2MPS, 0 ,&s); + a->setupState(aoa, kts * KTS2MPS, 0 ,&s); m->getBody()->reset(); m->initIteration(); m->calcForces(&s);