From 2ce979596925c8ab8d387430345e6aa309a33c53 Mon Sep 17 00:00:00 2001
From: David Dorchies <david.dorchies@irstea.fr>
Date: Wed, 3 Jul 2019 17:17:36 +0200
Subject: [PATCH] #105 Ajout de CloisonAval pour prendre en charge les vannes
 levantes

---
 spec/pab/cloison_aval.spec.ts           |  78 ++++++++++++++++
 spec/pab/pab.spec.ts                    |  35 +++++--
 spec/structure/structure_vanlev.spec.ts |  61 ------------
 src/index.ts                            |   1 +
 src/pab/cloison_aval.ts                 | 118 ++++++++++++++++++++++++
 src/pab/cloisons.ts                     |   2 +-
 src/pab/pab.ts                          |  22 ++---
 src/structure/structure_props.ts        |  22 +++++
 src/structure/structure_vanlev.ts       |  45 ---------
 9 files changed, 258 insertions(+), 126 deletions(-)
 create mode 100644 spec/pab/cloison_aval.spec.ts
 delete mode 100644 spec/structure/structure_vanlev.spec.ts
 create mode 100644 src/pab/cloison_aval.ts

diff --git a/spec/pab/cloison_aval.spec.ts b/spec/pab/cloison_aval.spec.ts
new file mode 100644
index 00000000..f3e187b8
--- /dev/null
+++ b/spec/pab/cloison_aval.spec.ts
@@ -0,0 +1,78 @@
+import { CloisonAval, ParallelStructureParams } from "../../src/pab/cloison_aval";
+import { StructureVanLevLarinier, StructureVanLevParams } from "../../src/structure/structure_vanlev";
+import { StructureVanLevVillemonte } from "../../src/structure/structure_vanlev";
+import { MessageCode } from "../../src/util/message";
+
+function getCloisonAvalTest(Q: number, Z2: number): CloisonAval {
+    return new CloisonAval(
+        new ParallelStructureParams(Q, 0, Z2)
+    );
+}
+
+let ca: CloisonAval;
+let s: StructureVanLevVillemonte | StructureVanLevLarinier;
+describe("class CloisonAval", () => {
+    describe("StructureVanLevVillemonte", () => {
+        beforeEach(() => {
+            ca = getCloisonAvalTest(0.773, 74.86);
+            ca.addChild(
+                new StructureVanLevVillemonte(
+                    new StructureVanLevParams(0.773, 73, 75.090, 74.86, 0.6, 0.4, 0.217, 73.5, 74),
+                    false
+                )
+            );
+            ca.calculatedParam = ca.prms.Z1;
+            s = ca.structures[0] as StructureVanLevVillemonte;
+        });
+        it("Calc(Z1) should return 75.077 and extraResults.ZDV should be 73.95", () => {
+            expect(ca.CalcSerie().vCalc).toBeCloseTo(75.077, 3);
+            expect(ca.CalcSerie().extraResults.ZDV).toBeCloseTo(73.95, 2);
+        });
+        it("ZDV min bound Calc(Z1) should return 75.059 and extraResults.ZDV should be 73.9", () => {
+            s.prms.maxZDV.singleValue = 73.90;
+            const r = ca.CalcSerie();
+            expect(r.vCalc).toBeCloseTo(75.059, 3);
+            expect(r.extraResults.ZDV).toBeCloseTo(73.9, 2);
+            expect(r.log.messages[0].code).toBe(MessageCode.WARNING_VANLEV_ZDV_SUP_MAX);
+        });
+        it("ZDV max bound Calc(Z1) should return 75.096 and extraResults.ZDV should be 74", () => {
+            s.prms.minZDV.singleValue = 74;
+            const r = ca.CalcSerie();
+            expect(r.vCalc).toBeCloseTo(75.096, 3);
+            expect(r.extraResults.ZDV).toBeCloseTo(74, 2);
+            expect(r.log.messages[0].code).toBe(MessageCode.WARNING_VANLEV_ZDV_INF_MIN);
+        });
+    });
+
+    describe("StructureVanLevLarinier", () => {
+        beforeEach(() => {
+            ca = getCloisonAvalTest(0.773, 74.86);
+            ca.addChild(
+                new StructureVanLevLarinier(
+                    new StructureVanLevParams(0.773, 73, 75.090, 74.86, 0.35, 0.65, 0.217, 73.3, 73.5),
+                    false
+                )
+            );
+            ca.calculatedParam = ca.prms.Z1;
+            s = ca.structures[0] as StructureVanLevLarinier;
+        });
+        it("Calc(Z1) should return 75.077 and extraResults.ZDV should be 73.431", () => {
+            expect(ca.CalcSerie().vCalc).toBeCloseTo(75.077, 3);
+            expect(ca.CalcSerie().extraResults.ZDV).toBeCloseTo(73.431, 2);
+        });
+        it("ZDV min bound Calc(Z1) should return 75.071 and extraResults.ZDV should be 73.4", () => {
+            s.prms.maxZDV.singleValue = 73.40;
+            const r = ca.CalcSerie();
+            expect(r.vCalc).toBeCloseTo(75.071, 3);
+            expect(r.extraResults.ZDV).toBeCloseTo(73.4, 2);
+            expect(r.log.messages[0].code).toBe(MessageCode.WARNING_VANLEV_ZDV_SUP_MAX);
+        });
+        it("ZDV max bound Calc(Z1) should return 75.092 and extraResults.ZDV should be 73.5", () => {
+            s.prms.minZDV.singleValue = 73.5;
+            const r = ca.CalcSerie();
+            expect(r.vCalc).toBeCloseTo(75.092, 3);
+            expect(r.extraResults.ZDV).toBeCloseTo(73.5, 2);
+            expect(r.log.messages[0].code).toBe(MessageCode.WARNING_VANLEV_ZDV_INF_MIN);
+        });
+    });
+});
diff --git a/spec/pab/pab.spec.ts b/spec/pab/pab.spec.ts
index 2fb11fb0..292f7785 100644
--- a/spec/pab/pab.spec.ts
+++ b/spec/pab/pab.spec.ts
@@ -6,12 +6,14 @@
  */
 // import { describe, expect, it, xdescribe, xit } from "../mock_jasmine";
 
