Commit 2c2899c3 authored by Dorchies David's avatar Dorchies David
Browse files

feat: Add triangular broad weir structure (tests not OK)

Refs #211
parent ed9d2230
......@@ -7,7 +7,7 @@ function createStruct() {
return new StructureTriangularWeir(new TriangularStructureParams(0, 100.1, 100.1, 100.1, 45, 1.36), false);
}
describe("Class StructureTriangularWeirFree: ", () => {
describe("Class StructureTriangularWeir: ", () => {
describe("Calcul Q a surface libre avec h1 croissant: ", () => {
const structTest = createStruct();
......
import { StructureTriangularWeirBroad } from "../../src/structure/structure_triangular_weir_broad";
import { CreateStructure } from "../../src/structure/factory_structure";
import { LoiDebit } from "../../src/index";
describe("Class StructureTriangularWeirBroad: ", () => {
it("Q free flow should be similar to Q limit submergence", () => {
const st = CreateStructure(LoiDebit.TriangularWeirBroad);
st.prms.Z2.singleValue = st.prms.ZDV.singleValue - 1;
const rQFreeFlow = st.CalcSerie().vCalc;
st.prms.Z2.singleValue = st.prms.ZDV.singleValue + (st.prms.Z1.singleValue - st.prms.ZDV.singleValue) * 0.8001;
expect(st.CalcSerie().vCalc).toBeCloseTo(rQFreeFlow, 1E-3);
})
it("Z2 similar to Z1 should lead to null discharge", () => {
const st = CreateStructure(LoiDebit.TriangularWeirBroad);
st.prms.Z2.singleValue = st.prms.Z1.singleValue - 0.001;
expect(st.CalcSerie().vCalc).toBeCloseTo(0, 1E-3);
})
});
\ No newline at end of file
......@@ -20,6 +20,7 @@ import { StructureRectangularOrificeSubmerged } from "./structure_rectangular_or
import { StructureTriangularTruncWeirFree } from "./structure_triangular_trunc_weir";
import { TriangularTruncStructureParams } from "./structure_triangular_trunc_weir_params";
import { StructureTriangularWeir } from "./structure_triangular_weir";
import { StructureTriangularWeirBroad } from "./structure_triangular_weir_broad";
import { TriangularStructureParams } from "./structure_triangular_weir_params";
import { StructureVanLevLarinier } from "./structure_vanlev_larinier";
import { StructureVanLevParams } from "./structure_vanlev_params";
......@@ -126,6 +127,7 @@ export function CreateStructure(loiDebit: LoiDebit, parentNub?: ParallelStructur
break;
case LoiDebit.TriangularWeirFree:
case LoiDebit.TriangularWeirBroad:
const structTriangPrms: TriangularStructureParams = new TriangularStructureParams(
0, // Q
100, // ZDV
......@@ -135,7 +137,11 @@ export function CreateStructure(loiDebit: LoiDebit, parentNub?: ParallelStructur
oCd.SeuilT // Cd pour un seuil triangulaire
// W = Infinity par défaut pour un seuil
);
ret = new StructureTriangularWeir(structTriangPrms, dbg);
if(loiDebit === LoiDebit.TriangularWeirFree) {
ret = new StructureTriangularWeir(structTriangPrms, dbg);
} else {
ret = new StructureTriangularWeirBroad(structTriangPrms, dbg);
}
break;
case LoiDebit.TriangularTruncWeirFree:
......
......@@ -49,6 +49,8 @@ export enum LoiDebit {
VanLevVillemonte,
// loi de débit Seuil Cunge 1980
WeirCunge80,
// Loi de débit seuil triangulaire épais (Bos, Discharge measurement structures, 1989, p.137-143)
TriangularWeirBroad,
}
export const loiAdmissiblesOuvrages: { [key: string]: LoiDebit[] } = {
......@@ -60,7 +62,7 @@ export const loiAdmissiblesOuvrages: { [key: string]: LoiDebit[] } = {
LoiDebit.WeirVillemonte, LoiDebit.WeirFree, LoiDebit.KIVI, LoiDebit.WeirCunge80
],
SeuilTriangulaire: [
LoiDebit.TriangularWeirFree
LoiDebit.TriangularWeirFree, LoiDebit.TriangularWeirBroad
],
SeuilTriangulaireTrunc: [
LoiDebit.TriangularTruncWeirFree
......@@ -79,7 +81,7 @@ export const loiAdmissiblesCloisons: { [key: string]: LoiDebit[] } = {
LoiDebit.WeirSubmergedLarinier, LoiDebit.WeirVillemonte
],
SeuilTriangulaire: [
LoiDebit.TriangularWeirFree
LoiDebit.TriangularWeirFree, LoiDebit.TriangularWeirBroad
],
SeuilTriangulaireTrunc: [
LoiDebit.TriangularTruncWeirFree
......@@ -109,7 +111,7 @@ export const loiAdmissiblesCloisonAval: { [key: string]: LoiDebit[] } = {
LoiDebit.VanLevVillemonte, LoiDebit.VanLevLarinier
],
SeuilTriangulaire: [
LoiDebit.TriangularWeirFree
LoiDebit.TriangularWeirFree, LoiDebit.TriangularWeirBroad
],
SeuilTriangulaireTrunc: [
LoiDebit.TriangularTruncWeirFree
......
import { ParamCalculability } from "../param/param-definition";
import { Result } from "../util/result";
import { StructureFlowMode, StructureFlowRegime } from "./structure";
import { LoiDebit } from "./structure_props";
import { TriangularStructureParams } from "./structure_triangular_weir_params";
import { Villemonte } from "./villemonte";
import { StructureTriangularWeirFree } from "./structure_triangular_weir_free";
/**
* Equation classique seuil triangulaire + Ennoiement Villemonte
*/
export class StructureTriangularWeirBroad extends StructureTriangularWeirFree {
constructor(prms: TriangularStructureParams, dbg: boolean = false) {
super(prms, dbg);
this._loiDebit = LoiDebit.TriangularWeirBroad; // First name of the law for backward compatibility
}
/**
* Calcul analytique Q = f(Cd, L, h1, h2, W)
* @param sVarCalc Variable à calculer (doit être "Q")
*/
public CalcQ(): Result {
const r = super.CalcQ();
if (r.values.ENUM_StructureFlowRegime !== StructureFlowRegime.FREE) {
r.vCalc = r.vCalc * Math.sin(3.962902 * Math.pow((1 - this.prms.h2.v / this.prms.h1.v), 0.574979))
}
return r;
}
protected getFlowRegime() {
if (this.prms.h2.v < 4 / 5 * this.prms.h1.v) {
// Yc = 4 / 5 * H1 (Jameson, 1925)
return StructureFlowRegime.FREE;
}
return StructureFlowRegime.SUBMERGED;
}
}
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