diff --git a/src/pipe_flow/pl_lechaptcalmon.ts b/src/pipe_flow/pl_lechaptcalmon.ts index 154ec11d41f9bc59f29863b595e82f4795e37242..3c531d4657bec917b601e98436a740f59eff0265 100644 --- a/src/pipe_flow/pl_lechaptcalmon.ts +++ b/src/pipe_flow/pl_lechaptcalmon.ts @@ -91,6 +91,10 @@ export class PL_LechaptCalmon extends PressureLossLaw implements Observer { this.properties.setPropValue("material", m); } + protected calc_Jlin(): number { + return this.prms.L.v * Math.pow(this.prms.Q.v, this.prms.M.v) / Math.pow(this.prms.D.v, this.prms.N.v) * (this.prms.Lg.v / 1000); + } + /** * paramètres castés au bon type */ @@ -106,26 +110,6 @@ export class PL_LechaptCalmon extends PressureLossLaw implements Observer { return r; } - public Equation(sVarCalc: string): Result { - - if (sVarCalc !== "J") { - throw new Error("LechaptCalmon.Equation() : invalid variable name " + sVarCalc); - } - - const r: Result = new Result(0, this); - - r.values.V = this.prms.Q.v / (Math.PI * Math.pow(this.prms.D.v / 2, 2)); - if (r.values.V < 0.4 || r.values.V > 2) { - r.resultElement.log.add(new Message(MessageCode.WARNING_LECHAPT_CALMON_SPEED_OUTSIDE_04_2)); - } - r.values.Jl = this.prms.L.v * Math.pow(this.prms.Q.v, this.prms.M.v) - / Math.pow(this.prms.D.v, this.prms.N.v) * (this.prms.Lg.v / 1000); - - r.vCalc = r.values.Jl + this.prms.Kloc.v / 19.62 * Math.pow(r.values.V, 2); - - return r; - } - // interface Observer public update(sender: any, data: any) { diff --git a/src/pipe_flow/pressureloss_law.ts b/src/pipe_flow/pressureloss_law.ts index 18c82a1d0ed1599ff6e88ac8d8b9c809e238c248..889a2c5dcafac643fadf6c6b9f4185be425c0ae1 100644 --- a/src/pipe_flow/pressureloss_law.ts +++ b/src/pipe_flow/pressureloss_law.ts @@ -1,4 +1,6 @@ -import { Nub } from "../internal_modules"; +import { Nub, PressureLossLawParams } from "../internal_modules"; +import { Result } from "../internal_modules"; +import { Message, MessageCode } from "../internal_modules"; /** * Loi de perte de charge @@ -17,4 +19,34 @@ export abstract class PressureLossLaw extends Nub { public get pressureLossType(): PressureLossType { return this._pressureLossType; } + + /** + * paramètres castés au bon type + */ + get prms(): PressureLossLawParams { + return this._prms as PressureLossLawParams; + } + + /** + * calcul de la perte de charge linéaire spécifique à chaque mdule de perte de charge + */ + protected abstract calc_Jlin(): number; + + public Equation(sVarCalc: string): Result { + if (sVarCalc !== "J") { + throw new Error("LechaptCalmon.Equation() : invalid variable name " + sVarCalc); + } + + const r: Result = new Result(0, this); + + r.values.V = this.prms.Q.v / (Math.PI * Math.pow(this.prms.D.v / 2, 2)); + if (r.values.V < 0.4 || r.values.V > 2) { + r.resultElement.log.add(new Message(MessageCode.WARNING_LECHAPT_CALMON_SPEED_OUTSIDE_04_2)); + } + r.values.Jl = this.calc_Jlin(); + + r.vCalc = r.values.Jl + this.prms.Kloc.v / 19.62 * Math.pow(r.values.V, 2); + + return r; + } }