Skip to content

Commit

Permalink
Trying stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
FernCarrera committed May 31, 2019
1 parent 74fb904 commit 27ad916
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 165 deletions.
6 changes: 5 additions & 1 deletion Model/Propulsion/cruise_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def setup(self):
self.add_input('cd0',desc='zero lift drag')

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

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


Expand All @@ -25,7 +26,10 @@ def compute(self,inputs,outputs):
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
cd = inputs['cd0'] + k*cl**2
outputs['cl'] = cl
outputs['cd'] = cd
#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
50 changes: 30 additions & 20 deletions Model/costanalysis/OperatingCost.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,38 @@

#def operatingCost2( r_prop, cruise_speed, avg_dist, shaft_power, mass_struct, mass_batt, mass_motor, b_ref, cRef, power_to_weight ):
# function inputs
r_prop = 1
cruise_speed = 102.82
avg_dist = 193121
shaft_power = 156
mass_struct = 180
mass_batt = 627.66
mass_motor = 635.8
b_ref = 13.21
c_ref = 1
power_to_weight = 0.22

c_ref = 1 #m

from costanalysis.CostBuildup import CostBuildup
from openmdao.api import ExplicitComponent

class OperatingCost(ExplicitComponent):
def setup(self):
self.add_input('r_prop',desc = 'prop radius')
self.add_input('cruise_speed',desc = 'cruise speed')
self.add_input('avg_dist',desc = 'range')
self.add_input('shaft_power',desc = 'shaft power')
self.add_input('mass_struct',desc = 'structural mass')
self.add_input('mass_batt',desc = 'battery mass')
self.add_input('mass_motor',desc = 'motor mass')
self.add_input('b_ref',desc = 'span')
self.add_input('power_to_weight',desc = 'power to weight ratio')

self.add_output('Cost_per_flight',desc = 'cost per flight')

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

def compute(self,inputs,outputs):
avg_dist = inputs['avg_dist']
cruise_speed = inputs['cruise_speed']
# Assumptions
flight_hours_per_year = 600
flight_time = avg_dist/cruise_speed
flights_per_year = flight_hours_per_year / (flight_time / 3600)
vehicle_life_years = 10
n_vehicles_per_facility = 200

# Assumptions
flight_hours_per_year = 600
flight_time = avg_dist/cruise_speed
flights_per_year = flight_hours_per_year / (flight_time / 3600)
vehicle_life_years = 10
n_vehicles_per_facility = 200


# def CostBuildup( r_prop,c_ref, b_ref ):
Expand Down Expand Up @@ -156,7 +169,4 @@
servo_repl_cost_per_flight + labor_cost_per_flight

print('Cost Per Flight: $', cost_per_flight*1000)
# return [C]



# return [C]
81 changes: 0 additions & 81 deletions Model/costanalysis/costanalysis/CostBuildup.py

This file was deleted.

62 changes: 0 additions & 62 deletions Model/costanalysis/costanalysis/ToolingCost.py

This file was deleted.

Binary file not shown.
Binary file not shown.
4 changes: 3 additions & 1 deletion solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
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_constraint('cruiseP.cl',upper=0.4)

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

Expand Down Expand Up @@ -140,5 +141,6 @@
print('Required Power for Hover:',prob['FOM.PH'],'[kW]')
print('Required Power for Cruise:',prob['cruiseP.P_C'],'[kW]')
print('Max Trip Range @',prob['V'],'[m/s]:',prob['range.R'],'[km]','Time',prob['range.t'],'[hr]')

print('cl',prob['cruiseP.cl'])
print('cd',prob['cruiseP.cd'])

0 comments on commit 27ad916

Please sign in to comment.