-
Notifications
You must be signed in to change notification settings - Fork 11
/
wing_test.py
66 lines (53 loc) · 1.72 KB
/
wing_test.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
" wing test "
from gpkitmodels.GP.aircraft.wing.wing import Wing
from gpkitmodels.GP.aircraft.wing.boxspar import BoxSpar
from gpkit import Variable, Model
#pylint: disable=no-member
class FlightState(Model):
" state variables "
def setup(self):
V = Variable("V", 50, "m/s", "airspeed")
rho = Variable("\\rho", 1.255, "kg/m^3", "air density")
mu = Variable("\\mu", 1.5e-5, "N*s/m**2", "air viscosity")
constraints = [V == V, rho == rho, mu == mu]
return constraints
def wing_test():
" test wing models "
W = Wing()
W.substitutions[W.W] = 50
fs = FlightState()
perf = W.flight_model(W, fs)
loading = [W.spar.loading(W)]
loading[0].substitutions["W"] = 100
loading.append(W.spar.gustloading(W))
loading[1].substitutions["W"] = 100
m = Model(perf.Cd, [
loading[1].v == fs["V"],
loading[1].cl == perf.CL,
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)
def box_spar():
" test wing models "
Wing.sparModel = BoxSpar
W = Wing()
W.substitutions[W.W] = 50
fs = FlightState()
perf = W.flight_model(W, fs)
loading = [W.spar.loading(W)]
loading[0].substitutions["W"] = 100
loading.append(W.spar.gustloading(W))
loading[1].substitutions["W"] = 100
m = Model(perf.Cd, [
loading[1].v == fs["V"],
loading[1].cl == perf.CL,
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)
def test():
wing_test()
box_spar()
if __name__ == "__main__":
test()