diff --git a/src/compute-node.ts b/src/compute-node.ts index adc2ae4f52ac126788d2c945eda513a2354d31b9..2f5548eee221383924047f364fc4aed29e67e33d 100644 --- a/src/compute-node.ts +++ b/src/compute-node.ts @@ -42,7 +42,8 @@ export enum CalculatorType { PbCloison, // Cloison de pré-barrage PbBassin, // Bassin de pré-barrage Espece, // Critères de vérification pour une espèce de poissons - Verificateur // Vérificateur de contraintes sur une passe pour une ou plusieurs espèces + Verificateur, // Vérificateur de contraintes sur une passe pour une ou plusieurs espèces + PressureLoss // Pertes de charge (Lechapt-Calmon, Colebrook-White, Strickler, ...) } /** types de sections */ diff --git a/src/index.ts b/src/index.ts index 68b082638b642bde7d65e9b7fdf4a8a2b4060a8d..88adf8802d3021d363fb1bfd8274bba2ac421792 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,6 +62,7 @@ export * from "./pab/pab_puissance_params"; export * from "./pab/cloison_aval"; export * from "./pipe_flow/pl_lechaptcalmon"; export * from "./pipe_flow/pressureloss"; +export * from "./pipe_flow/pressureloss_law"; export * from "./lc-material"; export * from "./structure/dever"; export * from "./macrorugo/macrorugo"; diff --git a/src/pipe_flow/pl_lechaptcalmon.ts b/src/pipe_flow/pl_lechaptcalmon.ts index 46f6f33d2d50028ef81178ff0499fa232d5fd31a..64ed7519f4cf43d1f15ba1ecc03cdd3ab2152f52 100644 --- a/src/pipe_flow/pl_lechaptcalmon.ts +++ b/src/pipe_flow/pl_lechaptcalmon.ts @@ -1,16 +1,16 @@ import { CalculatorType } from "../compute-node"; import { LCMaterial } from "../lc-material"; -import { Nub } from "../nub"; import { ParamCalculability } from "../param/param-definition"; import { Message, MessageCode } from "../util/message"; import { Observer } from "../util/observer"; import { Result } from "../util/result"; import { PL_LechaptCalmonParams } from "./pl_lechaptcalmon_params"; +import { PressureLossLaw, PressureLossType } from "./pressureloss_law"; /** * Calcul des pertes de charge dans un tube à partir des tables de Lechapt et Calmon */ -export class PL_LechaptCalmon extends Nub implements Observer { +export class PL_LechaptCalmon extends PressureLossLaw implements Observer { private static _materials: { L: number, M: number, N: number, title: string }[] = [ { @@ -72,6 +72,7 @@ export class PL_LechaptCalmon extends Nub implements Observer { constructor(prms: PL_LechaptCalmonParams, dbg: boolean = false) { super(prms, dbg); this.setCalculatorType(CalculatorType.LechaptCalmon); + this._pressureLossType = PressureLossType.LechaptCalmon; this._props.addObserver(this); this.material = LCMaterial.PVCPolyethylene; } diff --git a/src/pipe_flow/pl_lechaptcalmon_params.ts b/src/pipe_flow/pl_lechaptcalmon_params.ts index 147183f3968fdf3bf1b9cf2b9bc9cbfe1a5bccf0..9bd1f4c4eff6b63843b52dc228917f16fc7570cf 100644 --- a/src/pipe_flow/pl_lechaptcalmon_params.ts +++ b/src/pipe_flow/pl_lechaptcalmon_params.ts @@ -1,22 +1,11 @@ import { ParamDefinition, ParamFamily } from "../param/param-definition"; import { ParamDomain, ParamDomainValue } from "../param/param-domain"; -import { ParamsEquation } from "../param/params-equation"; +import { PressureLossParams } from "./pressureloss_params"; /** * paramètres pour le calcul Lechapt et Calmon */ -export class PL_LechaptCalmonParams extends ParamsEquation { - /** Débit */ - private _Q: ParamDefinition; - - /** Diamètre */ - private _D: ParamDefinition; - - /** Perte de charge */ - private _J: ParamDefinition; - - /** Longueur de la conduite */ - private _Lg: ParamDefinition; +export class PL_LechaptCalmonParams extends PressureLossParams { /** Paramètre de rugosité L */ private _L: ParamDefinition; @@ -27,50 +16,19 @@ export class PL_LechaptCalmonParams extends ParamsEquation { /** Paramètre de rugosité N */ private _N: ParamDefinition; - /** Perte de charge singulière Ks */ - private _Ks: ParamDefinition; - constructor(rQ: number, rD: number, rJ: number, rLg: number, rL: number, rM: number, rN: number, rKs: number, nullParams: boolean = false) { - super(); - this._Q = new ParamDefinition(this, "Q", ParamDomainValue.POS, "m³/s", rQ, ParamFamily.FLOWS, undefined, nullParams); - this._D = new ParamDefinition( - this, "D", new ParamDomain(ParamDomainValue.INTERVAL, 0, 20), "m", rD, ParamFamily.DIAMETERS, undefined, nullParams - ); - this._J = new ParamDefinition(this, "J", ParamDomainValue.POS_NULL, "m", rJ, undefined, undefined, nullParams); - this._Lg = new ParamDefinition(this, "Lg", ParamDomainValue.POS, "m", rLg, ParamFamily.LENGTHS, undefined, nullParams); + super(rQ, rD, rJ, rLg, rKs, nullParams); this._L = new ParamDefinition(this, "L", new ParamDomain(ParamDomainValue.INTERVAL, 0.8, 2), undefined, rL, undefined, false, nullParams); this._M = new ParamDefinition(this, "M", new ParamDomain(ParamDomainValue.INTERVAL, 1.5, 2.5), undefined, rM, undefined, false, nullParams); this._N = new ParamDefinition(this, "N", new ParamDomain(ParamDomainValue.INTERVAL, 4.5, 5.5), undefined, rN, undefined, false, nullParams); - this._Ks = new ParamDefinition(this, "Ks", ParamDomainValue.POS_NULL, undefined, rKs, ParamFamily.STRICKLERS, undefined, nullParams); - this.addParamDefinition(this._Q); - this.addParamDefinition(this._D); - this.addParamDefinition(this._J); - this.addParamDefinition(this._Lg); this.addParamDefinition(this._L); this.addParamDefinition(this._M); this.addParamDefinition(this._N); - this.addParamDefinition(this._Ks); - } - - get Q() { - return this._Q; - } - - get D() { - return this._D; - } - - get J() { - return this._J; - } - - get Lg() { - return this._Lg; } get L() { @@ -84,8 +42,4 @@ export class PL_LechaptCalmonParams extends ParamsEquation { get N() { return this._N; } - - get Ks() { - return this._Ks; - } } diff --git a/src/pipe_flow/pressureloss.ts b/src/pipe_flow/pressureloss.ts index 65b051d1b413109f37ea3f43661507a1a6b929ec..4dc7fa7c94e95e11e7cd263b1081ead19909ba63 100644 --- a/src/pipe_flow/pressureloss.ts +++ b/src/pipe_flow/pressureloss.ts @@ -1,9 +1,16 @@ import { Nub } from "../nub"; import { Observer } from "../util/observer"; import { Result } from "../util/result"; +import { CalculatorType } from "../compute-node"; +import { PressureLossParams } from "./pressureloss_params"; export class PressureLoss extends Nub implements Observer { + constructor(prms: PressureLossParams, dbg: boolean = false) { + super(prms, dbg); + this.setCalculatorType(CalculatorType.PressureLoss); + } + /** * paramétrage de la calculabilité des paramètres */ diff --git a/src/pipe_flow/pressureloss_law.ts b/src/pipe_flow/pressureloss_law.ts new file mode 100644 index 0000000000000000000000000000000000000000..39686a438367e776388c85835c924966b4f460e0 --- /dev/null +++ b/src/pipe_flow/pressureloss_law.ts @@ -0,0 +1,20 @@ +import { Nub } from "../nub"; + +/** + * Loi de perte de charge + */ +export enum PressureLossType { + LechaptCalmon +} + +/** + * generic pressure loss law (analogous to acSection with respect to SectionParametree nub) + */ +export abstract class PressureLossLaw extends Nub { + + protected _pressureLossType: PressureLossType; + + public get pressureLossType(): PressureLossType { + return this._pressureLossType; + } +} diff --git a/src/pipe_flow/pressureloss_params.ts b/src/pipe_flow/pressureloss_params.ts new file mode 100644 index 0000000000000000000000000000000000000000..539eca4c0ef226d6f491bde5d842cf086f760eb2 --- /dev/null +++ b/src/pipe_flow/pressureloss_params.ts @@ -0,0 +1,58 @@ +import { ParamDefinition, ParamFamily } from "../param/param-definition"; +import { ParamsEquation } from "../param/params-equation"; +import { ParamDomain, ParamDomainValue } from "../param/param-domain"; + +/** + * generic pressure loss parameters + */ +export class PressureLossParams extends ParamsEquation { + /** Débit */ + private _Q: ParamDefinition; + + /** Diamètre */ + private _D: ParamDefinition; + + /** Perte de charge */ + private _J: ParamDefinition; + + /** Longueur de la conduite */ + private _Lg: ParamDefinition; + + /** Perte de charge singulière Ks */ + private _Ks: ParamDefinition; + + constructor(rQ: number, rD: number, rJ: number, rLg: number, rKs: number, nullParams: boolean = false) { + super(); + this._Q = new ParamDefinition(this, "Q", ParamDomainValue.POS, "m³/s", rQ, ParamFamily.FLOWS, undefined, nullParams); + this._D = new ParamDefinition(this, "D", new ParamDomain(ParamDomainValue.INTERVAL, 0, 20), "m", rD, ParamFamily.DIAMETERS, undefined, nullParams); + this._J = new ParamDefinition(this, "J", ParamDomainValue.POS_NULL, "m", rJ, undefined, undefined, nullParams); + this._Lg = new ParamDefinition(this, "Lg", ParamDomainValue.POS, "m", rLg, ParamFamily.LENGTHS, undefined, nullParams); + this._Ks = new ParamDefinition(this, "Ks", ParamDomainValue.POS_NULL, undefined, rKs, ParamFamily.STRICKLERS, undefined, nullParams); + + this.addParamDefinition(this._Q); + this.addParamDefinition(this._D); + this.addParamDefinition(this._J); + this.addParamDefinition(this._Lg); + this.addParamDefinition(this._Ks); + } + + get Q() { + return this._Q; + } + + get D() { + return this._D; + } + + get J() { + return this._J; + } + + get Lg() { + return this._Lg; + } + + get Ks() { + return this._Ks; + } +}