+import { CloisonAval } from "../../src/pab/cloison_aval";
 import { Cloisons, CloisonsParams } from "../../src/pab/cloisons";
 import { Pab, PabParams } from "../../src/pab/pab";
-import { ParallelStructure, ParallelStructureParams } from "../../src/structure/parallel_structure";
+import { ParallelStructureParams } from "../../src/structure/parallel_structure";
 import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params";
-import { StructureKivi, StructureKiviParams } from "../../src/structure/structure_kivi";
 import { StructureWeirSubmergedLarinier } from "../../src/structure/structure_weir_submerged_larinier";
+import { StructureWeirVillemonte } from "../../src/structure/structure_weir_villemonte";
+import { StructureVanLevVillemonte, StructureVanLevParams } from "../../src/structure/structure_vanlev";
 
 const dbg: boolean = false;
 
@@ -50,18 +52,16 @@ function createModelCloisonTest(): Cloisons {
 
 function createPabTest(): Pab {
     // Création de la cloison aval
-    const downWall = new ParallelStructure(new ParallelStructureParams(0, 0, 0));
-    const kiviPrms = new StructureKiviParams(
+    const downWall = new CloisonAval(new ParallelStructureParams(0, 0, 0));
+    const kiviPrms = new RectangularStructureParams (
         0,  // Q
         73.95,        // ZDV
         0,        // Z1
         0,      // Z2
         0.6,          // L
-        0.4,        // Cd pour un seuil rectangulaire
-        0,
-        73.435
+        0.4        // Cd pour un seuil rectangulaire
     );
-    downWall.addChild(new StructureKivi(kiviPrms));
+    downWall.addChild(new StructureWeirVillemonte(kiviPrms));
 
     // Création de la passe
     const p: Pab = new Pab(
@@ -169,4 +169,23 @@ describe("Class Pab: ", () => {
             checkPabResults(pab, 0.773);
         });
     });
+    describe("Vanne levante sur Cloison aval", () => {
+        beforeEach( () => {
+            pab = createPabTest();
+            pab.downWall = new CloisonAval(new ParallelStructureParams(0, 0, 0));
+            pab.downWall.addChild(
+                new StructureVanLevVillemonte(
+                    new StructureVanLevParams(0.773, 73, 75.090, 74.86, 0.6, 0.4, 0.217, 73.5, 74)
+                )
+            );
+        });
+        it("CalcSerie(Z1) should return 78.27", () => {
+            pab.calculatedParam = pab.prms.Z1;
+            checkPabResults(pab, 78.27);
+        });
+        it("Calc(Q) should return 0.773", () => {
+            pab.calculatedParam = pab.prms.Q;
+            checkPabResults(pab, 0.773);
+        });
+    });
 });
