-
Notifications
You must be signed in to change notification settings - Fork 11
/
gustloading.py
43 lines (35 loc) · 1.49 KB
/
gustloading.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
" spar loading for gust case "
import os
from numpy import pi, hstack, cos
import pandas as pd
from gpkit import Variable, Vectorize
from gpfit.fit_constraintset import FitCS
from .sparloading import SparLoading
#pylint: disable=invalid-name, no-member, arguments-differ
#pylint: disable=attribute-defined-outside-init
class GustL(SparLoading):
"spar loading model"
new_qbarFun = None
new_SbarFun = None
def setup(self, wing):
self.load = SparLoading.setup(self, wing)
vgust = Variable("V_{gust}", 10, "m/s", "gust velocity")
Ww = Variable("W_w", "lbf", "wing weight")
v = Variable("V", "m/s", "speed")
cl = Variable("c_l", "-", "wing lift coefficient")
with Vectorize(self.wing.N):
agust = Variable("\\alpha_{gust}", "-", "gust angle of attack")
return_cosm1 = lambda c: hstack(
[1e-10, 1-cos(c[self.wing.planform.eta][1:]*pi/2)])
cosminus1 = Variable("1-cos(\\eta)", return_cosm1,
"-", "1 minus cosine factor")
path = os.path.dirname(os.path.abspath(__file__))
df = pd.read_csv(path + os.sep + "arctan_fit.csv").to_dict(
orient="records")[0]
constraints = [
# fit for arctan from 0 to 1, RMS = 0.044
FitCS(df, agust, [cosminus1*vgust/v]),
self.beam["\\bar{q}"] >= self.wing.planform.cbar*(
1 + 2*pi*agust/cl*(1+Ww/self.W)),
]
return self.load, constraints