jalhyd
Version:
JaLHyd, a Javascript Library for Hydraulics
84 lines • 3.12 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cHautCorrespondante = 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 correspondante (charge égale)
*/
// tslint:disable-next-line:class-name
class cHautCorrespondante extends internal_modules_3.acNewton {
/**
* Constructeur de la classe
* @param oSn Section sur laquelle on fait le calcul
*/
// tslint:disable-next-line:variable-name
constructor(Sn, maxIter, dbg = false) {
super(Sn.prms, maxIter, dbg);
this.Y = Sn.prms.Y.v;
// this.rS2 = Math.pow(Sn.CalcSection("S"), -2);
this.Sn = Sn;
// tslint:disable-next-line:no-unused-expression
this.rS2; // pour initialiser la valeur @WTF (utilise le getter)
this.rQ2G = Math.pow(Sn.prms.Q.v, 2) / (2 * internal_modules_4.ParamsSection.G);
}
get rS2() {
if (this._rS2 === undefined) {
const rS = this.Sn.CalcSection("S");
if (rS.ok) {
const v = Math.pow(rS.vCalc, -2);
this._rS2 = new internal_modules_2.Result(v);
}
else {
this._rS2 = rS;
}
}
return this._rS2;
}
/**
* Calcul de la fonction dont on cherche le zéro
* @param rX Variable dont dépend la fonction
*/
CalcFn(rX) {
if (!this.rS2.ok) {
return this.rS2;
}
const rS = this.Sn.CalcSection("S", rX);
if (!rS.ok) {
return rS;
}
// Calcul de la fonction
// return this.Y - rX + (this.rS2 - Math.pow(this.Sn.CalcSection("S", rX), -2)) * this.rQ2G;
const v = this.Y - rX + (this.rS2.vCalc - Math.pow(rS.vCalc, -2)) * this.rQ2G;
return new internal_modules_2.Result(v);
}
/**
* 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) {
// let S = this.Sn.CalcSection("S");
const rS = this.Sn.CalcSection("S");
if (!rS.ok) {
return rS;
}
const S = rS.vCalc;
// L'initialisation a été faite lors de l'appel à CalcFn
// if (S !== 0)
if (S === 0) {
return new internal_modules_2.Result(new internal_modules_1.Message(internal_modules_1.MessageCode.ERROR_SECTION_SURFACE_NULLE));
}
const rB = this.Sn.CalcSection("B");
if (!rB.ok) {
return rB;
}
// return -1 + 2 * this.rQ2G * this.Sn.CalcSection("B") / Math.pow(S, 3);
const v = -1 + 2 * this.rQ2G * rB.vCalc / Math.pow(S, 3);
return new internal_modules_2.Result(v);
// return Infinity;
}
}
exports.cHautCorrespondante = cHautCorrespondante;
//# sourceMappingURL=hauteur_correspondante.js.map