Esempio n. 1
0
def Get_xy_components(s1, s2, s3, s4, s5, qs12, qs23, qs35, qs56, qs61):

    t_ys12 = np.array([])

    x_coor_AC = 0.25 * Wing.Chordlength
    # Moments from section 1 -> 2
    for i in range(0, len(qs12) - 1):
        t_y = qs12[i] / Wing.ThSpar1
        t_ys12 = np.append(t_ys12, t_y.to(ureg("N/(m**2)")))
    t_y = qs12L[-1] / Wing.ThSpar1
    t_ys12 = np.append(t_ys12, t_y.to(ureg("N/(m**2)")))
    # Moments from section 2 -> 3
    t_xs23 = np.array([])
    t_ys23 = np.array([])
    for i in range(0, len(qs23) - 1):
        x_loc_1, y_loc_1 = Wing.get_xy_from_perim(s2[i] / Wing.Chordlength,
                                                  Wing.ChSpar1)
        x_loc_2, y_loc_2 = Wing.get_xy_from_perim(s2[i + 1] / Wing.Chordlength,
                                                  Wing.ChSpar1)
        x_loc_1 *= Wing.Chordlength
        x_loc_2 *= Wing.Chordlength
        y_loc_1 *= Wing.Chordlength
        y_loc_2 *= Wing.Chordlength
        Force_angle = np.arctan2(y_loc_2 - y_loc_1, x_loc_2 - x_loc_1)
        t_x = qs23[i] / Wing.ThSkin * np.cos(Force_angle)
        t_y = qs23[i] / Wing.ThSkin * np.sin(Force_angle)
        t_xs23 = np.append(t_xs23, t_x.to(ureg("N/(m**2)")))
        t_ys23 = np.append(t_ys23, t_y.to(ureg("N/(m**2)")))

    t_x = qs23[-1] / Wing.ThSkin * np.cos(Force_angle)
    t_y = qs23[-1] / Wing.ThSkin * np.sin(Force_angle)

    t_xs23 = np.append(t_xs23, t_x.to(ureg("N/(m**2)")))
    t_ys23 = np.append(t_ys23, t_y.to(ureg("N/(m**2)")))
    # Moments from section 3->5
    t_ys35 = np.array([])
    for i in range(0, len(qs35) - 1):
        t_y = qs35[i] / Wing.ThSpar2
        t_ys35 = np.append(t_ys35, t_y.to(ureg("N/(m**2)")))

    t_y = qs35[-1] / Wing.ThSpar2

    t_ys35 = np.append(t_ys35, t_y.to(ureg("N/(m**2)")))
    # Moments from section 5 -> 6
    t_xs56 = np.array([])
    t_ys56 = np.array([])
    for i in range(0, len(qs56) - 1):
        x_loc_1, y_loc_1 = Wing.get_xy_from_perim(s4[i] / Wing.Chordlength,
                                                  Wing.ChSpar2,
                                                  reverse=True)
        x_loc_2, y_loc_2 = Wing.get_xy_from_perim(s4[i + 1] / Wing.Chordlength,
                                                  Wing.ChSpar2,
                                                  reverse=True)
        x_loc_1 *= Wing.Chordlength
        x_loc_1 -= x_coor_AC
        x_loc_2 *= Wing.Chordlength
        x_loc_2 -= x_coor_AC
        y_loc_1 *= Wing.Chordlength
        y_loc_2 *= Wing.Chordlength

        Force_angle = np.arctan2(y_loc_2 - y_loc_1, x_loc_2 - x_loc_1)
        t_x = qs56[i] / Wing.ThSkin * np.cos(Force_angle)
        t_y = qs56[i] / Wing.ThSkin * np.sin(Force_angle)

        t_xs56 = np.append(t_xs56, t_x.to(ureg("N/(m**2)")))
        t_ys56 = np.append(t_ys56, t_y.to(ureg("N/(m**2)")))

    t_x = qs56[-1] / Wing.ThSkin * np.cos(Force_angle)
    t_y = qs56[-1] / Wing.ThSkin * np.sin(Force_angle)

    t_xs56 = np.append(t_xs56, t_x.to(ureg("N/(m**2)")))
    t_ys56 = np.append(t_ys56, t_y.to(ureg("N/(m**2)")))
    # Moment 6 -> 1
    t_ys61 = np.array([])
    for i in range(0, len(qs61) - 1):
        t_y = qs61[i] / Wing.ThSpar1
        t_ys61 = np.append(t_ys61, t_y.to(ureg("N/(m**2)")))
    t_y = qs61[-1] / Wing.ThSpar1
    t_ys61 = np.append(t_ys61, t_y.to(ureg("N/(m**2)")))

    t_xs23 *= ureg("N/(m**2)")
    t_xs56 *= ureg("N/(m**2)")
    t_ys12 *= ureg("N/(m**2)")
    t_ys23 *= ureg("N/(m**2)")
    t_ys35 *= ureg("N/(m**2)")
    t_ys56 *= ureg("N/(m**2)")
    t_ys61 *= ureg("N/(m**2)")
    return t_xs23, t_xs56, t_ys12, t_ys23, t_ys35, t_ys56, t_ys61
