Commit d83c1754 authored by Grand Francois's avatar Grand Francois
Browse files

fix: MacroRugoRemous: return result error if setNubMacroRugoFromProps() fails

refs #325
Showing with 27 additions and 17 deletions
+27 -17
......@@ -54,9 +54,11 @@ export class MacroRugoRemous extends CourbeRemous {
if (this._nubMacroRugo.result === undefined) {
this._nubMacroRugo.CalcSerie();
}
this._nubMacroRugo.calculatedParam.singleValue = this._nubMacroRugo.result.vCalc;
this._nubMacroRugo.calculatedParam = this._nubMacroRugo.prms.If;
this._nubMacroRugo.prms.Q.visible = false;
if (this._nubMacroRugo.result.ok) {
this._nubMacroRugo.calculatedParam.singleValue = this._nubMacroRugo.result.vCalc;
this._nubMacroRugo.calculatedParam = this._nubMacroRugo.prms.If;
this._nubMacroRugo.prms.Q.visible = false;
}
}
// silent fail if (nub === undefined)
}
......@@ -70,21 +72,22 @@ export class MacroRugoRemous extends CourbeRemous {
*/
public syncSectionMacroRugo() {
this.setNubMacroRugoFromProps();
if (this._nubMacroRugo.result.ok) {
this.section.prms.LargeurBerge.singleValue = this._nubMacroRugo.prms.B.V;
this._nubMacroRugo.prms.Q.singleValue = this.section.prms.Q.singleValue;
this.section.prms.If.singleValue = this._nubMacroRugo.prms.If.v;
const Z2 = this.prms.Z2.singleValue;
const ZF2 = this._nubMacroRugo.result.getValue("ZF2");
this.section.prms.YB.singleValue = Math.max((Z2 - ZF2) * 1.5, 1); // pour éviter de fournir Infinity (max avec 1 à cause des fuzz tests)
this.section.prms.Ks.singleValue = this._nubMacroRugo.result.resultElement.values.Strickler;
this.prms.ZF1.singleValue = this._nubMacroRugo.prms.ZF1.singleValue;
this.prms.ZF2.singleValue = ZF2;
this.prms.Long.singleValue = this._nubMacroRugo.prms.L.singleValue;
this.section.prms.LargeurBerge.singleValue = this._nubMacroRugo.prms.B.V;
this._nubMacroRugo.prms.Q.singleValue = this.section.prms.Q.singleValue;
this.section.prms.If.singleValue = this._nubMacroRugo.prms.If.v;
const Z2 = this.prms.Z2.singleValue;
const ZF2 = this._nubMacroRugo.result.getValue("ZF2");
this.section.prms.YB.singleValue = Math.max((Z2 - ZF2) * 1.5, 1); // pour éviter de fournir Infinity (max avec 1 à cause des fuzz tests)
this.section.prms.Ks.singleValue = this._nubMacroRugo.result.resultElement.values.Strickler;
this.prms.ZF1.singleValue = this._nubMacroRugo.prms.ZF1.singleValue;
this.prms.ZF2.singleValue = ZF2;
this.prms.Long.singleValue = this._nubMacroRugo.prms.L.singleValue;
// set Dx to half of block distance
const ax: number = this._nubMacroRugo.prms.PBD.v / Math.sqrt(this._nubMacroRugo.prms.C.v);
this.prms.Dx.singleValue = ax / 2;
// set Dx to half of block distance
const ax: number = this._nubMacroRugo.prms.PBD.v / Math.sqrt(this._nubMacroRugo.prms.C.v);
this.prms.Dx.singleValue = ax / 2;
}
}
/**
......@@ -94,6 +97,13 @@ export class MacroRugoRemous extends CourbeRemous {
*/
public CalcSerie(rInit?: number): Result {
this.syncSectionMacroRugo();
if (!this._nubMacroRugo.result.ok) {
const res = new Result();
res.addLog(this._nubMacroRugo.result.globalLog);
res.addLog(this._nubMacroRugo.result.log);
return res;
}
const res = super.CalcSerie(rInit);
// add warning about downstream fall in case of downstream water elevation < critical elevation
......
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