Skip to content

Commit

Permalink
Deleted simpleqprop model; isolating bug in multiElementProp
Browse files Browse the repository at this point in the history
  • Loading branch information
courtin committed Apr 18, 2018
1 parent 7e2e065 commit 75fdda1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 148 deletions.
22 changes: 0 additions & 22 deletions gpkitmodels/GP/aircraft/motor/motor_test.py
Expand Up @@ -31,20 +31,7 @@ def setup(self):
self.cost = pp.motor.Pelec/(1000*units('W')) + p.W/(1000*units('lbf'))

return fs,p,pp
class SimpleQprop_Propulsor_Test(Model):
"""Propulsor Test Model
"""

def setup(self):
fs = FlightState()
Propulsor.prop_flight_model = SimpleQProp
p = Propulsor()
pp = p.flight_model(p,fs)
pp.substitutions[pp.prop.T] = 100
#pp.substitutions[pp.prop.AR_b] = 15
self.cost = pp.motor.Pelec/(1000*units('W')) + p.W/(1000*units('lbf'))

return fs,p,pp

class MultiElement_Propulsor_Test(Model):
"""Propulsor Test Model
Expand All @@ -69,14 +56,6 @@ def actuator_propulsor_test():
#sol = test.solve()
#print sol.table()

def simpleQprop_propulsor_test():

test = SimpleQprop_Propulsor_Test()
#sol = test.debug()
sol = test.localsolve()
#sol = test.solve()
#print sol.table()

def ME_propulsor_test():
print "Blade Element Model Test"
test = MultiElement_Propulsor_Test()
Expand Down Expand Up @@ -139,7 +118,6 @@ def test():
motor_test()
actuator_propulsor_test()
propulsor_test()
simpleQprop_propulsor_test()
ME_propulsor_test()

if __name__ == "__main__":
Expand Down
25 changes: 1 addition & 24 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.GP.aircraft.prop.propeller import SimpleQProp, MultiElementProp
from gpkitmodels.GP.aircraft.prop.propeller import MultiElementProp

from gpkitmodels.GP.aircraft.wing.wing_test import FlightState
from gpkit import units, Model
Expand All @@ -17,20 +17,6 @@ def simpleprop_test():
sol = m.solve()
#print sol.table()

def OE_eta_test():
" simple qprop test "

fs = FlightState()
Propeller.flight_model = SimpleQProp
p = Propeller()
pp = p.flight_model(p, fs)
pp.substitutions[pp.T] = 100
pp.substitutions[pp.AR_b] = 12
m = Model(1/pp.eta + pp.Q/(10.*units("N*m"))+ p.W/(100.*units("lbf")),
[pp, p])
#m.debug()
sol = m.localsolve()
#print sol.table()

def ME_eta_test():

Expand All @@ -50,18 +36,9 @@ def ME_eta_test():
sol = pp.localsolve(iteration_limit = 400)
print sol.table()

#def qprop_test():
#
# fs = FlightState()
# p = QProp(fs)
# p.substitutions[p.T] = 100
# p.cost = 1/p.eta
# sol = p.solve()
# print sol.table()

def test():
"tests"
#OE_eta_test()
#simpleprop_test()
ME_eta_test()
if __name__ == "__main__":
Expand Down
112 changes: 10 additions & 102 deletions gpkitmodels/GP/aircraft/prop/propeller.py
Expand Up @@ -70,7 +70,6 @@ class Blade_Element_Performance(Model):
va [m/s] Axial induced velocity
vt [m/s] Tangential induced velocity
G [m^2/s] Circulation
c [m] local chord
cl [-] local lift coefficient
cd [-] local drag coefficient
cdp [-] local drag coefficient
Expand Down Expand Up @@ -104,7 +103,7 @@ def setup(self,static, state):
path = os.path.dirname(__file__)
fd = pd.read_csv(path + os.sep + "dae51_fitdata.csv").to_dict(
orient="records")[0]

c = static.c
constraints = [TCS([Wa>=V + va]),
TCS([Wt + vt<=omega*r]),
TCS([G == (1./2.)*Wr*c*cl]),
Expand Down Expand Up @@ -149,8 +148,8 @@ class MultiElementProp(Model):
---------
Mtip .5 [-] tip mach number
"""
def setup(self,static, state, N = 4):
#exec parse_variables(Multi_Element_Propeller_Performance.__doc__)
def setup(self,static, state, N = 5):
#exec parse_variables(MultiElementProp.__doc__)
T = self.T = Variable('T', 'lbf', 'Overall thrust')
Q = self.Q = Variable('Q', 'N*m', 'Overall torque')
eta = self.eta = Variable('eta', '-', 'Overall efficiency')
Expand All @@ -167,11 +166,13 @@ def setup(self,static, state, N = 4):


