/
sparloading.py
46 lines (35 loc) · 1.66 KB
/
sparloading.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
" cap spar "
from numpy import flip
from gpkit import Model, Variable, Vectorize
from gpkitmodels.GP.beam.beam import Beam
#pylint: disable=invalid-name
class SparLoading(Model):
"spar loading model"
def new_qbarFun(self, c):
" define qbar model for chord loading "
barc = self.static["\\bar{c}"]
return [f(c) for f in self.static.substitutions[barc]]
def setup(self, static):
self.static = static
Nmax = Variable("N_{max}", 5, "-", "max loading")
sigmacfrp = Variable("\\sigma_{CFRP}", 1700e6, "Pa", "CFRP max stress")
taucfrp = Variable("\\tau_{CFRP}", 450e6, "Pa", "CFRP fabric stress")
kappa = Variable("\\kappa", 0.2, "-", "max tip deflection ratio")
self.W = Variable("W", "lbf", "loading weight")
with Vectorize(self.static.N-1):
Mr = Variable("M_r", "N*m", "wing section root moment")
Beam.qbarFun = self.new_qbarFun
self.beam = Beam(self.static.N)
constraints = [
# dimensionalize moment of inertia and young's modulus
self.beam["dx"] == self.static["d\\eta"],
self.beam["\\bar{EI}"] <= (8*self.static["E"]*self.static["I"]/Nmax
/ self.W/self.static["b"]**2),
Mr == (self.beam["\\bar{M}"][:-1]*self.W*Nmax*self.static["b"]/4),
sigmacfrp >= Mr/self.static["S_y"],
self.beam["\\bar{\\delta}"][-1] <= kappa,
taucfrp >= (self.beam["\\bar{S}"][-1]*self.W*Nmax/4
/ self.static["t_{shear}"]/self.static["c_{ave}"]
/ self.static["\\tau"])
]
return self.beam, constraints