Esempio n. 2
0
def Calc_base_shear_flow(boom_areas, n):
    """
    :param boom_areas: Return variable from  Boom_area function
    :param n: Number of sections that divides the perimiter
    :return: Arrays with s's and qs's, seperated for L and D
    """
    strs_x_coords, strs_y_coords, _ = Wing.x_y_angle_coords
    strs_x_coords.ito(ureg("m"))
    strs_y_coords.ito(ureg("m"))
    strs_x_coords = np.append(strs_x_coords, np.flip(strs_x_coords, 0))
    strs_x_coords *= ureg('m')
    strs_y_coords = np.append(strs_y_coords, np.flip(-1 * strs_y_coords, 0))
    strs_y_coords *= ureg('m')
    S_x = WingStress.D
    S_y = WingStress.L
    Ixx = Inertia.Ixx_wb
    Iyy = Inertia.Iyy_wb
    ## section 1 2
    ds = Wing.HSpar1 / (2 * n)
    qs12L = np.array([])
    qs12D = np.array([])
    qs12L = np.append(qs12L, 0)
    qs12D = np.append(qs12D, 0)
    s1 = np.array([])
    s1 = np.append(s1, 0)
    s = Q_("0 m")
    q_loc_L = 0
    q_loc_D = 0
    x = (Wing.ChSpar1 - Wing.centroid
         ) * Wing.Chordlength  # x_coordinate of Spar 1 w.r.t. the centroid
    for _ in range(n - 1):
        s += ds
        y = s
        s1 = np.append(s1, s)
        # Lift
        q_loc_L += -(S_y / Ixx) * Wing.ThSpar1 * y * ds
        qs12L = np.append(qs12L, q_loc_L.to(ureg("N/m")))
        # Drag
        q_loc_D += -(S_x / Iyy) * Wing.ThSpar1 * x * ds
        qs12D = np.append(qs12D, q_loc_D.to(ureg("N/m")))
    s += ds
    y = s
    s1 = np.append(s1, s)
    # Lift
    q_loc_L += -(S_y / Ixx) * (Wing.ThSpar1 * y * ds +
                               boom_areas[0] * Wing.HSpar1 / 2)
    qs12L = np.append(qs12L, q_loc_L.to(ureg("N/m")))
    # Drag
    q_loc_D += -(S_x / Iyy) * (Wing.ThSpar1 * x * ds + boom_areas[0] * x)
    qs12D = np.append(qs12D, q_loc_D.to(ureg("N/m")))

    ## section 2 3
    ds = (Wing.skin_length) / n
    s = Q_("0 m")
    qs23L = np.array([])
    qs23L = np.append(qs23L, qs12L[-1])
    qs23D = np.array([])
    qs23D = np.append(qs23D, qs12D[-1])
    s2 = np.array([])
    s2 = np.append(s2, s)
    str_counter = 0
    for _ in range(n):
        s = np.add(ds, s)
        s2 = np.append(s2, s)
        x_coor, y_coor = Wing.get_xy_from_perim(s / Wing.Chordlength,
                                                Wing.ChSpar1)  # RELATIVE!!
        # Lift
        q_loc_L += -(S_y / Ixx) * (Wing.ThSkin * y_coor * Wing.Chordlength *
                                   ds)

        # Drag
        q_loc_D += -(S_x / Iyy) * (Wing.ThSkin * (x_coor - Wing.centroid) *
                                   Wing.Chordlength * ds)
        if (np.sqrt(
            (x_coor * Wing.Chordlength - strs_x_coords[str_counter])**2 +
            (y_coor * Wing.Chordlength - strs_y_coords[str_counter])**2) <
                Q_("1 cm")):
            print("s2:", strs_x_coords[str_counter])
            q_loc_L += -(S_y /
                         Ixx) * Wing.A_stringer * strs_y_coords[str_counter]
            q_loc_D += -(S_x / Iyy) * Wing.A_stringer * (
                strs_x_coords[str_counter] / Wing.Chordlength -
                Wing.centroid) * Wing.Chordlength
            str_counter += 1
        qs23L = np.append(qs23L, q_loc_L.to(ureg("N/m")))
        qs23D = np.append(qs23D, q_loc_D.to(ureg("N/m")))

    ## Section 3 5
    ds = Wing.HSpar2 / n
    qs35L = np.array([])
    qs35D = np.array([])
    qs35L = np.append(qs35L, qs23L[-1])
    qs35D = np.append(qs35D, qs23D[-1])
    s3 = np.array([])
    s3 = np.append(s3, 0)
    s = Q_("0 m")
    x = (Wing.ChSpar2 - Wing.centroid
         ) * Wing.Chordlength  # x_coordinate of Spar 1 w.r.t. the centroid

    for _ in range(n):
        s += ds
        y = Wing.HSpar2 / 2 - s
        s3 = np.append(s3, s)
        # Lift
        q_loc_L += -(S_y / Ixx) * Wing.ThSpar2 * y * ds
        qs35L = np.append(qs35L, q_loc_L.to(ureg("N/m")))
        # Drag
        q_loc_D += -(S_x / Iyy) * Wing.ThSpar2 * x * ds
        qs35D = np.append(qs35D, q_loc_D.to(ureg("N/m")))

    ## section 5 6
    ds = (Wing.skin_length) / n
    s = Q_("0 m")
    qs56L = np.array([])
    qs56L = np.append(qs56L, qs35L[-1])
    qs56D = np.array([])
    qs56D = np.append(qs56D, qs35D[-1])
    s4 = np.array([])
    s4 = np.append(s4, s)
    for _ in range(n):
        s = np.add(ds, s)
        s4 = np.append(s4, s)
        x_coor, y_coor = Wing.get_xy_from_perim(s / Wing.Chordlength,
                                                Wing.ChSpar2,
                                                reverse=True)  # RELATIVE!!
        # Lift
        q_loc_L += -(S_y / Ixx) * (Wing.ThSkin * y_coor * Wing.Chordlength *
                                   ds)

        # Drag
        q_loc_D += -(S_x / Iyy) * (Wing.ThSkin * (x_coor - Wing.centroid) *
                                   Wing.Chordlength * ds)
        if (str_counter < Wing.N_stringers):
            if (abs(x_coor * Wing.Chordlength - strs_x_coords[str_counter]) <
                    Q_("1 cm")):
                q_loc_L += -(
                    S_y / Ixx) * Wing.A_stringer * strs_y_coords[str_counter]
                print(strs_x_coords[str_counter])
                q_loc_D += -(S_x / Iyy) * Wing.A_stringer * (
                    strs_x_coords[str_counter] / Wing.Chordlength -
                    Wing.centroid) * Wing.Chordlength
                str_counter += 1
        qs56L = np.append(qs56L, q_loc_L.to(ureg("N/m")))
        qs56D = np.append(qs56D, q_loc_D.to(ureg("N/m")))

    ## section 6 1
    ds = Wing.HSpar1 / (2 * n)
    qs61L = np.array([])
    qs61D = np.array([])
    qs61L = np.append(qs61L, qs56L[-1])
    qs61D = np.append(qs61D, qs56D[-1])
    s5 = np.array([])
    s5 = np.append(s5, 0)
    s = Q_("0 m")
    x = (Wing.ChSpar1 - Wing.centroid
         ) * Wing.Chordlength  # x_coordinate of Spar 1 w.r.t. the centroid
    y = -Wing.HSpar1 / 2
    # Lift
    s5 = np.append(s5, 0)
    q_loc_L += -(S_y / Ixx) * (Wing.ThSpar1 * y * ds + boom_areas[-1] * y)
    qs61L = np.append(qs61L, q_loc_L.to(ureg("N/m")))
    # Drag
    q_loc_D += -(S_x / Iyy) * (Wing.ThSpar1 * x * ds + boom_areas[-1] * x)
    qs61D = np.append(qs61D, q_loc_D.to(ureg("N/m")))
    for _ in range(n - 1):
        s += ds
        y = -Wing.HSpar1 / 2 + s  # x_coordinate of Spar 1 w.r.t. the centroid
        s5 = np.append(s5, s)
        # Lift
        q_loc_L += -(S_y / Ixx) * Wing.ThSpar1 * y * ds
        qs61L = np.append(qs61L, q_loc_L.to(ureg("N/m")))
        # Drag
        q_loc_D += -(S_x / Iyy) * Wing.ThSpar1 * x * ds
        qs61D = np.append(qs61D, q_loc_D.to(ureg("N/m")))

    s1 *= ureg("m")
    s2 *= ureg("m")
    s3 *= ureg("m")
    s4 *= ureg("m")
    s5 *= ureg("m")
    qs12L *= ureg("N/m")
    qs12D *= ureg("N/m")
    qs23L *= ureg("N/m")
    qs23D *= ureg("N/m")
    qs35L *= ureg("N/m")
    qs35D *= ureg("N/m")
    qs56L *= ureg("N/m")
    qs56D *= ureg("N/m")
    qs61L *= ureg("N/m")
    qs61D *= ureg("N/m")

    return s1, s2, s3, s4, s5, qs12L, qs23L, qs35L, qs56L, qs61L, qs12D, qs23D, qs35D, qs56D, qs61D
