Пример #1
0
def plot_runwayv():
    M = Mission(sp=False)
    M.substitutions.update({
        "R": 400,
        "W_{pay}": 195 * 6,
        "g_{loading}": 0.3,
        "C_{L_{TO}}": 4.0,
        "C_{L_{land}}": 3.5
    })

    del M.substitutions["R"]
    clrs = ["#084081", "#0868ac", "#2b8cbe", "#4eb3d3", "#7bccc4"] * 5
    fig, ax = plt.subplots()
    i = 0
    for vmin in [100, 125, 150]:
        M.substitutions.update({"V_{min}": vmin})
        M.cost = 1 / M["R"]
        sol = M.solve("mosek")
        M.cost = M[M.aircraft.topvar("W")]
        Rmax = sol("R").magnitude - 5
        Rmin = 5
        bst = autosweep_1d(M, 0.01, M["R"], [Rmin, Rmax])
        _x = np.linspace(Rmin, Rmax, 100)
        mtow = bst.sample_at(_x)(M.aircraft.topvar("W"))
        ax.plot(_x, mtow, c=clrs[i], lw=2)
        i += 1

    ax.grid()
    ax.set_ylim([0, 10000])
    ax.set_xlabel("Range [nmi]")
    ax.set_ylabel("Max Takeoff Weight [lbf]")
    fig.savefig("rangev.pdf", bbox_inches="tight")
Пример #2
0
def plot_gl():
    M = Mission(sp=False)
    M.substitutions.update({
        "R": 100,
        "V_{min}": 100,
        "C_{L_{land}}": 3.5,
        "C_{L_{TO}}": 4.0,
        "W_{pay}": 5. * 195
    })

    clrs = ["#084081", "#0868ac", "#2b8cbe", "#4eb3d3", "#7bccc4"] * 5
    fig, ax = plt.subplots()
    fig2, ax2 = plt.subplots()
    i = 0
    for gl in [0.3, 0.4, 0.5]:
        M.substitutions.update({"g_{loading}": gl})
        M.cost = M["S_{runway}"]
        sol = M.solve("mosek")
        M.cost = M.aircraft.topvar("W")
        Smin = sol("S_{runway}").magnitude + 5
        Smax = 800
        bst = autosweep_1d(M, 0.01, M["S_{runway}"], [Smin, Smax])
        _x = np.linspace(Smin, Smax, 100)
        pay = bst.sample_at(_x)(M.aircraft.topvar("W"))
        ax.plot(_x, pay, c=clrs[i], lw=2)
        i += 1

    ax.grid()
    ax.set_ylim([0, 8000])
    ax.set_xlim([0, 800])
    ax.set_xlabel("Runway Length [ft]")
    ax.set_ylabel("Max Take Off Weight [lbs]")
    fig.savefig("smtow_gl.pdf", bbox_inches="tight")
Пример #3
0
def plot_vminWp():
    M = Mission(sp=False)
    M.substitutions.update({
        "S_{runway}": 600,
        "R": 100,
        "g_{loading}": 0.3,
        "C_{L_{TO}}": 4.0,
        "C_{L_{land}}": 4.0
    })

    del M.substitutions["V_{min}"]
    clrs = ["#084081", "#0868ac", "#2b8cbe", "#4eb3d3", "#7bccc4"] * 5
    fig, ax = plt.subplots()
    i = 0
    for wpay in [2, 4, 6, 8]:
        M.substitutions.update({"W_{pay}": 195. * wpay})
        M.cost = 1 / M["V_{min}"]
        sol = M.solve("mosek")
        M.cost = M[M.aircraft.topvar("W")]
        Vmin = 50
        Vmax = sol("V_{min}").magnitude - 1
        bst = autosweep_1d(M, 0.1, M["V_{min}"], [Vmin, Vmax])
        _x = np.linspace(Vmin, Vmax, 100)
        mtow = bst.sample_at(_x)(M.aircraft.topvar("W"))
        ax.plot(_x, mtow, c=clrs[i], lw=2)
        i += 1

    ax.grid()
    ax.set_ylim([0, 10000])
    ax.set_xlabel("Minimum Cruise Speed [kts]")
    ax.set_ylabel("Max Takeoff Weight [lbf]")
    fig.savefig("vweightWp.pdf", bbox_inches="tight")
Пример #4
0
def plot_sw_mtowtech():
    M = Mission(sp=False)
    M.substitutions.update({
        "R": 100,
        "V_{min}": 100,
        "h_{batt}": 300,
        "m_{fac}_Mission/GLanding": 1.2,
        "m_{fac}_Mission/TakeOff": 1.2,
        "sp_{motor}": 7. / 9.81 * 0.8,
        "f_{ref}": 1.1,
        "g_{loading}": 0.5,
        "C_{L_{TO}}": 5.0,
        "C_{L_{land}}": 4.5
    })

    clrs = ["#084081", "#0868ac", "#2b8cbe", "#4eb3d3", "#7bccc4"] * 5
    fig, ax = plt.subplots()
    fig2, ax2 = plt.subplots()
    i = 0
    for npax in range(2, 9):
        M.substitutions.update({"W_{pay}": npax * 195.})
        M.cost = M["S_{runway}"]
        sol = M.solve("mosek")
        M.cost = M.aircraft.topvar("W")
        Smin = sol("S_{runway}").magnitude + 5
        Smax = 800
        bst = autosweep_1d(M, 0.1, M["S_{runway}"], [Smin, Smax])
        _x = np.linspace(Smin, Smax, 100)
        sensland = bst.solarray["sensitivities"]["constants"]["C_{L_{land}}"]
        xp = bst.solarray("S_{runway}").magnitude
        f = interp1d(xp, sensland)
        sensland = f(_x)
        ax2.plot(_x, sensland, c=clrs[i])
        pay = bst.sample_at(_x)(M.aircraft.topvar("W"))
        ax.plot(_x, pay, c=clrs[i], lw=2)
        i += 1

    ax.grid()
    ax.set_ylim([0, 8000])
    ax.set_xlim([0, 800])
    ax.set_xlabel("Runway Length [ft]")
    ax.set_ylabel("Max Take Off Weight [lbs]")
    fig.savefig("sw_mtowt.pdf", bbox_inches="tight")

    ax2.set_ylabel("Sensitivity to landing constraints")
    ax2.grid()
    ax2.set_xlabel("Runway Length [ft]")
    fig2.savefig("sw_mtowtsens.pdf", bbox_inches="tight")
Пример #5
0
        if s[1] > 0:
            pss.append(s[1])
            ngs.append(0)
        else:
            ngs.append(abs(s[1]))
            pss.append(0)

    ind = np.arange(0.5, i + 0.5, 1)
    ax.bar(ind, pss, 0.5, color="#4D606E")
    ax.bar(ind, ngs, 0.5, color="#3FBAC2")
    ax.set_xlim([0.0, ind[-1] + 1.0])
    ax.set_xticks(ind)
    ax.set_xticklabels(labels, rotation=-45, ha="left")
    ax.legend(["Positive", "Negative"])
    ax.set_ylabel("sensitivities")
    return fig, ax


if __name__ == "__main__":
    M = Mission()
    M.cost = M["W"]
    sol = M.solve("mosek")

    varns = [
        "W_{pay}", "R", "S_{TO}", "h_{batt}", "(W/S)", "sp_{motor}", "AR",
        "\\eta_{prop}"
    ]

    Fig, _ = plot_sens(M, sol, varns)
    Fig.savefig("sensbar.pdf", bbox_inches="tight")