diff --git a/src/prebarrage/pb_cloison.ts b/src/prebarrage/pb_cloison.ts index 74009908ceee4383e57d6a3e91e8b9daab6d853a..72867e448a3ac70eab6a4654e38f93330309c84c 100644 --- a/src/prebarrage/pb_cloison.ts +++ b/src/prebarrage/pb_cloison.ts @@ -4,6 +4,7 @@ import { PreBarrage } from "./pre_barrage"; import { ParallelStructureParams } from "../structure/parallel_structure_params"; import { CalculatorType } from "../compute-node"; import { Result } from "../util/result"; +import { LoiDebit, loiAdmissiblesOuvrages } from "../structure/structure_props"; export class PbCloison extends ParallelStructure { @@ -94,4 +95,8 @@ export class PbCloison extends ParallelStructure { } return minZDV; } + + public getLoisAdmissibles(): { [key: string]: LoiDebit[]; } { + return loiAdmissiblesOuvrages; // @TODO loiAdmissiblesCloisons plutôt, mais penser à y intégrer Cunge80 + } } diff --git a/src/structure/structure.ts b/src/structure/structure.ts index 1797f8a421bd09e531498eddd726b2ad5196f068..88a4aa89487c03d80e98525b474b15bd4ab8196a 100644 --- a/src/structure/structure.ts +++ b/src/structure/structure.ts @@ -5,7 +5,8 @@ import { Props } from "../props"; import { Message, MessageCode } from "../util/message"; import { Result } from "../util/result"; import { StructureParams } from "./structure_params"; -import { LoiDebit } from "./structure_props"; +import { LoiDebit, StructureProperties } from "./structure_props"; +import { ParallelStructure } from "./parallel_structure"; /** * Flow mode: weir or orifice flow @@ -75,11 +76,14 @@ export abstract class Structure extends ChildNub { /** Returns Props object (observable set of key-values) associated to this Nub */ public get properties(): Props { - // completes props with calcType and loiDebit if not already set + // completes props with calcType, structureType and loiDebit if not already set this._props.setPropValue("calcType", this.calcType); if (this._props.getPropValue("loiDebit") === undefined) { this._props.setPropValue("loiDebit", this._loiDebit); } + if (this._props.getPropValue("structureType") === undefined) { + this._props.setPropValue("structureType", StructureProperties.findCompatibleStructure(this._props.getPropValue("loiDebit"), this.parent as ParallelStructure)); + } return this._props; } diff --git a/src/structure/structure_props.ts b/src/structure/structure_props.ts index 59794f0c0046c11f7175269e62c474bbdd5c42dc..3197ef4b5c891dd3e9f0b6a8b48017d639f07c4c 100644 --- a/src/structure/structure_props.ts +++ b/src/structure/structure_props.ts @@ -134,7 +134,7 @@ export class StructureProperties { /** * @return la 1ère valeur de StructureType compatible avec la loi de débit, dans le contexte - * du module de calcul parentNub + * du module de calcul parentNub @TODO la 1ère ? normalement il n'y en a qu'une ! */ public static findCompatibleStructure(loi: LoiDebit, parentNub: ParallelStructure): StructureType { const loisAdmissibles = parentNub.getLoisAdmissibles();