Commit add1c5e2 authored by Dorchies David's avatar Dorchies David
Browse files

fix(PreBarrage): wrong discharge distribution for small headlosses

Refs #279
parent 91f31349
import { PreBarrage, Session } from "../../src/index";
import { checkResultConsistency } from "../test_func";
describe("PreBarrage", () => {
describe("jalhyd#279", () => {
it("Discharge in first bassin should be greater than 0.4", () => {
// tslint:disable-next-line:max-line-length
const sessionJson = `{"header":{"source":"jalhyd","format_version":"1.3","created":"2020-10-01T06:43:50.495Z"},"settings":{"precision":1e-7,"maxIterations":100,"displayPrecision":3},"documentation":"","session":[{"uid":"cG9yaG","props":{"calcType":"PreBarrage"},"meta":{"title":"Prébarrages"},"children":[{"uid":"c29nYW","props":{"calcType":"PbBassin"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":13.8},{"symbol":"ZF","mode":"SINGLE","value":95}]},{"uid":"ajB2cn","props":{"calcType":"PbCloison","upstreamBasin":"","downstreamBasin":"c29nYW"},"children":[{"uid":"dGtvMW","props":{"calcType":"Structure","loiDebit":"WeirCunge80","structureType":"SeuilRectangulaire"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":95.3},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdCunge","mode":"SINGLE","value":1}]}],"parameters":[]},{"uid":"a2t5eG","props":{"calcType":"PbCloison","upstreamBasin":"c29nYW","downstreamBasin":""},"children":[{"uid":"enJhZT","props":{"calcType":"Structure","loiDebit":"WeirCunge80","structureType":"SeuilRectangulaire"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":95.3},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdCunge","mode":"SINGLE","value":1}]}],"parameters":[]},{"uid":"ODUxdn","props":{"calcType":"PbCloison","upstreamBasin":"","downstreamBasin":""},"children":[{"uid":"YWFqdm","props":{"calcType":"Structure","loiDebit":"WeirCunge80","structureType":"SeuilRectangulaire"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":95.3},{"symbol":"L","mode":"SINGLE","value":0.4},{"symbol":"CdCunge","mode":"SINGLE","value":1}]}],"parameters":[]}],"parameters":[{"symbol":"Q","mode":"SINGLE","value":1},{"symbol":"Z1","mode":"CALCUL"},{"symbol":"Z2","mode":"SINGLE","value":100}]}]}`;
Session.getInstance().unserialise(sessionJson);
const nub = Session.getInstance().findNubByUid("cG9yaG") as PreBarrage;
// nub.DBG = true;
nub.CalcSerie();
expect(nub.bassins[0].result.values.Q).toBeGreaterThan(0.4);
});
});
});
......@@ -533,7 +533,7 @@ export class PreBarrage extends Nub {
// Calculation of repartition regarding actual water elevations
let QT2: number = 0;
for (const c of cloisons) {
c.prms.Q.initValue = c.prms.Q.v;
c.prms.Q.initValue = Math.max(0, c.prms.Q.v);
c.Calc("Q");
// Relax! On ne prend pas toute la modification proposée !
if(c.prms.Q.v > 0) {
......
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