From fef01780777a8f2fed8806b3e587f4f2f790da5f Mon Sep 17 00:00:00 2001 From: mjburton Date: Fri, 15 Dec 2017 14:24:04 -0500 Subject: [PATCH] use single model for tail boom bending, call beam model in bending --- gpkitmodels/GP/aircraft/tail/empennage.py | 9 +-- gpkitmodels/GP/aircraft/tail/tail_boom.py | 76 ++++++---------------- gpkitmodels/GP/aircraft/tail/tail_tests.py | 8 ++- gpkitmodels/GP/aircraft/tail/tube_spar.py | 4 +- gpkitmodels/GP/beam/beam.py | 2 +- 5 files changed, 33 insertions(+), 66 deletions(-) diff --git a/gpkitmodels/GP/aircraft/tail/empennage.py b/gpkitmodels/GP/aircraft/tail/empennage.py index 9ed1fb26..291e1f52 100644 --- a/gpkitmodels/GP/aircraft/tail/empennage.py +++ b/gpkitmodels/GP/aircraft/tail/empennage.py @@ -46,10 +46,11 @@ def setup(self): l = self.l = self.tailboom.l state = TailBoomState() - self.hbend = self.tailboom.hbending(self.tailboom, self.htail, state) - self.vbend = self.tailboom.vbending(self.tailboom, self.vtail, state) - self.vtor = self.tailboom.vtorsion(self.tailboom, self.vtail, state) - loading = [self.hbend, self.vbend, self.vtor] + self.tailboom.tailLoad.__name__ = "HTailBoomBending" + self.hbend = self.tailboom.tailLoad(self.tailboom, self.htail, state) + self.tailboom.tailLoad.__name__ = "VTailBoomBending" + self.vbend = self.tailboom.tailLoad(self.tailboom, self.vtail, state) + loading = [self.hbend, self.vbend] constraints = [ W/mfac >= sum(c.W for c in self.components), diff --git a/gpkitmodels/GP/aircraft/tail/tail_boom.py b/gpkitmodels/GP/aircraft/tail/tail_boom.py index f3426408..176f9991 100644 --- a/gpkitmodels/GP/aircraft/tail/tail_boom.py +++ b/gpkitmodels/GP/aircraft/tail/tail_boom.py @@ -2,6 +2,7 @@ from numpy import pi from gpkit import Model, parse_variables from .tube_spar import TubeSpar +from gpkitmodels.GP.beam.beam import Beam #pylint: disable=exec-used, undefined-variable, invalid-name #pylint: disable=attribute-defined-outside-init @@ -89,54 +90,14 @@ def setup(self, tailboom, vtail, state): taucfrp >= T*d0/2/J ] -class VerticalBoomBending(Model): - """ Tail Boom Bending from Vtail Deflection +class TailBoomBending(Model): + """ Tail Boom Bending Variables --------- - F [N] vertical tail force + F [N] tail force th [-] tail boom deflection angle - thmax 0.1 [-] max tail boom deflection angle - - Upper Unbounded - --------------- - I0 - - Lower Unbounded - --------------- - S, l - - LaTex Strings - ------------- - th \\theta - thmax \\theta_{\\mathrm{max}} - - """ - def setup(self, tailboom, vtail, state): - exec parse_variables(VerticalBoomBending.__doc__) - - I0 = self.I0 = tailboom.I - l = self.l = tailboom.l - S = self.S = vtail.planform.S - E = self.E = tailboom.material.E - k = self.k = tailboom.k - rhosl = self.rhosl = state.rhosl - Vne = self.Vne = state.Vne - CLmax = vtail.planform.CLmax - - return [F >= 0.5*rhosl*Vne**2*S*CLmax, - th >= F*l**2/E/I0*(1+k)/2, - th <= thmax, - ] - -class HorizontalBoomBending(Model): - """ Tail Boom Bending from Htail Deflection - - Variables - --------- - F [N] horizontal tail force - th [-] tail boom deflection angle - thmax 0.1 [-] max tail boom deflection angle + kappa 0.1 [-] max tail boom deflection Upper Unbounded --------------- @@ -153,21 +114,28 @@ class HorizontalBoomBending(Model): """ def setup(self, tailboom, htail, state): - exec parse_variables(HorizontalBoomBending.__doc__) + exec parse_variables(TailBoomBending.__doc__) + + N = tailboom.N + Beam.qbarFun = [1e-10]*N + Beam.SbarFun = [1.]*N + beam = Beam(N) - I0 = self.I0 = tailboom.I + I = self.I = tailboom.I l = self.l = tailboom.l S = self.S = htail.planform.S E = self.E = tailboom.material.E - k = self.k = tailboom.k rhosl = self.rhosl = state.rhosl Vne = self.Vne = state.Vne CLmax = htail.planform.CLmax + deta = tailboom.deta - return [F >= 0.5*rhosl*Vne**2*S, - th >= F*l**2/E/I0*(1+k)/2, - th*CLmax <= thmax, - ] + return beam, [beam["dx"] == deta, + F >= 0.5*rhosl*Vne**2*S, + beam["\\bar{EI}"] <= E*I/F/l**2/2, + th == beam["\\theta"][-1], + beam["\\bar{\\delta}"][-1]*CLmax <= kappa + ] class TailBoom(TubeSpar): """ Tail Boom Model @@ -181,12 +149,11 @@ class TailBoom(TubeSpar): """ flight_model = TailBoomAero - hbending = HorizontalBoomBending - vbending = VerticalBoomBending - vtorsion = VerticalBoomTorsion + tailLoad = TailBoomBending def setup(self, N=2): exec parse_variables(TailBoom.__doc__) + self.N = N self.spar = TubeSpar.setup(self, N, self) @@ -194,4 +161,3 @@ def setup(self, N=2): return self.spar, S == l*pi*d0 - diff --git a/gpkitmodels/GP/aircraft/tail/tail_tests.py b/gpkitmodels/GP/aircraft/tail/tail_tests.py index 7c8693a0..c3069404 100644 --- a/gpkitmodels/GP/aircraft/tail/tail_tests.py +++ b/gpkitmodels/GP/aircraft/tail/tail_tests.py @@ -55,12 +55,14 @@ def test_emp(): emp.htail.Vh <= emp.htail.planform.S*emp.htail.lh/Sw/cmac, emp.vtail.Vv <= emp.vtail.planform.S*emp.vtail.lv/Sw/bw, emp, fs, htperf, vtperf, tbperf]) - m.solve(verbosity=0) + sol = m.solve(verbosity=0) + return sol def test(): test_htail() test_vtail() - test_emp() + sol = test_emp() + return sol if __name__ == "__main__": - test() + sol = test() diff --git a/gpkitmodels/GP/aircraft/tail/tube_spar.py b/gpkitmodels/GP/aircraft/tail/tube_spar.py index 0ecd0dfb..4c63fa35 100644 --- a/gpkitmodels/GP/aircraft/tail/tube_spar.py +++ b/gpkitmodels/GP/aircraft/tail/tube_spar.py @@ -19,7 +19,6 @@ class TubeSpar(Model): I [m^4] moment of inertia d [in] diameter t [in] thickness - J [m^4] polar moment of inertia dm [kg] segment mass Upper Unbounded @@ -51,5 +50,4 @@ def setup(self, N, surface): return [I <= pi*t*d**3/8.0, dm >= pi*rho*d*deta*t*kfac*l, W/mfac >= g*dm.sum(), - t >= tmin, - J <= pi/8.0*d**3*t] + t >= tmin] diff --git a/gpkitmodels/GP/beam/beam.py b/gpkitmodels/GP/beam/beam.py index ae6f467b..6eb799a5 100644 --- a/gpkitmodels/GP/beam/beam.py +++ b/gpkitmodels/GP/beam/beam.py @@ -42,7 +42,7 @@ def setup(self, N): if self.SbarFun is None: with Vectorize(N): qbar = self.qbar = Variable("\\bar{q}", self.qbarFun, "-", - "normalized loading") + "normalized loading") Sbartip = Variable("\\bar{S}_{tip}", 1e-10, "-", "Tip loading") constraints.extend([ Sbar[:-1] >= Sbar[1:] + 0.5*dx*(qbar[:-1] + qbar[1:]),