structure_weir_submerged.ts 2.08 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { Message, MessageCode, ParamCalculability } from "../index";
import { Result } from "../util/result";
import { RectangularStructure } from "./rectangular_structure";
import { RectangularStructureParams } from "./rectangular_structure_params";
import { Structure, StructureFlowMode, StructureFlowRegime } from "./structure";
import { LoiDebit } from "./structure_props";

/**
 * Equation de la fente noyée
 * d'après Rajaratnam, N., et D. Muralidhar.
 * « Flow below deeply submerged rectangular weirs ».
 * Journal of Hydraulic Research 7, nᵒ 3 (1969): 355–374.
 */
export class StructureWeirSubmerged extends RectangularStructure {

    constructor(prms: RectangularStructureParams, dbg: boolean = false) {
        super(prms, dbg);
        this._loiDebit = LoiDebit.WeirSubmerged;
        this.prms.CdWS.visible = true;
    }

    public Calc(sVarCalc: string, rInit?: number): Result {
        this.currentResult = super.Calc(sVarCalc, rInit);
        const h2h1ratio = this.prms.h2.v / this.prms.h1.v;
        if (h2h1ratio < 0.8) {
            this._result.resultElement.addMessage(new Message(
                MessageCode.WARNING_WEIR_SUBMERSION_LOWER_THAN_08,
                { h1: this.prms.h1.v, h2: this.prms.h2.v }
            ));
        }
        return this._result;
    }

    /**
     * Calcul analytique Q
     * @param sVarCalc Variable à calculer (doit être "Q")
     */
    public CalcQ(): Result {
        const data = this.getResultData();

        const v = this.prms.CdWS.v * this.prms.L.v * Structure.R2G
            * this.prms.h2.v * Math.sqrt(this.prms.h1.v - this.prms.h2.v);

        return new Result(v, this, data);
    }

    protected getFlowRegime() {
        return StructureFlowRegime.SUBMERGED;
    }

    protected getFlowMode() {
        return StructureFlowMode.WEIR;
    }

    /**
     * paramétrage de la calculabilité des paramètres
     */
    protected setParametersCalculability() {
        super.setParametersCalculability();
        this.prms.L.calculability = ParamCalculability.DICHO;
        this.prms.CdWS.calculability = ParamCalculability.DICHO;
    }
}