From dcfa75f7fb087b47723722a067d07bbd1ed5dc72 Mon Sep 17 00:00:00 2001
From: "WINDOWS-VULKH01\\lamin" <lm21g15@soton.ac.uk>
Date: Mon, 29 Mar 2021 14:04:52 +0100
Subject: [PATCH] adapted for thrust at altitude to sea level

---
 .../ode_batt_mot_prop/electric_batt_mot_prop.py          | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/powertrain_analysis/ode_batt_mot_prop/electric_batt_mot_prop.py b/powertrain_analysis/ode_batt_mot_prop/electric_batt_mot_prop.py
index 97f629b..5495026 100644
--- a/powertrain_analysis/ode_batt_mot_prop/electric_batt_mot_prop.py
+++ b/powertrain_analysis/ode_batt_mot_prop/electric_batt_mot_prop.py
@@ -49,7 +49,7 @@ time_discharge_calculation = battery_1.time_discharge_s()
 nominal_current_a_caluclation = time_discharge_calculation[0]
 
 
-def batt_mot_prop_for_ode(tas_mps, thrust_n, timestamp_s_list, tas_mps_list,
+def batt_mot_prop_for_ode(tas_mps, thrust_n, agl_m, timestamp_s_list, tas_mps_list,
                           motor_speed_rpm_list, motor_torque_nm_list, voltage_v_to_em_1_list,
                           current_a_to_em_1_list, efficiency_em_1_list, power_w_em_output_list,
                           power_w_esc_1_list, soc_list, dsoc_list, battery_1_terminal_voltage_v_list,
@@ -60,9 +60,12 @@ def batt_mot_prop_for_ode(tas_mps, thrust_n, timestamp_s_list, tas_mps_list,
     # Assuming that propeller speed and torque are equal to the motor torque and speed
     # propeller equations
 
+    atmosphere = at.Atmosphere()
     propeller_1.v_tas_mps = tas_mps
-    # print("propeller_1.v_tas_mps", propeller_1.v_tas_mps)
-    propeller_1.thrust_n_required = thrust_n
+    propeller_1.thrust_n_required = thrust_n * atmosphere.airdens_kgpm3(0) / atmosphere.airdens_kgpm3(agl_m)
+    # propeller_1.thrust_n_required = thrust_n
+
+
     # print("propeller_1.thrust_n_required", propeller_1.thrust_n_required)
     try:
         # interp_function_speed_rpm(propeller_1.thrust_n_required, propeller_1.v_tas_mps)[0]
-- 
GitLab