Commit 7a7b5033 authored by Mathias Chouet's avatar Mathias Chouet 🍝
Browse files

Fix #217 - PAB: absence of negative sill warning

parent 03f8cf9e
......@@ -268,4 +268,18 @@ describe("Class Pab: ", () => {
});
});
describe("errors inherited from Cloisons −", () => {
it("negative sill warning should be present", () => {
const sess = `{"header":{"source":"jalhyd","format_version":"1.3","created":"2020-05-06T14:44:44.505Z"},"settings":{"precision":1e-7,"maxIterations":100,"displayPrecision":3},"documentation":"","session":[{"uid":"M29hc3","props":{"calcType":"Pab"},"meta":{"title":"PAB 1"},"children":[{"uid":"eDllOD","props":{"calcType":"Cloisons"},"children":[{"uid":"ZGMwc3","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirSubmergedLarinier"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":98},{"symbol":"L","mode":"SINGLE","value":0.2},{"symbol":"CdWSL","mode":"SINGLE","value":0.75}]},{"uid":"cGs5OX","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirSubmergedLarinier"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":101},{"symbol":"L","mode":"SINGLE","value":0.2},{"symbol":"CdWSL","mode":"SINGLE","value":0.75}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":10},{"symbol":"BB","mode":"SINGLE","value":1},{"symbol":"ZRMB","mode":"SINGLE","value":100.5},{"symbol":"ZRAM","mode":"SINGLE","value":100.75},{"symbol":"QA","mode":"SINGLE","value":0}]}],"parameters":[{"symbol":"Q","mode":"SINGLE","value":2.349},{"symbol":"Z1","mode":"CALCUL"},{"symbol":"Z2","mode":"SINGLE","value":101}],"downWall":{"uid":"NzBlcD","props":{"calcType":"CloisonAval"},"children":[{"uid":"cG5xdX","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirSubmergedLarinier"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":97.5},{"symbol":"L","mode":"SINGLE","value":0.2},{"symbol":"CdWSL","mode":"SINGLE","value":0.75}]},{"uid":"aGM1ZG","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirSubmergedLarinier"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":100.5},{"symbol":"L","mode":"SINGLE","value":0.2},{"symbol":"CdWSL","mode":"SINGLE","value":0.75}]}],"parameters":[{"symbol":"ZRAM","mode":"SINGLE","value":100.25}]}}]}`;
Session.getInstance().clear();
Session.getInstance().unserialise(sess);
const pab = Session.getInstance().findNubByUid("M29hc3") as Pab;
const res = pab.CalcSerie();
expect(pab.children[0].result.log.messages.length).toBe(2);
expect(pab.children[0].result.log.messages[0].code).toBe(MessageCode.WARNING_SLOT_SUBMERSION_NOT_BETWEEN_07_AND_09);
expect(pab.children[0].result.log.messages[1].code).toBe(MessageCode.WARNING_NEGATIVE_SILL);
});
});
});
......@@ -76,15 +76,16 @@ export class Cloisons extends ParallelStructure {
for (const s of this.structures) {
if (s.prms.h1.visible) {
s.result.resultElement.addExtraResult("ZDV", this.prms.Z1.v - s.prms.h1.v);
// calcul de la pelle
const pelle = s.prms.ZDV.v - this.prms.ZRAM.v;
s.result.resultElement.values.P = pelle;
if (pelle < -1E-7) { // si c'est enfoncé d'un dixième de micron ça va
const m = new Message(MessageCode.WARNING_NEGATIVE_SILL);
s.result.resultElement.log.add(m);
// merge in parent for GUI display
this.result.resultElement.log.add(m);
}
}
// calcul de la pelle
const pelle = s.prms.ZDV.v - this.prms.ZRAM.v;
s.result.resultElement.values.P = pelle;
if (pelle < -1E-7) { // si c'est enfoncé d'un dixième de micron ça va
const m = new Message(MessageCode.WARNING_NEGATIVE_SILL);
m.extraVar.number = String(s.findPositionInParent() + 1); // String to avoid decimals
s.result.resultElement.log.add(m);
// merge in parent for GUI display
this.result.resultElement.log.add(m);
}
}
......
......@@ -317,7 +317,7 @@ export enum MessageCode {
/** abstract showing number of warning messages encountered in an iterative calculation */
WARNING_WARNINGS_ABSTRACT,
/** Déversoirs: la cote de déversoir d'un ouvrage est en dessous de la cote de fond du lit */
/** Déversoirs: la cote de déversoir de l'ouvrage %number% est en dessous de la cote de fond du lit */
WARNING_DEVER_ZDV_INF_ZR,
/** La cote de fond aval est plus élevée que la code de l'eau aval */
......@@ -394,7 +394,7 @@ export enum MessageCode {
*/
WARNING_STRUCTUREKIVI_HP_TROP_ELEVE,
/** Cloisons: la pelle d'un ouvrage est en dessous du radier */
/** Cloisons: la pelle de l'ouvrage %number% est en dessous du radier */
WARNING_NEGATIVE_SILL,
/**
......@@ -430,7 +430,10 @@ export enum MessageCode {
/**
* La valeur du paramètre a été arrondie à l'entier
*/
WARNING_VALUE_ROUNDED_TO_INTEGER
WARNING_VALUE_ROUNDED_TO_INTEGER,
/** Cloisons : la cote de radier de l'ouvrage n°%number% est en dessous de la cote de radier amont de la cloison */
WARNING_CLOISONS_ZDV_INF_ZRAM
}
/**
......
Markdown is supported
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