diff --git a/spec/regime_uniforme_rect.spec.ts b/spec/regime_uniforme_rect.spec.ts index 6cec1391b9ea04d073e3735618ba7d973fcec006..a6dd6ab07d4e7897e7f3fcf378e6dc6301319a04 100644 --- a/spec/regime_uniforme_rect.spec.ts +++ b/spec/regime_uniforme_rect.spec.ts @@ -21,7 +21,7 @@ describe('Class RegimeUniforme / section rectangulaire : ', () => { // largeur de fond sect = new cSnRectang(false, prmsCanal, 2.5); // tirant d'eau - sect.Y = 0.8; + sect.v.Y = 0.8; var ru = new RegimeUniforme(sect); @@ -39,7 +39,7 @@ describe('Class RegimeUniforme / section rectangulaire : ', () => { // largeur de fond sect = new cSnRectang(false, prmsCanal, 3); // tirant d'eau - sect.Y = 1.1; + sect.v.Y = 1.1; var ru = new RegimeUniforme(sect); @@ -47,7 +47,7 @@ describe('Class RegimeUniforme / section rectangulaire : ', () => { expect(ru.Calc("Q").vCalc).toBeCloseTo(0.731, precDigits); }); - it('Strickler should be 30.619', () => { + it('Strickler should be 30.618', () => { let sect: cSnRectang; let prmsCanal: cParamsCanal; @@ -57,12 +57,12 @@ describe('Class RegimeUniforme / section rectangulaire : ', () => { // largeur de fond sect = new cSnRectang(false, prmsCanal, 2.5); // tirant d'eau - sect.Y = 0.8; + sect.v.Y = 0.8; var ru = new RegimeUniforme(sect); // nom variable à calculer, valeur de Ks - expect(ru.Calc("Ks").vCalc).toBeCloseTo(30.619, precDigits); + expect(ru.Calc("Ks").vCalc).toBeCloseTo(30.618, precDigits); }); }); }); diff --git a/spec/regime_uniforme_trapeze.spec.ts b/spec/regime_uniforme_trapeze.spec.ts index 688e231298a0b58de35b81c1b6c65cf957d9c028..51acbad5f8a50478f272848581e6120a3652b916 100644 --- a/spec/regime_uniforme_trapeze.spec.ts +++ b/spec/regime_uniforme_trapeze.spec.ts @@ -11,7 +11,7 @@ describe('Class RegimeUniforme / section trapèze: ', () => { }); describe('Calc(): ', () => { - it('Q should be 9.393', () => { + it('Q should be 1.988', () => { let sect: cSnTrapez; let paramCnl: cParamsCanal; // Ks=Strickler, Q=Débit, If=pente du font, précision, YB=hauteur de berge, YCL=Condition limite en cote à l'amont ou à l'aval @@ -19,7 +19,7 @@ describe('Class RegimeUniforme / section trapèze: ', () => { // largeur de fond, fruit sect = new cSnTrapez(false, paramCnl, 2.5, 0.56); // tirant d'eau - sect.Y = 0.8; + sect.v.Y = 0.8; var ru: RegimeUniforme; ru = new RegimeUniforme(sect); @@ -28,19 +28,20 @@ describe('Class RegimeUniforme / section trapèze: ', () => { }); - it('LargeurAuFond should be 9.393', () => { + it('LargeurFond should be 1.516', () => { let sect: cSnTrapez; let paramCnl: cParamsCanal; // Ks=Strickler, Q=Débit, If=pente du font, précision, YB=hauteur de berge, YCL=Condition limite en cote à l'amont ou à l'aval paramCnl = new cParamsCanal(40, 1.2, 0.001, 0.001, 1) // largeur de fond, fruit sect = new cSnTrapez(false, paramCnl, 0, 0.56); + // tirant d'eau + sect.v.Y = 0.8; var ru: RegimeUniforme; ru = new RegimeUniforme(sect); - let res = new Result(9.393); - expect(ru.Calc("q").vCalc).toBeCloseTo(res.vCalc, precDigits); + expect(ru.Calc("LargeurFond").vCalc).toBeCloseTo(1.516, precDigits); }); }); }); diff --git a/src/dichotomie.ts b/src/dichotomie.ts index a9a554d3a427531ca5d1f0eca424408681136bcd..53db5c39e394b2b0d67d47b5ccd4597600f2b504 100644 --- a/src/dichotomie.ts +++ b/src/dichotomie.ts @@ -14,7 +14,7 @@ export class Dichotomie extends Debug { * @param sVarCalc Nom de la variable à calculer */ constructor(private nub: Nub, private sVarCalc: string) { - super(false); + super(true); } /** Valeur inconnue à rechercher */ @@ -50,7 +50,6 @@ export class Dichotomie extends Debug { /** * Calcul à l'ouvrage - * @param sVarCalc Nom de la variable à calculer * @param rTarget Valeur cible * @param rtol Précision attendue du résultat * @param rInit Valeur initiale de l'inconnue à rechercher @@ -78,7 +77,7 @@ export class Dichotomie extends Debug { v1 = v; v2 = v; - this.debug(nIterMax); + //** @todo : Chercher en dehors de l'intervalle en le décalant à droite ou à gauche en fonction de la valeur */ let nIter: number; for (nIter = 1; nIter < nIterMax; nIter++) { @@ -112,6 +111,7 @@ export class Dichotomie extends Debug { } if (this.XOR(rTarget > v1, rTarget >= v2)) { break; } } + this.debug("intervalle initial " + X1 + ", " + X2); // Gestion de l'absence de solution dans l'intervalle de recherche if (nIter >= this.IDEFINT) { @@ -153,9 +153,6 @@ export class Dichotomie extends Debug { res.extraVar["flag"] = -1; // la valeur cible n'est pas dans l'intervalle de recherche return res; } - // res = new Result(); - // res.vCalc = X; - // return res; return new Result(X); } } \ No newline at end of file diff --git a/src/nub.ts b/src/nub.ts new file mode 100644 index 0000000000000000000000000000000000000000..ff654c2caee6b226da6555ccb48f8cc4be7cf781 --- /dev/null +++ b/src/nub.ts @@ -0,0 +1,74 @@ +import { Debug, IParamsEquation, Result, Serie } from "./base" +import { Dichotomie } from "./dichotomie" + +/** + * Classe abstraite de Noeud de calcul : classe de base pour tous les calculs + */ +export abstract class Nub extends Debug { + /// Nom des variables calculées par la méthode Equation + private _varsEq: string[] = []; + + public v: IParamsEquation; + + constructor(paramsEq: IParamsEquation, dbg: boolean = false) { + super(dbg); + this.v = paramsEq; + } + + + /** + * Formule utilisée pour le calcul analytique (solution directe ou méthode de résolution spécifique) + */ + abstract Equation(sVarCalc: string): Result; + + + /** + * Calcul d'une équation quelque soit l'inconnue à calculer + * @param sVarCalc nom de la variable à calculer + * @param rInit valeur initiale de la variable à calculer dans le cas de la dichotomie + * @param rPrec précision de calcul + */ + Calc(sVarCalc: string, rInit: number = 0, rPrec: number = 0.001): Result { + for (let sVarEq of this._varsEq) { + if (sVarCalc == sVarEq) { + return this.Equation(sVarCalc); + } + } + return this.Solve(sVarCalc, rInit, rPrec); + } + + + CalcSerie(svarCalc: string, serie: Serie): Result[] { + /** @todo faire une boucle pour appeler this.Calc avec chaque valeur de serie.values + * + */ + // let results = [new (Result)]; + let results = [new Result(0)]; + return results; + } + + get sVarsEq(): string[] { + return this._varsEq; + } + + set sVarsEq(sVarsEq: string[]) { + this._varsEq = sVarsEq; + } + + AddVarEq(sVarEq: string) { + this._varsEq.push(sVarEq); + } + + + /** + * Résoud l'équation par une méthode numérique + * @param sVarCalc nom de la variable à calculer + * @param rInit valeur initiale de la variable à calculer dans le cas de la dichotomie + * @param rPrec précision de calcul + */ + Solve(sVarCalc: string, rInit: number, rPrec: number): Result { + let dicho: Dichotomie = new Dichotomie(this, sVarCalc); + var target = this.v[this._varsEq[0]]; + return dicho.Dichotomie(target, rPrec, rInit); + } +} diff --git a/src/regime_uniforme.ts b/src/regime_uniforme.ts index 70c8c2c870780e78febe9680031b26918e0a284d..d50099edfff899611970b8b76a3dbfa3f332e3b2 100644 --- a/src/regime_uniforme.ts +++ b/src/regime_uniforme.ts @@ -8,8 +8,10 @@ export class RegimeUniforme extends Nub { private Sn: acSection; ///< Objet section constructor(s: acSection) { - let paramsEq: { [key: string]: number } = {}; - super(paramsEq); + // let paramsEq: { [key: string]: number } = {}; + super(s.v, true); + + this.debug('constructeur RU'); this.Sn = s; @@ -23,12 +25,12 @@ export class RegimeUniforme extends Nub { */ Calc_Qn() { this.Sn.Reset(true); - if (this.Sn.oP.If <= 0) { + if (this.Sn.oP.v.If <= 0) { var Qn = 0; // ? false bool //this.oLog.Add('h_normale_pente_neg_nul',true); } else { - this.debug(this.Sn); - Qn = this.Sn.oP.Ks * Math.pow(this.Sn.Calc('R', this.Sn.Y), 2 / 3) * this.Sn.Calc('S', this.Sn.Y) * Math.sqrt(this.Sn.oP.If); + Qn = this.Sn.oP.v.Ks * Math.pow(this.Sn.Calc('R', this.Sn.v.Y), 2 / 3) * this.Sn.Calc('S', this.Sn.v.Y) * Math.sqrt(this.Sn.oP.v.If); + this.debug("RU : Qn=" + Qn); } return Qn; } diff --git a/src/section/newton.ts b/src/section/newton.ts index 89c39377092e67a1adf34a9fc2d8134367a2f04f..d237ddab55dacb5c6c20a7c8ed3a0dd81a0fce20 100644 --- a/src/section/newton.ts +++ b/src/section/newton.ts @@ -15,8 +15,8 @@ export abstract class acNewton { * @param $oP Paramètres supplémentaires (Débit, précision...) */ constructor(oP: cParamsCanal) { - this.rTol = oP.Prec; - this.Dx = oP.Prec / 10; + this.rTol = oP.v.Prec; + this.Dx = oP.v.Prec / 10; } /** * Calcul de la fonction f(x) dont on cherche le zéro. diff --git a/src/section/section_circulaire.ts b/src/section/section_circulaire.ts index 214ff218a91d400d41e83636a72d220874c76e5f..56bb10999ae80b1c3acf8970f9bcf2f91c1467c1 100644 --- a/src/section/section_circulaire.ts +++ b/src/section/section_circulaire.ts @@ -5,13 +5,13 @@ import { acSection } from "./section_type"; */ export class cSnCirc extends acSection { - public D; /// Diamètre du cercle + //public D; /// Diamètre du cercle private Alpha; /// Angle de la surface libre par rapport au fond protected nbDessinPoints = 50; constructor(oLog, oP, D) { super(oLog, oP); - this.D = D; + this.v.D = D; if (oP.YB > D) { oP.YB = D; } // On place la berge au sommet du cercle } /** @@ -19,20 +19,20 @@ export class cSnCirc extends acSection { * @return Alpha */ Calc_Alpha() { - if (this.Y > this.oP.YB) { - var rY = this.oP.YB; + if (this.v.Y > this.oP.v.YB) { + var rY = this.oP.v.YB; } else { - rY = this.Y; + rY = this.v.Y; } if (rY <= 0) { return 0; } - else if (rY > this.D) { + else if (rY > this.v.D) { return Math.PI; } else { - var alpha = Math.acos(1. - rY / (this.D / 2.)); + var alpha = Math.acos(1. - rY / (this.v.D / 2.)); if (alpha > Math.PI) { return Math.PI; } @@ -47,11 +47,11 @@ export class cSnCirc extends acSection { * @return dAlpha */ Calc_dAlpha() { - if (this.Y <= 0 || this.Y >= this.D || this.Y > this.oP.YB) { + if (this.v.Y <= 0 || this.v.Y >= this.v.D || this.v.Y > this.oP.v.YB) { return 0; } else { - return 2. / this.D / Math.sqrt(1. - Math.pow(1. - 2. * this.Y / this.D, 2)); + return 2. / this.v.D / Math.sqrt(1. - Math.pow(1. - 2. * this.v.Y / this.v.D, 2)); } } @@ -60,11 +60,11 @@ export class cSnCirc extends acSection { * @return B */ Calc_B() { - if (this.Y > this.oP.YB) { + if (this.v.Y > this.oP.v.YB) { return super.Calc_B_Debordement(); } else { - return this.D * Math.sin(this.Calc('Alpha')); + return this.v.D * Math.sin(this.Calc('Alpha')); } } @@ -74,12 +74,12 @@ export class cSnCirc extends acSection { * @return B */ Calc_P($rY = 0) { - if (this.Y > this.oP.YB && !this.bSnFermee) { + if (this.v.Y > this.oP.v.YB && !this.bSnFermee) { // On n'ajoute pas le périmètre dans le cas d'une fente de Preissmann - return this.CalcGeo('P') + super.Calc_P_Debordement(this.Y - this.oP.YB); + return this.CalcGeo('P') + super.Calc_P_Debordement(this.v.Y - this.oP.v.YB); } else { - return this.D * this.Calc('Alpha'); + return this.v.D * this.Calc('Alpha'); } } @@ -89,11 +89,11 @@ export class cSnCirc extends acSection { * @return S */ Calc_S($rY = 0) { - if (this.Y > this.oP.YB) { - return this.CalcGeo('S') + super.Calc_S_Debordement(this.Y - this.oP.YB); + if (this.v.Y > this.oP.v.YB) { + return this.CalcGeo('S') + super.Calc_S_Debordement(this.v.Y - this.oP.v.YB); } else { - return Math.pow(this.D, 2) / 4 * (this.Calc('Alpha') - Math.sin(this.Calc('Alpha')) * Math.cos(this.Calc('Alpha'))); + return Math.pow(this.v.D, 2) / 4 * (this.Calc('Alpha') - Math.sin(this.Calc('Alpha')) * Math.cos(this.Calc('Alpha'))); } } @@ -103,11 +103,11 @@ export class cSnCirc extends acSection { * @return dP */ Calc_dP() { - if (this.Y > this.oP.YB && !this.bSnFermee) { + if (this.v.Y > this.oP.v.YB && !this.bSnFermee) { return super.Calc_dP_Debordement(); } else { - return this.D * this.Calc('dAlpha'); + return this.v.D * this.Calc('dAlpha'); } } /** @@ -115,11 +115,11 @@ export class cSnCirc extends acSection { * @return dB */ Calc_dB() { - if (this.Y > this.oP.YB) { + if (this.v.Y > this.oP.v.YB) { return super.Calc_dB_Debordement(); } else { - return this.D * this.Calc('dAlpha') * Math.cos(this.Calc('Alpha')); + return this.v.D * this.Calc('dAlpha') * Math.cos(this.Calc('Alpha')); } } /** @@ -130,7 +130,7 @@ export class cSnCirc extends acSection { */ Calc_SYg($rY = 0) { var SYg = Math.sin(this.Calc('Alpha')) - Math.pow(Math.sin(this.Calc('Alpha')), 3) / 3 - this.Calc('Alpha') * Math.cos(this.Calc('Alpha')); - SYg = Math.pow(this.D, 3) / 8 * SYg; + SYg = Math.pow(this.v.D, 3) / 8 * SYg; return SYg; } /** @@ -145,7 +145,7 @@ export class cSnCirc extends acSection { var SYg = this.Calc('dAlpha') * cos; SYg += - this.Calc('dAlpha') * cos * Math.pow(sin, 2); SYg += - this.Calc('dAlpha') * cos + this.Calc('Alpha') * this.Calc('dAlpha') * sin; - SYg = 3 * Math.pow(this.D, 3) / 8 * SYg; + SYg = 3 * Math.pow(this.v.D, 3) / 8 * SYg; return SYg; } } \ No newline at end of file diff --git a/src/section/section_puissance.ts b/src/section/section_puissance.ts index 004869fec28960993ebf33ef2e6d24fae9255e68..1afb789b01788281ecd32a3fc421694dfc939bad 100644 --- a/src/section/section_puissance.ts +++ b/src/section/section_puissance.ts @@ -4,32 +4,32 @@ import { acSection } from "./section_type"; * Calculs de la section parabolique ou "puissance" */ export class cSnPuiss extends acSection { - public k; /// Coefficient de forme compris entre 0 et 1 + //public k; /// Coefficient de forme compris entre 0 et 1 //$LargeurBerge => La largeur des berges est déjà présente dans acSection protected nbDessinPoints = 50; constructor(oLog, oP, rk, LargeurBerge) { super(oLog, oP); - this.k = rk; - this.LargeurBerge = LargeurBerge; + this.v.k = rk; + this.v.LargeurBerge = LargeurBerge; } /** * Calcul de Lambda (mais on garde la routine Alpha commune avec la section circulaire) * @return Lambda */ Calc_Alpha() { - return this.LargeurBerge / Math.pow(this.oP.YB, this.k); + return this.v.LargeurBerge / Math.pow(this.oP.v.YB, this.v.k); } /** * Calcul de la largeur au miroir. * @return B */ Calc_B() { - if (this.Y >= this.oP.YB) { - return this.LargeurBerge; + if (this.v.Y >= this.oP.v.YB) { + return this.v.LargeurBerge; } else { - return this.Calc('Alpha') * Math.pow(this.Y, this.k); + return this.Calc('Alpha') * Math.pow(this.v.Y, this.v.k); } } /** @@ -43,7 +43,7 @@ export class cSnPuiss extends acSection { var P = 0; /// Le périmètre à calculer var Previous = 0; for (var i = 1; i <= n; i++) { - var Current = Math.pow(this.Y * i / n, this.k) / 2; + var Current = Math.pow(this.v.Y * i / n, this.v.k) / 2; P += Math.sqrt(Math.pow(n, -2) + Lambda2 * Math.pow(Current - Previous, 2)); Previous = Current; } @@ -57,7 +57,7 @@ export class cSnPuiss extends acSection { * @return S */ Calc_S($rY = 0) { - return this.Calc('Alpha') * Math.pow(this.Y, this.k + 1) / (this.k + 1); + return this.Calc('Alpha') * Math.pow(this.v.Y, this.v.k + 1) / (this.v.k + 1); } /** @@ -65,7 +65,7 @@ export class cSnPuiss extends acSection { * @return dP */ Calc_dP() { - return 2 * Math.sqrt(1 + Math.pow(this.k * this.Calc('Alpha') / 2, 2) * Math.pow(this.Y, 2 * (this.k - 1))); + return 2 * Math.sqrt(1 + Math.pow(this.v.k * this.Calc('Alpha') / 2, 2) * Math.pow(this.v.Y, 2 * (this.v.k - 1))); } /** @@ -73,7 +73,7 @@ export class cSnPuiss extends acSection { * @return dB */ Calc_dB() { - return this.Calc('Alpha') * this.k * Math.pow(this.Y, this.k - 1); + return this.Calc('Alpha') * this.v.k * Math.pow(this.v.Y, this.v.k - 1); } /** * Calcul de la distance du centre de gravité de la section à la surface libre @@ -82,7 +82,7 @@ export class cSnPuiss extends acSection { * @return S x Yg */ Calc_SYg($rY = 0) { - return this.Calc('Alpha') * Math.pow(this.Y, this.k + 2) / ((this.k + 1) * (this.k + 2)); + return this.Calc('Alpha') * Math.pow(this.v.Y, this.v.k + 2) / ((this.v.k + 1) * (this.v.k + 2)); } /** * Calcul de la dérivée distance du centre de gravité de la section à la surface libre @@ -91,7 +91,7 @@ export class cSnPuiss extends acSection { * @return S x Yg */ Calc_dSYg($rY = 0) { - var SYg = this.Calc('dAlpha') * Math.pow(this.Y, this.k + 2) + this.Calc('Alpha') * Math.pow(this.Y, this.k + 1) * (this.k + 2); - return SYg / ((this.k + 1) * (this.k + 2)); + var SYg = this.Calc('dAlpha') * Math.pow(this.v.Y, this.v.k + 2) + this.Calc('Alpha') * Math.pow(this.v.Y, this.v.k + 1) * (this.v.k + 2); + return SYg / ((this.v.k + 1) * (this.v.k + 2)); } } \ No newline at end of file diff --git a/src/section/section_rectang.ts b/src/section/section_rectang.ts index 4187cace903d2f18b621caf5a500bb3dcac025d3..1a7b0b739c280b59c8ef927a0ae9bba056e719a2 100644 --- a/src/section/section_rectang.ts +++ b/src/section/section_rectang.ts @@ -6,7 +6,7 @@ import { acSection } from "./section_type"; export class cSnRectang extends acSection { constructor(oLog, oP, LargeurFond) { super(oLog, oP); - this.LargeurBerge = LargeurFond; + this.v.LargeurBerge = LargeurFond; } /** * Calcul du périmètre mouillé @@ -14,7 +14,7 @@ export class cSnRectang extends acSection { * @return Périmètre mouillé (m) */ Calc_P($rY = 0) { - return this.LargeurBerge + super.Calc_P_Debordement(this.Y); + return this.v.LargeurBerge + super.Calc_P_Debordement(this.v.Y); } Calc_dP() { @@ -30,7 +30,7 @@ export class cSnRectang extends acSection { } Calc_S() { - return super.Calc_S_Debordement(this.Y); + return super.Calc_S_Debordement(this.v.Y); } /** @@ -38,6 +38,6 @@ export class cSnRectang extends acSection { * @return tirant d'eau conjugué */ CalcYco() { - return this.Y * (Math.sqrt(1 + 8 * Math.pow(this.Calc('Fr'), 2)) - 1) / 2; + return this.v.Y * (Math.sqrt(1 + 8 * Math.pow(this.Calc('Fr'), 2)) - 1) / 2; } } \ No newline at end of file diff --git a/src/section/section_trapez.ts b/src/section/section_trapez.ts index 4dc736f8c69795914ac17ee15312b07c8019c4a3..e1a67989fa1a61d3824320b54f440fe178da6548 100644 --- a/src/section/section_trapez.ts +++ b/src/section/section_trapez.ts @@ -4,20 +4,20 @@ import { acSection } from "./section_type"; * Calculs de la section trapézoïdale */ export class cSnTrapez extends acSection { - public LargeurFond; /// Largeur au fond - public Fruit; /// Fruit des berges + // public LargeurFond; /// Largeur au fond + // public Fruit; /// Fruit des berges constructor(oLog, oP, LargeurFond, Fruit) { super(oLog, oP); - this.LargeurFond = LargeurFond; - this.Fruit = Fruit; + this.v.LargeurFond = LargeurFond; + this.v.Fruit = Fruit; } Calc_B(bBerge = false) { - if (!bBerge && this.Y > this.oP.YB) { - return this.LargeurBerge; + if (!bBerge && this.v.Y > this.oP.v.YB) { + return this.v.LargeurBerge; } else { - return this.LargeurFond + 2 * this.Fruit * this.Y; + return this.v.LargeurFond + 2 * this.v.Fruit * this.v.Y; } } @@ -27,11 +27,11 @@ export class cSnTrapez extends acSection { * @return Périmètre mouillé (m) */ Calc_P($rY = 0) { - if (this.Y > this.oP.YB) { - var P = this.CalcGeo('P') + super.Calc_P_Debordement(this.Y - this.oP.YB); + if (this.v.Y > this.oP.v.YB) { + var P = this.CalcGeo('P') + super.Calc_P_Debordement(this.v.Y - this.oP.v.YB); } else { - P = this.LargeurFond + 2 * Math.sqrt(1 + Math.pow(this.Fruit, 2)) * this.Y; + P = this.v.LargeurFond + 2 * Math.sqrt(1 + Math.pow(this.v.Fruit, 2)) * this.v.Y; } //~ spip_log('Trapez->CalcP(rY='.$this->rY.')='.$P,'hydraulic.'._LOG_DEBUG); return P; @@ -43,11 +43,11 @@ export class cSnTrapez extends acSection { * @return Surface mouillée (m2) */ Calc_S($rY = 0) { - if (this.Y > this.oP.YB) { - var S = this.CalcGeo('S') + super.Calc_S_Debordement(this.Y - this.oP.YB); + if (this.v.Y > this.oP.v.YB) { + var S = this.CalcGeo('S') + super.Calc_S_Debordement(this.v.Y - this.oP.v.YB); } else { - S = this.Y * (this.LargeurFond + this.Fruit * this.Y); + S = this.v.Y * (this.v.LargeurFond + this.v.Fruit * this.v.Y); } //~ spip_log('Trapez->CalcS(rY='.$this->rY.')='.$S,'hydraulic.'._LOG_DEBUG); return S; @@ -58,11 +58,11 @@ export class cSnTrapez extends acSection { * @return dS */ Calc_dS() { - if (this.Y > this.oP.YB) { + if (this.v.Y > this.oP.v.YB) { return super.Calc_dS(); } else { - return this.LargeurFond + 2 * this.Fruit * this.Y; + return this.v.LargeurFond + 2 * this.v.Fruit * this.v.Y; } } @@ -71,11 +71,11 @@ export class cSnTrapez extends acSection { * @return dP */ Calc_dP() { - if (this.Y > this.oP.YB) { + if (this.v.Y > this.oP.v.YB) { return super.Calc_dP_Debordement(); } else { - return 2 * Math.sqrt(1 + this.Fruit * this.Fruit); + return 2 * Math.sqrt(1 + this.v.Fruit * this.v.Fruit); } } @@ -84,11 +84,11 @@ export class cSnTrapez extends acSection { * @return dB */ Calc_dB() { - if (this.Y > this.oP.YB) { + if (this.v.Y > this.oP.v.YB) { return super.Calc_dB_Debordement(); } else { - return 2 * this.LargeurFond * this.Fruit; + return 2 * this.v.LargeurFond * this.v.Fruit; } } /** @@ -98,7 +98,7 @@ export class cSnTrapez extends acSection { * @return S x Yg */ Calc_SYg($rY = 0) { - return (this.LargeurFond / 2 + this.Fruit * this.Y / 3) * Math.pow(this.Y, 2); + return (this.v.LargeurFond / 2 + this.v.Fruit * this.v.Y / 3) * Math.pow(this.v.Y, 2); } /** * Calcul de la dérivée de la distance du centre de gravité de la section à la surface libre @@ -107,8 +107,8 @@ export class cSnTrapez extends acSection { * @return S x Yg */ Calc_dSYg($rY = 0) { - var SYg = this.Fruit / 3 * Math.pow(this.Y, 2); - SYg += (this.LargeurFond / 2 + this.Fruit * this.Y / 3) * 2 * this.Y; + var SYg = this.v.Fruit / 3 * Math.pow(this.v.Y, 2); + SYg += (this.v.LargeurFond / 2 + this.v.Fruit * this.v.Y / 3) * 2 * this.v.Y; return SYg; } } \ No newline at end of file diff --git a/src/section/section_type.ts b/src/section/section_type.ts index deb89b2e437dbe8c9f500a4af2082bf8df0b5c60..8a75981ae56904345e7c824a946eaeadb5ef91c1 100644 --- a/src/section/section_type.ts +++ b/src/section/section_type.ts @@ -1,6 +1,8 @@ -import { acNewton } from "./newton"; -import { cLog } from "./log" import { Debug } from "../base" +import { acNewton } from "./newton"; +import { cLog } from "./log"; +import { IParamsEquation } from "../base"; + /** * Calcul de la hauteur critique */ @@ -9,8 +11,8 @@ export class cHautCritique extends acNewton { private oP; /** * Constructeur de la classe - * @param $oSn Section sur laquelle on fait le calcul - * @param $oP Paramètres supplémentaires (Débit, précision...) + * @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); @@ -20,12 +22,12 @@ export class cHautCritique extends acNewton { } /** * Calcul de la fonction dont on cherche le zéro - * @param $rX Variable dont dépend la fonction + * @param rX Variable dont dépend la fonction */ - CalcFn($rX) { + CalcFn(rX) { // Calcul de la fonction - if (this.Sn.Calc('S', $rX) != 0) { - var Fn = (Math.pow(this.oP.Q, 2) * this.Sn.Calc('B', $rX) / Math.pow(this.Sn.Calc('S', $rX), 3) / this.oP.G - 1); + if (this.Sn.Calc('S', rX) != 0) { + var Fn = (Math.pow(this.oP.Q, 2) * this.Sn.Calc('B', rX) / Math.pow(this.Sn.Calc('S', rX), 3) / this.oP.G - 1); } else { Fn = Infinity; @@ -34,18 +36,18 @@ export class cHautCritique extends acNewton { } /** * Calcul analytique de la dérivée de la fonction dont on cherche le zéro - * @param $rX Variable dont dépend la fonction + * @param rX Variable dont dépend la fonction */ - CalcDer($rX) { + CalcDer(rX) { if (this.Sn.Calc('S') != 0) { - // L'initialisation à partir de $rX a été faite lors de l'appel à CalcFn + // 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.Q, 2) / this.oP.G * Der / Math.pow(this.Sn.Calc('S'), 4); } else { Der = Infinity; } - //spip_log('cHautCritique:CalcDer('.$rX.')='.$rDer,'hydraulic.'._LOG_DEBUG); + //spip_log('cHautCritique:CalcDer('.rX.')='.rDer,'hydraulic.'._LOG_DEBUG); return Der; } } @@ -60,36 +62,36 @@ export class cHautNormale extends acNewton { private G; /** * Constructeur de la classe - * @param $oSn Section sur laquelle on fait le calcul - * @param $oP Paramètres supplémentaires (Débit, précision...) + * @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.Q; - this.Ks = oP.Ks; - this.If = oP.If; - this.G = oP.G; + this.Q = oP.v.Q; + this.Ks = oP.v.Ks; + this.If = oP.v.If; + this.G = oP.v.G; } /** * Calcul de la fonction dont on cherche le zéro - * @param $rX Variable dont dépend la fonction + * @param rX Variable dont dépend la fonction */ - CalcFn($rX) { + 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)); + 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 + * @param rX Variable dont dépend la fonction */ - CalcDer($rX) { + 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); + //spip_log('cHautNormale:CalcDer('.rX.')='.rDer,'hydraulic.'._LOG_DEBUG); return Der; } } @@ -103,31 +105,31 @@ export class cHautCorrespondante extends acNewton { private rQ2G; // 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...) + * @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.Y; + this.Y = Sn.v.Y; this.rS2 = Math.pow(Sn.Calc('S'), -2); this.Sn = Sn; - this.rQ2G = Math.pow(oP.Q, 2) / (2 * oP.G); + this.rQ2G = Math.pow(oP.v.Q, 2) / (2 * oP.v.G); } /** * Calcul de la fonction dont on cherche le zéro - * @param $rX Variable dont dépend la fonction + * @param rX Variable dont dépend la fonction */ - CalcFn($rX) { + 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); + 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 + * @param rX Variable dont dépend la fonction */ - CalcDer($rX) { + 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); @@ -135,7 +137,7 @@ export class cHautCorrespondante extends acNewton { else { Der = Infinity; } - //~ spip_log('cHautCorrespondante:CalcDer('.$rX.')='.$rDer,'hydraulic.'._LOG_DEBUG); + //~ spip_log('cHautCorrespondante:CalcDer('.rX.')='.rDer,'hydraulic.'._LOG_DEBUG); return Der; } } @@ -159,48 +161,48 @@ export class cHautConjuguee extends acNewton { private rSYg; /** * Constructeur de la classe - * @param $oSn Section sur laquelle on fait le calcul - * @param $oP Paramètres supplémentaires (Débit, précision...) + * @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.Y; - this.rQ2 = Math.pow($oP.Q, 2); - this.Sn = $oSn; - this.G = $oP.G; - this.rS = $oSn.Calc('S'); - this.rSYg = $oSn.Calc('SYg'); + constructor(oSn: acSection, oP: cParamsCanal) { + super(oP); + this.Y = oSn.v.Y; + this.rQ2 = Math.pow(oP.v.Q, 2); + this.Sn = oSn; + this.G = oP.v.G; + 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 + * @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) { + 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 + this.G * (this.rSYg - this.Sn.Calc('SYg')); } else { Fn = -Infinity; } - //~ spip_log('cHautConjuguee:CalcFn('.$rX.')='.$rFn,'hydraulic.'._LOG_DEBUG); + //~ 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 + * @param rX Variable dont dépend la fonction */ - CalcDer($rX) { + 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 - this.G * this.Sn.Calc('dSYg', $rX); + Der = Der - this.G * this.Sn.Calc('dSYg', rX); } else { Der = -Infinity; } - //~ spip_log('cHautConjuguee:CalcDer('.$rX.')='.$rDer,'hydraulic.'._LOG_DEBUG); + //~ spip_log('cHautConjuguee:CalcDer('.rX.')='.rDer,'hydraulic.'._LOG_DEBUG); return Der; } } @@ -209,29 +211,34 @@ export class cHautConjuguee extends acNewton { * Gestion des Paramètres du canal (hors section) */ export class cParamsCanal { - public YCL; /// Condition limite en cote à l'amont ou à l'aval - public Ks; /// Strickler - public Q; /// Débit - public Long; /// Longueur du bief - public If; /// Pente du fond - public Dx; /// Pas d'espace (positif en partant de l'aval, négatif en partant de l'amont) - public Prec; /// Précision de calcul et d'affichage - public G = 9.81;/// Constante de gravité - public iPrec; /// Précision en nombre de décimales - public YB; /// Hauteur de berge - public Resolution; /// Méthode de résolution "Euler" ou "RK4" - constructor($rKs, $rQ, $rIf, $rPrec, $rYB, $rYCL = 0, $rDx = 0, $rLong = 0, $sResolution = '') { - this.Resolution = $sResolution; - this.YCL = $rYCL; - this.Ks = $rKs; - this.Q = $rQ; - this.Long = $rLong; - this.If = $rIf; - this.Dx = $rDx; - this.Prec = $rPrec; - this.YB = $rYB; - this.iPrec = -Math.log($rPrec) / Math.log(10); + private _v: IParamsEquation = {}; + + // public YCL; /// Condition limite en cote à l'amont ou à l'aval + // public Ks; /// Strickler + // public Q; /// Débit + // public Long; /// Longueur du bief + // public If; /// Pente du fond + // public Dx; /// Pas d'espace (positif en partant de l'aval, négatif en partant de l'amont) + // public Prec; /// Précision de calcul et d'affichage + // public G = 9.81;/// Constante de gravité + // public iPrec; /// Précision en nombre de décimales + // public YB; /// Hauteur de berge + // public Resolution; /// Méthode de résolution "Euler" ou "RK4" + constructor(rKs, rQ, rIf, rPrec, rYB, rYCL = 0, rDx = 0, rLong = 0) //, sResolution = '') { + { + //this.v.Resolution = sResolution; + this.v.YCL = rYCL; + this.v.Ks = rKs; + this.v.Q = rQ; + this.v.Long = rLong; + this.v.If = rIf; + this.v.Dx = rDx; + this.v.Prec = rPrec; + this.v.YB = rYB; + this.v.iPrec = -Math.log(rPrec) / Math.log(10); } + + get v() { return this._v; } } /** @@ -239,16 +246,18 @@ export class cParamsCanal { * Comprend les formules pour la section rectangulaire pour gérer les débordements */ export abstract class acSection extends Debug { + private _v: IParamsEquation; + - public Y; /// Tirant d'eau + //public Y; /// Tirant d'eau public HautCritique; /// Tirant d'eau critique public HautNormale; /// Tirant d'eau normal public oP: cParamsCanal; /// Paramètres du système canal (classe oParam) protected oLog: cLog; /// Pour l'affichage du journal de calcul - public LargeurBerge; /// largeur au débordement + //public LargeurBerge; /// largeur au débordement protected bSnFermee = false; /// true si la section est fermée (fente de Preissmann) /** - * Tableau contenant les données dépendantes du tirant d'eau $this->rY. + * Tableau contenant les données dépendantes du tirant d'eau this->rY. * * Les clés du tableau peuvent être : * - S : la surface hydraulique @@ -279,10 +288,18 @@ export abstract class acSection extends Debug { this.oP = oP; this.oLog = oLog; this.CalcGeo['B']; + + this._v = this.oP.v; + this.v.Y = 0; + this.v.LargeurBerge = 0; } + + get v() { return this._v; } + set v(v) { this._v = v; } + /** * Efface toutes les données calculées pour forcer le recalcul - * @param $bGeo Réinitialise les données de géométrie aussi + * @param bGeo Réinitialise les données de géométrie aussi */ Reset(bGeo = true) { this.arCalc = {}; @@ -296,11 +313,11 @@ export abstract class acSection extends Debug { */ Swap(bMem) { if (bMem) { - this.Y_old = this.Y; + this.Y_old = this.v.Y; this.Calc_old = this.arCalc; } else { - this.Y = this.Y_old; + this.v.Y = this.Y_old; this.arCalc = this.Calc_old; this.Calc_old = {}; } @@ -308,13 +325,13 @@ export abstract class acSection extends Debug { /** * Calcul des données à la section - * @param $sDonnee Clé de la donnée à calculer (voir $this->$arCalc) - * @param $bRecalc Pour forcer le recalcul de la donnée + * @param sDonnee Clé de la donnée à calculer (voir this->arCalc) + * @param bRecalc Pour forcer le recalcul de la donnée * @return la donnée calculée */ Calc(sDonnee, rY: number = undefined) { - if (rY != undefined && rY != this.Y) { - this.Y = rY; + if (rY != undefined && rY != this.v.Y) { + this.v.Y = rY; // On efface toutes les données dépendantes de Y pour forcer le calcul this.Reset(false); } @@ -323,7 +340,7 @@ export abstract class acSection extends Debug { // La donnée a besoin d'être calculée switch (sDonnee) { case 'I-J': // Variation linéaire de l'énergie spécifique (I-J) en m/m - this.arCalc[sDonnee] = this.oP.If - this.Calc('J'); + this.arCalc[sDonnee] = this.oP.v.If - this.Calc('J'); break; case 'Yn': // Hauteur normale return this.Calc_Yn(); @@ -338,8 +355,8 @@ export abstract class acSection extends Debug { /** * Calcul des données uniquement dépendantes de la géométrie de la section - * @param $sDonnee Clé de la donnée à calculer (voir $this->$arCalcGeo) - * @param $rY Hauteur d'eau + * @param sDonnee Clé de la donnée à calculer (voir this->arCalcGeo) + * @param rY Hauteur d'eau * @return la donnée calculée */ CalcGeo(sDonnee) { @@ -352,17 +369,17 @@ export abstract class acSection extends Debug { // La donnée a besoin d'être calculée this.Swap(true); // On mémorise les données hydrauliques en cours this.Reset(false); - this.Y = this.oP.YB; + this.v.Y = this.oP.v.YB; switch (sDonnee) { case 'B': // Largeur aux berges this.CalcGeo[sDonnee] = this.Calc_B(); - if (this.calcGeo[sDonnee] < this.oP.YB / 100) { + if (this.calcGeo[sDonnee] < this.oP.v.YB / 100) { // Section fermée this.bSnFermee = true; // On propose une fente de Preissmann égale à 1/100 de la hauteur des berges - this.CalcGeo[sDonnee] = this.oP.YB / 100; + this.CalcGeo[sDonnee] = this.oP.v.YB / 100; } - this.LargeurBerge = this.CalcGeo[sDonnee]; + this.v.LargeurBerge = this.CalcGeo[sDonnee]; break; default: /*var methode = 'Calc_'+sDonnee + '()'; @@ -371,7 +388,7 @@ export abstract class acSection extends Debug { this.CalcGeo[sDonnee] = this[methode](); this.debug("methodecalcgeo " + this[methode]()); } - //~ spip_log('CalcGeo('.$sDCalcGeonnee.',rY='.$this->oP->rYB.')='.$this->arCalcGeo[$sDonnee],'hydraulic.'._LOG_DEBUG); + //~ spip_log('CalcGeo('.sDCalcGeonnee.',rY='.this->oP->rYB.')='.this->arCalcGeo[sDonnee],'hydraulic.'._LOG_DEBUG); this.Swap(false); // On restitue les données hydrauliques en cours } this.debug('calcgeo ' + sDonnee + ' ' + this.CalcGeo[sDonnee]); @@ -395,7 +412,7 @@ export abstract class acSection extends Debug { * @param Y hauteur d'eau au dela de la berge **/ Calc_S_Debordement(Y: number) { - return Y * this.LargeurBerge; + return Y * this.v.LargeurBerge; } /** @@ -409,7 +426,7 @@ export abstract class acSection extends Debug { * @return La dérivée de la surface hydraulique en cas de débordement */ Calc_dS_Debordement() { - return this.LargeurBerge; + return this.v.LargeurBerge; } /** @@ -478,7 +495,7 @@ export abstract class acSection extends Debug { * @return La largeur au miroir en cas de débordement */ Calc_B_Debordement() { - return this.LargeurBerge; + return this.v.LargeurBerge; } /** @@ -501,7 +518,7 @@ export abstract class acSection extends Debug { */ Calc_J() { if (this.Calc('R') != 0) { - return Math.pow(this.Calc('V') / this.oP.Ks, 2) / Math.pow(this.Calc('R'), 4 / 3); + return Math.pow(this.Calc('V') / this.oP.v.Ks, 2) / Math.pow(this.Calc('R'), 4 / 3); } else { return Infinity; @@ -513,7 +530,7 @@ export abstract class acSection extends Debug { */ Calc_Fr() { if (this.Calc('S') != 0) { - return this.oP.Q / this.Calc('S') * Math.sqrt(this.Calc('B') / this.Calc('S') / this.oP.G); + return this.oP.v.Q / this.Calc('S') * Math.sqrt(this.Calc('B') / this.Calc('S') / this.oP.v.G); } else { return Infinity; @@ -524,7 +541,7 @@ export abstract class acSection extends Debug { */ Calc_dYdX(Y) { // L'appel à Calc('J') avec Y en paramètre réinitialise toutes les données dépendantes de la ligne d'eau - return - (this.oP.If - this.Calc('J', Y) / (1 - Math.pow(this.Calc('Fr', Y), 2))); + return - (this.oP.v.If - this.Calc('J', Y) / (1 - Math.pow(this.Calc('Fr', Y), 2))); } XOR(a, b) { @@ -537,8 +554,8 @@ export abstract class acSection extends Debug { */ Calc_Y_Euler(Y) { // L'appel à Calc('J') avec Y en paramètre réinitialise toutes les données dépendantes de la ligne d'eau - var Y2 = Y + this.oP.Dx * this.Calc_dYdX(Y); - if (this.XOR(this.oP.Dx > 0, !(Y2 < this.HautCritique))) { + var Y2 = Y + this.oP.v.Dx * this.Calc_dYdX(Y); + if (this.XOR(this.oP.v.Dx > 0, !(Y2 < this.HautCritique))) { return false; } else { return Y2; @@ -550,7 +567,7 @@ export abstract class acSection extends Debug { */ Calc_Y_RK4(Y) { // L'appel à Calc('J') avec Y en paramètre réinitialise toutes les données dépendantes de la ligne d'eau - var Dx = this.oP.Dx; + var Dx = this.oP.v.Dx; var k1 = this.Calc_dYdX(Y); if (this.XOR(Dx > 0, !(Y + Dx / 2 * k1 < this.HautCritique))) { return false; } var k2 = this.Calc_dYdX(Y + Dx / 2 * k1); @@ -565,20 +582,20 @@ export abstract class acSection extends Debug { * Calcul du point suivant d'une courbe de remous * @return Tirant d'eau */ - Calc_Y($rY) { - var funcCalcY = 'Calc_Y_' + this.oP.Resolution; - var methods = Object.getOwnPropertyNames(this).filter(function (p) { - return typeof this[p] === 'function'; - }); - for (var m of methods) { - if (funcCalcY == m) { - return this[funcCalcY]($rY); - } - else { - return false; - } - } - } + // Calc_Y(rY) { + // var funcCalcY = 'Calc_Y_' + this.oP.Resolution; + // var methods = Object.getOwnPropertyNames(this).filter(function (p) { + // return typeof this[p] === 'function'; + // }); + // for (var m of methods) { + // if (funcCalcY == m) { + // return this[funcCalcY](rY); + // } + // else { + // return false; + // } + // } + // } /** * Calcul de la vitesse moyenne. @@ -586,7 +603,7 @@ export abstract class acSection extends Debug { */ Calc_V() { if (this.Calc('S') != 0) { - return this.oP.Q / this.Calc('S'); + return this.oP.v.Q / this.Calc('S'); } else { return Infinity; @@ -597,7 +614,7 @@ export abstract class acSection extends Debug { * @return Charge spécifique */ Calc_Hs() { - return this.Y + Math.pow(this.Calc('V'), 2) / (2 * this.oP.G); + return this.v.Y + Math.pow(this.Calc('V'), 2) / (2 * this.oP.v.G); } /** * Calcul de la charge spécifique critique. @@ -622,7 +639,7 @@ export abstract class acSection extends Debug { //traduction de code de langue: //this.oLog.Add(_T('hydraulic:h_critique')+' : '+_T('hydraulic:newton_non_convergence'),true); }*/ - this.HautCritique = hautCritique.Newton(this.oP.YB); + this.HautCritique = hautCritique.Newton(this.oP.v.YB); return this.HautCritique; } /** @@ -631,7 +648,7 @@ export abstract class acSection extends Debug { */ Calc_Yn() { this.debug("in calc_Yn"); - if (this.oP.If <= 0) { + if (this.oP.v.If <= 0) { this.HautNormale = false; //this.oLog.Add(_T('hydraulic:h_normale_pente_neg_nul'),true); } else { @@ -649,8 +666,8 @@ export abstract class acSection extends Debug { * @return tirant d'eau fluvial */ Calc_Yf() { - if (this.Y > this.CalcGeo('Yc')) { - return this.Y; + if (this.v.Y > this.CalcGeo('Yc')) { + return this.v.Y; } else { var oHautCorrespondante = new cHautCorrespondante(this, this.oP); @@ -662,8 +679,8 @@ export abstract class acSection extends Debug { * @return tirant d'eau torrentiel */ Calc_Yt() { - if (this.Y < this.CalcGeo('Yc')) { - return this.Y; + if (this.v.Y < this.CalcGeo('Yc')) { + return this.v.Y; } else { var oHautCorrespondante = new cHautCorrespondante(this, this.oP); @@ -686,7 +703,7 @@ export abstract class acSection extends Debug { Y0 = this.Calc('Yf'); } /* if(!Yco = oHautConj->Newton(Y0) || !oHautConj.HasConverged()) { - //$this->oLog->Add(_T('hydraulic:h_conjuguee').' : '._T('hydraulic:newton_non_convergence'),true); + //this->oLog->Add(_T('hydraulic:h_conjuguee').' : '._T('hydraulic:newton_non_convergence'),true); } return Yco;*/ // c quoi Yco ? } @@ -695,30 +712,30 @@ export abstract class acSection extends Debug { * @return contrainte de cisaillement */ Calc_Tau0() { - return 1000 * this.oP.G * this.Calc('R') * this.Calc('J'); + return 1000 * this.oP.v.G * this.Calc('R') * this.Calc('J'); } /** * Calcul de la distance du centre de gravité de la section à la surface libre * multiplié par la surface hydraulique * @return S x Yg */ - Calc_SYg($rY) { - return Math.pow($rY, 2) * this.LargeurBerge / 2; + Calc_SYg(rY) { + return Math.pow(rY, 2) * this.v.LargeurBerge / 2; } /** * Calcul de la dérivée distance du centre de gravité de la section à la surface libre * multiplié par la surface hydraulique * @return S x Yg */ - Calc_dSYg($rY) { - return $rY * this.LargeurBerge; + Calc_dSYg(rY) { + return rY * this.v.LargeurBerge; } /** * Calcul de l'impulsion hydraulique. * @return Impulsion hydraulique */ Calc_Imp() { - return 1000 * (this.oP.Q * this.Calc('V') + this.oP.G * this.Calc('SYg')); + return 1000 * (this.oP.v.Q * this.Calc('V') + this.oP.v.G * this.Calc('SYg')); } /** * Calcul de l'angle Alpha entre la surface libre et le fond pour les sections circulaires.