From 83db3917910b1818db38fa8f432d08fe3cff30bd Mon Sep 17 00:00:00 2001 From: David Dorchies <david.dorchies@irstea.fr> Date: Mon, 1 Jul 2019 10:39:03 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20#97=20ZDV=20=C3=A0=20-Infinity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/structure/structure.ts | 6 ++++-- src/structure/structure_orifice_submerged_params.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/structure/structure.ts b/src/structure/structure.ts index a1bed272..6274720a 100644 --- a/src/structure/structure.ts +++ b/src/structure/structure.ts @@ -202,11 +202,13 @@ export abstract class Structure extends Nub { ); } + this.prms.update_h1h2(); + // Gestion du débit nul const flagsNull = { ENUM_StructureFlowMode: StructureFlowMode.NULL, ENUM_StructureFlowRegime: StructureFlowRegime.NULL }; if (sVarCalc === "Q") { - if (this.prms.Z1.v <= this.prms.ZDV.v || this.prms.Z1.v === this.prms.Z2.v || this.prms.W.v <= 0) { + if (this.prms.h1.v <= 0 || Math.abs(this.prms.h1.v - this.prms.h2.v) < 1E-20 || this.prms.W.v <= 1E-20) { return new Result(0, this, flagsNull); } } else if (this.prms.Q.v === 0) { @@ -234,7 +236,7 @@ export abstract class Structure extends Nub { let rPrm: number; switch (sVarCalc) { case "ZDV": - rPrm = Infinity; + rPrm = Math.max(this.prms.Z1.v, this.prms.Z2.v); break; default: rPrm = 0; diff --git a/src/structure/structure_orifice_submerged_params.ts b/src/structure/structure_orifice_submerged_params.ts index 68b0fc8c..12e69efb 100644 --- a/src/structure/structure_orifice_submerged_params.ts +++ b/src/structure/structure_orifice_submerged_params.ts @@ -23,7 +23,7 @@ export class StructureOrificeSubmergedParams extends StructureParams { * @param rS Surface de l'orifice (m2) */ constructor(rQ: number, rZ1: number, rZ2: number, rCd: number, rS: number) { - super(rQ, -Infinity, rZ1, rZ2); + super(rQ, 100, rZ1, rZ2); this.S = new ParamDefinition(this, "S", ParamDomainValue.POS_NULL, rS); this.addParamDefinition(this.S); this.Cd = new ParamDefinition(this, "Cd", ParamDomainValue.POS_NULL, rCd); -- GitLab