Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if args None don't add to constraints #134

Merged
merged 2 commits into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions gpkitmodels/GP/aircraft/wing/gustloading.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GustL(SparLoading):

def setup(self, static, Wcent=None, Wwing=None, V=None, CL=None):

self.load = SparLoading.setup(self, static, Wcent)
self.load = SparLoading.setup(self, static, Wcent=Wcent)
vgust = Variable("V_{gust}", 10, "m/s", "gust velocity")
Ww = Variable("W_w", "lbf", "wing weight")
v = Variable("V", "m/s", "speed")
Expand All @@ -35,12 +35,14 @@ def setup(self, static, Wcent=None, Wwing=None, V=None, CL=None):

constraints = [
# fit for arctan from 0 to 1, RMS = 0.044
V == v,
CL == cl,
Ww == Wwing,
FitCS(df, agust, [cosminus1*vgust/v]),
self.beam["\\bar{q}"] >= self.static["\\bar{c}"]*(
1 + 2*pi*agust/cl*(1+Ww/Wcent)),
1 + 2*pi*agust/cl*(1+Ww/self.W)),
]

if Wcent:
constraints.extend([V == v,
CL == cl,
Ww == Wwing])

return self.load, constraints
12 changes: 7 additions & 5 deletions gpkitmodels/GP/aircraft/wing/sparloading.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def setup(self, static, Wcent=None):
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")
W = Variable("W", "lbf", "loading weight")
self.W = Variable("W", "lbf", "loading weight")

with Vectorize(self.static.N-1):
Mr = Variable("M_r", "N*m", "wing section root moment")
Expand All @@ -42,15 +42,17 @@ def setup(self, static, Wcent=None):
constraints = [
# dimensionalize moment of inertia and young's modulus
self.beam["dx"] == self.static["d\\eta"],
W == Wcent,
self.beam["\\bar{EI}"] <= (8*self.static["E"]*self.static["I"]/Nmax
/ W/self.static["b"]**2),
Mr == (self.beam["\\bar{M}"][:-1]*W*Nmax*self.static["b"]/4),
/ 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]*W*Nmax/4
taucfrp >= (self.beam["\\bar{S}"][-1]*self.W*Nmax/4
/ self.static["t_{shear}"]/self.static["c_{ave}"]
/ self.static["\\tau"])
]

if Wcent:
constraints.extend([self.W == Wcent])

return self.beam, constraints
13 changes: 9 additions & 4 deletions gpkitmodels/GP/aircraft/wing/wing_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ def wing_test():
W.substitutions[W.topvar("W")] = 50
fs = FlightState()
perf = W.flight_model(W, fs)
loading = W.loading(W, Wcent, W.topvar("W"), fs["V"], perf["C_L"])
loading = W.loading(W, Wcent)

m = Model(perf["C_d"], [W, fs, perf, loading])
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])
m.solve("mosek")

if __name__ == "__main__":
Expand Down