From 4e6145c38ad920c7c617ecf137be538252b72030 Mon Sep 17 00:00:00 2001 From: David Dorchies <david.dorchies@irstea.fr> Date: Mon, 1 Oct 2018 16:49:53 +0200 Subject: [PATCH] #22 MAJ pour IHM nghyd --- spec/macrorugo/macrorugo.spec.ts | 3 +-- src/compute-node.ts | 3 ++- src/macrorugo/macrorugo.ts | 8 ++++---- src/nub_factory.ts | 20 ++++++++++++++++++++ 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/spec/macrorugo/macrorugo.spec.ts b/spec/macrorugo/macrorugo.spec.ts index a3449afc..0eb635f1 100644 --- a/spec/macrorugo/macrorugo.spec.ts +++ b/spec/macrorugo/macrorugo.spec.ts @@ -8,8 +8,7 @@ import { ParamCalculability, ParamValueMode } from "../../src"; import { MacroRugo, MacroRugoFlowType, MacrorugoParams } from "../../src/macrorugo/macrorugo"; -import { Result } from "../../src/util/result"; -import { checkResult, checkPercent } from "../test_func"; +import { checkPercent, checkResult } from "../test_func"; function macroRugoInstanceEmergent(): MacroRugo { return new MacroRugo( diff --git a/src/compute-node.ts b/src/compute-node.ts index 023de3bb..b4e0cbc7 100644 --- a/src/compute-node.ts +++ b/src/compute-node.ts @@ -17,7 +17,8 @@ export enum CalculatorType { Structure, // ouvrages hydrauliques simples ParallelStructure, // ouvrages hydrauliques en parallèle Dever, // Outil Cassiopée Dever - Cloisons // Outil Cassiopée PAB Cloisons + Cloisons, // Outil Cassiopée PAB Cloisons + MacroRugo // Passe à enrochement simple (Cassan et al., 2016) } /** diff --git a/src/macrorugo/macrorugo.ts b/src/macrorugo/macrorugo.ts index 8c62b8a6..001b446a 100644 --- a/src/macrorugo/macrorugo.ts +++ b/src/macrorugo/macrorugo.ts @@ -72,7 +72,7 @@ export class MacroRugo extends Nub { // Vitesse maximale r.extraResults.V = r.extraResults.Vdeb * this.calc_fFr(r.extraResults.Vdeb); // Puissance dissipée - r.extraResults.P = 1000 * MacroRugo.g * this.V(this.prms.Q) / this.prms.B.v * this.prms.If.v; + r.extraResults.PV = 1000 * MacroRugo.g * this.V(this.prms.Q) / this.prms.B.v * this.prms.If.v; // Type d'écoulement if (this.prms.Y.v / this.prms.PBH.v < 1) { r.extraResults.FlowType = MacroRugoFlowType.EMERGENT; @@ -95,14 +95,14 @@ export class MacroRugo extends Nub { cV = [3.35, 0.27, 0.53]; } else { cQ = [0.815, 1.45, 0.557, -0.456]; - cV = [4.54, 0.32, 0.56] + cV = [4.54, 0.32, 0.56]; } } - r.extraResults.Q2 = cQ[0] * Math.pow(this.prms.Y.v / hdk, cQ[1]) * + r.extraResults.Q_GuideTech = cQ[0] * Math.pow(this.prms.Y.v / hdk, cQ[1]) * Math.pow(this.prms.If.v, cQ[2]) * Math.pow(this.prms.C.v, cQ[3]) * Math.sqrt(MacroRugo.g * this.prms.PBD.v) * this.prms.PBD.v * this.prms.B.v; if (this.prms.Y.v / this.prms.PBH.v <= MacroRugo.limitSubmerg) { - r.extraResults.V2 = cV[0] * Math.pow(this.prms.Y.v / this.prms.PBD.v, cV[1]) * + r.extraResults.V_GuideTech = cV[0] * Math.pow(this.prms.Y.v / this.prms.PBD.v, cV[1]) * Math.pow(this.prms.If.v, cQ[2]) * Math.sqrt(MacroRugo.g * this.prms.PBD.v); } return r; diff --git a/src/nub_factory.ts b/src/nub_factory.ts index e8a5458f..f8015266 100644 --- a/src/nub_factory.ts +++ b/src/nub_factory.ts @@ -5,6 +5,7 @@ import { Props, SessionNub } from "./session_nub"; // Calculettes import { ConduiteDistrib, ConduiteDistribParams } from "./cond_distri"; import { LechaptCalmon, LechaptCalmonParams } from "./lechaptcalmon"; +import { MacroRugo, MacrorugoParams } from "./macrorugo/macrorugo"; import { PabDimension, PabDimensionParams } from "./pab/pab_dimension"; import { PabPuissance, PabPuissanceParams } from "./pab/pab_puissance"; import { RegimeUniforme } from "./regime_uniforme"; @@ -353,6 +354,25 @@ export class NubFactory { ); } + case CalculatorType.MacroRugo: + { + return new MacroRugo( + new MacrorugoParams( + 12.5, // ZF1 + 6, // L + 1, // B + 0.05, // If + 1.57, // Q + 0.6, // h + 0.01, // Ks + 0.05, // C + 0.5, // D + 0.8, // k + 1.5 // Cd0 + ) + ); + } + default: throw new Error( // tslint:disable-next-line:max-line-length -- GitLab