jalhyd
Version:
JaLHyd, a Javascript Library for Hydraulics
97 lines • 3.84 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cHautConjuguee = void 0;
const internal_modules_1 = require("../../internal_modules");
const internal_modules_2 = require("../../internal_modules");
const internal_modules_3 = require("../../internal_modules");
const internal_modules_4 = require("../../internal_modules");
/**
* Calcul de la hauteur conjuguée (Impulsion égale)
*/
// tslint:disable-next-line:class-name
class cHautConjuguee extends internal_modules_3.acNewton {
/**
* Constructeur de la classe
* @param oSn Section sur laquelle on fait le calcul
*/
constructor(oSn, maxIter, dbg = false) {
super(oSn.prms, maxIter, dbg);
this.rQ2 = Math.pow(oSn.prms.Q.v, 2);
this.Sn = oSn;
this.rS = oSn.CalcSection("S");
this.rSYg = oSn.CalcSection("SYg");
}
/**
* Calcul de la fonction dont on cherche le zéro
* @param rX Variable dont dépend la fonction
*/
CalcFn(rX) {
if (!this.rS.ok) {
return this.rS;
}
if (!this.rSYg.ok) {
return this.rSYg;
}
const rS2 = this.Sn.CalcSection("S", rX);
if (!rS2.ok) {
return rS2;
}
// Réinitialisation des paramètres hydrauliques de this.Sn avec l'appel this.Sn.CalcSection("S',rX)
// if (this.rS > 0 && this.Sn.CalcSection("S", rX) > 0) {
if (this.rS.vCalc > 0 && rS2.vCalc > 0) {
// let Fn = this.rQ2 * (1 / this.rS - 1 / this.Sn.CalcSection("S"));
const rS3 = this.Sn.CalcSection("S");
if (!rS3.ok) {
return rS3;
}
// tslint:disable-next-line:variable-name
const Fn = this.rQ2 * (1 / this.rS.vCalc - 1 / rS3.vCalc);
const rSYg = this.Sn.CalcSection("SYg");
if (!rSYg.ok) {
return rSYg;
}
// return Fn + ParamsSection.G * (this.rSYg - this.Sn.CalcSection("SYg"));
const v = Fn + internal_modules_4.ParamsSection.G * (this.rSYg.vCalc - rSYg.vCalc);
return new internal_modules_2.Result(v);
}
return new internal_modules_2.Result(new internal_modules_1.Message(internal_modules_1.MessageCode.ERROR_SECTION_PERIMETRE_NUL));
// 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) {
if (!this.rS.ok) {
return this.rS;
}
// let S = this.Sn.CalcSection("S");
const rS2 = this.Sn.CalcSection("S");
if (!rS2.ok) {
return rS2;
}
const S = rS2.vCalc;
// L'initialisation a été faite lors de l'appel à CalcFn
// if (this.rS > 0 && S > 0) {
if (this.rS.vCalc > 0 && S > 0) {
const rDS = this.Sn.CalcSection("dS");
if (!rDS.ok) {
return rDS;
}
// let Der = this.rQ2 * this.Sn.CalcSection("dS") * Math.pow(S, -2);
// tslint:disable-next-line:variable-name
const Der = this.rQ2 * rDS.vCalc * Math.pow(S, -2);
const rDYG = this.Sn.CalcSection("dSYg", rX);
if (!rDYG.ok) {
return rDYG;
}
// return Der - ParamsSection.G * this.Sn.CalcSection("dSYg", rX);
const v = Der - internal_modules_4.ParamsSection.G * rDYG.vCalc;
return new internal_modules_2.Result(v);
}
return new internal_modules_2.Result(new internal_modules_1.Message(internal_modules_1.MessageCode.ERROR_SECTION_PERIMETRE_NUL));
// return -Infinity;
}
}
exports.cHautConjuguee = cHautConjuguee;
//# sourceMappingURL=hauteur_conjuguee.js.map