Skip to content

Commit

Permalink
Multiple blade element model (#165)
Browse files Browse the repository at this point in the history
* Name change; can call multi element prop by changing propeller flight model

* Added multielement propulsor to weight tests

* Minor edits

* solar integration edits

* minor updates

* Changed Kv to bounded variable instead of fixed

* fixed T_m constraint error in prop_tests

* Deleted simpleqprop model; isolating bug in multiElementProp

* Deliberately causing error

* Minor update to GPfit

* edits to gpfit

* added __init.py__ to motor

* updates to tests

* fixed motor docstring

* updates to test

* Fixed merge conflicts

* Added fitdata back in

* Added polar creation files

* changed to dot notation

* Tweaked test weights

* Moved SP propeller models to SP folder

* added new SP propeller files

* add csv to prop folder in setup

* Changes per review

* Added SP .csv to setup
  • Loading branch information
courtin committed Apr 23, 2018
1 parent 3a49468 commit 89f6f8f
Show file tree
Hide file tree
Showing 14 changed files with 2,297 additions and 19 deletions.
10 changes: 7 additions & 3 deletions gpkitmodels/GP/aircraft/motor/motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class MotorPerf(Model):
i [amps] current
v [V] woltage
i0 4.5 [amps] zero-load current
Kv 29 [rpm/V] motor voltage constant
Kv_min 1 [rpm/V] min motor voltage constant
Kv_max 1000 [rpm/V] max motor voltage constant
Kv [rpm/V] motor voltage constant
R .033 [ohms] internal resistance
"""
def setup(self, static, state):
Expand All @@ -29,15 +31,17 @@ def setup(self, static, state):
static.Qmax >= Q,
v <= static.V_max,
TCS([i >= Q*Kv+i0]),
TCS([v >= omega/Kv + i*R])
TCS([v >= omega/Kv + i*R]),
Kv >= Kv_min,
Kv <= Kv_max
]

class Motor(Model):
""" Electric Motor Model
Variables
---------
Qstar .5 [kg/(N*m)] motor specific torque
Qstar .8 [kg/(N*m)] motor specific torque
W [lbf] motor weight
Qmax [N*m] motor max. torque
V_max 300 [V] motor max voltage
Expand Down
26 changes: 19 additions & 7 deletions gpkitmodels/GP/aircraft/motor/motor_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +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 BladeElementProp
from gpkitmodels.GP.aircraft.wing.wing_test import FlightState

class Propulsor_Test(Model):
Expand All @@ -17,7 +18,7 @@ def setup(self):
return fs,p,pp

class Actuator_Propulsor_Test(Model):
"""Propulsor Test Model
"""Propulsor Test Model w/ Actuator Disk Propeller
"""

def setup(self):
Expand All @@ -29,20 +30,31 @@ def setup(self):
self.cost = pp.motor.Pelec/(1000*units('W')) + p.W/(1000*units('lbf'))

return fs,p,pp
class BladeElement_Propulsor_Test(Model):
"""Propulsor Test Model w/ Blade Element Propeller
"""

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

return fs,p,pp

def actuator_propulsor_test():

test = Actuator_Propulsor_Test()
test.solve()



def ME_propulsor_test():
test = BladeElement_Propulsor_Test()
sol = test.localsolve()

def propulsor_test():

test = Propulsor_Test()
test.solve()
sol = test.solve()

class Motor_P_Test(Model):
def setup(self):
Expand Down Expand Up @@ -89,7 +101,7 @@ def test():
motor_test()
actuator_propulsor_test()
propulsor_test()

ME_propulsor_test()

if __name__ == "__main__":
test()
13 changes: 13 additions & 0 deletions gpkitmodels/GP/aircraft/prop/arccos_fit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import unittest
from numpy import log, exp, log10, vstack
from numpy import arccos,arange
from gpfit.fit import fit
from numpy.random import random_sample
i = arange(0.0001,3,.001)
j = arccos(exp(-i))
x = log(i)
y = log(j)
K = 1

cstrt, rmsErr = fit(x,y,K,"SMA")
print rmsErr
14 changes: 12 additions & 2 deletions gpkitmodels/GP/aircraft/prop/prop_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
" propeller tests "
from gpkitmodels.GP.aircraft.prop.propeller import Propeller, ActuatorProp

from gpkitmodels.SP.aircraft.prop.propeller import BladeElementProp

from gpkitmodels.GP.aircraft.wing.wing_test import FlightState
from gpkit import units, Model
Expand All @@ -15,12 +15,22 @@ def simpleprop_test():
[fs, p, pp])
m.substitutions.update({"rho": 1.225, "V": 50, "T": 100, "omega":1000})
m.solve()


def ME_eta_test():

fs = FlightState()
Propeller.flight_model = BladeElementProp
p = Propeller()
pp = p.flight_model(p,fs)
pp.substitutions[pp.T] = 100
pp.cost = 1./pp.eta + pp.Q/(1000.*units("N*m")) + p.T_m/(1000*units('N'))
sol = pp.localsolve(iteration_limit = 400)


def test():
"tests"
simpleprop_test()
ME_eta_test()
if __name__ == "__main__":
test()

9 changes: 2 additions & 7 deletions gpkitmodels/GP/aircraft/prop/propeller.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def setup(self, static, state):
return constraints



class Propeller(Model):
""" Propeller Model
Expand All @@ -74,11 +73,7 @@ class Propeller(Model):

flight_model = ActuatorProp

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]




Empty file.
2 changes: 2 additions & 0 deletions gpkitmodels/SP/aircraft/prop/dae51_fitdata.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lb1,lb0,ub0,d,e11,e10,K,e21,e20,e00,e01,a1,ftype,max_err,c2,c1,c0,rms_err,ub1
50000.00000000001,0.4742,1.4495,2,-0.8108155563264187,6.320590230366453,3,-2.8766519103828543,42.173818269878126,-0.7631609541518628,-5.0062373433526455,6.153287557875197,SMA,0.32163665175749223,2.655008812201457,8.068321204642572e-09,309019700605405.5,0.09733995717389085,700000.0000000002
83 changes: 83 additions & 0 deletions gpkitmodels/SP/aircraft/prop/dae51polars/dae51.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
DAE 51
# Daedalus propeller airfoil
1.000000 -0.000051
0.989166 0.001996
0.975819 0.004501
0.957448 0.007991
0.931599 0.013004
0.901654 0.018957
0.870818 0.025167
0.839998 0.031363
0.809336 0.037430
0.778839 0.043301
0.748503 0.048933
0.718326 0.054243
0.688314 0.059175
0.658443 0.063716
0.628653 0.067839
0.598855 0.071530
0.569004 0.074792
0.539074 0.077652
0.509071 0.080095
0.479015 0.082100
0.448934 0.083641
0.418877 0.084690
0.388863 0.085217
0.358908 0.085197
0.329049 0.084600
0.299321 0.083399
0.269760 0.081570
0.240419 0.079081
0.211388 0.075895
0.182766 0.071967
0.154699 0.067243
0.127404 0.061670
0.101193 0.055204
0.076503 0.047832
0.054060 0.039675
0.034881 0.031085
0.020059 0.022737
0.010052 0.015405
0.004208 0.009557
0.001251 0.005050
0.000113 0.001479
0.000123 -0.001494
0.001002 -0.004085
0.002793 -0.006422
0.006019 -0.008524
0.011960 -0.010609
0.022698 -0.012727
0.040333 -0.014554
0.064233 -0.015717
0.091882 -0.016173
0.121305 -0.016067
0.151560 -0.015570
0.182231 -0.014790
0.213149 -0.013797
0.244240 -0.012649
0.275464 -0.011392
0.306798 -0.010061
0.338230 -0.008690
0.369725 -0.007318
0.401184 -0.005962
0.432597 -0.004640
0.463976 -0.003366
0.495325 -0.002147
0.526644 -0.000994
0.557930 0.000082
0.589182 0.001071
0.620390 0.001960
0.651547 0.002731
0.682648 0.003367
0.713694 0.003847
0.744690 0.004152
0.775644 0.004269
0.806546 0.004190
0.837373 0.003898
0.868134 0.003359
0.898985 0.002532
0.929868 0.001410
0.956572 0.000219
0.975393 -0.000742
0.988983 -0.001472
1.000000 -0.002051
81 changes: 81 additions & 0 deletions gpkitmodels/SP/aircraft/prop/dae51polars/dae51.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
1.000000 -0.000051
0.989166 0.001996
0.975819 0.004501
0.957448 0.007991
0.931599 0.013004
0.901654 0.018957
0.870818 0.025167
0.839998 0.031363
0.809336 0.037430
0.778839 0.043301
0.748503 0.048933
0.718326 0.054243
0.688314 0.059175
0.658443 0.063716
0.628653 0.067839
0.598855 0.071530
0.569004 0.074792
0.539074 0.077652
0.509071 0.080095
0.479015 0.082100
0.448934 0.083641
0.418877 0.084690
0.388863 0.085217
0.358908 0.085197
0.329049 0.084600
0.299321 0.083399
0.269760 0.081570
0.240419 0.079081
0.211388 0.075895
0.182766 0.071967
0.154699 0.067243
0.127404 0.061670
0.101193 0.055204
0.076503 0.047832
0.054060 0.039675
0.034881 0.031085
0.020059 0.022737
0.010052 0.015405
0.004208 0.009557
0.001251 0.005050
0.000113 0.001479
0.000123 -0.001494
0.001002 -0.004085
0.002793 -0.006422
0.006019 -0.008524
0.011960 -0.010609
0.022698 -0.012727
0.040333 -0.014554
0.064233 -0.015717
0.091882 -0.016173
0.121305 -0.016067
0.151560 -0.015570
0.182231 -0.014790
0.213149 -0.013797
0.244240 -0.012649
0.275464 -0.011392
0.306798 -0.010061
0.338230 -0.008690
0.369725 -0.007318
0.401184 -0.005962
0.432597 -0.004640
0.463976 -0.003366
0.495325 -0.002147
0.526644 -0.000994
0.557930 0.000082
0.589182 0.001071
0.620390 0.001960
0.651547 0.002731
0.682648 0.003367
0.713694 0.003847
0.744690 0.004152
0.775644 0.004269
0.806546 0.004190
0.837373 0.003898
0.868134 0.003359
0.898985 0.002532
0.929868 0.001410
0.956572 0.000219
0.975393 -0.000742
0.988983 -0.001472
1.000000 -0.002051

0 comments on commit 89f6f8f

Please sign in to comment.