-
Notifications
You must be signed in to change notification settings - Fork 11
/
wing_test.py
39 lines (30 loc) · 1.1 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
" wing test "
from gpkitmodels.GP.aircraft.wing.wing import Wing
from gpkit import Variable, Model
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 "
Wcent = Variable("W_{cent}", 100, "lbf", "center weight")
W = Wing()
W.substitutions[W.topvar("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["C_d"], [loading[1]["V"] == fs["V"],
loading[1]["c_l"] == perf["C_L"],
loading[1]["W_w"] == W.topvar("W"),
W, fs, perf, loading])
s = m.solve("mosek")
print s("b")
if __name__ == "__main__":
wing_test()