Skip to content

Commit

Permalink
dank dank
Browse files Browse the repository at this point in the history
  • Loading branch information
FernCarrera committed Jun 2, 2019
1 parent 2676b20 commit 9690e9c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Model/Propulsion/power_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def compute(self, inputs, outputs):
ct = T/( rho *S* (tip_speed**2) )
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)
PH = cp*rho*S*(tip_speed**3)*.99
FM = PI/PH

outputs['FM'] = FM
Expand Down
Binary file modified Model/Weight/__pycache__/weight_buildup_comp.cpython-36.pyc
Binary file not shown.
4 changes: 3 additions & 1 deletion Model/Weight/gross_weight_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ class GrossWeightComp(ExplicitComponent):
def setup(self):
self.add_input('Wp') # weight of payload (passangers)
self.add_input('Wb') # weight of battery
self.add_input('S',desc='lifting surface')
#self.add_input('We/W0') # empty over gross
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.add_output('W_S')
self.declare_partials('*', '*')
self.declare_partials(of='*', wrt='*', method='cs')

Expand All @@ -26,6 +27,7 @@ def compute(self, inputs, outputs):
outputs['We_W0'] = We/W0
outputs['Wb_W0'] = Wb/W0
outputs['W0'] = W0
outputs['W_S'] = W0/inputs['S']

#def compute_partials(self, inputs, partials):
#Wp = inputs['Wp']
Expand Down
8 changes: 4 additions & 4 deletions Model/Weight/weight_buildup_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def compute(self, inputs, outputs):
Sf = 362.744 # fuselage wetted area
Sw = 142.233 # trapezoidal wing area
Wdg = inputs['W0']*2.2046 # gross weight
Wen = 110 # engine weight each [lb]
Wen = 105 # engine weight each [lb]
Wl = Wdg # langing gross weight
#Wuav = 800 # usual 800-1400
M = V/1116.13 # mach
Expand All @@ -45,7 +45,7 @@ def compute(self, inputs, outputs):
# fuselage
W_f = 0.052*(Sf**1.086)*((Nz*Wdg)**0.22)*(L_f**(-0.051))*((L_D)**(-0.072))*(q**0.241)
# landing gear
W_lg = 0.095*((Nl*Wl)**0.768)*((Lm/12)**0.845)
W_lg = (0.095*((Nl*Wl)**0.768)*((Lm/12)**0.845))*0.70
# installed engine
W_ie = 2.575*(Wen**0.922)*(Neg)
# flight controls
Expand All @@ -57,14 +57,14 @@ def compute(self, inputs, outputs):
# electrical
W_el = 12.57*(W_av)**0.51
# air conditioning
W_ac = 0.265*Wdg**0.52*Np**0.68*W_av**0.17*M**0.08
W_ac = (0.265*Wdg**0.52*Np**0.68*W_av**0.17*M**0.08)*0.85
# furnishings
W_fur = 0.0582*Wdg - 65
# actuators
# 12 actuators, 0.65 kg each
W_act = 12*1.43

We = 0.8*(W_w + W_f + W_lg + W_ie + W_fc + W_h + W_av + W_el + W_ac + W_fur + W_act)/2.205
We = (W_w + W_f + W_lg + W_ie + W_fc + W_h + W_av + W_el + W_ac + W_fur + W_act)/2.205
#print('weight',We)
outputs['We'] = We # outputs kg

Expand Down
32 changes: 17 additions & 15 deletions solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
model.connect('Wb','weight.Wb')
model.connect('Wp','weight.Wp')
model.connect('emptyW.We','weight.We')
model.connect('S','weight.S')
#model.connect('We/W0','weight.We/W0')

# connecting to empty weight comp
Expand Down Expand Up @@ -109,26 +110,29 @@


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

model.add_design_var('r',lower=0.7,upper=1)
#opt driver
#prob.driver = pyOptSparseDriver()
#prob.driver.options['optimizer'] = "SLSQP"
#prob.driver.hist_file = 'host.hst'


model.add_design_var('r',lower=0.7,upper=1.2)
model.add_design_var('V',lower=67,upper=103)
model.add_design_var('Wb') # proff sees typical of 20-25% gross weight
#model.add_design_var('S',lower=10,upper=20)

#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('FOM.FM',lower=0.70,upper=0.80)

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=80)
#model.add_constraint('cruiseP.cl',upper=0.4)
model.add_constraint('range.R',equals=245)
model.add_constraint('weight.Wb_W0',lower=0.20,upper=0.30) # batt to gross
#model.add_constraint('cruiseP.cl',upper=0.5)
#model.add_constraint('weight.W_S',upper = 1327)
#model.add_constraint('cruiseP.P_C',upper=110)
model.add_objective('cost.Cost',scaler=-1)

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

prob.setup()

Expand All @@ -138,15 +142,13 @@
prob['V'] = 80


#opt driver
#prob.driver = pyOptSparceDriver()
#prob.driver.options['optimizer'] = "SLSQP"
#prob.driver.hist_file = 'host.hst'


#prob.run_model()
prob.set_solver_print(level=0)
prob.run_driver()
print('S',prob['S'])
print('W_S',prob['weight.W_S'])
print('Batt Weight',prob['Wb'])
print('Tip Speed',prob['TS'],'[m/s]')
print('Empty Weight Fraction:',prob['weight.We_W0'])
Expand Down

0 comments on commit 9690e9c

Please sign in to comment.