diff --git a/spec/structure/structure_vanlev.spec.ts b/spec/structure/structure_vanlev.spec.ts
deleted file mode 100644
index b46e64fd..00000000
--- a/spec/structure/structure_vanlev.spec.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-import { StructureVanLevLarinier, StructureVanLevParams } from "../../src/structure/structure_vanlev";
-import { StructureVanLevVillemonte } from "../../src/structure/structure_vanlev";
-import { MessageCode } from "../../src/util/message";
-
-let vlv: StructureVanLevVillemonte;
-describe("class StructureVanLevVillemonte", () => {
-    beforeEach( () => {
-        vlv = new StructureVanLevVillemonte(
-            new StructureVanLevParams(0.773, 73, 75.090, 74.86, 0.6, 0.4, 0.217, 73.5, 74)
-            , false);
-    });
-    it("Calc(Z1) should return 75.077 and extraResults.ZDV should be 73.95", () => {
-        expect(vlv.Calc("Z1").vCalc).toBeCloseTo(75.077, 3);
-        expect(vlv.Calc("Z1").extraResults.ZDV).toBeCloseTo(73.95, 2);
-    });
-    it("ZDV min bound Calc(Z1) should return 75.059 and extraResults.ZDV should be 73.9", () => {
-        const s = vlv;
-        s.prms.maxZDV.v = 73.90;
-        const r = s.Calc("Z1");
-        expect(r.vCalc).toBeCloseTo(75.059, 3);
-        expect(r.extraResults.ZDV).toBeCloseTo(73.9, 2);
-        expect(r.log.messages[0].code).toBe(MessageCode.WARNING_VANLEV_ZDV_SUP_MAX);
-    });
-    it("ZDV max bound Calc(Z1) should return 75.096 and extraResults.ZDV should be 74", () => {
-        const s = vlv;
-        s.prms.minZDV.v = 74;
-        const r = s.Calc("Z1");
-        expect(r.vCalc).toBeCloseTo(75.096, 3);
-        expect(r.extraResults.ZDV).toBeCloseTo(74, 2);
-        expect(r.log.messages[0].code).toBe(MessageCode.WARNING_VANLEV_ZDV_INF_MIN);
-    });
-});
-
-let vll: StructureVanLevLarinier;
-describe("class StructureVanLevLarinier", () => {
-    beforeEach( () => {
-        vll = new StructureVanLevLarinier(
-            new StructureVanLevParams(0.773, 73, 75.090, 74.86, 0.35, 0.65, 0.217, 73.3, 73.5)
-            , false);
-    });
-    it("Calc(Z1) should return 75.077 and extraResults.ZDV should be 73.431", () => {
-        expect(vll.Calc("Z1").vCalc).toBeCloseTo(75.077, 3);
-        expect(vll.Calc("Z1").extraResults.ZDV).toBeCloseTo(73.431, 2);
-    });
-    it("ZDV min bound Calc(Z1) should return 75.071 and extraResults.ZDV should be 73.4", () => {
-        const s = vll;
-        s.prms.maxZDV.v = 73.40;
-        const r = s.Calc("Z1");
-        expect(r.vCalc).toBeCloseTo(75.071, 3);
-        expect(r.extraResults.ZDV).toBeCloseTo(73.4, 2);
-        expect(r.log.messages[0].code).toBe(MessageCode.WARNING_VANLEV_ZDV_SUP_MAX);
-    });
-    it("ZDV max bound Calc(Z1) should return 75.092 and extraResults.ZDV should be 73.5", () => {
-        const s = vll;
-        s.prms.minZDV.v = 73.5;
-        const r = s.Calc("Z1");
-        expect(r.vCalc).toBeCloseTo(75.092, 3);
-        expect(r.extraResults.ZDV).toBeCloseTo(73.5, 2);
-        expect(r.log.messages[0].code).toBe(MessageCode.WARNING_VANLEV_ZDV_INF_MIN);
-    });
-});
diff --git a/src/index.ts b/src/index.ts
index 3098fb10..b174dd52 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -37,3 +37,4 @@ export * from "./jalhyd_object";
 export * from "./date_revision";
 export * from "./section/section_nub";
 export * from "./pab/pab";
