From 62f23314a7d76210989a2584467ae6118286b901 Mon Sep 17 00:00:00 2001
From: David Dorchies <david.dorchies@irstea.fr>
Date: Tue, 26 Jun 2018 10:52:09 +0200
Subject: [PATCH] #28 Ajout du calcul du type de jet

---
 src/structure/structure.ts        | 30 ++++++++++++++++++++++++++++++
 src/structure/structure_params.ts |  2 +-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/src/structure/structure.ts b/src/structure/structure.ts
index fcd0e5e1..c3effee9 100644
--- a/src/structure/structure.ts
+++ b/src/structure/structure.ts
@@ -33,6 +33,18 @@ export enum StructureFlowRegime {
     NULL,
 }
 
+/**
+ * Type de jet : Sans objet (orifice), plongeant, de surface
+ */
+export enum StructureJetType {
+    /** Sans objet (orifice) */
+    SO,
+    /** Plongeant */
+    PLONGEANT,
+    /** De surface */
+    SURFACE,
+}
+
 /**
  * classe de calcul sur la conduite distributrice
  */
@@ -212,4 +224,22 @@ export abstract class Structure extends Nub {
             return StructureFlowRegime.SUBMERGED;
         }
     }
+
+    /**
+     * Give the Jet Type for weir flow
+     * Cf. Baudoin J.M., Burgun V., Chanseau M., Larinier M., Ovidio M., SremskiW., Steinbach P. et Voegtle B., 2014.
+     * Evaluer le franchissement des obstacles par les poissons. Principes et méthodes. Onema. 200 pages
+     */
+    protected getJetType(): StructureJetType {
+        if (this.getFlowMode() === StructureFlowMode.WEIR) {
+            if (Math.abs(this.prms.h1.v - this.prms.h2.v) < 0.5 * this.prms.h1.v) {
+                return StructureJetType.SURFACE;
+            } else {
+                return StructureJetType.PLONGEANT;
+            }
+        } else {
+            return StructureJetType.SO;
+        }
+    }
+
 }
diff --git a/src/structure/structure_params.ts b/src/structure/structure_params.ts
index 28ff720a..8740525e 100644
--- a/src/structure/structure_params.ts
+++ b/src/structure/structure_params.ts
@@ -1,7 +1,7 @@
 import { Nub } from "../nub";
-import { ParamsEquation } from "../param/params-equation";
 import { ParamDefinition } from "../param/param-definition";
 import { ParamDomainValue } from "../param/param-domain";
+import { ParamsEquation } from "../param/params-equation";
 
 /**
  * Common parameters of hydraulic structure equations
-- 
GitLab