From 1f3bd17b6ced7af40894a44f9acdda014c72817a Mon Sep 17 00:00:00 2001 From: planes Date: Tue, 26 Apr 2022 09:42:35 -0700 Subject: [PATCH] updated initial Cp --- .../Components/Energy/Converters/Rotor.py | 1 + .../Energy/Networks/Battery_Propeller.py | 18 ++++++---- .../Components/Energy/Networks/Lift_Cruise.py | 36 +++++++++++++++---- .../SUAVE/Components/Energy/Networks/Solar.py | 9 +++-- 4 files changed, 50 insertions(+), 14 deletions(-) diff --git a/trunk/SUAVE/Components/Energy/Converters/Rotor.py b/trunk/SUAVE/Components/Energy/Converters/Rotor.py index d42b6771fa..0630167bf6 100644 --- a/trunk/SUAVE/Components/Energy/Converters/Rotor.py +++ b/trunk/SUAVE/Components/Energy/Converters/Rotor.py @@ -83,6 +83,7 @@ def __defaults__(self): self.vtk_airfoil_points = 40 self.induced_power_factor = 1.48 # accounts for interference effects self.profile_drag_coefficient = .03 + self.design_power_coefficient = 0.01 self.use_2d_analysis = False # True if rotor is at an angle relative to freestream or nonuniform freestream self.nonuniform_freestream = False diff --git a/trunk/SUAVE/Components/Energy/Networks/Battery_Propeller.py b/trunk/SUAVE/Components/Energy/Networks/Battery_Propeller.py index 32004501f2..4c69ee0f0f 100644 --- a/trunk/SUAVE/Components/Energy/Networks/Battery_Propeller.py +++ b/trunk/SUAVE/Components/Energy/Networks/Battery_Propeller.py @@ -408,7 +408,7 @@ def residuals(self,segment): return ## @ingroup Components-Energy-Networks - def add_unknowns_and_residuals_to_segment(self, segment, initial_voltage = None, initial_power_coefficient = 0.02, + def add_unknowns_and_residuals_to_segment(self, segment, initial_voltage = None, initial_power_coefficient = None, initial_battery_cell_temperature = 283. , initial_battery_state_of_charge = 0.5, initial_battery_cell_current = 5.): """ This function sets up the information that the mission needs to run a mission segment using this network @@ -445,9 +445,12 @@ def add_unknowns_and_residuals_to_segment(self, segment, initial_voltage = None, # unpack the initial values if the user doesn't specify if initial_voltage==None: initial_voltage = self.battery.max_voltage - + + if initial_power_coefficient==None: + prop_key = list(self.propellers.keys())[0] # Use the first propeller + initial_power_coefficient = float(self.propellers[prop_key].design_power_coefficient) + # Count how many unknowns and residuals based on p - if n_props!=n_motors!=n_eng: print('The number of propellers is not the same as the number of motors') @@ -489,7 +492,7 @@ def add_unknowns_and_residuals_to_segment(self, segment, initial_voltage = None, ## @ingroup Components-Energy-Networks def add_tiltrotor_transition_unknowns_and_residuals_to_segment(self, segment, initial_voltage = None, initial_y_axis_rotation = 0.0, - initial_power_coefficient = 0.02, + initial_power_coefficient = None, initial_battery_cell_temperature = 283. , initial_battery_state_of_charge = 0.5, initial_battery_cell_current = 5.): @@ -532,9 +535,12 @@ def add_tiltrotor_transition_unknowns_and_residuals_to_segment(self, segment, in # unpack the initial values if the user doesn't specify if initial_voltage==None: initial_voltage = self.battery.max_voltage + + if initial_power_coefficient==None: + prop_key = list(self.propellers.keys())[0] # Use the first propeller + initial_power_coefficient = float(self.propellers[prop_key].design_power_coefficient) - # Count how many unknowns and residuals based on p) - + # Count how many unknowns and residuals based on p) if n_props!=n_motors!=n_eng: print('The number of propellers is not the same as the number of motors') diff --git a/trunk/SUAVE/Components/Energy/Networks/Lift_Cruise.py b/trunk/SUAVE/Components/Energy/Networks/Lift_Cruise.py index 6e8519ec5d..3acc1ae6c4 100644 --- a/trunk/SUAVE/Components/Energy/Networks/Lift_Cruise.py +++ b/trunk/SUAVE/Components/Energy/Networks/Lift_Cruise.py @@ -701,8 +701,8 @@ def residuals_lift(self,segment): def add_transition_unknowns_and_residuals_to_segment(self, segment, initial_voltage = None, - initial_prop_power_coefficient = 0.005, - initial_lift_rotor_power_coefficient = 0.005, + initial_prop_power_coefficient = None, + initial_lift_rotor_power_coefficient = None, initial_throttle_lift = 0.9, initial_battery_cell_temperature = 283. , initial_battery_state_of_charge = 0.5, @@ -747,6 +747,18 @@ def add_transition_unknowns_and_residuals_to_segment(self, segment, initial_volt if n_lift_rotors!=n_motors_r!=n_eng_r: assert('The number of lift_rotors is not the same as the number of motors') + # unpack the initial values if the user doesn't specify + if initial_voltage==None: + initial_voltage = self.battery.max_voltage + + if initial_prop_power_coefficient==None: + prop_key = list(self.propellers.keys())[0] # Use the first propeller + initial_prop_power_coefficient = float(self.propellers[prop_key].design_power_coefficient) + + if initial_lift_rotor_power_coefficient==None: + prop_key = list(self.lift_rotors.keys())[0] # Use the first propeller + initial_lift_rotor_power_coefficient = float(self.lift_rotors[prop_key].design_power_coefficient) + # Now check if the props/lift_rotors are all identical, in this case they have the same of residuals and unknowns if self.identical_propellers: n_props = 1 @@ -804,7 +816,7 @@ def add_transition_unknowns_and_residuals_to_segment(self, segment, initial_volt def add_cruise_unknowns_and_residuals_to_segment(self, segment, initial_voltage = None, - initial_prop_power_coefficient = 0.005, + initial_prop_power_coefficient = None, initial_battery_cell_temperature = 283., initial_battery_state_of_charge = 0.5, initial_battery_cell_current = 5.): @@ -854,6 +866,14 @@ def add_cruise_unknowns_and_residuals_to_segment(self, segment, initial_voltage else: self.number_of_lift_rotor_engines = int(self.number_of_lift_rotor_engines) + # unpack the initial values if the user doesn't specify + if initial_voltage==None: + initial_voltage = self.battery.max_voltage + + if initial_prop_power_coefficient==None: + prop_key = list(self.propellers.keys())[0] # Use the first propeller + initial_prop_power_coefficient = float(self.propellers[prop_key].design_power_coefficient) + # Assign initial segment conditions to segment if missing battery = self.battery append_initial_battery_conditions(segment,battery) @@ -897,7 +917,7 @@ def add_cruise_unknowns_and_residuals_to_segment(self, segment, initial_voltage def add_lift_unknowns_and_residuals_to_segment(self, segment, initial_voltage = None, - initial_lift_rotor_power_coefficient = 0.005, + initial_lift_rotor_power_coefficient = None, initial_throttle_lift = 0.9, initial_battery_cell_temperature = 283., initial_battery_state_of_charge = 0.5, @@ -930,8 +950,12 @@ def add_lift_unknowns_and_residuals_to_segment(self, segment, initial_voltage = # unpack the initial values if the user doesn't specify if initial_voltage==None: - initial_voltage = self.battery.max_voltage - + initial_voltage = self.battery.max_voltage + + if initial_lift_rotor_power_coefficient==None: + prop_key = list(self.lift_rotors.keys())[0] # Use the first propeller + initial_lift_rotor_power_coefficient = float(self.lift_rotors[prop_key].design_power_coefficient) + # Count how many unknowns and residuals based on p n_lift_rotors = len(self.lift_rotors) n_motors_r = len(self.lift_rotor_motors) diff --git a/trunk/SUAVE/Components/Energy/Networks/Solar.py b/trunk/SUAVE/Components/Energy/Networks/Solar.py index 076f34ae77..0b65bf96f1 100644 --- a/trunk/SUAVE/Components/Energy/Networks/Solar.py +++ b/trunk/SUAVE/Components/Energy/Networks/Solar.py @@ -310,7 +310,7 @@ def residuals(self,segment): - def add_unknowns_and_residuals_to_segment(self, segment, initial_power_coefficient = 0.005): + def add_unknowns_and_residuals_to_segment(self, segment, initial_power_coefficient = None): """ This function sets up the information that the mission needs to run a mission segment using this network Assumptions: @@ -340,7 +340,7 @@ def add_unknowns_and_residuals_to_segment(self, segment, initial_power_coefficie n_props = len(self.propellers) n_motors = len(self.motors) n_eng = self.number_of_engines - + if n_props!=n_motors!=n_eng: print('The number of propellers is not the same as the number of motors') @@ -348,6 +348,11 @@ def add_unknowns_and_residuals_to_segment(self, segment, initial_power_coefficie if self.identical_propellers: n_props = 1 + # unpack the initial values if the user doesn't specify + if initial_power_coefficient==None: + prop_key = list(self.propellers.keys())[0] # Use the first propeller + initial_power_coefficient = float(self.propellers[prop_key].design_power_coefficient) + # number of residuals, props plus the battery voltage n_res = n_props