Skip to content
Merged

Prop #157

Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions gpkitmodels/GP/aircraft/prop/prop_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
" propelle tests "
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

from propeller import Propeller
from qprop import QProp
from gpkitmodels.GP.aircraft.wing.wing_test import FlightState

def eta_test():

Choose a reason for hiding this comment

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

Can this test be a unit test for the Propeller model?


fs = FlightState()
p = Propeller(fs)
Copy link
Contributor

Choose a reason for hiding this comment

The 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()

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

class Propeller(Model):
""" Propeller Model

Variables
---------
R 10 [m] prop radius
W 10 [lbf] prop weight

Choose a reason for hiding this comment

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

I don't like the propeller having a fixed weight. Does it add 10 lbs to the solar model too? I would probably leave it without weight variable for now. Maybe it can scale with radius?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed fixed weights are not correct, but I'm not sure the best simple weight model yet. I think we should leave it with a small weight value as a placeholder until we can implement a real weight model. This lets it be added to the aircraft.components list for integration into the overall model without adding an inaccurate weight estimate.


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

def performance(self,state):

Choose a reason for hiding this comment

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

Instead of declaring it as a model I would declare like:

"""
docstring
"""

performance = Propeller_Performance

def setup(self):
...

Also can we rename it from performance to flight_model so it's consistent with wing.py and the other GP models in this repo?

return Propeller_Performance(self, state)

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):
return 2. - 1./c[self.etaadd]

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

V = state.V
rho = state.rho
R = parent.R

constraints = [eta <= etav*etai,
Tc == T/(0.5*rho*V**2*pi*R**2),
z2 >= Tc + 1,
etai*(z1 + z2**0.5/etaadd) <= 2,
lam == V/(omega*R),
CT == Tc*lam**2,
CP == Q*omega/(.5*rho*(omega*R)**3*math.pi*R**2),
eta == CT*lam/CP, #Is this the same eta? check

Choose a reason for hiding this comment

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

Is this calculating the same eta? If not which equation is driving it and which is correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is for the motor weight estimate; it should be left off this pull request.

]
return constraints
58 changes: 58 additions & 0 deletions gpkitmodels/GP/aircraft/prop/qprop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
" qprop model "

Choose a reason for hiding this comment

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

Is this model done yet? If not let's leave it off of this PR

from numpy import pi
from gpkit import Model, parse_variables
from gpkit.constraints.tight import Tight as TCS
from gpfit.fit_constraintset import FitCS
import pandas as pd
from os.path import abspath

class QProp(Model):
""" Propeller Model

Variables
---------
T [N] thrust
B 2 [-] number of blades
r 0.5 [m] local radius
R 1 [m] propeller radius
dr 1 [m] local delta radius
Q [N*m] torque
G [m**2/s] prop circulation
Omega 1000 [rpm] rotation rate
eta [-] prop efficiency
W [m/s] local total velocity
Wa [m/s] axial local total velocity
Wt [m/s] tangential local total velocity
va [m/s] axial local rotor-induced velocity
vt [m/s] tangential local rotor-induced velocity
ep 0.1 [-] inverse local lift to drag
cl 1.0 [-] local coefficient of lift
c 0.1 [m] local blade chord
F 0.5 [-] Prandtl factor
lamw [-] local wake advance ratio
f [-] Prandtl exponent

"""

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

V = state.V
rho = state.rho

df = pd.read_csv(abspath("arccosfit.csv"))
fd = df.to_dict(orient="records")[0]

return [eta <= V*T/Omega/Q,
Q >= rho*B*G*(Wa + ep*Wt)*r*dr,
G >= 0.5*W*c*cl,
W**2 >= Wa**2 + Wt**2,
Wa >= V + va,
va >= vt*Wt/Wa,
Wt >= Omega*r,
# vt**2*(1 + (4*lamw*R/pi/B/r)**2) >= (B*G/4/pi/r/F)**2,
vt >= (B*G/4/pi/r/F),
# lamw >= r/R*(vt/va),
# f >= B/2*(0.5)*R/r*(va/vt),
# FitCS(fd, F, [f])
]