Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prop #157

Merged
merged 17 commits into from
Apr 3, 2018
1 change: 1 addition & 0 deletions TESTS
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
gpkitmodels/GP/aircraft/wing/wing_test.py
gpkitmodels/GP/aircraft/tail/tail_tests.py
gpkitmodels/GP/aircraft/fuselage/test_fuselage.py
gpkitmodels/GP/aircraft/prop/prop_test.py
Empty file.
21 changes: 21 additions & 0 deletions gpkitmodels/GP/aircraft/prop/prop_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
" propeller tests "
from gpkitmodels.GP.aircraft.prop.propeller import Propeller
from gpkitmodels.GP.aircraft.wing.wing_test import FlightState
from gpkit import Model

def simpleprop_test():
" test simple propeller model "
fs = FlightState()
p = Propeller()
pp = p.flight_model(p, fs)
m = Model(1/pp.eta, [fs, p, pp])
m.substitutions.update({"rho": 1.225, "V": 50, "T": 100})
m.solve()

def test():
"tests"
simpleprop_test()

if __name__ == "__main__":
test()

56 changes: 56 additions & 0 deletions gpkitmodels/GP/aircraft/prop/propeller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
" propeller model "
from numpy import pi
from gpkit import Model, parse_variables

class Propeller_Performance(Model):
""" Propeller Model

Variables
---------
T [N] thrust
Tc [-] coefficient of thrust
etaadd 0.7 [-] swirl and nonuniformity losses
etav 0.85 [-] viscous losses
etai [-] inviscid losses
eta [-] overall efficiency
z1 self.helper [-] efficiency helper 1
z2 [-] efficiency helper 2
lam [-] advance ratio
CT [-] thrust coefficient
CP [-] power coefficient
Q [N*m] torque
omega [rpm] propeller rotation rate

"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be great to have bounds as well!


def helper(self, c):
" helper function to avoid signomial constraint "
return 2. - 1./c[self.etaadd]

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

V = state.V
rho = state.rho
R = static.R

return [eta <= etav*etai,
Tc == T/(0.5*rho*V**2*pi*R**2),
z2 >= Tc + 1,
etai*(z1 + z2**0.5/etaadd) <= 2,
], static

class Propeller(Model):
""" Propeller Model

Variables
---------
R 1 [m] prop radius

"""
#TODO add weight model
flight_model = Propeller_Performance

def setup(self):
exec parse_variables(Propeller.__doc__)

6 changes: 3 additions & 3 deletions gpkitmodels/GP/aircraft/wing/wing.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class Planform(Model):
deta self.return_deta [-] \\Delta (2y/b)

Upper Unbounded
--------------- # bounding any pair of planform variables will work
cmac, b, tau
--------------- # bounding any pair of variables will work
cave, b, tau

Lower Unbounded
---------------
cmac, b, tau
cave, b, tau

LaTex Strings
-------------
Expand Down