diff --git a/src/pab/pab.ts b/src/pab/pab.ts index 50a332d9c947358c56123dc9ddef645634e6be89..ada5cdb2727ac5e867c936ed5cd70886b020c7a0 100644 --- a/src/pab/pab.ts +++ b/src/pab/pab.ts @@ -71,6 +71,8 @@ export class Pab extends Nub { this._downWall = dw; if (dw) { // might be undefined dw.parent = this; // important + // postprocessing + this.adjustDownwallParameters(this.downWall); } } @@ -90,21 +92,12 @@ export class Pab extends Nub { for (let i = 0; i < n; i++) { const cl: Cloisons = Session.getInstance().unserialiseSingleNub(serialisedCloisonModel).nub as Cloisons; const p = cl.prms; - for (const st of cl.structures) { - if (st.prms.h1.visible) { - // Set ZDV from h1 for rectangular weirs - st.prms.ZDV.singleValue = this.prms.Z1.currentValue - st.prms.h1.currentValue; - // Set parameter visibility for ZDV and h1 in PAB context - st.prms.ZDV.visible = true; - st.prms.h1.visible = false; - } - } p.ZRMB.singleValue = ZRMB - i * DH; p.ZRAM.singleValue = ZRAM - i * DH; // Set Structure ZDVs for (const st of cl.structures) { if (st.isZDVcalculable) { - st.prms.ZDV.singleValue = st.prms.ZDV.currentValue - i * DH; + st.prms.ZDV.singleValue = (this.prms.Z1.currentValue - st.prms.h1.currentValue) - i * DH; if (st.getParameter("ZT") !== undefined) { const stTT = st as StructureTriangularTruncWeirFree; stTT.prms.ZT.singleValue = stTT.prms.ZT.currentValue - i * DH; @@ -266,6 +259,23 @@ export class Pab extends Nub { child.prms.Z1.visible = false; child.prms.PB.visible = false; child.prms.DH.visible = false; + for (const st of child.structures) { + if (st.prms.h1.visible) { + // Set parameter visibility for ZDV and h1 in PAB context + st.prms.ZDV.visible = true; + st.prms.h1.visible = false; + } + } + } + + /** + * Remove visibility of downwall hydraulic parameters, for serialisation + * @param dw + */ + protected adjustDownwallParameters(dw: ParallelStructure) { + dw.prms.Q.visible = false; + dw.prms.Z1.visible = false; + dw.prms.Z2.visible = false; } private calcCloisonZ1(cl: ParallelStructure, Z: number): number {