Skip to content

Commit

Permalink
change small subs when solving with cvxopt
Browse files Browse the repository at this point in the history
  • Loading branch information
mjburton committed Dec 18, 2017
1 parent 6c60169 commit 560722b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gpkitmodels/GP/aircraft/tail/tail_boom.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def setup(self, N=N):
self.deta = Variable("deta", 1./(N-1), "-",
"non-dim segment length")
b = self.b = Variable("b", "ft", "twice tail boom length")
self.cave = VectorVariable(N-1, "cave", "ft",
self.cave = VectorVariable(N-1, "cave", "in",
"average segment width")
self.tau = Variable("tau", 1.0, "-", "thickness to width ratio")

Expand Down
23 changes: 18 additions & 5 deletions gpkitmodels/GP/aircraft/tail/tail_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ def test_emp():
vtperf = emp.vtail.flight_model(emp.vtail, fs)
tbperf = emp.tailboom.flight_model(emp.tailboom, fs)

from gpkit import settings
if settings["default_solver"] == "cvxopt":
for l in [emp.hbend, emp.vbend]:
for v in ["\\bar{M}_{tip}", "\\bar{S}_{tip}",
"\\bar{\\delta}_{root}", "\\theta_{root}"]:
l.substitutions[v] = 1e-3

m = Model(htperf.Cd + vtperf.Cd + tbperf.Cf,
[emp.vtail.lv == emp.tailboom.l, emp.htail.lh == emp.tailboom.l,
emp.htail.Vh <= emp.htail.planform.S*emp.htail.lh/Sw/cmac,
Expand All @@ -77,21 +84,27 @@ def test_tailboom_mod():
vtperf = emp.vtail.flight_model(emp.vtail, fs)
tbperf = emp.tailboom.flight_model(emp.tailboom, fs)

from gpkit import settings
if settings["default_solver"] == "cvxopt":
for l in [emp.hbend, emp.vbend]:
for v in ["\\bar{M}_{tip}", "\\bar{S}_{tip}",
"\\bar{\\delta}_{root}", "\\theta_{root}"]:
l.substitutions[v] = 1e-3

m = Model(htperf.Cd + vtperf.Cd + tbperf.Cf,
[emp.vtail.lv == emp.tailboom.l, emp.htail.lh == emp.tailboom.l,
emp.htail.Vh <= emp.htail.planform.S*emp.htail.lh/Sw/cmac,
emp.vtail.Vv <= emp.vtail.planform.S*emp.vtail.lv/Sw/bw,
emp.tailboom.cave <= cmax,
emp, fs, htperf, vtperf, tbperf])
sol = m.solve(verbosity=0)
return sol
sol = m.solve("cvxopt", verbosity=0)
return m

def test():
test_htail()
test_vtail()
test_emp()
sol = test_tailboom_mod()
return sol
test_tailboom_mod()

if __name__ == "__main__":
sol = test()
test()

0 comments on commit 560722b

Please sign in to comment.