Forked from HYCAR-Hydro / airGR
Source project has a limited visibility.
hauteur.ts 7.14 KiB
import { Debug } from "../base"
import { acSection, cParamsCanal } from "./section_type";
import { acNewton } from "./newton";
/**
 * Calcul de la hauteur critique
 */
export class cHautCritique extends acNewton {
        /**
         * Section sur laquuelle porte le calcul
        private Sn: acSection;
        /**
         * Constructeur de la classe
         * @param Sn Section sur laquelle on fait le calcul
        constructor(Sn: acSection, maxIter: number, dbg: boolean = false) {
                super(Sn.prms, maxIter, dbg);
                this.Sn = Sn.clone();
        /**
         * Calcul de la fonction dont on cherche le zéro
         * @param rX Variable dont dépend la fonction
        CalcFn(rX: number) {
                // Calcul de la fonction
                if (this.Sn.Calc("S", rX) != 0)
                        return (Math.pow(this.Sn.prms.Q.v, 2) * this.Sn.Calc("B", rX) / Math.pow(this.Sn.Calc("S", rX), 3) / cParamsCanal.G - 1);
                return Infinity;
        /**
         * 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: number) {
                let S = this.Sn.Calc("S");
                if (S != 0) {
                        let B = this.Sn.Calc("B");
                        // L'initialisation à partir de rX a été faite lors de l'appel à CalcFn
                        let Der = (this.Sn.Calc("dB") * S - 3 * B * B);
                        return Math.pow(this.Sn.prms.Q.v, 2) / cParamsCanal.G * Der / Math.pow(S, 4);
                return Infinity;
/**
 * Calcul de la hauteur normale
export class cHautNormale extends acNewton {
        /**
       * Section sur laquuelle porte le calcul
        private Sn: acSection;
        /**
         * Débit connu
        private Q: number;
        /**
         * Coefficient de Strickler
        private Ks: number;
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
/** * Pente du fond */ private If: number; /** * Constructeur de la classe * @param oSn Section sur laquelle on fait le calcul */ constructor(Sn: acSection, maxIter: number, dbg: boolean = false) { super(Sn.prms, maxIter, dbg); this.Sn = Sn; this.Q = Sn.prms.Q.v; this.Ks = Sn.prms.Ks.v; this.If = Sn.prms.If.v; } /** * Calcul de la fonction dont on cherche le zéro * @param rX Variable dont dépend la fonction */ CalcFn(rX: number) { // Calcul de la fonction return (this.Q - this.Ks * Math.pow(this.Sn.Calc("R", rX), 2 / 3) * this.Sn.Calc("S", rX) * Math.sqrt(this.If)); } /** * 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: number) { // L'initialisation a été faite lors de l'appel à CalcFn let 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); return Der; } } /** * Calcul de la hauteur correspondante (charge égale) */ export class cHautCorrespondante 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; /** * Constante de gravité */ private rQ2G: number; /** * Constructeur de la classe * @param oSn Section sur laquelle on fait le calcul */ constructor(Sn: acSection, maxIter: number, dbg: boolean = false) { super(Sn.prms, maxIter, dbg); this.Y = Sn.prms.Y.v;
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
this.rS2 = Math.pow(Sn.Calc("S"), -2); this.Sn = Sn; this.rQ2G = Math.pow(Sn.prms.Q.v, 2) / (2 * cParamsCanal.G); } /** * Calcul de la fonction dont on cherche le zéro * @param rX Variable dont dépend la fonction */ CalcFn(rX: number) { // Calcul de la fonction return this.Y - rX + (this.rS2 - Math.pow(this.Sn.Calc("S", rX), -2)) * this.rQ2G; } /** * 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: number) { let S = this.Sn.Calc("S"); // L'initialisation a été faite lors de l'appel à CalcFn if (S != 0) return -1 + 2 * this.rQ2G * this.Sn.Calc("B") / Math.pow(S, 3); return Infinity; } } /** * Calcul de la hauteur conjuguée (Impulsion égale) */ export class cHautConjuguee extends acNewton { /** 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 */ constructor(oSn: acSection, maxIter: number, dbg: boolean = false) { super(oSn.prms, maxIter, dbg); this.rQ2 = Math.pow(oSn.prms.Q.v, 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: number) { // 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) { let Fn = this.rQ2 * (1 / this.rS - 1 / this.Sn.Calc("S")); return Fn + cParamsCanal.G * (this.rSYg - this.Sn.Calc("SYg")); } return -Infinity; }
211212213214215216217218219220221222223224225226
/** * 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: number) { let S = this.Sn.Calc("S"); // L'initialisation a été faite lors de l'appel à CalcFn if (this.rS > 0 && S > 0) { let Der = this.rQ2 * this.Sn.Calc("dS") * Math.pow(S, -2); return Der - cParamsCanal.G * this.Sn.Calc("dSYg", rX); } return -Infinity; } }