Ejemplo n.º 1
0
def Tracé_en_allure():
    PHI = np.deg2rad(0)
    Vt = fctAnnexes.nds2ms(15)
    Vs = fctAnnexes.nds2ms(5)
    LAMBDA = np.deg2rad(0)
    L_angle_allure_deg = np.linspace(10, 170)
    L_angle_allure = np.deg2rad(L_angle_allure_deg)
    L_Fxtot = []
    L_Fxaero = []
    L_Fxsafran = []
    L_Fxquille = []
    L_Fxstab = []
    L_Fxresistance = []
    for angle in L_angle_allure:
        T_aero = aero.torseur_Faero(Vt, Vs, angle, LAMBDA, PHI, rho_eau,
                                    rho_air, workbookAero)
        Fx_aero = T_aero[0][0]
        L_Fxaero.append(Fx_aero)

    # plt.plot(L_angle_allure_deg, L_Fxtot, label = "Fx_total")
    plt.plot(L_angle_allure_deg, L_Fxaero, label="Fx_aero")
    # plt.plot(L_angle_allure_deg, L_Fxquille, label = "Fx_quille")
    # plt.plot(L_angle_allure_deg, L_Fxsafran, label = "Fx_safran")
    # plt.plot(L_angle_allure_deg, L_Fxstab, label = "Fx_stab")
    # plt.plot(L_angle_allure_deg, L_Fxresistance, label = "Fx_resistance")
    plt.ylabel("Fx (N)")
    plt.xlabel("TWA (deg)")
    plt.legend()
    plt.show()
Ejemplo n.º 2
0
    def testEfforts_resistance(self):
        Vs = fctAnnexes.nds2ms(4)
        Lambda = np.deg2rad(0)
        assert_array_almost_equal(
            round(
                resistance.efforts_resistance(Vs, Lambda, workbookDVP)[0][0],
                2), -31.83)

        Vs = fctAnnexes.nds2ms(-4)
        assert_array_almost_equal(
            round(
                resistance.efforts_resistance(Vs, Lambda, workbookDVP)[0][0],
                2), -199999.95)
Ejemplo n.º 3
0
def Tracé_en_Vs():
    PHI = np.deg2rad(1)
    Vt = fctAnnexes.nds2ms(20)
    angle_allure = np.deg2rad(120)
    LAMBDA = np.deg2rad(1)
    L_Vs_nds = np.linspace(0,10,50)
    L_Vs = [fctAnnexes.nds2ms(x) for x in L_Vs_nds]
    L_Fxtot = []
    L_Fxaero = []
    L_Fxsafran = []
    L_Fxquille = []
    L_Fxstab = []
    L_Fxresistance = []
    for V in L_Vs:
        print(V)
        T_aero = aero.torseur_Faero(Vt, V, angle_allure, LAMBDA, PHI, rho_eau, rho_air)
        T_safran = safran.torseur_Fhydro_safran(V, LAMBDA, PHI, rho_eau)
        T_stab = stab.torseur_Fstab(DELTA, LAMBDA, PHI, theta)
        T_quille = quille.torseur_Fhydro_quille(V, LAMBDA, PHI, rho_eau)
        T_resistance = resistance.torseur_Fresistance(V, LAMBDA)
        Fx_aero = T_aero[0][0]
        Fx_safran = T_safran[0][0]
        Fx_quille = T_quille[0][0]
        Fx_resistance = T_resistance[0][0]
        Fx_stab = T_stab[0][0]
        SommeFx = Fx_aero + Fx_quille + Fx_resistance + Fx_safran + Fx_stab
        L_Fxtot.append(SommeFx)
        L_Fxaero.append(Fx_aero)
        L_Fxsafran.append(Fx_safran)
        L_Fxquille.append(Fx_quille)
        L_Fxstab.append(Fx_stab)
        L_Fxresistance.append(Fx_resistance)

    plt.plot(L_Vs_nds, L_Fxtot, label = "Fx_total")
    plt.plot(L_Vs_nds, L_Fxaero, label = "Fx_aero")
    plt.plot(L_Vs_nds, L_Fxquille, label = "Fx_quille")
    plt.plot(L_Vs_nds, L_Fxsafran, label = "Fx_safran")
    plt.plot(L_Vs_nds, L_Fxstab, label = "Fx_stab")
    plt.plot(L_Vs_nds, L_Fxresistance, label = "Fx_resistance")
    plt.ylabel("Fx (N)")
    plt.xlabel("Vs (kt)")
    plt.legend()
    plt.show()
Ejemplo n.º 4
0
def Tracé_en_Lambda():
    V = fctAnnexes.nds2ms(3.94)
    PHI = np.deg2rad(-1.77)
    Vt = fctAnnexes.nds2ms(20)
    angle_allure = np.deg2rad(120)
    L_lambda_deg = np.linspace(-10,10,100)
    L_lambda = np.deg2rad(L_lambda_deg)
    L_Fxtot = []
    L_Fxaero = []
    L_Fxsafran = []
    L_Fxquille = []
    L_Fxstab = []
    L_Fxresistance = []
    for LAMBDA in L_lambda:
        T_aero = aero.torseur_Faero(Vt, V, angle_allure, LAMBDA, PHI, rho_eau, rho_air, workbookAero)
        T_safran = safran.torseur_Fhydro_safran(V, LAMBDA, PHI, rho_eau, workbookSafran)
        T_stab = stab.torseur_Fstab(DELTA, LAMBDA, PHI, theta, workbookStab)
        T_quille = quille.torseur_Fhydro_quille(V, LAMBDA, PHI, rho_eau, workbookQuille)
        T_resistance = resistance.torseur_Fresistance(V, LAMBDA, workbookDVP)
        Fx_aero = T_aero[0][0]
        Fx_safran = T_safran[0][0]
        Fx_quille = T_quille[0][0]
        Fx_resistance = T_resistance[0][0]
        Fx_stab = T_stab[0][0]
        SommeFx = Fx_aero + Fx_quille + Fx_resistance + Fx_safran + Fx_stab
        L_Fxtot.append(SommeFx)
        L_Fxaero.append(Fx_aero)
        L_Fxsafran.append(Fx_safran)
        L_Fxquille.append(Fx_quille)
        L_Fxstab.append(Fx_stab)
        L_Fxresistance.append(Fx_resistance)

    plt.plot(L_lambda_deg, L_Fxtot, label = "Fx_total")
    plt.plot(L_lambda_deg, L_Fxaero, label = "Fx_aero")
    plt.plot(L_lambda_deg, L_Fxquille, label = "Fx_quille")
    plt.plot(L_lambda_deg, L_Fxsafran, label = "Fx_safran")
    plt.plot(L_lambda_deg, L_Fxstab, label = "Fx_stab")
    plt.plot(L_lambda_deg, L_Fxresistance, label = "Fx_resistance")
    plt.ylabel("Fx (N)")
    plt.xlabel("Lambda (deg)")
    plt.legend()
    plt.show()
Ejemplo n.º 5
0
    def testPolaire_voile(self):
        rho_air = 1.225
        # Cas de test 1 : vent apparent inférieur à 1 noeud : pas de portance, pas de trainée
        Lambda = np.deg2rad(5)
        angle_allure = np.deg2rad(45)
        Vt = fctAnnexes.nds2ms(0.5)
        Vs = fctAnnexes.nds2ms(0)
        phi = 0
        torseur_aero_repVoile, CP_repVoile, deltav = aero.polaire_voile(
            Vt, Vs, rho_air, Lambda, angle_allure, phi, workbookAero)
        assert_array_almost_equal(torseur_aero_repVoile, np.zeros((3, 2)))
        assert_array_almost_equal(CP_repVoile, np.zeros((3, 1)))

        # Cas de test 2 : vent apparent égal à l'un des v_bateau du tableau excel
        Lambda = np.deg2rad(0)
        angle_allure = np.deg2rad(20)
        Vt = fctAnnexes.nds2ms(10)
        Vs = fctAnnexes.nds2ms(0)
        phi = 0
        torseur_aero_repVoile, CP_repVoile, deltav = aero.polaire_voile(
            Vt, Vs, rho_air, Lambda, angle_allure, phi, workbookAero)
        #Valeurs théoriques
        CP_repVoile_th = np.array([-0.047069719, 0,
                                   1.151453695]).reshape(-1, 1)
        torseur_aero_repVoile_th = np.zeros((3, 2))
        Va = aero.vent_apparent(Vt, Vs, Lambda, angle_allure, phi)
        np.testing.assert_almost_equal(fctAnnexes.ms2nds(Va), 10, decimal=0)
        CL_th, CD_th = 0.621872556, 0.075411043
        S_th = 1.647
        L_th = 0.5 * rho_air * CL_th * S_th * Va**2
        D_th = 0.5 * rho_air * CD_th * S_th * Va**2
        torseur_aero_repVoile_th[0, 0] = D_th
        torseur_aero_repVoile_th[1, 0] = L_th
        #print("TEST________________________",torseur_aero_repVoile)
        assert_array_almost_equal(CP_repVoile_th, CP_repVoile, 1)
        assert_array_almost_equal(torseur_aero_repVoile,
                                  torseur_aero_repVoile_th, 1)

        np.testing.assert_almost_equal(np.rad2deg(deltav), 8, 0)
Ejemplo n.º 6
0
def Tracé_en_PHI():
    V = 0.8
    LAMBDA = np.deg2rad(3)
    Vt = fctAnnexes.nds2ms(5)
    angle_allure = 120
    L_phi_deg = np.linspace(-50, 50, 50)
    L_phi = np.deg2rad(L_phi_deg)
    L_Mxtot = []
    L_Mxaero = []
    L_Mxsafran = []
    L_Mxquille = []
    L_Mxstab = []
    L_Mxresistance = []
    for PHI in L_phi:
        print(PHI)
        T_aero = aero.torseur_Faero(Vt, V, angle_allure, LAMBDA, PHI, rho_eau,
                                    rho_air, workbookAero)
        T_safran = safran.torseur_Fhydro_safran(V, LAMBDA, PHI, rho_eau,
                                                workbookSafran)
        T_stab = stab.torseur_Fstab(DELTA, LAMBDA, PHI, theta, workbookStab)
        T_quille = quille.torseur_Fhydro_quille(V, LAMBDA, PHI, rho_eau,
                                                workbookQuille)
        T_resistance = resistance.torseur_Fresistance(V, LAMBDA, workbookDVP)
        Mx_aero = T_aero[0][1]
        Mx_safran = T_safran[0][1]
        Mx_quille = T_quille[0][1]
        Mx_resistance = T_resistance[0][1]
        Mx_stab = T_stab[0][1]
        SommeMx = Mx_aero + Mx_quille + Mx_resistance + Mx_safran + Mx_stab
        L_Mxtot.append(SommeMx)
        L_Mxaero.append(Mx_aero)
        L_Mxsafran.append(Mx_safran)
        L_Mxquille.append(Mx_quille)
        L_Mxstab.append(Mx_stab)
        L_Mxresistance.append(Mx_resistance)

    plt.plot(L_phi_deg, L_Mxtot, label="Mx_total")
    plt.plot(L_phi_deg, L_Mxaero, label="Mx_aero")
    plt.plot(L_phi_deg, L_Mxquille, label="Mx_quille")
    plt.plot(L_phi_deg, L_Mxsafran, label="Mx_safran")
    plt.plot(L_phi_deg, L_Mxstab, label="Mx_stab")
    plt.plot(L_phi_deg, L_Mxresistance, label="Mx_resistance")
    plt.ylabel("Mx (N.m)")
    plt.xlabel("Phi (deg)")
    plt.legend()
    plt.show()
Ejemplo n.º 7
0
def Tracé_en_Lambda():
    V = 0.8
    PHI = -6E-3
    Vt = fctAnnexes.nds2ms(5)
    angle_allure = 120
    L_lambda_deg = np.linspace(-10,10,100)
    L_lambda = np.deg2rad(L_lambda_deg)
    L_Fytot = []
    L_Fyaero = []
    L_Fysafran = []
    L_Fyquille = []
    L_Fystab = []
    L_Fyresistance = []
    for LAMBDA in L_lambda:
        T_aero = aero.torseur_Faero(Vt, V, angle_allure, LAMBDA, PHI, rho_eau, rho_air, workbookAero)
        T_safran = safran.torseur_Fhydro_safran(V, LAMBDA, PHI, rho_eau, workbookSafran)
        T_stab = stab.torseur_Fstab(DELTA, LAMBDA, PHI, theta, workbookStab)
        T_quille = quille.torseur_Fhydro_quille(V, LAMBDA, PHI, rho_eau, workbookQuille)
        T_resistance = resistance.torseur_Fresistance(V, LAMBDA, workbookDVP)
        Fy_aero = T_aero[1][0]
        Fy_safran = T_safran[1][0]
        Fy_quille = T_quille[1][0]
        Fy_resistance = T_resistance[1][0]
        Fy_stab = T_stab[1][0]
        SommeFy = Fy_aero + Fy_quille + Fy_resistance + Fy_safran + Fy_stab
        L_Fytot.append(SommeFy)
        L_Fyaero.append(Fy_aero)
        L_Fysafran.append(Fy_safran)
        L_Fyquille.append(Fy_quille)
        L_Fystab.append(Fy_stab)
        L_Fyresistance.append(Fy_resistance)

    plt.plot(L_lambda_deg, L_Fytot, label = "Fy_total")
    plt.plot(L_lambda_deg, L_Fyaero, label = "Fy_aero")
    plt.plot(L_lambda_deg, L_Fyquille, label = "Fy_quille")
    plt.plot(L_lambda_deg, L_Fysafran, label = "Fy_safran")
    plt.plot(L_lambda_deg, L_Fystab, label = "Fy_stab")
    plt.plot(L_lambda_deg, L_Fyresistance, label = "Fy_resistance")
    plt.ylabel("Fy (N.m)")
    plt.xlabel("Lambda (deg)")
    plt.legend()
    plt.show()
Ejemplo n.º 8
0
def PFS(X, Vt, angle_allure):
    V = float(X[0])
    PHI = float(X[1])
    LAMBDA = float(X[2])
    # print("VALEURS EN DEBUT DE BOUCLE")
    if V > fctAnnexes.nds2ms(
            10
    ):  #Polaires de safran et de quille ne sont plus prises en compte
        V = fctAnnexes.nds2ms(10)
        warnings.warn("Speed was above 10 kts and was reset to 10 kts.")
    if PHI > np.deg2rad(90):  #On empeche une gite trop importante
        PHI = np.deg2rad(60)
        warnings.warn(
            "Heeling angle was above 90 degrees and was reset to 60 degrees")
    if PHI < np.deg2rad(-90):  #On empeche une contre gite trop importante
        PHI = np.deg2rad(-60)
        warnings.warn(
            "Heeling angle was below -90 degrees and was reset to -60 degrees")

    # print("V=", ms2nds(V), "noeuds", "              PHI=", np.rad2deg(PHI), "degrés", "              LAMBDA=",
    # np.rad2deg(LAMBDA), "degrés")

    T_aero = aero.torseur_Faero(Vt, V, angle_allure, LAMBDA, PHI, rho_eau,
                                rho_air, workbookAero)
    T_safran = safran.torseur_Fhydro_safran(V, LAMBDA, PHI, rho_eau,
                                            workbookSafran)
    T_stab = stab.torseur_Fstab(DELTA, LAMBDA, PHI, theta, workbookStab)
    T_quille = quille.torseur_Fhydro_quille(V, LAMBDA, PHI, rho_eau,
                                            workbookQuille)
    T_resistance = resistance.torseur_Fresistance(V, LAMBDA, workbookDVP)
    # print("T_aero","\n",T_aero,"___________","\n","T_safran","\n",T_safran,"___________","\n","T_stab","\n",T_stab,
    # "___________","\n","T_quille","\n",T_quille,"___________","\n","T_resistance","\n",T_resistance)

    SommeTorseurs = np.array([0., 0., 0.]).reshape((-1, ))
    Fx_aero = T_aero[0][0]
    Fx_safran = T_safran[0][0]
    Fx_quille = T_quille[0][0]
    Fx_resistance = T_resistance[0][0]
    Fx_stab = T_stab[0][0]
    SommeTorseurs[
        0] = Fx_stab + Fx_safran + Fx_quille + Fx_resistance + Fx_aero

    Fy_aero = T_aero[1][0]
    Fy_safran = T_safran[1][0]
    Fy_quille = T_quille[1][0]
    Fy_resistance = T_resistance[1][0]
    Fy_stab = T_stab[1][0]
    SommeTorseurs[
        2] = Fy_stab + Fy_aero + Fy_resistance + Fy_safran + Fy_quille

    Mx_aero = T_aero[0][1]
    Mx_safran = T_safran[0][1]
    Mx_quille = T_quille[0][1]
    Mx_resistance = T_resistance[0][1]
    Mx_stab = T_stab[0][1]
    SommeTorseurs[
        1] = Mx_aero + Mx_quille + Mx_resistance + Mx_safran + Mx_stab

    # print("PFS=", SommeTorseurs)
    if V > fctAnnexes.nds2ms(
            10
    ):  #Polaires de safran et de quille ne sont plus prises en compte
        V = fctAnnexes.nds2ms(10)

    LISTEV.append(V)
    LISTEPHI.append(PHI)
    LISTELAMBDA.append(LAMBDA)
    LISTE_Fx.append(SommeTorseurs[0])
    LISTE_Fy.append(SommeTorseurs[2])
    LISTE_Mx.append(SommeTorseurs[1])
    return 10 * SommeTorseurs
Ejemplo n.º 9
0
        print("Calculs pour Vt = " + str(Vt) + " kt")
        Vtfilename = "Vt_" + str(Vt) + "kt"
        # Variables de stockage des résulats par valeur de vent
        BILAN_Vs = []
        BILAN_Phi = []
        BILAN_Lambda = []
        BILAN_Fx = []
        BILAN_Fy = []
        BILAN_Mx = []

        for angle in L_angles:
            print("    Calculs en cours pour un angle d'allure de " +
                  str(angle) + " deg")
            anglefilename = "AngleAllure_" + str(angle) + "deg"
            # Listes de stockage des variables au fur et à mesure de la convergence
            Vt_ms = fctAnnexes.nds2ms(Vt)
            angle_rad = np.deg2rad(angle)
            LISTEV = []
            LISTEPHI = []
            LISTELAMBDA = []
            LISTE_Fx = []
            LISTE_Fy = []
            LISTE_Mx = []
            X_sol = scpo.fsolve(PFS, X0, args=(Vt_ms, angle_rad))
            BILAN_Vs.append(X_sol[0])
            BILAN_Phi.append(X_sol[1])
            BILAN_Lambda.append(X_sol[2])
            BILAN_Fx.append(LISTE_Fx[-1])
            BILAN_Fy.append(LISTE_Fy[-1])
            BILAN_Mx.append(LISTE_Mx[-1])
Ejemplo n.º 10
0
    M_repAvBateau = chgt_base_moments(CP_repAvBateau, F_repAvBateau)
    T = np.concatenate((F_repAvBateau, M_repAvBateau), axis=1)
    return T


if __name__ == "__main__":
    import os

    path = os.getcwd()
    pathdir = os.path.dirname(path)
    workbook = load_workbook(filename=os.path.join(pathdir, "tests/data.xlsx"),
                             data_only=True)
    sheet = workbook.active
    Lambda = np.deg2rad(0)
    angle_allure = np.deg2rad(20)
    Vt = fctAnnexes.nds2ms(25)
    Vs = fctAnnexes.nds2ms(0)
    phi = 0
    rho_air = sheet["G3"].value
    rho_eau = sheet["H3"].value
    fichier = os.path.join(pathdir, "data/Polaires_Voile_data4.xlsm")
    workbook2 = load_workbook(filename=fichier, data_only=True)
    print(polaire_voile(Vt, Vs, rho_air, Lambda, angle_allure, phi, workbook2))
    T = torseur_Faero(Vt, Vs, angle_allure, Lambda, phi, rho_eau, rho_air,
                      workbook2)
    # angle_allure_list = np.linspace(10, 180, 170)
    # angle_allure_rad = np.deg2rad(angle_allure_list)
    # deltav_list = []
    # alpha_list = []
    # for i in angle_allure_rad:
    # beta_t = Lambda + i  # beta_t : page 33 de [2] - angle entre axe X d'avance du bateau et vent réel"