UNPKG

jalhyd

Version:

JaLHyd, a Javascript Library for Hydraulics

151 lines 4.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PL_LechaptCalmon = 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 des pertes de charge dans un tube à partir des tables de Lechapt et Calmon */ class PL_LechaptCalmon extends internal_modules_4.PressureLossLaw { constructor(prms, dbg = false) { super(prms, dbg); this.pressureLossType = internal_modules_4.PressureLossType.LechaptCalmon; this._props.addObserver(this); this.material = internal_modules_1.LCMaterial.PVCPolyethylene; this._intlType = "LechaptCalmon"; } static get materials() { return PL_LechaptCalmon._materials; } get material() { return this.getPropValue("material"); } set material(m) { this.setPropValue("material", m); } Equation(sVarCalc) { if (sVarCalc !== undefined && sVarCalc !== "Jlin") { throw new Error("PL_LechaptCalmon.Equation() : invalid variable name " + sVarCalc); } const r = this._result; // récupération des paramètres Q,D et Lg dans le parent const parentPrms = this.parent.prms; const Q = parentPrms.Q.v; const D = parentPrms.D.v; const Lg = parentPrms.Lg.v; // Calcul de la perte de charge linéaire spécifique à chaque module de perte de charge. r.values.Jlin = this.prms.L.v * Math.pow(Q, this.prms.M.v) / Math.pow(D, this.prms.N.v) * (Lg / 1000); return r; } finalChecks(r) { if (r.values.V < 0.4 || r.values.V > 2) { r.resultElement.log.add(new internal_modules_3.Message(internal_modules_3.MessageCode.WARNING_LECHAPT_CALMON_SPEED_OUTSIDE_04_2)); } } /** * paramètres castés au bon type */ get prms() { return this._prms; } // interface Observer update(sender, data) { if (data.action === "propertyChange" && data.name === "material") { this.applyMaterialPreset(); } } /** * paramétrage de la calculabilité des paramètres */ setParametersCalculability() { this.prms.L.calculability = internal_modules_2.ParamCalculability.FIXED; this.prms.M.calculability = internal_modules_2.ParamCalculability.FIXED; this.prms.N.calculability = internal_modules_2.ParamCalculability.FIXED; } exposeResults() { this._resultsFamilies = { Klin: undefined, fD: undefined, V: undefined, Jlin: undefined }; } /** * Modifies values of L, M, N depending on the given material, * according to this._materials presets */ applyMaterialPreset() { const m = this.getPropValue("material"); const values = PL_LechaptCalmon._materials[m]; this.prms.L.singleValue = values.L; this.prms.M.singleValue = values.M; this.prms.N.singleValue = values.N; } // interface IProperties hasProperty(key) { if (super.hasProperty(key)) { return true; } return key === "material"; } } exports.PL_LechaptCalmon = PL_LechaptCalmon; PL_LechaptCalmon._materials = [ { L: 1.863, M: 2, N: 5.33, title: "Unlined cast iron - Coarse concrete (corrosive water)" }, { L: 1.601, M: 1.975, N: 5.25, title: "Cast steel or uncoated - Coarse concrete (somewhat corrosive water)" }, { L: 1.40, M: 1.96, N: 5.19, title: "Cast steel or cement coating" }, { L: 1.16, M: 1.93, N: 5.11, title: "Cast iron or steel coating bitumen - Centrifuged concrete" }, { L: 1.1, M: 1.89, N: 5.01, title: "Rolled steel - Smooth concrete" }, { L: 1.049, M: 1.86, N: 4.93, title: "Cast iron or steel coating centrifuged" }, { L: 1.01, M: 1.84, N: 4.88, title: "PVC - Polyethylene" }, { L: 0.916, M: 1.78, N: 4.78, title: "Hydraulically smooth pipe - 0.05 ≤ D ≤ 0.2" }, { L: 0.971, M: 1.81, N: 4.81, title: "Hydraulically smooth pipe - 0.25 ≤ D ≤ 1" } ]; //# sourceMappingURL=pl_lechaptcalmon.js.map