Skip to content

Commit

Permalink
Changes per review
Browse files Browse the repository at this point in the history
  • Loading branch information
courtin committed Apr 23, 2018
1 parent d3f83e2 commit 9b507d5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 36 deletions.
8 changes: 4 additions & 4 deletions gpkitmodels/GP/aircraft/motor/motor_test.py
@@ -1,7 +1,7 @@
from gpkit import Model, parse_variables, SignomialsEnabled, SignomialEquality, units
from motor import Propulsor, Motor, MotorPerf
from gpkitmodels.GP.aircraft.prop.propeller import Propeller, ActuatorProp
from gpkitmodels.SP.aircraft.prop.propeller import MultiElementProp
from gpkitmodels.SP.aircraft.prop.propeller import BladeElementProp
from gpkitmodels.GP.aircraft.wing.wing_test import FlightState

class Propulsor_Test(Model):
Expand Down Expand Up @@ -30,13 +30,13 @@ def setup(self):
self.cost = pp.motor.Pelec/(1000*units('W')) + p.W/(1000*units('lbf'))

return fs,p,pp
class MultiElement_Propulsor_Test(Model):
class BladeElement_Propulsor_Test(Model):
"""Propulsor Test Model w/ Blade Element Propeller
"""

def setup(self):
fs = FlightState()
Propulsor.prop_flight_model = MultiElementProp
Propulsor.prop_flight_model = BladeElementProp
p = Propulsor()
pp = p.flight_model(p,fs)
pp.substitutions[pp.prop.T] = 100
Expand All @@ -49,7 +49,7 @@ def actuator_propulsor_test():
test.solve()

def ME_propulsor_test():
test = MultiElement_Propulsor_Test()
test = BladeElement_Propulsor_Test()
sol = test.localsolve()

def propulsor_test():
Expand Down
4 changes: 2 additions & 2 deletions gpkitmodels/GP/aircraft/prop/prop_test.py
@@ -1,6 +1,6 @@
" propeller tests "
from gpkitmodels.GP.aircraft.prop.propeller import Propeller, ActuatorProp
from gpkitmodels.SP.aircraft.prop.propeller import MultiElementProp
from gpkitmodels.SP.aircraft.prop.propeller import BladeElementProp

from gpkitmodels.GP.aircraft.wing.wing_test import FlightState
from gpkit import units, Model
Expand All @@ -19,7 +19,7 @@ def simpleprop_test():
def ME_eta_test():

fs = FlightState()
Propeller.flight_model = MultiElementProp
Propeller.flight_model = BladeElementProp
p = Propeller()
pp = p.flight_model(p,fs)
pp.substitutions[pp.T] = 100
Expand Down
53 changes: 23 additions & 30 deletions gpkitmodels/SP/aircraft/prop/propeller.py
Expand Up @@ -8,7 +8,7 @@



class Blade_Element_Performance(Model):
class BladeElementPerf(Model):
""" Single element of a propeller blade
Variables
Expand All @@ -23,26 +23,26 @@ class Blade_Element_Performance(Model):
va [m/s] Axial induced velocity
vt [m/s] Tangential induced velocity
G [m^2/s] Circulation
cl [-] local lift coefficient
cl [-] local lift coefficient
cd [-] local drag coefficient
B 2 [-] number of blades
r [m] local radius
lam_w [-] advance ratio
eps [-] blade efficiency
AR_b [-] blade aspect ratio
AR_b [-] blade aspect ratio
AR_b_max 50 [-] max blade aspect ratio
Re [-] blade reynolds number
f [-] intermediate tip loss variable
F [-] Prandtl tip loss factor
cl_max .6 [-] max airfoil cl
cl_max .6 [-] max airfoil cl
dr [m] length of blade element
M [-] Mach number
a 295 [m/s] Speed of sound at altitude
"""

def setup(self,static, state):
exec parse_variables(Blade_Element_Performance.__doc__)
exec parse_variables(BladeElementPerf.__doc__)

V = state.V
rho = state.rho
Expand All @@ -55,7 +55,7 @@ def setup(self,static, state):
constraints = [TCS([Wa>=V + va]),
TCS([Wt + vt<=omega*r]),
TCS([G == (1./2.)*Wr*c*cl]),
F == (2./pi)*(1.01116*f**.0379556)**(1./.1), #This is the GP fit of arccos(exp(-f))
F == (2./pi)*(1.01116*f**.0379556)**(10), #This is the GP fit of arccos(exp(-f))
M == Wr/a,
lam_w == (r/R)*(Wa/Wt),
va == vt*(Wt/Wa),
Expand All @@ -65,27 +65,20 @@ def setup(self,static, state):
AR_b <= AR_b_max,
Re == Wr*c*rho/mu,
eta_i == (V/(omega*r))*(Wt/Wa),
TCS([f+(r/R)*B/(2*lam_w) <= (B/2.)*(1./lam_w)]),

TCS([f+(r/R)*B/(2*lam_w) <= (B/2.)*(1./lam_w)]),
XfoilFit(fd, cd, [cl,Re], name="polar"),

cl <= cl_max
]
with SignomialsEnabled():
constraints += [SignomialEquality(Wr**2,(Wa**2+Wt**2)),

TCS([dT <= rho*B*G*(Wt-eps*Wa)*dr]),
#SignomialEquality(vt**2*F**2*(1.+(4.*lam_w*R/(pi*B*r))**2),(B*G/(4.*pi*r))**2),
TCS([vt**2*F**2*(1.+(4.*lam_w*R/(pi*B*r))**2)>=(B*G/(4.*pi*r))**2]),
#SignomialEquality(f+(r/R)*B/(2*lam_w),(B/2.)*(1./lam_w))


TCS([vt**2*F**2*(1.+(4.*lam_w*R/(pi*B*r))**2) >= (B*G/(4.*pi*r))**2]),
]
return constraints, state



class MultiElementProp(Model):
class BladeElementProp(Model):
""" Performance for a propeller with multiple elements
Variables
Expand All @@ -98,30 +91,30 @@ class MultiElementProp(Model):
Q [N*m] total torque
"""
def setup(self,static, state, N = 5):
exec parse_variables(MultiElementProp.__doc__)
exec parse_variables(BladeElementProp.__doc__)

with Vectorize(N):
blade = Blade_Element_Performance(static, state)
blade = BladeElementPerf(static, state)


constraints = [blade.dr == static.R/(N),
blade.omega == omega,
blade.r[0] == static.R/(2.*N)]


with SignomialsEnabled():
for n in range(1,N):
constraints += [TCS([blade.r[n] >= blade.r[n-1] + static.R/N]),
blade.eta_i[n] == blade.eta_i[n-1],
]
constraints += [TCS([T <= sum(blade.dT)]),
TCS([Q >= sum(blade.dQ)]),
eta == state.V*T/(omega*Q),
blade.M[-1] <= Mtip,
static.T_m>=T,
omega <= omega_max
for n in range(1,N):
constraints += [TCS([blade.r[n] >= blade.r[n-1] + static.R/N]),
blade.eta_i[n] == blade.eta_i[n-1],
]

constraints += [TCS([Q >= sum(blade.dQ)]),
eta == state.V*T/(omega*Q),
blade.M[-1] <= Mtip,
static.T_m >= T,
omega <= omega_max
]

with SignomialsEnabled():
constraints += [TCS([T <= sum(blade.dT)])]

return constraints, blade

0 comments on commit 9b507d5

Please sign in to comment.