Esempio n. 3
0
def Calc_moment_due_to_shear(s1, s2, s3, s4, s5, qs12L, qs23L, qs35L, qs56L,
                             qs61L):

    x_coor_AC = 0.25 * Wing.Chordlength
    Moment_L = 0
    # Moments from section 1 -> 2
    for i in range(0, len(qs12L) - 1):
        q_loc = (qs12L[i] + qs12L[i + 1]) / 2
        s_loc = (s1[i] + s1[i + 1]) / 2
        ds = s1[i + 1] - s1[i]
        x_loc = Wing.ChSpar1 * Wing.Chordlength - x_coor_AC

        F_y = q_loc * ds
        Moment_L += F_y * x_loc

    # Moments from section 2 -> 3

    for i in range(0, len(qs23L) - 1):
        q_loc = (qs23L[i] + qs23L[i + 1]) / 2
        s_loc = (s2[i] + s2[i + 1]) / 2
        ds = s2[i + 1] - s2[i]
        x_loc_1, y_loc_1 = Wing.get_xy_from_perim(s2[i] / Wing.Chordlength,
                                                  Wing.ChSpar1)
        x_loc_2, y_loc_2 = Wing.get_xy_from_perim(s2[i + 1] / Wing.Chordlength,
                                                  Wing.ChSpar1)
        x_loc_1 *= Wing.Chordlength

        x_loc_2 *= Wing.Chordlength

        y_loc_1 *= Wing.Chordlength
        y_loc_2 *= Wing.Chordlength
        Force_angle = np.arctan2(y_loc_2 - y_loc_1, x_loc_2 - x_loc_1)
        x_loc_1 -= x_coor_AC
        x_loc_2 -= x_coor_AC
        F_x = q_loc * ds * np.cos(Force_angle)
        F_y = q_loc * ds * np.sin(Force_angle)

        Moment_L += -F_x * (y_loc_2 + y_loc_1) / 2 + F_y * (x_loc_2 +
                                                            x_loc_1) / 2

    # Moments from section 3->5
    t_ys35 = np.array([])
    for i in range(0, len(qs35L) - 1):
        q_loc = (qs35L[i] + qs35L[i + 1]) / 2
        s_loc = (s3[i] + s3[i + 1]) / 2
        ds = s3[i + 1] - s3[i]
        x_loc = Wing.ChSpar2 * Wing.Chordlength - x_coor_AC

        F_y = q_loc * ds

        Moment_L += -F_y * x_loc

    # Moments from section 5 -> 6

    for i in range(0, len(qs56L) - 1):
        q_loc = (qs56L[i] + qs56L[i + 1]) / 2
        s_loc = (s4[i] + s4[i + 1]) / 2
        ds = s4[i + 1] - s4[i]
        x_loc_1, y_loc_1 = Wing.get_xy_from_perim(s4[i] / Wing.Chordlength,
                                                  Wing.ChSpar2,
                                                  reverse=True)
        x_loc_2, y_loc_2 = Wing.get_xy_from_perim(s4[i + 1] / Wing.Chordlength,
                                                  Wing.ChSpar2,
                                                  reverse=True)
        x_loc_1 *= Wing.Chordlength
        x_loc_1 -= x_coor_AC
        x_loc_2 *= Wing.Chordlength
        x_loc_2 -= x_coor_AC
        y_loc_1 *= Wing.Chordlength
        y_loc_2 *= Wing.Chordlength

        Force_angle = np.arctan2(y_loc_2 - y_loc_1, x_loc_2 - x_loc_1)

        F_x = q_loc * ds * np.cos(Force_angle)
        F_y = q_loc * ds * np.sin(Force_angle)
        Moment_L += -F_x * (y_loc_2 + y_loc_1) / 2 + F_y * (x_loc_2 +
                                                            x_loc_1) / 2

    # Moment 6 -> 1

    for i in range(0, len(qs61L) - 1):
        q_loc = (qs61L[i] + qs61L[i + 1]) / 2
        s_loc = (s5[i] + s5[i + 1]) / 2
        ds = s5[i + 1] - s5[i]
        x_loc = Wing.ChSpar1 * Wing.Chordlength - x_coor_AC

        F_y = q_loc * ds
        Moment_L += F_y * x_loc

    return Moment_L