Qouvrage.sci 8.30 KiB
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;
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
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; printf("alfa=%f \n",alfa) if (alfa<0.4) alfa=0.4; end if (alfa>0.75) 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 printf("beta1=%f x=%f alfa=%f KF=%f\n",beta1,x,alfa,KF) 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')