Commit f981d63d authored by Mathias Chouet's avatar Mathias Chouet :spaghetti:
Browse files

PAB : add explicit log message when Z1 < Z2

Showing with 33 additions and 1 deletion
+33 -1
......@@ -170,6 +170,7 @@ describe("Class Pab: ", () => {
checkPabResults(pab, 0.773);
});
});
describe("Vanne levante sur Cloison aval", () => {
beforeEach( () => {
pab = createPabTest();
......@@ -199,4 +200,27 @@ describe("Class Pab: ", () => {
.toBe(MessageCode.ERROR_CLOISON_AVAL_UN_OUVRAGE_REGULE);
});
});
describe("when Z1 is too low compared to ZDV", () => {
it("logs should appear if dichotomy does not converge", () => {
pab.calculatedParam = pab.prms.Q;
pab.prms.Z1.singleValue = 78.26; // @WTF 78.27 in the example above works, 78.26 fails !
pab.CalcSerie();
expect(pab.result.hasLog).toBe(true);
expect(pab.result.resultElement.log.messages[0].code)
.toBe(MessageCode.ERROR_DICHO_CONVERGE); // @TODO or other error message ?
});
});
describe("variating Z1", () => {
it("logs should appear when Z1 < Z2", () => {
pab.calculatedParam = pab.prms.Q;
pab.prms.Z1.setValues(73, 85, 6);
pab.CalcSerie();
expect(pab.result.nbResultElements).toBe(3);
expect(pab.result.hasLog).toBe(true);
expect(pab.result.resultElements[0].log.messages[0].code).toBe(MessageCode.ERROR_Z1_LOWER_THAN_Z2);
});
});
});
......@@ -411,7 +411,6 @@ export abstract class Nub extends ComputeNode implements IObservable {
if (this._result.resultElement.ok) {
rInit = this._result.resultElement.vCalc;
}
this._result.globalLog.addLog(this._result.globalLog);
// update progress
this.progress += progressStep;
}
......
......@@ -110,6 +110,10 @@ export class Pab extends Nub {
this.currentResult = new Result(new Message(MessageCode.ERROR_CLOISON_AVAL_UN_OUVRAGE_REGULE));
return this.result;
}
if (sVarCalc === "Q" && this.prms.Z1.v < this.prms.Z2.v) {
this.currentResult = new Result(new Message(MessageCode.ERROR_Z1_LOWER_THAN_Z2));
return this.result;
}
return super.Calc(sVarCalc, rInit);
}
......
......@@ -118,6 +118,11 @@ export enum MessageCode {
*/
ERROR_CLOISON_AVAL_UN_OUVRAGE_REGULE,
/**
* La cote amont est plus basse que la cote aval
*/
ERROR_Z1_LOWER_THAN_Z2,
/**
* internationalisation : langue non prise en charge
*/
......
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