def test_emp(): Sw = Variable("S_w", 50, "ft**2", "wing area") bw = Variable("b_w", 20, "ft", "wing span") cmac = Variable("cmac", 15, "in", "wing MAC") emp = Empennage() fs = FlightState() emp.substitutions.update({emp.W: 10, emp.tailboom.l: 5, emp.htail.planform.AR: 4, emp.vtail.planform.AR: 4, emp.htail.planform.tau: 0.08, emp.vtail.planform.tau: 0.08, emp.vtail.Vv: 0.04, emp.htail.Vh: 0.4, emp.htail.mh: 0.01}) htperf = emp.htail.flight_model(emp.htail, fs) vtperf = emp.vtail.flight_model(emp.vtail, fs) tbperf = emp.tailboom.flight_model(emp.tailboom, fs) hbend = emp.tailboom.tailLoad(emp.tailboom, emp.htail, fs) vbend = emp.tailboom.tailLoad(emp.tailboom, emp.vtail, fs) 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, fs, emp, fs, htperf, vtperf, tbperf, hbend, vbend]) from gpkit import settings if settings["default_solver"] == "cvxopt": for l in [hbend, vbend]: for v in ["\\bar{M}_{tip}", "\\bar{\\delta}_{root}", "\\theta_{root}"]: m.substitutions[l[v]] = 1e-3 m.solve(verbosity=0)
def setup(self): fs = FlightState() p = Propulsor() pp = p.flight_model(p,fs) pp.substitutions[pp.prop.T] = 100 self.cost = 1./pp.motor.etam + p.W/(1000*units('lbf')) + 1./pp.prop.eta return fs,p,pp
def setup(self): fs = FlightState() m = Motor() mp = MotorPerf(m,fs) self.mp = mp mp.substitutions[m.Qmax] = 100 mp.substitutions[mp.Q] = 10 self.cost = 1./mp.etam + m.W/(100.*units('lbf')) return self.mp, fs, m
def setup(self): fs = FlightState() Propulsor.prop_flight_model = BladeElementProp p = Propulsor() pp = p.flight_model(p,fs) pp.substitutions[pp.prop.T] = 100 self.cost = pp.motor.Pelec/(1000*units('W')) + p.W/(1000*units('lbf')) return fs,p,pp
def test_ellp(): "elliptical fuselage test" f = Fuselage() fs = FlightState() faero = f.flight_model(f, fs) f.substitutions[f.Vol] = 1.33 m = Model(f.W * faero.Cd, [f, fs, faero]) m.solve()
def setup(self): fs = FlightState() m = Motor() mp = MotorPerf(m,fs) self.mp = mp mp.substitutions[m.Qmax] = 10000 mp.substitutions[mp.R] = .033 mp.substitutions[mp.i0] = 4.5 mp.substitutions[mp.Kv] = 29 self.cost = 1./mp.etam return self.mp, fs
def test_vtail(): Sw = Variable("S_w", 50, "ft**2", "wing area") bw = Variable("b_w", 20, "ft", "wing span") vt = VerticalTail() fs = FlightState() vt.substitutions.update({vt.W: 5, vt.planform.AR: 3, vt.Vv: 0.04, vt.lv: 10, vt.planform.tau: 0.08}) perf = vt.flight_model(vt, fs) m = Model(perf.Cd, [vt.Vv <= vt.planform.S*vt.lv/Sw/bw, vt, fs, perf]) m.solve(verbosity=0)
def test_htail(): Sw = Variable("S_w", 50, "ft**2", "wing area") cmac = Variable("cmac", 15, "in", "wing MAC") ht = HorizontalTail() fs = FlightState() ht.substitutions.update({ht.W: 5, ht.mh: 0.01, ht.planform.AR: 4, ht.Vh: 0.5, ht.lh: 10}) perf = ht.flight_model(ht, fs) m = Model(perf.Cd, [ht.Vh <= ht.planform.S*ht.lh/Sw/cmac, ht, perf]) m.solve(verbosity=0)
def test_emp(): Sw = Variable("S_w", 50, "ft**2", "wing area") bw = Variable("b_w", 20, "ft", "wing span") cmac = Variable("cmac", 15, "in", "wing MAC") emp = Empennage() fs = FlightState() emp.substitutions.update({emp.W: 10, emp.tailboom.l: 5, emp.htail.planform.AR: 4, emp.vtail.planform.AR: 4, emp.vtail.Vv: 0.04, emp.htail.Vh: 0.4, emp.htail.mh: 0.01}) htperf = emp.htail.flight_model(emp.htail, fs) vtperf = emp.vtail.flight_model(emp.vtail, fs) tbperf = emp.tailboom.flight_model(emp.tailboom, fs) 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, fs, htperf, vtperf, tbperf]) m.solve(verbosity=0)