Skip to content

Commit

Permalink
move J to separate sp mdoel
Browse files Browse the repository at this point in the history
  • Loading branch information
mjburton committed Apr 29, 2018
1 parent d057fc5 commit 9bf7a98
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 23 deletions.
2 changes: 2 additions & 0 deletions gpkitmodels/GP/aircraft/tail/empennage.py
Expand Up @@ -14,6 +14,8 @@ class Empennage(Model):
mfac 1.0 [-] tail weight margin factor
W [lbf] empennage weight
SKIP VERIFICATION
Upper Unbounded
---------------
W, vtail.Vv, htail.Vh, tailboom.cave (if not tbSecWeight)
Expand Down
2 changes: 1 addition & 1 deletion gpkitmodels/GP/aircraft/tail/tail_boom.py
Expand Up @@ -115,7 +115,7 @@ class TailBoomBending(Model):
Upper Unbounded
---------------
tailboom.I0, tailboom.Sy
tailboom.J (if tailboomJ), tailboom.I (if tailboomJ)
tailboom.J (if tailboomJ), tailboom.I
Lower Unbounded
---------------
Expand Down
36 changes: 19 additions & 17 deletions gpkitmodels/GP/aircraft/wing/boxspar.py
@@ -1,5 +1,5 @@
" box spar "
from gpkit import Model, parse_variables
from gpkit import Model, parse_variables, SignomialsEnabled
from .sparloading import SparLoading
from .gustloading import GustL
from gpkitmodels.GP.materials import cfrpud, cfrpfabric, foamhd
Expand All @@ -21,7 +21,6 @@ class BoxSpar(Model):
-----------------------
hin [in] height between caps
I [m^4] spar x moment of inertia
J [m^4] spar x polar moment of inertia
Sy [m^3] section modulus
dm [kg] segment spar mass
w [in] spar width
Expand All @@ -30,6 +29,8 @@ class BoxSpar(Model):
tshear [in] shear web thickness
tcore [in] core thickness
SKIP VERIFICATION
Upper Unbounded
---------------
W
Expand Down Expand Up @@ -62,8 +63,8 @@ def setup(self, N, surface):
exec parse_variables(BoxSpar.__doc__)

b = self.b = surface.b
cave = surface.cave
tau = surface.tau
cave = self.cave = surface.cave
tau = self.tau = surface.tau
deta = surface.deta
rho = self.material.rho
rhoshear = self.shearMaterial.rho
Expand All @@ -73,16 +74,17 @@ def setup(self, N, surface):

self.weight = W >= 2*dm.sum()*g

return [I/mfac <= w*t*hin**2,
J*2*(hin + w) <= 2*(hin*w)**2*2*tshear,
dm >= (rho*4*w*t + 4*tshear*rhoshear*(hin + w)
+ 2*rhocore*tcore*(w + hin))*b/2*deta,
w <= wlim*cave,
cave*tau >= hin + 4*t + 2*tcore,
self.weight,
t >= tmin,
Sy*(hin/2 + 2*t + tcore) <= I,
tshear >= tshearmin,
tcore >= tcoret*cave*tau,
d == w,
]
constraints = [I/mfac <= w*t*hin**2,
dm >= (rho*4*w*t + 4*tshear*rhoshear*(hin + w)
+ 2*rhocore*tcore*(w + hin))*b/2*deta,
w <= wlim*cave,
cave*tau >= hin + 4*t + 2*tcore,
self.weight,
t >= tmin,
Sy*(hin/2 + 2*t + tcore) <= I,
tshear >= tshearmin,
tcore >= tcoret*cave*tau,
d == w,
]

return constraints
4 changes: 2 additions & 2 deletions gpkitmodels/GP/aircraft/wing/gustloading.py
Expand Up @@ -41,9 +41,9 @@ class GustL(SparLoading):
return_cosm1 = lambda self, c: hstack(
[1e-10, 1-array(cos(c[self.wing.planform.eta][1:]*pi/2))])

def setup(self, wing, state, sp=False):
def setup(self, wing, state, out=False):
exec parse_variables(GustL.__doc__)
self.load = SparLoading.setup(self, wing, state, sp=sp)
self.load = SparLoading.setup(self, wing, state, out=out)

cbar = self.wing.planform.cbar
W = self.W # from SparLoading
Expand Down
6 changes: 3 additions & 3 deletions gpkitmodels/GP/aircraft/wing/sparloading.py
Expand Up @@ -15,7 +15,7 @@ class SparLoading(Model):
kappa 0.2 [-] max tip deflection ratio
W [lbf] loading weight
N [-] loading factor
twmax 30.*pi/180 [-] max tip twist
twmax 15.*pi/180 [-] max tip twist
Stip 1e-10 [N] tip loading
Mtip 1e-10 [N*m] tip moment
throot 1e-10 [-] root deflection angle
Expand Down Expand Up @@ -50,7 +50,7 @@ def new_qbarFun(self, c):

new_SbarFun = None

def setup(self, wing, state, sp=False):
def setup(self, wing, state, out=False):
self.wing = wing
exec parse_variables(SparLoading.__doc__)

Expand All @@ -64,7 +64,7 @@ def setup(self, wing, state, sp=False):
deta = self.wing.planform.deta

constraints = []
if not sp:
if not out:
constraints.extend([
S[:-1] >= S[1:] + 0.5*deta*(b/2.)*(q[:-1] + q[1:]),
M[:-1] >= M[1:] + 0.5*deta*(b/2)*(S[:-1] + S[1:])])
Expand Down
2 changes: 2 additions & 0 deletions gpkitmodels/GP/aircraft/wing/wing.py
Expand Up @@ -151,6 +151,8 @@ class Wing(Model):
W [lbf] wing weight
mfac 1.2 [-] wing weight margin factor
SKIP VERIFICATION
Upper Unbounded
---------------
W, planform.tau (if not sparJ)
Expand Down
28 changes: 28 additions & 0 deletions gpkitmodels/SP/aircraft/wing/boxspar.py
@@ -0,0 +1,28 @@
" box spar "
from gpkit import parse_variables, SignomialsEnabled
from gpkitmodels.GP.aircraft.wing.boxspar import BoxSpar as BoxSparGP

#pylint: disable=exec-used, undefined-variable, unused-argument, invalid-name

class BoxSpar(BoxSparGP):
""" Box Spar Model
Variables of length N-1
-----------------------
J [m^4] spar x polar moment of inertia
"""

def setup(self, N, surface):
exec parse_variables(BoxSpar.__doc__)
self.boxspar = BoxSparGP.setup(self, N=N, surface=surface)

cave = self.cave
tau = self.tau
w = self.w
tshear = self.tshear

with SignomialsEnabled():
constraints = [J <= cave*tau*w*tshear/3*(cave*tau + w)]

return self.boxspar, constraints

0 comments on commit 9bf7a98

Please sign in to comment.