Skip to content

Commit

Permalink
Made it work with emptyweight calc
Browse files Browse the repository at this point in the history
  • Loading branch information
FernCarrera committed May 31, 2019
1 parent b964372 commit 74fb904
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
Binary file modified Model/Propulsion/__pycache__/power_comp.cpython-36.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions Model/Propulsion/cruise_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ def setup(self):

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

self.declare_partials(of='*', wrt='*', method='fd')
self.declare_partials(of='*', wrt='*', method='cs')



def compute(self,inputs,outputs):
W = inputs['W']*9.81
W = inputs['W']*9.81
# 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
Expand Down
Binary file modified Model/Weight/__pycache__/gross_weight_comp.cpython-36.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions Model/Weight/gross_weight_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def setup(self):
self.add_input('We',desc='empty weight')
self.add_output('W0') # gross weight
self.add_output('We_W0') # gross weight
self.add_output('Wb_W0') # gross weight

self.declare_partials('*', '*')
self.declare_partials(of='*', wrt='*', method='cs')

Expand All @@ -22,6 +24,7 @@ def compute(self, inputs, outputs):
#We_W0 = inputs['We']/inputs['W0']
W0 = (Wp + Wb + We)
outputs['We_W0'] = We/W0
outputs['Wb_W0'] = Wb/W0
outputs['W0'] = W0

#def compute_partials(self, inputs, partials):
Expand Down
21 changes: 13 additions & 8 deletions solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

ivc = model.add_subsystem('ivc',IndepVarComp(),promotes_outputs = ['*'])

ivc.add_output('Wb') #[kg], battery weight
ivc.add_output('Wb',val=600) #[kg], battery weight
ivc.add_output('Wp',val=454) #[kg], weight of passangers
#ivc.add_output('We_W0') # empty to gross fraction

Expand Down Expand Up @@ -97,23 +97,27 @@
prob.driver.options['tol'] = 1e-9
prob.driver.options['disp'] = True

model.add_design_var('r',lower=0.7,upper=1.5)
model.add_design_var('r',lower=0.7,upper=1)
model.add_design_var('V',lower=67,upper=103)
model.add_design_var('Wb',lower=600,upper=750) # proff sees typical of 20% gross weight
model.add_design_var('Wb') # proff sees typical of 20-25% gross weight

#model.add_constraint('weight.We_W0',lower=0.45,upper=0.70) # 30% - 70%, from lecture
model.add_constraint('weight.W0',lower=1700,upper=2000)
#model.add_constraint('weight.W0',lower=1700,upper=2000)
model.add_constraint('FOM.FM',lower=0.70,upper=0.80)
#model.add_constraint('FOM.PH',upper=500)
#model.add_constraint('cruiseP.P_C',upper=90)
#model.add_constraint('range.R',equals=200)
model.add_objective('rho')

model.add_constraint('range.R',equals=340)
model.add_constraint('weight.Wb_W0',lower=0.25,upper=0.30) # batt to gross
#model.add_constraint('FOM.PH',upper=550)
model.add_constraint('cruiseP.P_C',upper=100)

model.add_objective('FOM.PH',scaler=-1)

prob.setup()

# Initial Guesses
#prob['We/W0'] = 0.6
prob['r'] = 0.7
prob['V'] = 80


#opt driver
Expand All @@ -128,6 +132,7 @@
print('Batt Weight',prob['Wb'])
print('Tip Speed',prob['TS'],'[m/s]')
print('Empty Weight Fraction:',prob['weight.We_W0'])
print('Battery Weight Fraction:',prob['weight.Wb_W0'])
print('Empty Weight',prob['emptyW.We'])
print('Gross Weight:',prob['weight.W0'],'[kg]')
print('Figure of Merit:',prob['FOM.FM'])
Expand Down

0 comments on commit 74fb904

Please sign in to comment.