Skip to content

Commit

Permalink
updated bounds for gpkit/check_on_build
Browse files Browse the repository at this point in the history
  • Loading branch information
bqpd committed Nov 14, 2017
1 parent 86df0bf commit 13dba6d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 23 deletions.
16 changes: 10 additions & 6 deletions gpkitmodels/GP/aircraft/wing/capspar.py
Expand Up @@ -31,11 +31,11 @@ class CapSpar(Model):
Upper Unbounded
---------------
W
W, cave
Lower Unbounded
---------------
Sy
Sy, b
LaTex Strings
-------------
Expand All @@ -59,13 +59,17 @@ class CapSpar(Model):
def setup(self, N, surface):
exec parse_variables(CapSpar.__doc__)

cave = self.cave = surface.cave
b = self.b = surface.b
deta = surface.deta
tau = surface.tau

return [I/mfac <= 2*w*t*(hin/2)**2,
dm >= (rhocfrp*(2*w*t + 2*tshear*(hin + 2*t))
+ rhocore*w*hin)*surface.b/2*surface.deta,
+ rhocore*w*hin)*b/2*deta,
W >= 2*dm.sum()*g,
w <= wlim*surface.cave,
surface.cave*surface.tau >= hin + 2*t,
w <= wlim*cave,
cave*tau >= hin + 2*t,
Sy*(hin/2 + t) <= I,
tshear >= tshearmin
]

26 changes: 15 additions & 11 deletions gpkitmodels/GP/aircraft/wing/wing.py
Expand Up @@ -40,12 +40,12 @@ class Planform(Model):
deta self.return_deta [-] \\Delta (2y/b)
Upper Unbounded
---------------
S, AR, b, croot, cmac
--------------- # bounding any pair of variables will work
cave, b
Lower Unbounded
---------------
S, AR, b, croot, cmac
cave, b
LaTex Strings
-------------
Expand Down Expand Up @@ -100,11 +100,7 @@ class WingAero(Model):
Upper Unbounded
---------------
Cd, Re
Lower Unbounded
---------------
CL
Cd, Re, AR
LaTex Strings
-------------
Expand All @@ -121,14 +117,16 @@ def setup(self, static, state,
df = pd.read_csv(fitdata)
fd = df.to_dict(orient="records")[0]

AR = self.AR = static.planform.AR
cmac = static.planform.cmac

if fd["d"] == 2:
independentvars = [self.CL, self.Re]
elif fd["d"] == 3:
independentvars = [self.CL, self.Re, static["\\tau"]]

return [Cd >= cdp + CL**2/np.pi/static.planform.AR/e,
Re == (state["\\rho"]*state["V"]*static.planform.cmac
/ state["\\mu"]),
return [Cd >= cdp + CL**2/np.pi/AR/e,
Re == (state["\\rho"]*state["V"]*cmac/state["\\mu"]),
# XfoilFit(fd, cdp, [CL, Re], airfoil="jho1.dat"),
XfoilFit(fd, cdp, independentvars),
CL <= CLstall
Expand All @@ -147,6 +145,10 @@ class Wing(Model):
---------------
W
Lower Unbounded
---------------
b, Sy
LaTex Strings
-------------
mfac m_{\\mathrm{fac}}
Expand All @@ -163,12 +165,14 @@ def setup(self, N=5):
self.N = N

self.planform = Planform(N)
self.b = self.planform.b
self.skin = WingSkin(self.planform)
self.components = [self.skin]

if self.sparModel:
self.spar = self.sparModel(N, self.planform)
self.components.extend([self.spar])
self.Sy = self.spar.Sy
if self.fillModel:
self.foam = self.fillModel(self.planform)
self.components.extend([self.foam])
Expand Down
10 changes: 8 additions & 2 deletions gpkitmodels/GP/aircraft/wing/wing_core.py
Expand Up @@ -17,6 +17,10 @@ class WingCore(Model):
---------------
W
Lower Unbounded
---------------
cave, b
LaTex Strings
-------------
rhocore \\rho_{\\mathrm{core}}
Expand All @@ -26,6 +30,8 @@ class WingCore(Model):
def setup(self, surface):
exec parse_variables(WingCore.__doc__)

return [W >= 2*(g*rhocore*Abar*surface.cave**2
* surface.b/2*surface.deta).sum()]
cave = self.cave = surface.cave
b = self.b = surface.b
deta = surface.deta

return [W >= 2*(g*rhocore*Abar*cave**2*b/2*deta).sum()]
12 changes: 9 additions & 3 deletions gpkitmodels/GP/aircraft/wing/wing_skin.py
Expand Up @@ -19,7 +19,11 @@ class WingSkin(Model):
Upper Unbounded
---------------
W
W, croot
Lower Unbounded
---------------
S
LaTex Strings
-------------
Expand All @@ -36,11 +40,13 @@ class WingSkin(Model):
def setup(self, surface):
exec parse_variables(WingSkin.__doc__)

croot = self.croot = surface.croot
S = self.S = surface.S
self.loading = WingSkinL

return [W >= rhocfrp*surface.S*2*t*g,
t >= tmin,
taucfrp >= (1/Jtbar/surface.croot**2/t*Cmw
* surface.S*rhosl*Vne**2)
taucfrp >= 1/Jtbar/croot**2/t*Cmw*S*rhosl*Vne**2
]

class WingSkinL(Model):
Expand Down
2 changes: 1 addition & 1 deletion gpkitmodels/GP/aircraft/wing/wing_test.py
Expand Up @@ -35,7 +35,7 @@ def wing_test():
loading[1].Ww == W.topvar("W"),
loading[1].Ww <= 0.5*fs["\\rho"]*fs["V"]**2*perf.CL*W.planform.S,
W, fs, perf, loading])
m.solve(verbosity=0)
m.solve("cvxopt", verbosity=0)

def box_spar():
" test wing models "
Expand Down

0 comments on commit 13dba6d

Please sign in to comment.