-
Mathias Chouet authored
merged cParamsCanal and ParamsSection Structures are now only defined by their LoiDebit (no more StructureType) Session : fixed serialization of lately registered Nubs Sections are now defined by a CalculatorType and a NodeType fixed bug in findFirstSingleParameter added tests for session serialisation
7b6e5403
import { ParamCalculability } from "../param/param-definition";
import { Message, MessageCode } from "../util/message";
import { Result } from "../util/result";
import { Structure, StructureFlowMode, StructureFlowRegime } from "./structure";
import { StructureKiviParams } from "./structure_kivi_params";
import { LoiDebit } from "./structure_props";
import { Villemonte } from "./villemonte";
export { StructureKiviParams };
export class StructureKivi extends Structure {
constructor(prms: StructureKiviParams, dbg: boolean = false) {
super(prms, dbg);
this._loiDebit = LoiDebit.KIVI;
}
/**
* paramètres castés au bon type
*/
get prms(): StructureKiviParams {
return this._prms as StructureKiviParams;
}
public Equation(sVarCalc: string): Result {
Structure.CheckEquation(sVarCalc);
const res: Result = new Result(0, this, this.getResultData());
// p : pelle
let p: number = this.prms.ZDV.v - this.prms.ZRAM.v;
let h1p: number;
if (p < 0.1) {
// - p ne doit pas être inférieur à 0,10 m (Norme NF X10-311-1983)
res.resultElement.addMessage(new Message(MessageCode.WARNING_STRUCTUREKIVI_PELLE_TROP_FAIBLE));
p = 0.1;
}
h1p = this.prms.h1.v / p;
if (h1p > 2.5) {
// - h/p ne doit pas être supérieur à 2,5 (Norme NF X10-311-1983)
res.resultElement.addMessage(new Message(MessageCode.WARNING_STRUCTUREKIVI_HP_TROP_ELEVE));
h1p = 2.5;
}
const cd: number = this.prms.alpha.v + this.prms.beta.v * h1p;
let Q = cd * this.prms.L.v * Structure.R2G * Math.pow(this.prms.h1.v, 1.5);
if (res.extraResults.ENUM_StructureFlowRegime === StructureFlowRegime.SUBMERGED) {
Q = Villemonte(this.prms.h1.v, this.prms.h2.v, 1.5) * Q;
}
res.resultElement.vCalc = Q;
return res;
}
/**
* Calcul de l'aire d'écoulement sur le seuil ou dans l'orifice
*/
public calcA(): number {
return Math.min(Math.max(this.prms.h1.v, this.prms.h2.v), this.prms.W.v) * this.prms.L.v;
}
protected getFlowRegime(): StructureFlowRegime {
if (this.prms.h2.v > 0) {
return StructureFlowRegime.SUBMERGED;
} else {
return StructureFlowRegime.FREE;
71727374757677787980818283848586878889
}
}
protected getFlowMode(): StructureFlowMode {
return StructureFlowMode.WEIR;
}
/**
* paramétrage de la calculabilité des paramètres
*/
protected setParametersCalculability() {
super.setParametersCalculability();
this.prms.L.calculability = ParamCalculability.DICHO;
this.prms.alpha.calculability = ParamCalculability.DICHO;
this.prms.beta.calculability = ParamCalculability.FREE;
this.prms.ZRAM.calculability = ParamCalculability.FREE;
}
}