From 9b507d5509d0e6995f016cde4963874c847983c2 Mon Sep 17 00:00:00 2001 From: Chris Courtin Date: Mon, 23 Apr 2018 12:48:46 -0400 Subject: [PATCH] Changes per review --- gpkitmodels/GP/aircraft/motor/motor_test.py | 8 ++-- gpkitmodels/GP/aircraft/prop/prop_test.py | 4 +- gpkitmodels/SP/aircraft/prop/propeller.py | 53 +++++++++------------ 3 files changed, 29 insertions(+), 36 deletions(-) diff --git a/gpkitmodels/GP/aircraft/motor/motor_test.py b/gpkitmodels/GP/aircraft/motor/motor_test.py index b7097c45..c077ab2f 100644 --- a/gpkitmodels/GP/aircraft/motor/motor_test.py +++ b/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): @@ -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 @@ -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(): diff --git a/gpkitmodels/GP/aircraft/prop/prop_test.py b/gpkitmodels/GP/aircraft/prop/prop_test.py index 763ea5a8..7ee5a55e 100644 --- a/gpkitmodels/GP/aircraft/prop/prop_test.py +++ b/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 @@ -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 diff --git a/gpkitmodels/SP/aircraft/prop/propeller.py b/gpkitmodels/SP/aircraft/prop/propeller.py index 40775108..9f3ab172 100644 --- a/gpkitmodels/SP/aircraft/prop/propeller.py +++ b/gpkitmodels/SP/aircraft/prop/propeller.py @@ -8,7 +8,7 @@ -class Blade_Element_Performance(Model): +class BladeElementPerf(Model): """ Single element of a propeller blade Variables @@ -23,18 +23,18 @@ 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 @@ -42,7 +42,7 @@ class Blade_Element_Performance(Model): """ def setup(self,static, state): - exec parse_variables(Blade_Element_Performance.__doc__) + exec parse_variables(BladeElementPerf.__doc__) V = state.V rho = state.rho @@ -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), @@ -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 @@ -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