Exemplo n.º 1
0
def Get_boom_area(A_spar_caps):
    """
    This function calculates the boom area's needed for the structural idealization
    It assumes the wingbox is loaded in bending.
    :param A_spar_caps: Spar cap area's [Expected With Unit]
    :return: Boom area array with dimension.
    """
    x_coords = Wing.x_y_angle_coords[0]
    y_coords = Wing.x_y_angle_coords[1]
    n_str = len(x_coords)
    t_sk = Wing.ThSkin
    h_sp_1 = Wing.HSpar1
    h_sp_2 = Wing.HSpar2
    B_area = np.array([])

    B_1 = A_spar_caps  #+ (Wing.ThSpar1*h_sp_1/6)*(2 + (-1)) + (t_sk*Wing.perim_spacing/6)*(2 + y_coords[1]/y_coords[0])
    B_area = np.append(B_area, B_1.to(ureg("m**2")))

    B_2 = Wing.A_stringer  #+ (t_sk*Wing.perim_spacing/6)*(2 + h_sp_1/2/ y_coords[0]) + (t_sk*Wing.perim_spacing/6)*(2 + y_coords[1]/ y_coords[0])
    B_area = np.append(B_area, B_2.to(ureg("m**2")))
    for i in range(1, n_str - 1):
        B_i = Wing.A_stringer  #+ (t_sk*Wing.perim_spacing/6)*(2 + y_coords[i-1]/ y_coords[i]) + (t_sk*Wing.perim_spacing/6)*(2 + y_coords[i+1]/ y_coords[i])
        B_area = np.append(B_area, B_i.to(ureg("m**2")))

    B_n_min_1 = Wing.A_stringer  #+ (t_sk*Wing.perim_spacing/6)*(2 + h_sp_2/2 / y_coords[-1]) + (t_sk*Wing.perim_spacing/6)*(2 + y_coords[-2]/ y_coords[-1])
    B_area = np.append(B_area, B_n_min_1.to(ureg("m**2")))

    #B_n = (t_sk*Wing.perim_spacing/6)*(2 + y_coords[-2]/ y_coords[-1]) + (Wing.ThSpar2*h_sp_2/6)*(2 + (-1))
    #B_area = np.append(B_area, B_n.to(ureg("m**2")))

    B_area = np.append(B_area, np.flip(B_area, 0))

    return B_area * ureg("m**2")
Exemplo n.º 2
0
def Correcting_shearflow_array(n, qs0L, qs0D):
    qs0_L = np.array([])
    qs0_D = np.array([])
    for _ in range(n + 1):
        qs0_L = np.append(qs0_L, qs0L)
        qs0_D = np.append(qs0_D, qs0D)
    return qs0_L * ureg("N/m"), qs0_D * ureg("N/m")
Exemplo n.º 3
0
def GetShearX(c, bottom_side=False, inter1=tau23Xinterp, inter2=tau56Xinterp):
    if c > Wing.ChSpar2 - (1e-2):
        print("⚠ c is out of range!! ⚠")
        c = Wing.ChSpar2 - (1e-2)
    x_coor = c * Wing.Chordlength
    if bottom_side == False:
        return_val = inter1(x_coor)
        return_val *= ureg("Pa")
        return return_val
    else:
        return_val = inter2(x_coor)
        return_val *= ureg("Pa")
        return return_val
Exemplo n.º 4
0
def data_reader(velocity, needed_value):
    if velocity.__class__ != int and velocity.__class__ != float:
        velocity.ito(ureg("m/s"))
        velocity = velocity.magnitude
    if velocity < 15:
        print(
            "ERROR: please supply a value for velocity between 15 and 160 m/s")
        return
    index = int(velocity) - 15
    if needed_value == "Propeller efficiency":
        col = 0
        unit = "none"
    elif needed_value == "Total thrust":
        col = 1
        unit = "newton"
    elif needed_value == "Pitch angle":
        col = 2
        unit = "degree"
    elif needed_value == "Power needed":
        col = 3
        unit = "W"
    elif needed_value == "Torque":
        col = 4
        unit = "newton * meter"
    else:
        print("ERROR: please supply a valid column header as needed_value")
        return

    return Q_("{} {}".format(data[index, col], unit))
