Skip to content

Commit

Permalink
updated initial Cp
Browse files Browse the repository at this point in the history
  • Loading branch information
planes committed Apr 26, 2022
1 parent 361138a commit 1f3bd17
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 14 deletions.
1 change: 1 addition & 0 deletions trunk/SUAVE/Components/Energy/Converters/Rotor.py
Expand Up @@ -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
Expand Down
18 changes: 12 additions & 6 deletions trunk/SUAVE/Components/Energy/Networks/Battery_Propeller.py
Expand Up @@ -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
Expand Down Expand Up @@ -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')

Expand Down Expand Up @@ -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.):
Expand Down Expand Up @@ -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')

Expand Down
36 changes: 30 additions & 6 deletions trunk/SUAVE/Components/Energy/Networks/Lift_Cruise.py
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.):
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions trunk/SUAVE/Components/Energy/Networks/Solar.py
Expand Up @@ -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:
Expand Down Expand Up @@ -340,14 +340,19 @@ 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')

# Now check if the propellers are all identical, in this case they have the same of residuals and unknowns
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

Expand Down

0 comments on commit 1f3bd17

Please sign in to comment.