Skip to content
Snippets Groups Projects
Commit cfb41dff authored by mathias.chouet's avatar mathias.chouet
Browse files

Fix #192 - add warning on LechaptCalmon speed

parent 4ef61080
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ import { ParamCalculability } from "../../src/param/param-definition";
import { LechaptCalmon } from "../../src/pipe_flow/lechaptcalmon";
import { LechaptCalmonParams } from "../../src/pipe_flow/lechaptcalmon_params";
import { SessionSettings } from "../../src/session_settings";
import { MessageCode } from "../../src/util/message";
function getLechapt(): LechaptCalmon {
const l = new LechaptCalmon(
......@@ -48,4 +49,19 @@ describe("Class LechaptCalmon : ", () => {
});
}
}
describe("warning on speed value -", () => {
it("case 1: there should not be any warning", () => {
const res = lechapt.CalcSerie();
expect(res.log.messages.length).toBe(0);
});
it("case 2: there should be a warning", () => {
lechapt.prms.Q.singleValue = 0.7;
const res = lechapt.CalcSerie();
expect(res.log.messages.length).toBe(1);
expect(res.log.messages[0].code).toBe(MessageCode.WARNING_LECHAPT_CALMON_SPEED_OUTSIDE_04_2);
});
});
});
......@@ -2,6 +2,7 @@ import { CalculatorType } from "../compute-node";
import { LCMaterial } from "../lc-material";
import { Nub } from "../nub";
import { ParamCalculability } from "../param/param-definition";
import { Message, MessageCode } from "../util/message";
import { Observer } from "../util/observer";
import { Result } from "../util/result";
import { LechaptCalmonParams } from "./lechaptcalmon_params";
......@@ -103,6 +104,9 @@ export class LechaptCalmon extends Nub implements Observer {
const r: Result = new Result(0, this);
r.values.V = this.prms.Q.v / (Math.PI * Math.pow(this.prms.D.v / 2, 2));
if (r.values.V < 0.4 || r.values.V > 2) {
r.resultElement.log.add(new Message(MessageCode.WARNING_LECHAPT_CALMON_SPEED_OUTSIDE_04_2));
}
r.values.Jl = this.prms.L.v * Math.pow(this.prms.Q.v, this.prms.M.v)
/ Math.pow(this.prms.D.v, this.prms.N.v) * (this.prms.Lg.v / 1000);
......
......@@ -328,6 +328,11 @@ export enum MessageCode {
*/
WARNING_DOWNSTREAM_ELEVATION_POSSIBLE_SUBMERSION,
/**
* Lechapt-Calmon : la vitesse est en dehors de l'intervalle [0.4, 2]
*/
WARNING_LECHAPT_CALMON_SPEED_OUTSIDE_04_2,
/**
* La cote de l'eau aval est plus élevée que la cote du centre de l'orifice (ennoiement possible)
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment