From 13eb499af331e00c47ff428b810043b9dbea24c9 Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Thu, 2 May 2019 15:27:33 +0200 Subject: [PATCH] Added new CalculatorType "Pab" --- src/compute-node.ts | 7 ++++--- src/pab/pab.ts | 6 ++++++ src/pab/pab_params.ts | 2 +- src/session.ts | 18 ++++++++++++++---- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/compute-node.ts b/src/compute-node.ts index 93b34ea7..915b9cf2 100644 --- a/src/compute-node.ts +++ b/src/compute-node.ts @@ -17,11 +17,12 @@ export enum CalculatorType { Structure, // ouvrages hydrauliques simples ParallelStructure, // ouvrages hydrauliques en parallèle Dever, // Outil Cassiopée Dever - Cloisons, // Outil Cassiopée PAB Cloisons - MacroRugo, // Passe à enrochement simple (Cassan et al., 2016) + Cloisons, // Outil Cassiopée PAB Cloisons + MacroRugo, // Passe à enrochement simple (Cassan et al., 2016) PabChute, PabNombre, - Section + Section, + Pab // Passe à bassins } /** diff --git a/src/pab/pab.ts b/src/pab/pab.ts index 1bef4aeb..2d9997c4 100644 --- a/src/pab/pab.ts +++ b/src/pab/pab.ts @@ -1,3 +1,4 @@ +import { CalculatorType } from "../compute-node"; import { Nub } from "../nub"; import { ParamCalculability } from "../param/param-definition"; import { Result } from "../util/result"; @@ -8,6 +9,11 @@ export { PabParams }; export class Pab extends Nub { + constructor(prms: PabParams, dbg: boolean = false) { + super(prms, dbg); + this._calcType = CalculatorType.Pab; + } + /** * paramètres castés au bon type */ diff --git a/src/pab/pab_params.ts b/src/pab/pab_params.ts index 00949271..15d858db 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, rZ1, ParamFamily.FLOWS); + this.Q = new ParamDefinition(this, "Q", ParamDomainValue.ANY, rQ, ParamFamily.FLOWS); this.addParamDefinition(this.Q); this.Z1 = new ParamDefinition(this, "Z1", ParamDomainValue.ANY, rZ1, ParamFamily.ELEVATIONS); this.addParamDefinition(this.Z1); diff --git a/src/session.ts b/src/session.ts index c70f3d5b..ca6894b8 100644 --- a/src/session.ts +++ b/src/session.ts @@ -23,13 +23,13 @@ import { acSection } from "./section/section_type"; // Classes relatives aux structures import { LinkedValue } from "./linked-value"; +import { Pab, PabParams } from "./pab/pab"; import { ParamDefinition } from "./param/param-definition"; import { Cloisons } from "./structure/cloisons"; import { CloisonsParams } from "./structure/cloisons_params"; import { Dever, DeverParams } from "./structure/dever"; import { CreateStructure } from "./structure/factory_structure"; import { ParallelStructure, ParallelStructureParams } from "./structure/parallel_structure"; -import { Structure } from "./structure/structure"; import { LoiDebit } from "./structure/structure_props"; export class Session { @@ -332,7 +332,7 @@ export class Session { 0.5, // D 0.8, // k 1.5 // Cd0 - ) + ), dbg ); break; } @@ -344,7 +344,7 @@ export class Session { 2, // Z1 0.5, // Z2 1.5 // DH - ) + ), dbg ); break; } @@ -356,7 +356,7 @@ export class Session { 6, // DHT 10, // N 0.6 // DH - ) + ), dbg ); break; } @@ -367,6 +367,16 @@ export class Session { break; } + case CalculatorType.Pab: + nub = new Pab( + new PabParams( + 1.5, // Q + 102, // Z1 + 99 // Z2 + ), dbg + ); + break; + default: { throw new Error( -- GitLab