Exemplo n.º 5
0
def calc_total_stringer_inertia(x_y_angle_coords, stringer_inertias):

    x_coords = x_y_angle_coords[0]
    x_coords = np.append(x_coords, x_coords)
    x_coords *= ureg.meter
    # print(x_coords)
    y_coords = x_y_angle_coords[1]
    y_coords = np.append(y_coords, -y_coords)
    y_coords *= ureg.meter
    angles = x_y_angle_coords[2]
    angles = np.append(angles, angles)
    angles *= ureg("rad")

    I_xx_stringer = stringer_inertias[0][0]
    I_yy_stringer = stringer_inertias[0][1]
    I_xy_stringer = stringer_inertias[0][2]
    stringer_area = stringer_inertias[2]
    I_XX_TOT = Q_("0 m**4")
    I_YY_TOT = Q_("0 m**4")
    I_XY_TOT = Q_("0 m**4")
    Y_CEN = Q_("0 m")
    for i in range(len(x_coords)):
        loc_I_xx, loc_I_yy, loc_I_xy = axis_transformation(
            I_xx_stringer, I_yy_stringer, I_xy_stringer, angles[i])
        I_XX_TOT += loc_I_xx + stringer_area * (y_coords[i])**2
        I_YY_TOT += loc_I_yy + stringer_area * (
            x_coords[i] - Wing.centroid * Wing.Chordlength)**2
        I_XY_TOT += loc_I_xy + stringer_area * (
            x_coords[i] - Wing.centroid * Wing.Chordlength) * (y_coords[i] -
                                                               Y_CEN)

    return I_XX_TOT, I_YY_TOT, I_XY_TOT
Exemplo n.º 6
0
def deformation_y(zs):
    deformation_temp = Llist[-1] / 24 * (
        zs)**4  #-Geometry.Fuselage.D_fus_max/2
    deformation_temp += -((Llist[-1] - Llist[0]) / (GWing.b / 2)) / 120 * (
        zs -
        Geometry.Fuselage.D_fus_max / 2)**5  #-Geometry.Fuselage.D_fus_max/2
    deformation_y = -deformation_temp / (youngs_modulus * Inertia.Iyy_wb)
    #deformation_y += L_moment/2*Geometry.Fuselage.D_fus_max**2/(youngs_modulus*Inertia.Iyy_wb)
    return deformation_y.to(ureg("meter"))
Exemplo n.º 7
0
def transform_to_xy(s2, s4, tau23X, tau56X, tau23Y, tau56Y):
    start_x_perim = Wing.get_perim_from_x(Wing.ChSpar1)
    xs2 = np.array([])
    ys2 = np.array([])
    for s in s2:
        #print("s=", s)
        x_coor, y_coor = Wing.lookup_xy_from_perim(
            Wing.perim_interpolant_x,
            Wing.perim_interpolant_y,
            Wing.perim_interpolant_inv_x,
            Wing.perim_interpolant_inv_y,
            s / Wing.Chordlength,
            start_x_perim=start_x_perim)
        x_coor *= Wing.Chordlength.to(ureg("m"))
        y_coor *= Wing.Chordlength.to(ureg("m"))
        xs2 = np.append(xs2, x_coor)
        ys2 = np.append(ys2, y_coor)

    start_x_perim = Wing.get_perim_from_x(Wing.ChSpar2, inverse=True)
    xs2 *= ureg("m")
    ys2 *= ureg("m")
    xs4 = np.array([])
    ys4 = np.array([])
    for s in s4:
        #print("s=",s)
        x_coor, y_coor = Wing.lookup_xy_from_perim(
            Wing.perim_interpolant_x,
            Wing.perim_interpolant_y,
            Wing.perim_interpolant_inv_x,
            Wing.perim_interpolant_inv_y,
            s / Wing.Chordlength,
            start_x_perim=start_x_perim,
            inverse=True)
        x_coor *= Wing.Chordlength.to(ureg("m"))
        y_coor *= Wing.Chordlength.to(ureg("m"))

        xs4 = np.append(xs4, x_coor)
        ys4 = np.append(ys4, y_coor)

    xs4 *= ureg("m")
    ys4 *= ureg("m")

    tau23Xinterp = interpolate.interp1d(xs2, tau23X)
    tau23Yinterp = interpolate.interp1d(xs2, tau23Y)
    tau56Xinterp = interpolate.interp1d(xs4, tau56X)
    tau56Yinterp = interpolate.interp1d(xs4, tau56Y)

    return tau23Xinterp, tau23Yinterp, tau56Xinterp, tau56Yinterp
Exemplo n.º 8
0
def Tsai_Wu(sigma_x, shear_x):
    F11=1/(yield_strength*compr_strength)
    F22 = F11
    F12 = -1/2*np.sqrt(F11*F22)
    F1 = 1/(yield_strength)-1/(compr_strength)
    F2 = 1/(yield_strength)-1/(compr_strength)
    F44 = 1/tau_max**2
    F66 = 1/tau_max**2
    sigma1 = sigma_x
    sigma2 = Q_("0 MPa")
    sigma3 = Q_("0 MPa")
    tau12 = shear_x
    tau23 = Q_("0 MPa")
    tau13 = Q_("0 MPa")
    F = F11 *sigma1**2+F22*(sigma2**2+sigma3**2)+sigma2*sigma3*(2*F22-F44)
    F += 2*F12*sigma1*(sigma3+sigma2)+F1*(sigma1+sigma2) + F2*sigma3
    F += F44*tau23**2 + F66*(tau13**2+tau12**2)
    F.ito(ureg('dimensionless'))
    if F.magnitude < 1:
        print("No failure occurs")
    if F.magnitude >= 1:
        print("Failure occurs")

    return F
Exemplo n.º 9
0
def input_acceleration(yaw_acceleration, pitch_acceleration, yaw_rate,
                       pitch_rate):
    # Make compatible for inputs with and without units
    if yaw_acceleration.__class__ == int or yaw_acceleration.__class__ == float:
        yaw_acceleration *= ureg("rad/s**2")
    if pitch_acceleration.__class__ == int or pitch_acceleration.__class__ == float:
        pitch_acceleration *= ureg("rad/s**2")
    if yaw_rate.__class__ == int or yaw_rate.__class__ == float:
        yaw_rate *= ureg("rad/s")
    if pitch_rate.__class__ == int or pitch_rate.__class__ == float:
        pitch_rate *= ureg("rad/s")

    m_y = Propeller.izg * yaw_acceleration + (Propeller.ixg -
                                              Propeller.izg) * pitch_rate * rpm
    m_z = Propeller.izg * pitch_acceleration + (Propeller.izg -
                                                Propeller.ixg) * yaw_rate * rpm

    m_y.ito(ureg("newton * meter"))
    m_z.ito(ureg("newton * meter"))

    print("Yaw moment: {}".format(m_y))
    print("Pitch moment: {}".format(m_z))
    return [m_y, m_z]
Exemplo n.º 10
0
def input_moment(yaw_moment, pitch_moment, yaw_rate, pitch_rate):
    # Make compatible for inputs with and without units
    if yaw_moment.__class__ == int or yaw_moment.__class__ == float:
        yaw_moment *= ureg("newton*meter")
    if pitch_moment.__class__ == int or pitch_moment.__class__ == float:
        pitch_moment *= ureg("newton*meter")
    if yaw_rate.__class__ == int or yaw_rate.__class__ == float:
        yaw_rate *= ureg("rad/s")
    if pitch_rate.__class__ == int or pitch_rate.__class__ == float:
        pitch_rate *= ureg("rad/s")

    omega_y_dot = (
        yaw_moment -
        (Propeller.ixg - Propeller.izg) * pitch_rate * rpm) / Propeller.izg
    omega_z_dot = (
        pitch_moment -
        (Propeller.izg - Propeller.ixg) * yaw_rate * rpm) / Propeller.izg

    omega_y_dot.ito(ureg("rad/s**2"))
    omega_z_dot.ito(ureg("rad/s**2"))

    print("Yaw acceleration: {}".format(omega_y_dot))
    print("Pitch acceleration: {}".format(omega_z_dot))
    return [omega_y_dot, omega_z_dot]
Exemplo n.º 11
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
Exemplo n.º 12
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
Exemplo n.º 13
0
def Moment_shearflow(n):
    qmoment = WingStress.M / (2 * Wing.Area_cell())
    q_moment = np.array([])
    for _ in range(n + 1):
        q_moment = np.append(q_moment, qmoment)
    return q_moment * ureg("N/m")
Exemplo n.º 14
0
def fuselage_calc(x, y, z):

    #Boom areas section 1 (normal)
    B_sec1 = t * (b_f80 / 2) / 2 + t * (b_f80 / 2) / 2          #area for all booms


    #Boom areas section 2 (cut out)
    B_sec2 = t * (b_f80 / 2) / 2 + t * (b_f80 / 2) / 2

    #Boom areas section 3 (cone/taper)
    def B_calc(x):
        if Q_('0 m') <= x <= l_sec1 + l_sec2:
            b_f_taper = b_f80
            B_sec3 = B_sec1

        if l_sec1 + l_sec2 < x <= l_fus:
            b_f_taper = b_f80 - ((b_f80 / (l_sec3 + l_sec2)) * (x - l_sec2 - l_sec1))
            B_sec3 = t * (b_f_taper / 2) / 2 + t * (b_f_taper / 2) / 2


        return B_sec3, b_f_taper

    # y = B_calc(x)[1]
    # z = B_calc(x)[1]                                         #the dreadful z


    B_sec3, b_f_taper = B_calc(x)

    '''------------------Inertia calculation-----------------------'''

    #Inertia section 1 (normal)
    Iyy_sec1 = (b_f80/2)**2 * B_sec1 * 4
    Izz_sec1 = Iyy_sec1

    #Inertia section 2
    Iyy_sec2 = (b_f80/2)**2 * B_sec2 * 4
    Izz_sec2 = Iyy_sec2

    #Inertia section 3
    Iyy_sec3 = (b_f_taper/2)**2 * B_sec3 * 4
    Izz_sec3 = Iyy_sec3

    print(x, b_f80, b_f_taper)
    '''------------Loading force/moment calculation------------'''

    #Tail force calculation
    cl_vt, cd_vt, cm_vt = AWing.computeloadsvt()
    cl_ht, cd_ht, cm_ht = AWing.computeloadsht()
    L_VT = 0.5 * cl_vt * rho * (V ** 2) * S_VT                          #Tangent forces of the control surfaces at full deflection
    L_HT = 0.5 * cl_ht * rho * (V ** 2) * S_HT

    D_VT = 0.5 * cd_vt * rho * (V ** 2) * S_VT                          #Normal forces of the control surfaces at full deflection
    D_HT = 0.5 * cd_ht * rho * (V ** 2) * S_HT

    M_VT = 0.5 * cm_vt * rho * (V ** 2) * S_VT * MAC_VT
    M_HT = 0.5 * cm_vt * rho * (V ** 2) * S_HT * MAC_HT


    #Bending Loading section 1
    My_sec1 = Engine_mounts.m_y         #calculation of the resultant moment in y as variable of z
    Mx_sec1 = Engine_mounts.m_x         #calculation of the resultant moment in y as variable of z
    Mz_sec1 = x * Engine_mounts.f_z + Engine_mounts.m_z          #calculation of the resultant moment in y as variable of z

    #Bending Loading section 2
    My_sec2 = (l_fus - x) * L_VT
    My_sec2.ito(ureg('N * m'))
    Mx_sec2 = (b_VT * 0.33) * L_VT
    Mx_sec2.ito(ureg('N * m'))
    Mz_sec2 = -(l_fus - x) * L_HT - (b_VT * 0.33) * D_VT
    Mz_sec2.ito(ureg('N * m'))

    #Bending Loading section 3
    My_sec3 = My_sec2
    Mx_sec3 = Mx_sec2
    Mz_sec3 = Mz_sec2


    #Axial Loading of section 1, 2 & 3
    ax_sec1 = Engine_mounts.f_x
    ax_sec2 = D_VT + D_HT
    ax_sec3 = ax_sec2


    '''----------Bending stress calculations----------------'''



    def normal_shear_stress(x):

        if Q_('0 m') <= x <= l_sec1:
            '''section 1'''

            #Bending section 1
            sigma_x = My_sec1 / Iyy_sec1 * z + Mz_sec1 / Izz_sec1 * y + (ax_sec1 / (B_sec1 * 4))        #bending stress
            #Torsion section 1

            q_x_sec1 = Mx_sec1 / (2 * b_f80 * b_f80)                                  #shear flow
            shear_x = q_x_sec1

        if l_sec1 < x < l_sec1 + l_sec2:

            '''section 2'''
            #Bending section 2
            sigma_x = My_sec2 / Iyy_sec2 * z + Mz_sec2 / Izz_sec2 * y + (ax_sec2 / (B_sec2 * 4))

            #Torsion section 2

            q_x_sec2 = Mx_sec2 / (2 * b_f80 * b_f80)
            shear_x = q_x_sec2

        if l_sec1 + l_sec2 <= x <= l_fus:
            '''section 3'''
            #Bending section 3
            sigma_x = My_sec3 / Iyy_sec3 * z + Mz_sec3 / Izz_sec3 * y + (ax_sec3 / (B_sec3 * 4))

            #Torsion section 3
            q_x_sec3 = Mx_sec3 / (2 * b_f_taper * b_f_taper)
            shear_x = q_x_sec3

        return sigma_x, shear_x

    sigma_x, shear_x = normal_shear_stress(x)

    '''------------Cut out correction calculation---------------'''
    q_12 = normal_shear_stress(x)[1]

    q_34_cor = (b_f80 * q_12) / b_f80
    q_23_cor = (b_f80 * q_34_cor) / b_f80
    q_14_cor = (b_f80 * q_23_cor) / b_f80
    print(q_34_cor, q_23_cor, q_14_cor)
    q_34 = q_12 + -q_34_cor
    q_23 = q_12 + q_23_cor
    q_14 = q_12 + q_14_cor
    q_12 = q_12 + -q_12


    P = ((q_14_cor + q_23_cor) * l_sec2) / 2


    P_stress = P / B_sec3

    if y > Q_('0 m') and z > Q_('0 m'):
        P_stress = -P_stress
    if y < Q_('0 m') and z < Q_('0 m'):
        P_stress = -P_stress

    if l_sec1 < x < l_sec1 + l_sec2:
        sigma_x = sigma_x + P_stress
        print('P_stress', P_stress)

        shear_x = q_34

        if z >= b_f_taper - Q_('0.01 m') or z <= -b_f_taper + Q_('0.01 m'):
            shear_x = q_23



    '''-------------Cut Out correction for non cut out parts (sec 1 and sec 3---------------'''

    if x <= l_sec1:
        a = np.array([[b_f_taper.magnitude, 0, -b_f_taper.magnitude, 0],
                     [0, b_f_taper.magnitude, 0, -b_f_taper.magnitude],
                     [0, 0, l_sec1.magnitude, l_sec1.magnitude],
                     [b_f_taper.magnitude, -b_f_taper.magnitude, 0, 0]])

        b = np.array([0, 0, P.magnitude, 0])

        M = np.linalg.solve(a, b)

        q_34 = shear_x + -M[2] * Q_('N/m')
        q_23 = shear_x + M[1] * Q_('N/m')
        q_14 = shear_x + M[3] * Q_('N/m')
        q_12 = shear_x + -M[0] * Q_('N/m')

        shear_x = q_12

        if z >= b_f_taper - Q_('0.01 m') or z <= -b_f_taper + Q_('0.01 m'):
            shear_x = q_23

    if x >= l_sec1 + l_sec2:
        a = np.array([[b_f_taper.magnitude, 0, -b_f_taper.magnitude, 0],
                      [0, b_f_taper.magnitude, 0, -b_f_taper.magnitude],
                      [0, 0, l_sec3.magnitude, l_sec3.magnitude],
                      [b_f_taper.magnitude, -b_f_taper.magnitude, 0, 0]])

        b = np.array([0, 0, P.magnitude, 0])

        M = np.linalg.solve(a, b)

        q_34 = shear_x + -M[2] * Q_('N/m')
        q_23 = shear_x + M[1] * Q_('N/m')
        q_14 = shear_x + M[3] * Q_('N/m')
        q_12 = shear_x + -M[0] * Q_('N/m')

        shear_x = q_12

        if z >= b_f_taper - Q_('0.01 m') or z <= -b_f_taper + Q_('0.01 m'):
            shear_x = q_23

    '''Area calculation'''
    Area = B_calc(x)[0]*4
    shear_x = shear_x / t

    '''Fuselage Ribs'''

    Area_ribs = b_f_taper * b_f_taper * h_ribs


    return sigma_x, shear_x, Area, Area_ribs
Exemplo n.º 15
0
print("L =", L)  # print the result

## EXAMPLE 3: GETTING THE MAGNITUDE OF A VALUE
## For compatibility reasons with other software
## You might only want the maginutude of a value
## without the unit, this example shows you how:

L_mag = L.magnitude  # Get the magnitude of L
print("\nMagnnitude of L=", L_mag)  # Print the result

## EXAMPLE 4: ASSIGING A UNIT USING A STRING EXPRESSION
## You can also assign a value and unit by typing them as a string
## Use Q_(<USER STRING>) function

I_XX = Q_(
    "2457 mm**4"
)  # To have for instance the 4th power, use the python expression **4
I_YY = Q_("0.002 m**4")

print("\n I_XX=", I_XX)
print("I_yy=", I_YY)

## EXAMPLE 5: CONVERTING UNITS USING STRING EXPRESSION
## FOR COMPOUND UNITS A STRING EXPRESSION IS OFTEN USEFUL
## FOR THE CONVERSION:

I_ZZ = Q_("84.4 lbf*inch*s**2")
print("\n Before conversion: Izz=", I_ZZ)

I_ZZ.ito(ureg("kg*m**2"))
print("After conversion: Izz=", I_ZZ)
Exemplo n.º 16
0
# # Get power needed from prop file
# P = Propeller.Powercalc(V_cruise.magnitude, D.magnitude)[3]
# P = P*Q_("W")
# P.ito(ureg.hp)
# print("Power needed: {}".format(P))

# Use "economic cruise" engine power
P = Q_("192 hp")
V_cruise = Q_("86.5 m/s")

T1 = Q_("0 newton")
# T2 = []
T2 = Q_("1000 newton")
vlst = []

P.ito(ureg("watt"))
# print(P)

# for i in range(0, 25, 1):
#     V_cruise = 71+i
#     T = Propeller.Thrustcalc(V_cruise)[1]
#     T2.append(T)
#     vlst.append(V_cruise)
#     print(V_cruise, T)
#
# plt.plot(vlst, T2)
# plt.show()

while abs(T1 - T2) > Q_("10 newton"):
    if T1 < T2:
        V_cruise += Q_("0.1 m/s")  # abs(T1.magnitude-T2.magnitude)*Q_("m/s")
Exemplo n.º 17
0
from Control import Calc_ISA_100km as ISA
from Aerodynamics import Wing as Aero_wing

mtow = Geometry.Masses.W_MTOW           # [kg] Max. Take-off weight
cl_max_hld = Aero_wing.CL_max_hld       # [-] CL max with HLD's deployed
cl_max_clean = Aero_wing.CL_max         # [-] CL max in clean config
to_distance = Q_("400 m")               # [m] Take-off distance
top = 130                               # [-] Take-Off parameter
s_land = Q_("550 m")                    # [m] Landing distance
V_cruise = Q_("94.1 m/s")               # [m/s] Cruise speed
h_c = Q_("3000 m")                      # [m] Cruise altitude !!!please check!!!
rho_c = ISA.isacal(h_c.magnitude)[2]    # Cruise density
rho_c *= Q_("kg/(m**3)")
rho_0 = Q_("1.225 kg/m**3")
Temp_c = ISA.isacal(h_c.magnitude)[1]   # Cruise temp
Temp_c *= ureg("K")
gamma_isa = 1.41                        # Specific heat ratio
m_c = (V_cruise/np.sqrt(gamma_isa*Temp_c*rho_c)).magnitude  # [-] Cruise Mach number
roc = Q_("16 m/s")                      # [m/s] Rate of Climb
Climb_angle = Q_("45 deg")              # [deg] Climb angle
V_sust = Q_("67.135 m/s")               # [m/s] Sustained turn velocity
n_sust = 4.16                           # [-] Sustained turn load factor
n_max = 10
h_a = Q_("600 m")                       # [m] Manouevring height
rho_a = ISA.isacal(h_a.magnitude)[2]    # [kg/m^3] Manouevring density
rho_a *= Q_(" 1 kg/m**3")
S_wing = Geometry.Wing.S                # Wing span for next calc.
g0 = Q_("9.80665 m/s**2")
V_stall_hld = np.sqrt((2*g0*mtow)/(cl_max_hld*rho_a*S_wing))   # Man. Veloc. at with HLD
V_a_hld = V_stall_hld * m.sqrt(n_max)
V_stall_clean = np.sqrt((2*g0*mtow)/(cl_max_clean*rho_a*S_wing))   # Man. Veloc. clean
Exemplo n.º 18
0
youngs_modulus = Q_("60.1 GPa")  #E
yield_strength = Q_("738 MPa")  #tensile
compr_strength = Q_("657 MPa")  #compression
shear_modulus = Q_("23 GPa")  #G
poisson = 0.31  # maximum 0.33
tau_max = Q_("60 MPa")
density = Q_("1560 kg/m**3")

cl, cd, cm = AWing.computeloads()  #Load aerodynamic properties
n = 10  #number of the devided sections
b = Wing.s  #Wing span
b = b.magnitude * ureg.meter
z = Wing.z

ChordR = Geometry.Wing.c_r.magnitude * ureg.meter  #root chord in m
rho = Performance.rho_c.magnitude * ureg("kg/(m**3)")  #cruise density
V = Performance.V_cruise.magnitude * ureg("m/s")  #cruise speed

dL_moment = Q_('0 kg * m ** 2 / s**2')
dD_moment = Q_('0 kg * m**2/s**2')
L_moment = Q_('0 kg * m ** 2 / s**2')
D_moment = Q_('0 kg * m ** 2 / s**2')

L = Q_('0 kg * m / s**2')
D = Q_('0 kg * m / s**2')
M = Q_('0 kg * m ** 2 / s**2')

Lmomentlist = np.array([])
Dmomentlist = np.array([])
dLlist = np.array([])
dDlist = np.array([])
Exemplo n.º 19
0
# End defining global variables

# Start assigning values to variables
# Engine dry mass as provided by Lycoming
drymass = Q_("446 lbs")
drymass.ito(ureg.kg)
# Assume additional 10% to include fluids and hoses
mass = 1.1 * drymass

# Engine mass moments of inertia about engine cg, as provided by Lycoming
ixg = Q_("84.4 inch*lbf*s**2")
iyg = Q_("93.5 inch*lbf*s**2")
izg = Q_("145.8 inch*lbf*s**2")
# Transfer to SI units
ixg.ito(ureg("kg*m**2"))
iyg.ito(ureg("kg*m**2"))
izg.ito(ureg("kg*m**2"))

# Engine dimensions
length = Q_("39.34 in")
width = Q_("34.25 in")
height = Q_("26.46 in")
# Transfer to SI units
length.ito(ureg.m)
width.ito(ureg.m)
height.ito(ureg.m)

# Engine cg location
# Assumed cg is on crankshaft & in the middle of the engine length
xcg = length / 2
Exemplo n.º 20
0
# X axis: parallel to the crankshaft centreline, pointing towards tail
# Y axis: up
# Z axis: left

# Start defining global variables for easy editing from elsewhere
# For explanations of the variables defined here, see below, where they are given values


def initialise_rpm(inp):
    global rpm
    rpm = inp


# Start assigning values
rpm = Q_("2700 rpm")
rpm.ito(ureg("rad/min"))

# Make function which calculates gyro accelerations (prop only!) from moment and rate inputs


def input_moment(yaw_moment, pitch_moment, yaw_rate, pitch_rate):
    # Make compatible for inputs with and without units
    if yaw_moment.__class__ == int or yaw_moment.__class__ == float:
        yaw_moment *= ureg("newton*meter")
    if pitch_moment.__class__ == int or pitch_moment.__class__ == float:
        pitch_moment *= ureg("newton*meter")
    if yaw_rate.__class__ == int or yaw_rate.__class__ == float:
        yaw_rate *= ureg("rad/s")
    if pitch_rate.__class__ == int or pitch_rate.__class__ == float:
        pitch_rate *= ureg("rad/s")
Exemplo n.º 21
0
# End assigning values

# Hinge moments calculation

# Calculate Angular stick deflections in deg

stick_angle_e = np.rad2deg(np.arcsin(Stick_pedals.d_e / Stick_pedals.l_s))
stick_angle_r = np.rad2deg(np.arcsin(Stick_pedals.d_r / Stick_pedals.l_s))

# Calculate hinge moment factor between stick hinge and control surface hinge
hinge_fac_e = stick_angle_e / Geometry.H_tail.delta_e
hinge_fac_r = stick_angle_r / Geometry.Wing.delta_a

# Calculate maximum aileron hinge moment
m_r_max = f_r_max * Stick_pedals.l_s * hinge_fac_r
m_r_max.ito(ureg("newton * meter"))
print("Maximum aileron hinge moment: {}".format(m_r_max))

# Calculate maximum elevator hinge moment
m_p_max = f_p_max * Stick_pedals.l_s * hinge_fac_e
m_p_max.ito(ureg("newton * meter"))
print("Maximum elevator  hinge moment: {}".format(m_p_max))

# Arm between rudder and cable/pushrod attachment
r_rudder = Stick_pedals.d_p / np.tan(Geometry.V_tail.delta_r)
# Calculate maximum hinge moment in yaw
m_y_max = f_y_max * r_rudder
m_y_max.ito(ureg("newton * meter"))
print("Maximum yaw hinge moment: {}".format(m_y_max))

# Calculate forces in pushrods
Exemplo n.º 22
0
b_f = Geometry.Fuselage.b_f                   #diameter of fuselage at the fire wall
b_f80 = b_f*0.8                               #design radius
print('b_f80', b_f80)
t = Q_('0.0025 m')                             #thickness of fuselage skin
t_ribs = Q_('0.002 m')                          #thickness of the ribs
h_ribs = Q_('0.05 m')                           #the height of the ribs
s_ribs = Q_('0.5 m')                            #rib spacing
moter_w = Q_('180 kg')                          #Resultant weight of the motor
g = Q_('9.81 m / s**2')                         #The gravity acceleration
l_fus = Geometry.Fuselage.l_f                   #length of the fuselage in m
print('l_fus', l_fus)
l_sec1 = Q_('1.5 m')                          #length of section 1 (normal)
l_sec2 = Q_('1.0 m')                          #length of section 2 (cut out)
l_sec3 = l_fus - l_sec1 - l_sec2               #length of section 3 (taper)
print('l_sec3', l_sec3)
rho = Performance.rho_c.magnitude * ureg("kg/(m**3)") #rho at cruise altitude
V = Performance.V_cruise.magnitude * ureg("m/s")        #cruise speed
S_VT = Geometry.V_tail.S                    #area of vertical tail
S_HT = Geometry.H_tail.S                    #are of horizontal tail
b_VT = Geometry.V_tail.b                    #span vertical tail
MAC_VT = Geometry.V_tail.MAC
MAC_HT = Geometry.H_tail.MAC

#Material properties of the chosen material.
#Current chosen material:
#Epoxy/Carbon fiber, UD prepreg, QI lay-up
youngs_modulus = Q_("60.1 GPa")  #E
yield_strength = Q_("738 MPa")  #tensile
compr_strength = Q_("657 MPa") #compression
shear_modulus = Q_("23 GPa")   #G
poisson = 0.31                 # maximum 0.33