Esempio n. 1
0
def compute_after_cabin_arr(arg_class):
    """
    compute after cabin numpy array

    :param arg_class: argument class
    :return: after_cabin_arr(numpy ndarray)
    """
    # set required parameters
    l1 = arg_class.l1  # section 1 length(cockpit)
    l2 = arg_class.l2  # section 2 length(cabin)
    l3 = arg_class.l3  # section 3 length(after cabin)
    huf = arg_class.huf  # height of upper at cabin(fuselage)
    hau = arg_class.hau  # height of upper at after cabin
    hlf = arg_class.hlf  # height of lower at cabin(fuselage)
    hlc = arg_class.hlc  # height of lower at cockpit
    wa = arg_class.wa  # width of after cabin
    wf = arg_class.wf  # width of cabin(fuselage)

    # create bezier curve
    bezier_zu = []  # z coord for upper line
    bezier_zl = []  # z coord for lower line
    bezier_y = []  # y coord for y line

    # set array for bezier curve
    qzu = np.array([[l1 + l2, huf], [l1 + l2 + 0.5 * l3, hau],
                    [l1 + l2 + l3, hau]])
    qzl = np.array([[l1 + l2, -hlf], [l1 + l2 + l3, -hlc], [l1 + l2 + l3, 0]])
    qy = np.array([[l1 + l2, wf], [l1 + l2 + l3, wa], [l1 + l2 + l3, 0]])

    # compute bezier curve
    for t in np.linspace(0, 1, 50):
        bezier_zu.append(bezier(qzu.shape[0] - 1, t, qzu)[1])
        bezier_zl.append(bezier(qzl.shape[0] - 1, t, qzl)[1])
        bezier_y.append(bezier(qy.shape[0] - 1, t, qy)[1])

    # compute after cabin array
    after_cabin_arr = []
    x = np.linspace(l1 + l2, l1 + l2 + l3, 50)

    for xi, bzl, bzu, by in zip(x, bezier_zl, bezier_zu, bezier_y):
        # set y range
        y = np.linspace(-by, by, 30)

        for yi in y:
            zui = bzu * np.sqrt(1.0 - yi**2 / by**2)
            zli = bzl * np.sqrt(1.0 - yi**2 / by**2)

            # exception
            if np.isnan(zui):
                zui, zli = 0, 0

            after_cabin_arr.append([xi, yi, zui])
            after_cabin_arr.append([xi, yi, zli])

    after_cabin_arr = np.array(after_cabin_arr)

    return after_cabin_arr
Esempio n. 2
0
def compute_cockpit_arr(arg_class):
    """
    compute cockpit numpy array(3D)

    :param arg_class: argument class
    :return: cockpit_arr(numpy ndarray)
    """
    # set required parameters
    l1 = arg_class.l1  # section 1 length(cockpit)
    huc = arg_class.huc  # height of upper at cockpit
    huf = arg_class.huf  # height of upper at cabin(fuselage)
    hlc = arg_class.hlc  # height of lower at cockpit
    hlf = arg_class.hlf  # height of lower at cabin(fuselage)
    uk = arg_class.uk  # constant for bezier curve
    wc = arg_class.wc  # width of cockpit
    wf = arg_class.wf  # width of cabin(fuselage)

    # array for bezier curve
    qzu = np.array([[0, 0], [l1 * uk, huc], [l1, huf]])
    qzl = np.array([[0, 0], [l1 * uk, -hlc], [l1, -hlf]])
    qy = np.array([[0, 0], [l1 * uk, wc], [l1, wf]])

    # compute bezier curve
    bezier_zu = []  # z coords of upper line
    bezier_zl = []  # z coord of lower line
    bezier_y = []  # y coord
    for t in np.linspace(0, 1, 50):
        bezier_zu.append(bezier(qzu.shape[0] - 1, t, qzu)[1])
        bezier_zl.append(bezier(qzl.shape[0] - 1, t, qzl)[1])
        bezier_y.append(bezier(qy.shape[0] - 1, t, qy)[1])

    # compute cockpit array
    cockpit_arr = []
    # set x range
    x = np.linspace(0.0, l1, 50)

    for xi, bzl, bzu, by in zip(x, bezier_zl, bezier_zu, bezier_y):
        # set y range
        y = np.linspace(-by, by, 30)

        for yi in y:
            # eclipse
            if by == 0:
                zui, zli = 0, 0
            else:
                zui = bzu * np.sqrt(1.0 - yi**2 / by**2)
                zli = bzl * np.sqrt(1.0 - yi**2 / by**2)

            cockpit_arr.append([xi, yi, zui])
            cockpit_arr.append([xi, yi, zli])

    cockpit_arr = np.array(cockpit_arr)

    return cockpit_arr
Esempio n. 3
0
cockpit_arr = []

bezier_zu = []
bezier_zl = []

uk = 0.5

qzu = np.array([[0, 0], [l1 * uk, huc], [l1, huf]])
qzl = np.array([[0, 0], [l1 * uk, -hlc], [l1, -hlf]])

bezier_y = []

qy = np.array([[0, 0], [l1 * uk, wc], [l1, wf]])

for t in np.linspace(0, 1, 50):
    bezier_zu.append(bezier(2, t, qzu)[1])
    bezier_zl.append(bezier(2, t, qzl)[1])
    bezier_y.append(bezier(2, t, qy)[1])

for xi, bzl, bzu, by in zip(x, bezier_zl, bezier_zu, bezier_y):

    y = np.linspace(-by, by, 30)

    for yi in y:
        zui = bzu * np.sqrt(1 - yi**2 / by**2)
        zli = bzl * np.sqrt(1 - yi**2 / by**2)

        cockpit_arr.append([xi, yi, zui])
        cockpit_arr.append([xi, yi, zli])

cockpit_arr = np.array(cockpit_arr)
Esempio n. 4
0
main_wing_arr = np.array(main_wing_arr)

# horizontal face

bezier_y1 = []
qy1 = np.array([[0, 0], [0, u1 * lb], [v1 * lb, u2 * lb],
                [(b * 0.5 - st[1]) * np.tan(theta * np.pi / 180.0) + st[0],
                 b * 0.5]])

bezier_y2 = []
qy2 = np.array([[
    (b * 0.5 - st[1]) * np.tan(theta * np.pi / 180.0) + st[0] + ctip, b * 0.5
], [croot + st[0], st[1]], [lb, u3 * lb], [lb, 0]])

for t in np.linspace(0, 1, 50):
    bezier_y1.append(bezier(qy1.shape[0] - 1, t, qy1))
    bezier_y2.append(bezier(qy2.shape[0] - 1, t, qy2))

xs = (b * 0.5 - st[1]) * np.tan(theta * np.pi / 180.0) + st[0]
xf = xs + ctip
interpolates = [np.array([xi, b * 0.5]) for xi in np.linspace(xs, xf, 5)]

# y coordinates
bezier_y = bezier_y1 + interpolates + bezier_y2

fuselage_arr = []
# xz plane
fuselage_line = []

for xi, yu in bezier_y:
    xi /= lb