Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* make changes to allow for future mods * initial attempt at parsing variables for wing skin model * add unbounded and latex rep * change planform to parsing * change vector length to N; delte commented out vars * fix space error in eta * fix tail compatibility errors * modify loading to fit parsing structure * make root moment greater than * fix doc string errors; bound b * put lower bound on S in wing est * bound Vv and Vh in tail tests * change wing perf to parsing notation * add unbounded vars and latex strings to doc strings * covert wing to parsing notation * add unbounded and strings * move wing interior to wing core and convert to parsing notation * switch spar cap to parsing * convert box spar to parsing notation and create test for box spar * move sparloading to parsing format * convert gust loading to parse constraints * add bounded vars to docs * updated bounds for gpkit/check_on_build * whoops fix test * direct reference * wing works with strict verification now! * change to 1e-5 * tail tests working with strict verification * change to 1e-3; passes with cvxopt * move more files to parsing format * substitutions for beam not working * passes tests locally * move tail boom to parsing notations * all tail boom models in parsing format * move empennage to parsing * fix lint errors * remove space * change sp to work with parsing
- Loading branch information
Michael Burton
committed
Nov 15, 2017
1 parent
642ab58
commit d142708
Showing
18 changed files
with
882 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,58 @@ | ||
" empennage.py " | ||
from gpkit import Variable, Model | ||
from gpkit import Model, parse_variables | ||
from .horizontal_tail import HorizontalTail | ||
from .vertical_tail import VerticalTail | ||
from .tail_boom import TailBoom, TailBoomState | ||
|
||
#pylint: disable=attribute-defined-outside-init | ||
#pylint: disable=attribute-defined-outside-init, no-member, exec-used | ||
#pylint: disable=too-many-instance-attributes, invalid-name, undefined-variable | ||
class Empennage(Model): | ||
"empennage model, consisting of vertical, horizontal and tailboom" | ||
"""empennage model, consisting of vertical, horizontal and tailboom | ||
Variables | ||
--------- | ||
mfac 1.0 [-] tail weight margin factor | ||
W [lbf] empennage weight | ||
Upper Unbounded | ||
--------------- | ||
W, Vv, Vh | ||
Lower Unbounded | ||
--------------- | ||
lv, lh, Vv, Vh, bv, bh, mh | ||
LaTex Strings | ||
------------- | ||
mfac m_{\\mathrm{fac}} | ||
""" | ||
def setup(self): | ||
mfac = Variable("m_{fac}", 1.0, "-", "Tail weight margin factor") | ||
W = Variable("W", "lbf", "empennage weight") | ||
exec parse_variables(Empennage.__doc__) | ||
|
||
self.htail = HorizontalTail() | ||
self.htail.substitutions.update({"m_{fac}": 1.1}) | ||
self.htail.substitutions.update({self.htail.mfac: 1.1}) | ||
lh = self.lh = self.htail.lh | ||
self.Vh = self.htail.Vh | ||
self.bh = self.htail.b | ||
self.mh = self.htail.mh | ||
self.vtail = VerticalTail() | ||
self.vtail.substitutions.update({"m_{fac}": 1.1}) | ||
self.vtail.substitutions.update({self.vtail.mfac: 1.1}) | ||
lv = self.lv = self.vtail.lv | ||
self.Vv = self.vtail.Vv | ||
self.bv = self.vtail.b | ||
self.tailboom = TailBoom() | ||
self.components = [self.htail, self.vtail, self.tailboom] | ||
l = self.l = self.tailboom.l | ||
|
||
state = TailBoomState() | ||
loading = [self.tailboom.horizontalbending(self.htail, state), | ||
self.tailboom.verticalbending(self.vtail, state), | ||
self.tailboom.verticaltorsion(self.vtail, state)] | ||
loading = [self.tailboom.hbending(self.tailboom, self.htail, state), | ||
self.tailboom.vbending(self.tailboom, self.vtail, state), | ||
self.tailboom.vtorsion(self.tailboom, self.vtail, state)] | ||
|
||
constraints = [ | ||
W/mfac >= (self.htail.topvar("W") + self.vtail.topvar("W") | ||
+ self.tailboom["W"]), | ||
self.tailboom["l"] >= self.htail["l_h"], | ||
self.tailboom["l"] >= self.vtail["l_v"], | ||
W/mfac >= sum(c.W for c in self.components), | ||
l >= lh, l >= lv, | ||
] | ||
|
||
return self.components, constraints, loading |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,52 @@ | ||
" horizontal tail " | ||
import numpy as np | ||
from gpkit import Variable | ||
from gpkit import parse_variables | ||
from .tail_aero import TailAero | ||
from gpkitmodels.GP.aircraft.wing.wing import Wing | ||
from gpkitmodels.GP.aircraft.wing.wing_interior import WingInterior | ||
from gpkitmodels.GP.aircraft.wing.wing_core import WingCore | ||
|
||
#pylint: disable=attribute-defined-outside-init, unused-variable | ||
#pylint: disable=attribute-defined-outside-init, no-member | ||
#pylint: disable=exec-used, undefined-variable | ||
|
||
class HorizontalTail(Wing): | ||
"horizontal tail model" | ||
""" Horizontal Tail Model | ||
Variables | ||
--------- | ||
Vh [-] horizontal tail volume coefficient | ||
lh [ft] horizontal tail moment arm | ||
CLhmin 0.75 [-] max downlift coefficient | ||
mh [-] horizontal tail span effectiveness | ||
Upper Unbounded | ||
--------------- | ||
lh, Vh, W | ||
Lower Unbounded | ||
--------------- | ||
lh, Vh, b, mh | ||
LaTex Strings | ||
------------- | ||
Vh V_{\\mathrm{h}} | ||
lh l_{\\mathrm{h}} | ||
CLmin C_{L_{\\mathrm{min}}} | ||
mh m_{\\mathrm{h}} | ||
""" | ||
flight_model = TailAero | ||
fillModel = WingInterior | ||
fillModel = WingCore | ||
sparModel = None | ||
|
||
def setup(self, N=3, lam=0.8): | ||
def setup(self, N=3): | ||
exec parse_variables(HorizontalTail.__doc__) | ||
|
||
self.ascs = Wing.setup(self, N) | ||
self.planform.substitutions.update({"AR": 4, "\\tau": 0.08, | ||
"\\lambda": 0.8}) | ||
self.skin.substitutions.update({"\\rho_{CFRP}": 0.049}) | ||
self.foam.substitutions.update({"\\bar{A}_{jh01}": 0.0548, | ||
"\\rho_{foam}": 0.024}) | ||
Vh = Variable("V_h", "-", "horizontal tail volume coefficient") | ||
lh = Variable("l_h", "ft", "horizontal tail moment arm") | ||
CLhmin = Variable("(C_{L_h})_{min}", 0.75, "-", | ||
"max downlift coefficient") | ||
mh = Variable("m_h", "-", "horizontal tail span effectiveness") | ||
self.planform.substitutions.update( | ||
{self.planform.AR: 4, self.planform.tau: 0.08, | ||
self.planform.lam: 0.8}) | ||
self.skin.substitutions.update({self.skin.rhocfrp: 0.049}) | ||
self.foam.substitutions.update({self.foam.Abar: 0.0548, | ||
self.foam.rhocore: 0.024}) | ||
|
||
return self.ascs, mh*(1+2.0/self.planform["AR"]) <= 2*np.pi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,46 @@ | ||
" tail aerodynamics " | ||
from gpkit import Variable, Model | ||
import os | ||
from gpfit.fit_constraintset import XfoilFit | ||
import pandas as pd | ||
from gpkit import Model, parse_variables | ||
from gpfit.fit_constraintset import XfoilFit | ||
|
||
#pylint: disable=exec-used, attribute-defined-outside-init, undefined-variable | ||
#pylint: disable=no-member | ||
|
||
class TailAero(Model): | ||
"horizontal tail aero model" | ||
def setup(self, static, state): | ||
"""Tail Aero Model | ||
Variables | ||
--------- | ||
Re [-] Reynolds number | ||
Cd [-] drag coefficient | ||
name = get_lowername(static.__class__.__name__) | ||
Re = Variable("Re", "-", "%s reynolds number" % name) | ||
Cd = Variable("C_d", "-", "%s drag coefficient" % name) | ||
Upper Unbounded | ||
--------------- | ||
Cd, Re | ||
LaTex Strings | ||
------------- | ||
Cd C_d | ||
""" | ||
def setup(self, static, state): | ||
exec parse_variables(TailAero.__doc__) | ||
|
||
cmac = self.cmac = static.planform.cmac | ||
b = self.b = static.planform.b | ||
S = self.S = static.planform.S | ||
path = os.path.dirname(__file__) | ||
fd = pd.read_csv(path + os.sep + "tail_dragfit.csv").to_dict( | ||
orient="records")[0] | ||
|
||
constraints = [ | ||
Re == (state["V"]*state["\\rho"]*static["S"]/static["b"] | ||
Re == (state["V"]*state["\\rho"]*S/b | ||
/ state["\\mu"]), | ||
# XfoilFit(fd, Cd, [Re, static["\\tau"]], | ||
# err_margin="RMS", airfoil="naca 0008") | ||
XfoilFit(fd, Cd, [Re, static["\\tau"]], err_margin="RMS") | ||
XfoilFit(fd, Cd, [Re, static.planform.tau], err_margin="RMS") | ||
] | ||
|
||
return constraints | ||
|
||
def get_lowername(classname): | ||
start = [c for c in classname if c.isupper()] | ||
name = [classname] | ||
for t in start: | ||
name = name[-1].split(t) | ||
|
||
n = " ".join([t.lower()+n for n, t in zip(name, start)]) | ||
return n |
Oops, something went wrong.