-
Notifications
You must be signed in to change notification settings - Fork 11
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
Prop #157
Changes from 14 commits
ca4d658
875e650
a06db84
f30e2ea
129cd22
eb7c39d
9bfa23c
4d2da32
3b2c57b
1840d3e
195883c
602606f
0b3c8ae
c47db82
05cbb85
210802e
db5e4cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
" propelle tests " | ||
from propeller import Propeller | ||
#from qprop import QProp | ||
from gpkitmodels.GP.aircraft.wing.wing_test import FlightState | ||
|
||
def eta_test(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this test be a unit test for the |
||
|
||
fs = FlightState() | ||
p = Propeller(fs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. propeller does not accept flight state as an argument |
||
p.substitutions[p.T] = 100 | ||
p.cost = 1/p.eta | ||
sol = p.solve() | ||
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" | ||
eta_test() | ||
#qprop_test() | ||
|
||
if __name__ == "__main__": | ||
test() | ||
|
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 | ||
|
||
""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 10 [m] prop radius | ||
|
||
""" | ||
#TODO add weight model | ||
flight_model = Propeller_Performance | ||
|
||
def setup(self): | ||
exec parse_variables(Propeller.__doc__) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo