Example #1
0
def test_calculate_dynamic_pressure():

    rho = 1
    TAS = 1

    expected_q_inf = 0.5

    q_inf = calculate_dynamic_pressure(rho, TAS)

    assert_almost_equal(expected_q_inf, q_inf)
Example #2
0
def test_calculate_dynamic_pressure():

    rho = 1
    TAS = 1

    expected_q_inf = 0.5

    q_inf = calculate_dynamic_pressure(rho, TAS)

    assert_almost_equal(expected_q_inf, q_inf)
Example #3
0
def get_aerodynamic_moments(TAS, rho, alpha, beta, delta_e, ih, delta_ail,
                            delta_r):

    """ Calculates forces

    Parameters
    ----------
    rho : float
        density (kg/m3).
    TAS : float
        velocity (m/s).
    alpha : float
        attack angle (rad).
    beta : float
        sideslip angle (rad).
    delta_e : float
        elevator deflection (rad).
    ih : float
        stabilator deflection (rad).
    delta_ail : float
        aileron deflection (rad).
    delta_r : float
        rudder deflection (rad).

    Returns
    -------
    moments : array_like
         3 dimensional vector with (Mxs, Mys, Mzs) forces
         in stability axes.

    References
    ----------
    AIRCRAFT DYNAMICS From modelling to simulation (Marcello R. Napolitano)
    chapter 3 and 4
    """

    long_coef_matrix = long_aero_coefficients()
    lat_coef_matrix = lat_aero_coefficients()

    Cm_0, Cm_a, Cm_de, Cm_dih = long_coef_matrix[2, :]
    Cl_b, Cl_da, Cl_dr = lat_coef_matrix[1, :]
    Cn_b, Cn_da, Cn_dr = lat_coef_matrix[2, :]

    Cm_full = Cm_0 + Cm_a * alpha + Cm_de * delta_e + Cm_dih * ih
    Cl_full = Cl_b * beta + Cl_da * delta_ail + Cl_dr * delta_r
    Cn_full = Cn_b * beta + Cn_da * delta_ail + Cn_dr * delta_r

    span = geometric_data()[2]
    c = geometric_data()[1]
    Sw = geometric_data()[0]

    aerodynamic_moments = calculate_dynamic_pressure(rho, TAS) * Sw\
        * np.array([Cl_full * span, Cm_full * c, Cn_full * span])

    return aerodynamic_moments
Example #4
0
def get_aerodynamic_forces(TAS, rho, alpha, beta, delta_e, ih, delta_ail,
                           delta_r):

    """ Calculates forces

    Parameters
    ----------

    rho : float
        density (kg/(m3).
    TAS : float
        velocity (m/s).
    alpha : float
        attack angle (rad).
    beta : float
        sideslip angle (rad).
    delta_e : float
        elevator deflection (rad).
    ih : float
        stabilator deflection (rad).
    delta_ail : float
        aileron deflection (rad).
    delta_r : float
        rudder deflection (rad).

    Returns
    -------
    forces : array_like
        3 dimensional vector with (F_x_s, F_y_s, F_z_s) forces  in stability
        axes.

    References
    ----------
    AIRCRAFT DYNAMICS From modelling to simulation (Marcello R. Napolitano)
    chapter 3 and 4
    """

    long_coef_matrix = long_aero_coefficients()
    lat_coef_matrix = lat_aero_coefficients()

    CL_0, CL_a, CL_de, CL_dih = long_coef_matrix[0, :]
    CD_0, CD_a, CD_de, CD_dih = long_coef_matrix[1, :]
    CY_b, CY_da, CY_dr = lat_coef_matrix[0, :]

    CL_full = CL_0 + CL_a * alpha + CL_de * delta_e + CL_dih * ih
    CD_full = CD_0 + CD_a * alpha + CD_de * delta_e + CD_dih * ih
    CY_full = CY_b * beta + CY_da * delta_ail + CY_dr * delta_r

    Sw = geometric_data()[0]

    aerodynamic_forces = calculate_dynamic_pressure(rho, TAS) *\
        Sw * np.array([-CD_full, CY_full, -CL_full])   # N

    return aerodynamic_forces