From d9c46b2f675f47f14dcb0e6701c8d0f61aa54d12 Mon Sep 17 00:00:00 2001
From: David Dorchies <david.dorchies@irstea.fr>
Date: Tue, 14 May 2019 17:28:12 +0200
Subject: [PATCH] #33 PAB: Correction test Calc(Q)

---
 spec/pab/pab.spec.ts  | 4 +++-
 src/pab/pab_params.ts | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/spec/pab/pab.spec.ts b/spec/pab/pab.spec.ts
index 807e406e..5ff7a5a5 100644
--- a/spec/pab/pab.spec.ts
+++ b/spec/pab/pab.spec.ts
@@ -63,7 +63,7 @@ downWall.addChild(new StructureKivi(kiviPrms));
 const pab: Pab = new Pab(
     new PabParams(
         modelCloisons.prms.Q.v,
-        modelCloisons.prms.Z1.v,
+        100,
         74.86
     ),
     downWall,
@@ -87,6 +87,8 @@ describe("Class Pab: ", () => {
             expect(pab.CalcSerie().vCalc).toBeCloseTo(78.27, 2);
         });
         it("Calc(Q) should return 0.773", () => {
+            pab.prms.Z1.v = modelCloisons.prms.Z1.v;
+            pab.prms.Q.v = 0;
             expect(pab.Calc("Q").vCalc).toBeCloseTo(0.773, 2);
         });
     });
diff --git a/src/pab/pab_params.ts b/src/pab/pab_params.ts
index 15d858db..94d71df2 100644
--- a/src/pab/pab_params.ts
+++ b/src/pab/pab_params.ts
@@ -23,7 +23,7 @@ export class PabParams extends ParamsEquation {
      */
     constructor(rQ: number, rZ1: number, rZ2: number) {
         super();
-        this.Q = new ParamDefinition(this, "Q", ParamDomainValue.ANY, rQ, ParamFamily.FLOWS);
+        this.Q = new ParamDefinition(this, "Q", ParamDomainValue.POS_NULL, rQ, ParamFamily.FLOWS);
         this.addParamDefinition(this.Q);
         this.Z1 = new ParamDefinition(this, "Z1", ParamDomainValue.ANY, rZ1, ParamFamily.ELEVATIONS);
         this.addParamDefinition(this.Z1);
-- 
GitLab