From 5015c6270bd3fb1a34ac496d777fde9a4b80bb96 Mon Sep 17 00:00:00 2001
From: philipphansmann <Philipp Hansmann>
Date: Tue, 25 Feb 2025 16:09:28 +0100
Subject: [PATCH] Fixed bug where performance_assessment stalls due to aero
 returning a NaN as drag

---
 performance_assessment/src/taw/defaultMethods/aircraft.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/performance_assessment/src/taw/defaultMethods/aircraft.cpp b/performance_assessment/src/taw/defaultMethods/aircraft.cpp
index 17259384..d1951096 100644
--- a/performance_assessment/src/taw/defaultMethods/aircraft.cpp
+++ b/performance_assessment/src/taw/defaultMethods/aircraft.cpp
@@ -216,6 +216,9 @@ double aircraft::ROC(double Mass, double Alt, double Mach, double fACC, string C
     } catch (const std::string& e) {
         tempDrag = ac_thrust;  // In case of missing polar data a gamma of 0 is forced
     }
+    if (std::isnan(tempDrag)) {
+        tempDrag = ac_thrust;  // In case of missing polar data (but NaN-flavoured)
+    }
     double tempGamma = asin((ac_thrust - tempDrag) / (G_FORCE * Mass) / (1. + fACC));  // because not with const. TAS but with const. IAS or Ma is risen
                                                                                     //--> Introduction of facc: Commutation factor: facc = V/g * dV/dh; see table 11.1 p.232
     double tempLiftCoefficient = 2.*(G_FORCE * Mass * cos(tempGamma))
-- 
GitLab