Commit 0029e79a authored by Dorchies David's avatar Dorchies David Committed by Mathias Chouet
Browse files

#33 Add downstream wall concept. Almost working version.

Showing with 104 additions and 13 deletions
+104 -13
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
import { Pab, PabParams } from "../../src/pab/pab"; import { Pab, PabParams } from "../../src/pab/pab";
import { PabCloisons } from "../../src/pab/pab_cloisons"; import { PabCloisons } from "../../src/pab/pab_cloisons";
import { Cloisons, CloisonsParams } from "../../src/structure/cloisons"; import { Cloisons, CloisonsParams } from "../../src/structure/cloisons";
import { ParallelStructure, ParallelStructureParams } from "../../src/structure/parallel_structure";
import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params"; import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params";
import { StructureKivi, StructureKiviParams } from "../../src/structure/structure_kivi";
import { StructureWeirSubmergedLarinier } from "../../src/structure/structure_weir_submerged_larinier"; import { StructureWeirSubmergedLarinier } from "../../src/structure/structure_weir_submerged_larinier";
const dbg: boolean = false; const dbg: boolean = false;
...@@ -41,16 +43,30 @@ const rectStructPrms = new RectangularStructureParams( ...@@ -41,16 +43,30 @@ const rectStructPrms = new RectangularStructureParams(
); );
// Ajout d'ouvrage dans la cloison // Ajout d'ouvrage dans la cloison
modelCloisons.addChild(new StructureWeirSubmergedLarinier(rectStructPrms, dbg)); modelCloisons.addChild(new StructureWeirSubmergedLarinier(rectStructPrms));
// Création de la passe // Création de la cloison aval
const downWall = new ParallelStructure(new ParallelStructureParams(0, 0, 0));
const kiviPrms = new StructureKiviParams(
0.773, // Q
73.95, // ZDV
0, // Z1
0, // Z2
0.6, // L
0.4, // Cd pour un seuil rectangulaire
0,
73.435
);
downWall.addChild(new StructureKivi(kiviPrms));
// Création de la passe
const pab: Pab = new Pab( const pab: Pab = new Pab(
new PabParams( new PabParams(
modelCloisons.prms.Q.v, modelCloisons.prms.Q.v,
modelCloisons.prms.Z1.v, modelCloisons.prms.Z1.v,
74.86 74.86
), ),
downWall,
dbg dbg
); );
...@@ -58,7 +74,7 @@ const pab: Pab = new Pab( ...@@ -58,7 +74,7 @@ const pab: Pab = new Pab(
const pabCloison = new PabCloisons(modelCloisons, 0, dbg); const pabCloison = new PabCloisons(modelCloisons, 0, dbg);
for (let i = 0; i < 15; i++) { for (let i = 0; i < 14; i++) {
pab.addChild(pabCloison); pab.addChild(pabCloison);
} }
......
import { CalculatorType } from "../compute-node"; import { CalculatorType } from "../compute-node";
import { Nub } from "../nub"; import { Nub } from "../nub";
import { ParamCalculability } from "../param/param-definition"; import { ParamCalculability } from "../param/param-definition";
import { ParallelStructure } from "../structure/parallel_structure";
import { Result } from "../util/result"; import { Result } from "../util/result";
import { PabCloisons } from "./pab_cloisons"; import { PabCloisons } from "./pab_cloisons";
import { PabParams } from "./pab_params"; import { PabParams } from "./pab_params";
...@@ -9,8 +10,14 @@ export { PabParams }; ...@@ -9,8 +10,14 @@ export { PabParams };
export class Pab extends Nub { export class Pab extends Nub {
constructor(prms: PabParams, dbg: boolean = false) { /**
* Last wall at downstream
*/
public downWall: ParallelStructure;
constructor(prms: PabParams, downWall: ParallelStructure, dbg: boolean = false) {
super(prms, dbg); super(prms, dbg);
this.downWall = downWall;
this._calcType = CalculatorType.Pab; this._calcType = CalculatorType.Pab;
} }
...@@ -34,13 +41,47 @@ export class Pab extends Nub { ...@@ -34,13 +41,47 @@ export class Pab extends Nub {
*/ */
public Equation(sVarCalc: string): Result { public Equation(sVarCalc: string): Result {
const r: Result = new Result(0, this); const r: Result = new Result(0, this);
// Up to down course : discharge distribution and bottom elevation
let Q: number = this.prms.Q.v; // Upstream discharge
// upstream basin apron elevation
let rZRam: number = this.children[0].prms.Z1.currentValue - this.children[0].Yam;
for (const cl of this.children) {
Q += cl.prms.QA.v; // Discharge in the current basin
rZRam -= cl.prms.DH.currentValue;
}
// Down to up course : water surface calculation
let Z: number = this.prms.Z2.v; let Z: number = this.prms.Z2.v;
for (const cloison of this.children) { Z = this.calcZ1(this.downWall, Q, Z);
cloison.prms.Z2.v = Z;
cloison.Calc("Z1"); for (let i = this.children.length - 1; i > 0; i--) {
Z = cloison.prms.Z1.v;
// Initialisations for current cloison
const cl: PabCloisons = this.children[i];
rZRam += cl.prms.DH.currentValue;
cl.updateZDV(rZRam);
// Calculation of upstream water elevation
Z = this.calcZ1(cl, Q, Z);
if (this.debug) {
for (const p of cl.prms) {
// tslint:disable-next-line:no-console
console.log(p.symbol + " = " + p.v);
}
for (const c of cl.getChildren()) {
console.log("Ouvrage");
for (const p of c.prms) {
// tslint:disable-next-line:no-console
console.log(p.symbol + " = " + p.v);
}
}
}
Q -= cl.prms.QA.v;
} }
this.prms.Z1.v = Z;
r.vCalc = Z;
return r; return r;
} }
...@@ -75,4 +116,18 @@ export class Pab extends Nub { ...@@ -75,4 +116,18 @@ export class Pab extends Nub {
this.prms.Z2.calculability = ParamCalculability.DICHO; this.prms.Z2.calculability = ParamCalculability.DICHO;
this.prms.Q.calculability = ParamCalculability.DICHO; this.prms.Q.calculability = ParamCalculability.DICHO;
} }
private calcZ1(cl: ParallelStructure, Q: number, Z: number): number {
// Initialisations for current cloison
cl.prms.Q.v = Q;
cl.prms.Z2.v = Z;
// Calculation of upstream water elevation
cl.Calc("Z1");
// TODO: Add extraresults: discharge, apron elevation upstream the wall, apron elevation at half basin
// Update elevation and discharge for next basin
return cl.prms.Z1.v;
}
} }
...@@ -54,6 +54,21 @@ class PabCloisonsParams extends CloisonsParams { ...@@ -54,6 +54,21 @@ class PabCloisonsParams extends CloisonsParams {
// tslint:disable-next-line:max-classes-per-file // tslint:disable-next-line:max-classes-per-file
export class PabCloisons extends Cloisons { export class PabCloisons extends Cloisons {
/**
* paramètres castés au bon type
*/
get prms(): PabCloisonsParams {
return this._prms as PabCloisonsParams;
}
/**
* Calculation of upstream water depth
*/
get Yam(): number {
// TODO: ajouter l'option radier horizontal
return this.prms.PB.currentValue + this.prms.DH.currentValue / 2;
}
public parent: Pab; public parent: Pab;
constructor(modelCloisons: Cloisons, rQA: number = 0, dbg: boolean = false) { constructor(modelCloisons: Cloisons, rQA: number = 0, dbg: boolean = false) {
...@@ -63,10 +78,14 @@ export class PabCloisons extends Cloisons { ...@@ -63,10 +78,14 @@ export class PabCloisons extends Cloisons {
} }
/** /**
* paramètres castés au bon type * Update crest elevations from upstream apron elevation
*/ */
get prms(): PabCloisonsParams { public updateZDV(rZR: number) {
return this._prms as PabCloisonsParams; for (const st of this.structures) {
if (st.prms.ZDV.calculability !== ParamCalculability.NONE) {
st.prms.ZDV.v = st.prms.ZDV.currentValue + rZR - (this.prms.Z1.currentValue - this.Yam);
}
}
} }
/** /**
......
...@@ -42,6 +42,7 @@ export class ParamValues implements IterableValues { ...@@ -42,6 +42,7 @@ export class ParamValues implements IterableValues {
public set singleValue(v: number) { public set singleValue(v: number) {
this._singleValue = v; this._singleValue = v;
this.currentValue = v;
} }
public count() { public count() {
......
...@@ -377,7 +377,7 @@ export class Session { ...@@ -377,7 +377,7 @@ export class Session {
1.5, // Q 1.5, // Q
102, // Z1 102, // Z1
99 // Z2 99 // Z2
), dbg ), undefined, dbg
); );
break; break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment