Skip to content

Commit

Permalink
updated range/cruise/power
Browse files Browse the repository at this point in the history
  • Loading branch information
FernCarrera committed May 30, 2019
1 parent 467c22c commit c756ed1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 18 deletions.
Binary file modified Model/Propulsion/__pycache__/power_comp.cpython-36.pyc
Binary file not shown.
8 changes: 7 additions & 1 deletion Model/Propulsion/cruise_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def setup(self):
self.add_input('AR',desc='Aspect Ratio')
self.add_input('S',desc='Refernce Area')
self.add_input('V',desc='Airspeed')
self.add_input('cd0',desc='zero lift drag')

self.add_output('P_C',desc='Power required for cruise')

Expand All @@ -22,4 +23,9 @@ def setup(self):

def compute(self,inputs,outputs):
W = inputs['W']*9.81
outputs['P_C'] = (( (2*(W**3)*(inputs['Cd']**2))/(inputs['S']*rho*(inputs['Cl']**3)) )**.5)/1000
# add Cl & Cd if airfoil code doesnt work
cl = 2*W/(rho*(inputs['V']**2)*inputs['S'])
k = 1/(3.14*0.8*inputs['AR']) # e = 0.8
cd = inputs['cd0'] + k*cl**2
#outputs['P_C'] = (( (2*(W**3)*(inputs['Cd']**2))/(inputs['S']*rho*(inputs['Cl']**3)) )**.5)/1000
outputs['P_C'] = (( (2*(W**3)*(cd**2))/(inputs['S']*rho*(cl**3) ))**.5)/1000
3 changes: 2 additions & 1 deletion Model/Propulsion/power_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ def compute(self, inputs, outputs):
rho = inputs['rho']
tip_speed = inputs['TS']
cd0 = inputs['cd0']
sol = 0.1


S = 3.14*(r**2)
T = n*W/8 # thrust required per motor
ct = T/( rho *S* (tip_speed**2) )
cp = ( 1.15*( (ct**(3/2)) /(2**.5) ) + (1/8)*0.1*cd0 )
cp = ( 1.15*( (ct**(3/2)) /(2**.5) ) + (1/8)*sol*cd0 ) # solidity
PI = T * ((T/(2*S*rho))**.5)
PH = cp*rho*S*(tip_speed**3)
FM = PI/PH
Expand Down
2 changes: 1 addition & 1 deletion Model/Propulsion/range_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def setup(self):
def compute(self,inputs,outputs):
LO_Wh = inputs['P_L']*LO_time*1000 # Energy spent on liftoff
time = ( (B_density*inputs['B_W']*res)-LO_Wh-(LO_Wh/2) ) / (1000*inputs['P_C'])
dist = (time-FAA)*inputs['V']
dist = (time-FAA)*inputs['V']*3.6 #conversion from [m/s]->[kph]

outputs['R'] = dist
outputs['t'] = time
41 changes: 26 additions & 15 deletions solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

ivc.add_output('m',val=0.0)
ivc.add_output('r',val=0.0)
ivc.add_output('TS',val=170)
ivc.add_output('TS',val=175) # ~55% of mach @ Sl
ivc.add_output('cd0',val=0.0197)
ivc.add_output('rho',val=1.225)

ivc.add_output('V',val=180)
ivc.add_output('Cd',val=0.0255)
ivc.add_output('V') # [m/s],~230[mph]
ivc.add_output('Cd',val=0.03)
ivc.add_output('Cl',val=0.32)
ivc.add_output('S',val=13.2)
ivc.add_output('AR',val=7)
Expand Down Expand Up @@ -52,6 +52,7 @@
model.connect('AR','cruiseP.AR')
model.connect('S','cruiseP.S')
model.connect('V','cruiseP.V')
model.connect('cd0','cruiseP.cd0')

# connecting to range comp
model.connect('Wb','range.B_W')
Expand All @@ -62,36 +63,46 @@

prob.driver = ScipyOptimizeDriver()
prob.driver.options['optimizer'] = 'SLSQP'
prob.driver.options['tol'] = 1e-7
prob.driver.options['tol'] = 1e-9
prob.driver.options['disp'] = True

model.add_design_var('r',lower=0.5,upper=1.5)
model.add_design_var('We/W0',lower=0.30,upper=0.70) # 30% - 70%, from lecture
model.add_constraint('weight.W0',lower = 1700,upper=2500)
model.add_constraint('FOM.FM',equals=0.8)
model.add_objective('FOM.PH')
model.add_design_var('We/W0',lower=0.50,upper=0.70) # 30% - 70%, from lecture
model.add_design_var('V',lower=67,upper=103)


model.add_constraint('FOM.FM',equals=0.80)
model.add_constraint('weight.W0',lower=1700,upper=2500)
model.add_constraint('FOM.PH',upper=500)
model.add_constraint('cruiseP.P_C',upper=90)
model.add_objective('range.R')

prob.setup()

# Initial Guesses
prob['We/W0'] = 0.60
prob['r'] = 1.5
prob['We/W0'] = 0.6
prob['r'] = 1
# guesses from CDR
#BASED ON INITIAL GUESS THE OPTIMZER MIGHT PICK A LOCAL MINIMA INSTEAD OF GLOBAL
prob['AR'] = 7
prob['S'] = 13.2
prob['V'] = 230
prob['Cd'] = 0.03
prob['Cl'] = 0.32
prob['V'] = 90
prob['Cd'] = 0.03 # not used for calculation but here to run
prob['Cl'] = 0.32 # not used for calculation but here to run
#prob['TS'] = 170



#prob.run_model()
prob.set_solver_print(level=0)
prob.run_driver()
print('Gross Weight Fraction:',prob['We/W0'])
print('Tip Speed',prob['TS'],'[m/s]')
print('Empty Weight Fraction:',prob['We/W0'])
print('Gross Weight:',prob['weight.W0'],'[kg]')
print('Figure of Merit:',prob['FOM.FM'])
print('Required Radius:',prob['FOM.r'],'[m]')
print('Required Power for Hover:',prob['FOM.PH'],'[kW]')
print('Required Power for Cruise:',prob['cruiseP.P_C'],'[kW]')
print('Range Not Using Reserve and battHealth :',prob['range.R'],'[km]')
print('Max Trip Range @',prob['V'],'[m/s]:',prob['range.R'],'[km]','Time',prob['range.t'],'[hr]')


0 comments on commit c756ed1

Please sign in to comment.