with SignomialsEnabled():
# constraints = [blade.r <= static.R]
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]
blade["eta_i"][n] == blade["eta_i"][n-1],
#blade["c"][n] == static["c"][n],
]
constraints += [TCS([T <= sum(blade["dT"][n] for n in range(N))]),
constraints += [TCS([T <= sum(blade["dT"])]),
TCS([Q >= sum(blade["dQ"][n] for n in range(N))]),
eta == state.V*T/(omega*Q),
blade["M"][-1] <= Mtip,
Expand All @@ -180,101 +181,8 @@ def setup(self,static, state, N = 4):
]


return constraints, blade


class SimpleQProp(Model):
""" Propeller Model
return constraints, blade

Variables
---------
T [lbf] thrust
etaadd 0.7 [-] swirl and nonuniformity losses
etap [-] viscous losses
etai [-] inviscid losses
eta [-] overall efficiency
Q [N*m] torque
omega [rpm] propeller rotation rate
omega_max 10000 [rpm] max rotation rate
P_shaft [kW] shaft power
M_tip .5 [-] Tip mach number
a 295 [m/s] Speed of sound at altitude
Wa [m/s] Axial total relative velocity
Wt [m/s] Tangential total relative velocity
Wr [m/s] Total relative velocity
va [m/s] Axial induced velocity
vt [m/s] Tangential induced velocity
G [m^2/s] Circulation
c [m] local chord
cl .4 [-] 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_max 18 [-] max blade aspect ratio
Ut [m/s] tangential freestreem
Re [-] blade reynolds number
f [-] intermediate tip loss variable
F [-] Prandtl tip loss factor
cl_max 1.3 [-] max airfoil cl
eta_check [-] efficiency check
"""

def helper(self, c):
return 2. - 1./c[self.etaadd]

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

V = state.V
rho = state.rho
R = static.R
mu = state.mu
path = os.path.dirname(__file__)
fd = pd.read_csv(path + os.sep + "dae51_fitdata.csv").to_dict(
orient="records")[0]

constraints = [TCS([eta <= etap*etai]),
omega <= omega_max,
P_shaft == Q*omega,
Ut == omega*r,
TCS([G == (1./2.)*Wr*c*cl]),
r == .8*R, #Assume 80% chord is representative
f == (B/2.)*.2*(1./lam_w), #.2 = 1-.8 = 1-r/R
F == (2./pi)*(1.02232*f**.0458729)**(1./.1), #This is the GP fit of arccos(exp(-f))
lam_w == (r/R)*(Wa/Wt),
va == vt*(Wt/Wa),
eps == cd/cl,
TCS([1 >= etai*(1+va/V)+vt/Ut]),
TCS([1 >= etap*(1+eps*Wt/Wa)+eps*Wt/Wa]),
TCS([Q >= rho*B*G*(Wa+eps*Wt)*R**2]),

TCS([(M_tip*a)**2 >= Wa**2 + Wt**2]),
AR_b == R/c,
AR_b <= AR_b_max,
Re == Wr*c*rho/mu,
eta == T*V/(Q*omega),
XfoilFit(fd, cd, [cl,Re], name="polar"),
static.T_m >= T,
cl <= cl_max
]
with SignomialsEnabled():
constraints += [TCS([Wa>=V + va]),
SignomialEquality(Wr**2,(Wa**2+Wt**2)),
#SignomialEquality(Wa,V+va),
SignomialEquality(Wt,omega*r-vt),
#TCS([Wt>=omega*r-vt]),
TCS([T <= rho*B*G*(Wt-eps*Wa)*R]),
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(1,etap*(1+eps*Wt/Wa)+eps*Wa/Wt),
#SignomialEquality(1,etai*(1+va/V)+vt/Ut),
#SignomialEquality(Q,rho*B*G*(Wa+eps*Wt)*R**2),
#SignomialEquality(T,rho*B*G*(Wt-eps*Wa)*R),
]
return constraints, state

class Propeller(Model):
""" Propeller Model
Expand All @@ -291,9 +199,9 @@ class Propeller(Model):
c [ft] prop chord
"""

flight_model = SimpleQProp
flight_model = MultiElementProp

def setup(self, N = 1):
def setup(self, N = 5):
exec parse_variables(Propeller.__doc__)
self.N = N
return [W >= K*T_m*R**2]
Expand Down

0 comments on commit 75fdda1

Please sign in to comment.