From fe0802f222dd4ceed71658fbc10c7b2a1df20ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr> Date: Mon, 12 Dec 2022 09:40:53 +0100 Subject: [PATCH] refactor: rename LechaptCalmon nub to PL_LechaptCalmon refs #334 --- spec/pipe_flow/lechaptcalmon.spec.ts | 12 +++++------ src/index.ts | 2 +- .../{lechaptcalmon.ts => pl_lechaptcalmon.ts} | 14 ++++++------- ...n_params.ts => pl_lechaptcalmon_params.ts} | 2 +- src/pipe_flow/pressureloss.ts | 21 +++++++++++++++++++ src/session.ts | 8 +++---- 6 files changed, 40 insertions(+), 19 deletions(-) rename src/pipe_flow/{lechaptcalmon.ts => pl_lechaptcalmon.ts} (91%) rename src/pipe_flow/{lechaptcalmon_params.ts => pl_lechaptcalmon_params.ts} (97%) create mode 100644 src/pipe_flow/pressureloss.ts diff --git a/spec/pipe_flow/lechaptcalmon.spec.ts b/spec/pipe_flow/lechaptcalmon.spec.ts index 125dac09..4a76a80a 100644 --- a/spec/pipe_flow/lechaptcalmon.spec.ts +++ b/spec/pipe_flow/lechaptcalmon.spec.ts @@ -1,12 +1,12 @@ import { ParamCalculability } from "../../src/param/param-definition"; -import { LechaptCalmon } from "../../src/pipe_flow/lechaptcalmon"; -import { LechaptCalmonParams } from "../../src/pipe_flow/lechaptcalmon_params"; +import { PL_LechaptCalmon } from "../../src/pipe_flow/pl_lechaptcalmon"; +import { PL_LechaptCalmonParams } from "../../src/pipe_flow/pl_lechaptcalmon_params"; import { SessionSettings } from "../../src/session_settings"; import { MessageCode } from "../../src/util/message"; -function getLechapt(): LechaptCalmon { - const l = new LechaptCalmon( - new LechaptCalmonParams( +function getLechapt(): PL_LechaptCalmon { + const l = new PL_LechaptCalmon( + new PL_LechaptCalmonParams( 0.3, // débit 0.5, // diamètre 0.1, /// perte de charge @@ -22,7 +22,7 @@ function getLechapt(): LechaptCalmon { return l; } -let lechapt: LechaptCalmon = getLechapt(); +let lechapt: PL_LechaptCalmon = getLechapt(); describe("Class LechaptCalmon : ", () => { beforeAll(() => { diff --git a/src/index.ts b/src/index.ts index 72a9c87d..8c33e4b6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -60,7 +60,7 @@ export * from "./pab/pab_nombre_params"; export * from "./pab/pab_puissance"; export * from "./pab/pab_puissance_params"; export * from "./pab/cloison_aval"; -export * from "./pipe_flow/lechaptcalmon"; +export * from "./pipe_flow/pl_lechaptcalmon"; export * from "./lc-material"; export * from "./structure/dever"; export * from "./macrorugo/macrorugo"; diff --git a/src/pipe_flow/lechaptcalmon.ts b/src/pipe_flow/pl_lechaptcalmon.ts similarity index 91% rename from src/pipe_flow/lechaptcalmon.ts rename to src/pipe_flow/pl_lechaptcalmon.ts index b430f333..46f6f33d 100644 --- a/src/pipe_flow/lechaptcalmon.ts +++ b/src/pipe_flow/pl_lechaptcalmon.ts @@ -5,12 +5,12 @@ import { ParamCalculability } from "../param/param-definition"; import { Message, MessageCode } from "../util/message"; import { Observer } from "../util/observer"; import { Result } from "../util/result"; -import { LechaptCalmonParams } from "./lechaptcalmon_params"; +import { PL_LechaptCalmonParams } from "./pl_lechaptcalmon_params"; /** * Calcul des pertes de charge dans un tube à partir des tables de Lechapt et Calmon */ -export class LechaptCalmon extends Nub implements Observer { +export class PL_LechaptCalmon extends Nub implements Observer { private static _materials: { L: number, M: number, N: number, title: string }[] = [ { @@ -69,7 +69,7 @@ export class LechaptCalmon extends Nub implements Observer { } ]; - constructor(prms: LechaptCalmonParams, dbg: boolean = false) { + constructor(prms: PL_LechaptCalmonParams, dbg: boolean = false) { super(prms, dbg); this.setCalculatorType(CalculatorType.LechaptCalmon); this._props.addObserver(this); @@ -77,7 +77,7 @@ export class LechaptCalmon extends Nub implements Observer { } public static get materials() { - return LechaptCalmon._materials; + return PL_LechaptCalmon._materials; } public get material(): LCMaterial { @@ -91,8 +91,8 @@ export class LechaptCalmon extends Nub implements Observer { /** * paramètres castés au bon type */ - get prms(): LechaptCalmonParams { - return this._prms as LechaptCalmonParams; + get prms(): PL_LechaptCalmonParams { + return this._prms as PL_LechaptCalmonParams; } public Calc(sVarCalc: string, rInit?: number): Result { @@ -161,7 +161,7 @@ export class LechaptCalmon extends Nub implements Observer { private applyMaterialPreset() { const m = this.properties.getPropValue("material"); if (m > 0) { - const values = LechaptCalmon._materials[m - 1]; // "0" means no preset + const values = PL_LechaptCalmon._materials[m - 1]; // "0" means no preset this.prms.L.singleValue = values.L; this.prms.M.singleValue = values.M; this.prms.N.singleValue = values.N; diff --git a/src/pipe_flow/lechaptcalmon_params.ts b/src/pipe_flow/pl_lechaptcalmon_params.ts similarity index 97% rename from src/pipe_flow/lechaptcalmon_params.ts rename to src/pipe_flow/pl_lechaptcalmon_params.ts index c10163a4..147183f3 100644 --- a/src/pipe_flow/lechaptcalmon_params.ts +++ b/src/pipe_flow/pl_lechaptcalmon_params.ts @@ -5,7 +5,7 @@ import { ParamsEquation } from "../param/params-equation"; /** * paramètres pour le calcul Lechapt et Calmon */ -export class LechaptCalmonParams extends ParamsEquation { +export class PL_LechaptCalmonParams extends ParamsEquation { /** Débit */ private _Q: ParamDefinition; diff --git a/src/pipe_flow/pressureloss.ts b/src/pipe_flow/pressureloss.ts new file mode 100644 index 00000000..65b051d1 --- /dev/null +++ b/src/pipe_flow/pressureloss.ts @@ -0,0 +1,21 @@ +import { Nub } from "../nub"; +import { Observer } from "../util/observer"; +import { Result } from "../util/result"; + +export class PressureLoss extends Nub implements Observer { + + /** + * paramétrage de la calculabilité des paramètres + */ + protected setParametersCalculability() { + } + + public Equation(sVarCalc: string): Result { + return undefined; + } + + // interface Observer + + public update(sender: any, data: any) { + } +} diff --git a/src/session.ts b/src/session.ts index 31f5cdce..0496e9ad 100644 --- a/src/session.ts +++ b/src/session.ts @@ -62,8 +62,8 @@ import { PabPuissance } from "./pab/pab_puissance"; import { PabPuissanceParams } from "./pab/pab_puissance_params"; import { ConduiteDistrib } from "./pipe_flow/cond_distri"; import { ConduiteDistribParams } from "./pipe_flow/cond_distri_params"; -import { LechaptCalmon } from "./pipe_flow/lechaptcalmon"; -import { LechaptCalmonParams } from "./pipe_flow/lechaptcalmon_params"; +import { PL_LechaptCalmon } from "./pipe_flow/pl_lechaptcalmon"; +import { PL_LechaptCalmonParams } from "./pipe_flow/pl_lechaptcalmon_params"; import { Solveur } from "./solveur/solveur"; import { SolveurParams } from "./solveur/solveur_params"; import { Dever } from "./structure/dever"; @@ -394,7 +394,7 @@ export class Session { break; case CalculatorType.LechaptCalmon: - prms = new LechaptCalmonParams( + prms = new PL_LechaptCalmonParams( 3, // débit 1.2, // diamètre 0.6, /// perte de charge @@ -405,7 +405,7 @@ export class Session { 0, // Ks Perte de charge singulière nullParams ); - nub = new LechaptCalmon(prms, dbg); + nub = new PL_LechaptCalmon(prms, dbg); break; case CalculatorType.SectionParametree: -- GitLab