+export * from "./pab/cloison_aval";
diff --git a/src/pab/cloison_aval.ts b/src/pab/cloison_aval.ts
new file mode 100644
index 00000000..b224de84
--- /dev/null
+++ b/src/pab/cloison_aval.ts
@@ -0,0 +1,118 @@
+import { ParallelStructure } from "../structure/parallel_structure";
+import { loiAdmissiblesCloisonAval, LoiDebit } from "../structure/structure_props";
+import { StructureVanLevLarinier, StructureVanLevVillemonte } from "../structure/structure_vanlev";
+import { Message, MessageCode } from "../util/message";
+import { Result } from "../util/result";
+import { ParamCalculability } from "../param/param-definition";
+
+export { ParallelStructureParams } from "../structure/parallel_structure_params";
+
+export class CloisonAval extends ParallelStructure {
+
+    /**
+     * Returns admissible LoiDebit grouped by StructureType
+     * Only one vanne levante is allowed on a CloisonAval
+     */
+    public getLoisAdmissibles(): { [key: string]: LoiDebit[]; } {
+        const loiAdmissibles = JSON.parse(JSON.stringify(loiAdmissiblesCloisonAval));
+        if (this.hasVanneLevante()) {
+            delete loiAdmissibles.VanneLevante;
+        }
+        return loiAdmissibles;
+    }
+
+    /**
+     * Calcul de la cote amont de la cloison
+     * @param sVarCalc Nom du paramètre à calculer : seul Z1 est admis
+     * @param rInit Valeur initiale
+     */
+    public Calc(sVarCalc: string | any, rInit?: number): Result {
+        if (sVarCalc !== "Z1") {
+            throw new Error("CloisonAval sVarCalc should be Z1");
+        }
+        this.checkVanneLevante();
+        let m: Message;
+        if (this.hasVanneLevante()) {
+            const s = this.structures[this.indexVanneLevante] as StructureVanLevVillemonte | StructureVanLevLarinier;
+            this.prms.Z1.v = this.prms.Z2.v + s.getParameter("DH").v;
+            this._result = this.CalcStructPrm(this.indexVanneLevante, "ZDV");
+            if (this.result.ok) {
+                // Suppression des extraResults : ils sont complétés plus bas pour chaque ouvrage
+                this.result.resultElement.extraResults = {};
+                s.prms.ZDV.v = this.result.vCalc;
+            }
+            // Check if calculated ZDV is between minZDV and maxZDV
+            if (this.result.vCalc < s.prms.minZDV.v) {
+                m = new Message(MessageCode.WARNING_VANLEV_ZDV_INF_MIN);
+                s.prms.ZDV.v = s.prms.minZDV.v;
+            } else if (this.result.vCalc > s.prms.maxZDV.v) {
+                m = new Message(MessageCode.WARNING_VANLEV_ZDV_SUP_MAX);
+                s.prms.ZDV.v = s.prms.maxZDV.v;
+            }
+        }
+        if (this._result === undefined || this._result.ok) {
+            // Calculation of Z1 with the new ZDV in case of existing vanne levante
+            this._result = super.Calc("Z1", rInit);
+            if (this.result.ok) {
+                this.getParameter(sVarCalc).v = this.result.vCalc;
+                // Recalcul du débit total pour récupérer les résultats des ouvrages dans les résultats complémentaires
+                const resQtot: Result = this.CalcQ();
+                for (const extraResKey in resQtot.extraResults) {
+                    if (resQtot.extraResults.hasOwnProperty(extraResKey)) {
+                        this.result.resultElement.addExtraResult(extraResKey, resQtot.extraResults[extraResKey]);
+                    }
+                }
+                if (this.hasVanneLevante()) {
+                    this.result.extraResults.ZDV = this.structures[this.indexVanneLevante].prms.ZDV.v;
+                    if (m !== undefined) {
+                        this.result.resultElement.addMessage(m);
+                    }
+                }
+            }
+        }
+        return this._result;
+    }
+
+    /**
+     * paramétrage de la calculabilité des paramètres
+     */
+    protected setParametersCalculability() {
+        this.prms.Q.calculability = ParamCalculability.EQUATION;
+        this.prms.Z1.calculability = ParamCalculability.DICHO;
+    }
+
+    /**
+     * Is there at least one Vanne Levante in the Cloison ?
+     */
+    private hasVanneLevante(): boolean {
+        return !(this.indexVanneLevante === null);
+    }
+
+    /**
+     * Return index structure of vanne levante
+     */
+    private get indexVanneLevante(): number {
+        for (let i = 0; i < this.structures.length; i++) {
+            // tslint:disable-next-line:max-line-length
+            if (loiAdmissiblesCloisonAval.VanneLevante.includes(this.structures[i].properties.getPropValue("loiDebit"))) {
+                return i;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Check if there is more than one vanne levante and throw an error
+     */
+    private checkVanneLevante() {
+        let n: number = 0;
+        for (const st of this.structures) {
+            if (loiAdmissiblesCloisonAval.VanneLevante.includes(st.properties.getPropValue("loiDebit"))) {
+                n += 1;
+            }
+        }
+        if (n > 1) {
+            throw new Error("CloisonAval: maximum 1 vanne levante allowed");
+        }
+    }
+}
diff --git a/src/pab/cloisons.ts b/src/pab/cloisons.ts
index 67dc4ba9..dc51f088 100644
--- a/src/pab/cloisons.ts
+++ b/src/pab/cloisons.ts
@@ -44,7 +44,7 @@ export class Cloisons extends ParallelStructure {
      *                 "Q", "Z1", "DH" ou "n.X" avec "n" l'index de l'ouvrage et "X" son paramètre
      * @param rInit Valeur initiale
      */
-    public Calc(sVarCalc: string, rInit?: number): Result {
+    public Calc(sVarCalc: string | any, rInit?: number): Result {
         let sVC: string = sVarCalc;
         if (sVarCalc === "DH") {
             sVC = "Z2";
diff --git a/src/pab/pab.ts b/src/pab/pab.ts
index ada5cdb2..d3181b66 100644
--- a/src/pab/pab.ts
+++ b/src/pab/pab.ts
@@ -4,9 +4,9 @@ import { ParamCalculability, ParamDefinition } from "../param/param-definition";
 import { IParamDefinitionIterator, ParamsEquation, ParamsEquationArrayIterator } from "../param/params-equation";
 import { Props } from "../props";
 import { Session } from "../session";
-import { ParallelStructure, ParallelStructureParams } from "../structure/parallel_structure";
 import { StructureTriangularTruncWeirFree } from "../structure/structure_triangular_trunc_weir";
 import { Result } from "../util/result";
+import { CloisonAval, ParallelStructureParams } from "./cloison_aval";
 import { Cloisons } from "./cloisons";
 import { PabParams } from "./pab_params";
 
@@ -28,7 +28,7 @@ export class Pab extends Nub {
         return this._children as Cloisons[];
     }
 
-    private static consoleDbgWall(cl: ParallelStructure) {
+    private static consoleDbgWall(cl: CloisonAval | Cloisons) {
         let s: string = "";
         for (const p of cl.prms) {
             // tslint:disable-next-line:no-console
@@ -55,9 +55,9 @@ export class Pab extends Nub {
     /**
      * Last wall at downstream
      */
-    private _downWall: ParallelStructure;
+    private _downWall: CloisonAval;
 
-    constructor(prms: PabParams, downWall: ParallelStructure, dbg: boolean = false) {
+    constructor(prms: PabParams, downWall: CloisonAval, dbg: boolean = false) {
         super(prms, dbg);
         this.downWall = downWall;
         this._calcType = CalculatorType.Pab;
@@ -67,7 +67,7 @@ export class Pab extends Nub {
         return this._downWall;
     }
 
-    public set downWall(dw: ParallelStructure) {
+    public set downWall(dw: CloisonAval) {
         this._downWall = dw;
         if (dw) { // might be undefined
             dw.parent = this; // important
@@ -108,8 +108,8 @@ export class Pab extends Nub {
                 // Add wall + basin = cloison
                 this.addChild(cl);
             } else {
-                // The last wall is a ParallelStructure (= Wall only, without basin)
-                this.downWall = new ParallelStructure(new ParallelStructureParams(0, 0, 0));
+                // The last wall is a CloisonAval (= Wall only, without basin)
+                this.downWall = new CloisonAval(new ParallelStructureParams(0, 0, 0));
                 this.downWall.structures = cl.structures;
             }
         }
@@ -129,7 +129,7 @@ export class Pab extends Nub {
         }
         let l: number = 0; // Lenght of the fishway and wall abscissas
         for (let i = 0; i < this.children.length; i++) {
-            let wall: ParallelStructure;
+            let wall: CloisonAval | Cloisons;
             if (i !== this.children.length - 1) {
                 wall = this.children[i + 1];
             } else {
@@ -220,7 +220,7 @@ export class Pab extends Nub {
         // load downwall if any
         if (obj.downWall) {
             // create the Nub
-            const dw = Session.getInstance().createNub(new Props(obj.downWall.props), this) as ParallelStructure;
+            const dw = Session.getInstance().createNub(new Props(obj.downWall.props), this) as CloisonAval;
             // try to keep the original ID
             if (! Session.getInstance().uidAlreadyUsed(obj.downWall.uid)) {
                 dw.setUid(obj.downWall.uid);
@@ -272,13 +272,13 @@ export class Pab extends Nub {
      * Remove visibility of downwall hydraulic parameters, for serialisation
      * @param dw
      */
-    protected adjustDownwallParameters(dw: ParallelStructure) {
+    protected adjustDownwallParameters(dw: CloisonAval) {
         dw.prms.Q.visible = false;
         dw.prms.Z1.visible = false;
         dw.prms.Z2.visible = false;
     }
 
-    private calcCloisonZ1(cl: ParallelStructure, Z: number): number {
+    private calcCloisonZ1(cl: CloisonAval | Cloisons, Z: number): number {
         // Initialisations for current cloison
         cl.prms.Z2.v = Z;
 
diff --git a/src/structure/structure_props.ts b/src/structure/structure_props.ts
index 8ca19b93..29379886 100644
--- a/src/structure/structure_props.ts
+++ b/src/structure/structure_props.ts
@@ -92,6 +92,28 @@ export const loiAdmissiblesDever: { [key: string]: LoiDebit[] } = {
     ]
 };
 
+export const loiAdmissiblesCloisonAval: { [key: string]: LoiDebit[] } = {
+    Orifice: [
+        LoiDebit.OrificeSubmerged
+    ],
+    SeuilRectangulaire: [
+        LoiDebit.WeirSubmergedLarinier, LoiDebit.WeirVillemonte
+    ],
+    VanneLevante: [
+        LoiDebit.VanLevVillemonte, LoiDebit.VanLevLarinier
+    ],
+    SeuilTriangulaire: [
+        LoiDebit.TriangularWeirFree
+    ],
+    SeuilTriangulaireTrunc: [
+        LoiDebit.TriangularTruncWeirFree
+    ],
+    VanneRectangulaire: [
+        LoiDebit.GateCem88d, LoiDebit.GateCem88v,
+        LoiDebit.RectangularOrificeSubmerged
+    ]
+};
+
 export class StructureProperties {
     /**
      * @return true si les valeurs de StructureType et LoiDebit sont compatibles
diff --git a/src/structure/structure_vanlev.ts b/src/structure/structure_vanlev.ts
index 8a80ca41..0447d0ba 100644
--- a/src/structure/structure_vanlev.ts
+++ b/src/structure/structure_vanlev.ts
@@ -44,35 +44,6 @@ export class StructureVanLevParams extends RectangularStructureParams {
     }
 }
 
-function CalcVanneLevante(
-    s: StructureVanLevVillemonte | StructureVanLevLarinier,
-    sVarCalc: string, rInit: number
-): Result {
-
-    if (sVarCalc !== "Z1") {
-        throw new Error("CalcVanneLevante sVarCalc should be Z1");
-    }
-    // Calculation of ZDV
-    s.prms.Z1.v = s.prms.Z2.v + s.prms.DH.v;
-    const r1: Result = s.superCalc("ZDV", rInit);
-    s.prms.ZDV.v = r1.vCalc;
-    // Check if calculated ZDV is between minZDV and maxZDV
-    let m: Message;
-    if (r1.vCalc < s.prms.minZDV.v) {
-        m = new Message(MessageCode.WARNING_VANLEV_ZDV_INF_MIN);
-        s.prms.ZDV.v = s.prms.minZDV.v;
-    } else if (r1.vCalc > s.prms.maxZDV.v) {
-        m = new Message(MessageCode.WARNING_VANLEV_ZDV_SUP_MAX);
-        s.prms.ZDV.v = s.prms.maxZDV.v;
-    }
-    const r2: Result = s.superCalc("Z1", rInit);
-    r2.extraResults.ZDV = s.prms.ZDV.v;
-    if (m !== undefined) {
-        r2.resultElements[0].addMessage(m);
-    }
-    return r2;
-}
-
 // tslint:disable-next-line:max-classes-per-file
 export class StructureVanLevVillemonte extends StructureWeirVillemonte {
 
@@ -87,14 +58,6 @@ export class StructureVanLevVillemonte extends StructureWeirVillemonte {
     get prms(): StructureVanLevParams {
         return this._prms as StructureVanLevParams;
     }
-
-    public Calc(sVarCalc: string, rInit?: number): Result {
-        return CalcVanneLevante(this, sVarCalc, rInit);
-    }
-
-    public superCalc(sVarCalc: string, rInit: number): Result {
-        return super.Calc(sVarCalc, rInit);
-    }
 }
 
 // tslint:disable-next-line:max-classes-per-file
@@ -105,18 +68,10 @@ export class StructureVanLevLarinier extends StructureWeirSubmergedLarinier {
         this._loiDebit = LoiDebit.VanLevLarinier;
     }
 
-    public Calc(sVarCalc: string, rInit?: number): Result {
-        return CalcVanneLevante(this, sVarCalc, rInit);
-    }
-
     /**
      * paramètres castés au bon type
      */
     get prms(): StructureVanLevParams {
         return this._prms as StructureVanLevParams;
     }
-
-    public superCalc(sVarCalc: string, rInit: number): Result {
-        return super.Calc(sVarCalc, rInit);
-    }
 }
-- 
GitLab