Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while using piston/turboprop aircraft #59

Open
andrewda opened this issue Oct 23, 2024 · 0 comments
Open

Error while using piston/turboprop aircraft #59

andrewda opened this issue Oct 23, 2024 · 0 comments

Comments

@andrewda
Copy link

andrewda commented Oct 23, 2024

Hello! Thanks for all your work on AirTrafficSim -- it has been an incredibly helpful tool for my research.

I have encountered an issue while trying to use piston and turboprop aircraft (e.g., BE20, C208). The Performance.cal_transition_alt function assumes that perf_model.climb_schedule[n, -2] and perf_model.climb_schedule[n, -1] are non-zero, but this appears to only be the case for jet aircraft. See the following code:

if (self.__engine_type[n] == EngineType.JET):
# If Jet (Equation 4.1-1~5)
self.climb_schedule[n] = [self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_1, self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_2, self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_3,
self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_4, self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_5, np.minimum(self.__v_cl_1[n], 250), self.__v_cl_2[n], self.__m_cl[n]]
else:
# Else if turboprop and piston (Equation 4.1-6~8)
self.climb_schedule[n] = [self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_6, self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_7, self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_8,
np.minimum(self.__v_cl_1[n], 250), self.__v_cl_2[n], self.__m_cl[n], 0.0, 0.0]

I was able to resolve this issue by simply using the jet calculations for all aircraft, but this clearly isn't the right approach. I did not have time to dig into the flight models too deeply, but figured I'd report the problem here to see if anyone more familiar with the code might have some pointers!

diff --git a/airtrafficsim/core/performance/bada.py b/airtrafficsim/core/performance/bada.py
index 6d4f312..fe45b71 100644
--- a/airtrafficsim/core/performance/bada.py
+++ b/airtrafficsim/core/performance/bada.py
@@ -1032,8 +1032,11 @@ class Bada:
                                       self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_4, self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_5, np.minimum(self.__v_cl_1[n], 250), self.__v_cl_2[n], self.__m_cl[n]]
         else:
             # Else if turboprop and piston (Equation 4.1-6~8)
-            self.climb_schedule[n] = [self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_6, self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_7, self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_8,
-                                      np.minimum(self.__v_cl_1[n], 250), self.__v_cl_2[n], self.__m_cl[n], 0.0, 0.0]
+            # self.climb_schedule[n] = [self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_6, self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_7, self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_8,
+            #                           np.minimum(self.__v_cl_1[n], 250), self.__v_cl_2[n], self.__m_cl[n], self.__v_cl_2[n], self.__m_cl[n]]
+            self.climb_schedule[n] = [self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_1, self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_2, self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_3,
+                                      self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_4, self.__C_V_MIN * v_stall_to_act + self.__V_D_CL_5, np.minimum(self.__v_cl_1[n], 250), self.__v_cl_2[n], self.__m_cl[n]]
+
 
         # Standard cruise schedule
         if (self.__engine_type[n] == EngineType.JET):
@@ -1055,8 +1058,11 @@ class Bada:
                                         self.__C_V_MIN * v_stall_ld_act + self.__V_D_DSE_4, np.minimum(self.__v_des_1[n], 220), np.minimum(self.__v_des_1[n], 250), self.__v_des_2[n], self.__m_des[n]]
         else:
             # Else if Piston (Equation 4.3-5~7)
-            self.descent_schedule[n] = [self.__C_V_MIN * v_stall_ld_act + self.__V_D_DSE_5, self.__C_V_MIN * v_stall_ld_act + self.__V_D_DSE_6, self.__C_V_MIN * v_stall_ld_act + self.__V_D_DSE_7,
-                                        self.__v_des_1[n], self.__v_des_2[n], self.__m_des[n], 0.0, 0.0]
+            # self.descent_schedule[n] = [self.__C_V_MIN * v_stall_ld_act + self.__V_D_DSE_5, self.__C_V_MIN * v_stall_ld_act + self.__V_D_DSE_6, self.__C_V_MIN * v_stall_ld_act + self.__V_D_DSE_7,
+            #                             self.__v_des_1[n], self.__v_des_2[n], self.__m_des[n], 0.0, 0.0]
+            self.descent_schedule[n] = [self.__C_V_MIN * v_stall_ld_act + self.__V_D_DSE_1, self.__C_V_MIN * v_stall_ld_act + self.__V_D_DSE_2, self.__C_V_MIN * v_stall_ld_act + self.__V_D_DSE_3,
+                                        self.__C_V_MIN * v_stall_ld_act + self.__V_D_DSE_4, np.minimum(self.__v_des_1[n], 220), np.minimum(self.__v_des_1[n], 250), self.__v_des_2[n], self.__m_des[n]]
+
 
     def get_procedure_speed(self, H_p, H_p_trans, flight_phase):
         """

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant