diff --git a/doc/scilab_tests/Qouvrage.sci b/doc/scilab_tests/Qouvrage.sci new file mode 100755 index 0000000000000000000000000000000000000000..afe3b948c91581ffc1b11c0ee0bd80126637275e --- /dev/null +++ b/doc/scilab_tests/Qouvrage.sci @@ -0,0 +1,252 @@ +function [Q,C,w] = Qouvrage(T,h1,h2,w,hv,L,Cd) + // T=1 : Seuil Orifice avec surverse éventuelle (SIC) + // 2 : Seuil Vanne avec surverse éventuelle (SIC) + // 3 : Classique Seuil + // 4 : Classique Orifice + // 5 : Classique Noyee + // 6 : Cunge avec differentes conditions d'ecoulement + // h1 : cote amont (par rapport au radier) + // h2 : cote aval (par rapport au radier) + // w : ouverture (par rapport au radier) + // hv : hauteur de la vanne (pour le calcul de la surverse éventuelle) + // L : largeur + // Cd : coefficient de debit + // Q : debit + // C : code couleur correspondant aux conditions d'ecoulement + // C=0; debit nul + // C=1; surface libre denoye + // C=2; surface libre noye + // C=3; charge denoye + // C=4; charge noye partiel + // C=5; charge noye total + // C=C+10; si surverse + // Initialisation --------------------------------------------- + R2G = sqrt(2*9.81); + R32 = 3*sqrt(3)/2; + // Tests ------------------------------------------------------ + Q=0; + C=0; + partiel="non" + if (w==0 & hv==0) + Q=0; + return + end + if (h2>h1) + Q=0; + return + end + if (h1==0) + Q=0; + return + end + // Seuil - Orifice =========================================== + if (T==1 & w>0) + // Conditions d'ecoulement ------------------------------------ + if (h1<=w) + surfacelibre='oui'; + else + surfacelibre='non'; + end + alfa=2/3; + if (h2<=alfa*h1) + denoye='oui'; + else + denoye='non'; + if (h2<=2/3*h1+w/3) + partiel='oui'; + else + partiel='non'; + end + end + // Seuil - Denoye --------------------------------------------- + if (surfacelibre=='oui') & (denoye=='oui') + Q=Cd*L*R2G*(h1^1.5); + C=1; + end + // Seuil - Noye ----------------------------------------------- + if (surfacelibre=='oui') & (denoye=='non') + Cs=R32*Cd; + Q=Cs*L*R2G*((h1-h2)^0.5)*h2; + C=2; + end + // Orifice - Denoye ------------------------------------------- + if (surfacelibre=='non') & (denoye=='oui') + Q=Cd*L*R2G*(h1^1.5-(h1-w)^1.5); + C=3; + end + // Orifice - Noye --------------------------------------------- + if (surfacelibre=='non') & (denoye=='non') + // Ennoyement partiel --------------------------------- + if (partiel=='oui') + Q=Cd*L*R2G*(R32*h2*(h1-h2)^0.5-(h1-w)^1.5); + C=4; + // Ennoyement total ----------------------------------- + else + Cs=R32*Cd; + Q=Cs*L*R2G*((h1-h2)^0.5)*w; + //~printf("b2= %f Cd1=%f\n",(h1-h2)^0.5, Cs*L*R2G); + C=5; + end + end + end + // Seuil - Vanne ============================================= + if (T==2 & w>0) + // Calcul de parametres --------------------------------------- + mu0=2/3*Cd; + // Conditions d'ecoulement ------------------------------------ + if (h1<=w) + surfacelibre='oui'; + muf=mu0-0.08; + alfa=0.75; + else + surfacelibre='non'; + mu =mu0-0.08/(h1/w); + mu1=mu0-0.08/(h1/w-1); + alfa=1-0.14*h2/w; + if (alfa<0.4) + alfa=0.4; + end + if (alfa>0) + alfa=0.75; + end + end + if (h2<=alfa*h1) + denoye='oui'; + else + denoye='non'; + x=sqrt(1-h2/h1); + beta1=-2*alfa+2.6; + if (x>0.2) + KF=1-(1-x/sqrt(1-alfa))^beta1; + else + KF=5*x*(1-(1-0.2/sqrt(1-alfa))^beta1); + end + alfa1=1-0.14*(h2-w)/w; + if (alfa1<0.4) + alfa1=0.4; + end + if (alfa1>0.75) + alfa1=0.75; + end + if (h2<=alfa1*h1+(1-alfa1)*w) + partiel='oui'; + else + partiel='non'; + end + end + // Seuil - Denoye --------------------------------------------- + if (surfacelibre=='oui') & (denoye=='oui') + Q=muf*L*R2G*(h1^1.5); + C=1; + end + // Seuil - Noye ----------------------------------------------- + if (surfacelibre=='oui') & (denoye=='non') + Q=KF*muf*L*R2G*(h1^1.5); + C=2; + end + // Vanne - Denoye --------------------------------------------- + if (surfacelibre=='non') & (denoye=='oui') + Q=L*R2G*(mu*h1^1.5-mu1*(h1-w)^1.5); + C=3; + end + // Vanne - Noye ----------------------------------------------- + if (surfacelibre=='non') & (denoye=='non') + x1=sqrt(1-(h2-w)/(h1-w)); + beta1=-2*alfa1+2.6; + if (x1>0.2) + KF1=1-(1-x1/sqrt(1-alfa1))^beta1; + else + KF1=5*x1*(1-(1-0.2/sqrt(1-alfa1))^beta1); + end + // Ennoyement partiel --------------------------------- + if (partiel=='oui') + Q=L*R2G*(KF*mu*(h1^1.5)-mu1*(h1-w)^1.5); + C=4; + // Ennoyement total ----------------------------------- + else + Q=L*R2G*(KF*mu*(h1^1.5)-KF1*mu1*(h1-w)^1.5); + C=5; + end + end + end + // Surverse dans cas 1 et 2 =================================== + if hv==0 + hv=%inf; + end; + if (T==1) | (T==2) + if (h1>w+hv) + surverse='oui'; + alfa=2/3; + if (h2-w-hv<=alfa*(h1-w-hv)) + denoyesurverse='oui'; + else + denoyesurverse='non'; + end + else + surverse='non'; + end + // Surverse - Denoye ------------------------------------------- + if (surverse=='oui') + if (denoyesurverse=='oui') + Q=Q+0.4*L*R2G*(h1-w-hv)^1.5; + C=C+10; + else + Q=Q+1.04*L*R2G*((h1-h2)^0.5)*(h2-w-hv); + C=C+10; + end + end + end + // Classique - Seuil ========================================== + if (T==3) + Q=Cd*L*R2G*h1^1.5; + C=1; + end + // Classique - Orifice ======================================== + if (T==4) + if (h1>w) + Q=Cd*w*L*R2G*(h1-w)^0.5; + C=3; + else + Q=0; + C=0; + end + end + // Classique - Noyee ========================================== + if (T==5) + if (h1>h2) + Q=Cd*w*L*R2G*(h1-h2)^0.5; + C=5; + else + Q=0; + C=0; + end + end + // Classique Cunge =========================================== + if (T==6) + // Conditions d'ecoulement ------------------------------------ + if (h2<=2/3*h1) + denoye='oui'; + if (w<=2/3*h1) + surfacelibre='non'; + Q=Cd*L*R2G*w*((h1-w)^0.5); + C=3; + else + surfacelibre='oui'; + Q=Cd*L*R2G/R32*h1^1.5; + C=1; + end + else + denoye='non'; + if (w<=h2) + surfacelibre='non'; + Q=Cd*L*R2G*w*((h1-h2)^0.5); + C=5; + else + surfacelibre='oui'; + Q=Cd*L*R2G*h2*((h1-h2)^0.5); + C=2; + end + end + end + //~printf("surface libre=%s denoye=%s partiel=%s\n", surfacelibre, denoye, partiel) +endfunction diff --git a/doc/scilab_tests/TestQOuvrageLoopW.sci b/doc/scilab_tests/TestQOuvrageLoopW.sci new file mode 100755 index 0000000000000000000000000000000000000000..fb80ced32f6dfa2b0ae453e9859cca183d6c1546 --- /dev/null +++ b/doc/scilab_tests/TestQOuvrageLoopW.sci @@ -0,0 +1,39 @@ +function TestQOuvrageLoop(sTest, T, L, Cd, H1, h2, W) + printf("\n") + printf("*** %s ***\n", sTest) + + // Tests des différents régimes + sCodeC = ["debit nul","surface libre denoye","surface libre noye","charge denoye","charge noye partiel","charge noye total"]; + Q = [] + C = [] + CS = [] + for w = W + for h1 = H1 + [q, c] = Qouvrage(T,h1,h2,w,0,L,Cd) + Q = [Q q] + C = [C c] + CS = [CS sCodeC(c+1)] + end + end + + printf("W=[") + printf("%f,",W') + printf("];\n") + + printf("h1=[") + printf("%f,",H1') + printf("];\n") + + printf("Q=[") + printf("%f,",Q') + printf("];\n") + + printf("C=[") + printf("%i,",C') + printf("];\n") + + printf("Code=[") + printf("%s,",CS') + printf("];\n") + +endfunction diff --git a/doc/scilab_tests/describe.sci b/doc/scilab_tests/describe.sci new file mode 100755 index 0000000000000000000000000000000000000000..283e4056dccba63f18da3887e69b69dfb509f7d6 --- /dev/null +++ b/doc/scilab_tests/describe.sci @@ -0,0 +1,6 @@ +function describe(sSuite) + printf("\n") + printf("****************************************\n") + printf("* %-36s *\n", sSuite) + printf("****************************************\n") +endfunction diff --git a/doc/scilab_tests/main_ouvrages.sce b/doc/scilab_tests/main_ouvrages.sce new file mode 100755 index 0000000000000000000000000000000000000000..a9f3a3347e456e03424fb3af8c81caf7e2924330 --- /dev/null +++ b/doc/scilab_tests/main_ouvrages.sce @@ -0,0 +1,17 @@ +// Test des équations d'ouvrages pour JaLHyd +clear +sCurrentPath = get_absolute_file_path("main_ouvrages.sce"); +getd(sCurrentPath); + +function TestQOuvrageSuite(T) + //TestQOuvrageLoop(sTest, T, L, Cd, H1, h2, W) + TestQOuvrageLoop("Calcul Q avec W croissant",T, 2, 0.6, 1.2, 1, 0:0.1:1.3); + TestQOuvrageLoop("Calcul Q en charge avec h1 croissant",T, 2, 0.6, [1.05,1.3,1.5], 1, 0.8); + TestQOuvrageLoop("Calcul Q a surface libre avec h1 croissant",T, 2, 0.6, 1.1:0.4:1.5, 1, 2); +endfunction + +describe("CEM88D"); +TestQOuvrageSuite(1); + +describe("CEM88V"); +TestQOuvrageSuite(2);