hauteur.ts 7.98 KiB
import { IParamsEquation, Debug } from "../base"
import { acSection, cParamsCanal } from "./section_type";
import { acNewton } from "./newton";
import { cLog } from "./log";
/**
 * Calcul de la hauteur critique
 */
export class cHautCritique extends acNewton {
        private Sn: acSection;
        private oP: cParamsCanal;
        /**
         * Constructeur de la classe
         * @param oSn Section sur laquelle on fait le calcul
         * @param oP Paramètres supplémentaires (Débit, précision...)
        constructor(Sn: acSection, oP: cParamsCanal) {
                super(oP);
                this.Sn = Sn;
                this.oP = oP;
        /**
         * Calcul de la fonction dont on cherche le zéro
         * @param rX Variable dont dépend la fonction
        CalcFn(rX) {
                // Calcul de la fonction
                if (this.Sn.Calc('S', rX) != 0) {
                        var Fn = (Math.pow(this.oP.v.Q, 2) * this.Sn.Calc('B', rX) / Math.pow(this.Sn.Calc('S', rX), 3) / cParamsCanal.G - 1);
                else {
                        Fn = Infinity;
                return Fn;
        /**
         * Calcul analytique de la dérivée de la fonction dont on cherche le zéro
         * @param rX Variable dont dépend la fonction
        CalcDer(rX) {
                if (this.Sn.Calc('S') != 0) {
                        // L'initialisation à partir de rX a été faite lors de l'appel à CalcFn
                        var Der = (this.Sn.Calc('dB') * this.Sn.Calc('S') - 3 * this.Sn.Calc('B') * this.Sn.Calc('B'));
                        Der = Math.pow(this.oP.v.Q, 2) / cParamsCanal.G * Der / Math.pow(this.Sn.Calc('S'), 4);
                else {
                        Der = Infinity;
                //spip_log('cHautCritique:CalcDer('.rX.')='.rDer,'hydraulic.'._LOG_DEBUG);
                return Der;
/**
 * Calcul de la hauteur normale
export class cHautNormale extends acNewton {
        private Sn: acSection;
        private Q: number;
        private Ks: number;
        private If: number;
        /**
         * Constructeur de la classe
         * @param oSn Section sur laquelle on fait le calcul
         * @param oP Paramètres supplémentaires (Débit, précision...)
        constructor(Sn: acSection, oP: cParamsCanal) {
                super(oP);
                this.Sn = Sn;
                this.Q = oP.v.Q;
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
this.Ks = oP.v.Ks; this.If = oP.v.If; } /** * Calcul de la fonction dont on cherche le zéro * @param rX Variable dont dépend la fonction */ CalcFn(rX) { // Calcul de la fonction var Fn = (this.Q - this.Ks * Math.pow(this.Sn.Calc('R', rX), 2 / 3) * this.Sn.Calc('S', rX) * Math.sqrt(this.If)); return Fn; } /** * Calcul analytique de la dérivée de la fonction dont on cherche le zéro * @param rX Variable dont dépend la fonction */ CalcDer(rX) { // L'initialisation a été faite lors de l'appel à CalcFn var Der = 2 / 3 * this.Sn.Calc('dR') * Math.pow(this.Sn.Calc('R'), -1 / 3) * this.Sn.Calc('S'); Der = Der + Math.pow(this.Sn.Calc('R'), 2 / 3) * this.Sn.Calc('B'); Der = Der * -this.Ks * Math.sqrt(this.If); //spip_log('cHautNormale:CalcDer('.rX.')='.rDer,'hydraulic.'._LOG_DEBUG); return Der; } } /** * Calcul de la hauteur correspondante (charge égale) */ export class cHautCorrespondante extends acNewton { private Y: number; // Tirant d'eau connu private rS2: number; // 1/S^2 associé au tirant d'eau connu private Sn: acSection; // Section contenant les données de la section avec la hauteur à calculer private rQ2G: number; // Constante de gravité /** * Constructeur de la classe * @param oSn Section sur laquelle on fait le calcul * @param oP Paramètres supplémentaires (Débit, précision...) */ constructor(Sn: acSection, oP: cParamsCanal) { super(oP); this.Y = Sn.v.Y; this.rS2 = Math.pow(Sn.Calc('S'), -2); this.Sn = Sn; this.rQ2G = Math.pow(oP.v.Q, 2) / (2 * cParamsCanal.G); } /** * Calcul de la fonction dont on cherche le zéro * @param rX Variable dont dépend la fonction */ CalcFn(rX) { // Calcul de la fonction var Fn = this.Y - rX + (this.rS2 - Math.pow(this.Sn.Calc('S', rX), -2)) * this.rQ2G; //~ spip_log('cHautCorrespondante:CalcFn('.rX.')='.rFn,'hydraulic.'._LOG_DEBUG); return Fn; } /** * Calcul analytique de la dérivée de la fonction dont on protected function cherche le zéro * @param rX Variable dont dépend la fonction */ CalcDer(rX) { // L'initialisation a été faite lors de l'appel à CalcFn if (this.Sn.Calc('S') != 0) { var Der = -1 + 2 * this.rQ2G * this.Sn.Calc('B') / Math.pow(this.Sn.Calc('S'), 3); } else { Der = Infinity; } //~ spip_log('cHautCorrespondante:CalcDer('.rX.')='.rDer,'hydraulic.'._LOG_DEBUG); return Der; }
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
} /** * Calcul de la hauteur conjuguée (Impulsion égale) */ export class cHautConjuguee extends acNewton { /** Tirant d'eau connu */ private Y: number; /** 1/S^2 associé au tirant d'eau connu */ private rS2: number; /** Section contenant les données de la section avec la hauteur à calculer */ private Sn: acSection; /** Carré du débit */ private rQ2: number; /** Surface hydraulique associée au tirant d'eau connu */ private rS: number; /** SYg associée au tirant d'eau connu */ private rSYg: number; /** * Constructeur de la classe * @param oSn Section sur laquelle on fait le calcul * @param oP Paramètres supplémentaires (Débit, précision...) */ constructor(oSn: acSection, oP: cParamsCanal) { super(oP); this.Y = oSn.v.Y; this.rQ2 = Math.pow(oP.v.Q, 2); this.Sn = oSn; this.rS = oSn.Calc('S'); this.rSYg = oSn.Calc('SYg'); } /** * Calcul de la fonction dont on cherche le zéro * @param rX Variable dont dépend la fonction */ CalcFn(rX) { // Réinitialisation des paramètres hydrauliques de oSn avec l'appel this->oSn->Calc('S',rX) if (this.rS > 0 && this.Sn.Calc('S', rX) > 0) { var Fn = this.rQ2 * (1 / this.rS - 1 / this.Sn.Calc('S')); Fn = Fn + cParamsCanal.G * (this.rSYg - this.Sn.Calc('SYg')); } else { Fn = -Infinity; } //~ spip_log('cHautConjuguee:CalcFn('.rX.')='.rFn,'hydraulic.'._LOG_DEBUG); return Fn; } /** * Calcul analytique de la dérivée de la fonction dont on cherche le zéro * @param rX Variable dont dépend la fonction */ CalcDer(rX) { // L'initialisation a été faite lors de l'appel à CalcFn if (this.rS > 0 && this.Sn.Calc('S') > 0) { var Der = this.rQ2 * this.Sn.Calc('dS') * Math.pow(this.Sn.Calc('S'), -2); Der = Der - cParamsCanal.G * this.Sn.Calc('dSYg', rX); } else { Der = -Infinity; } //~ spip_log('cHautConjuguee:CalcDer('.rX.')='.rDer,'hydraulic.'._LOG_DEBUG); return Der; } }