• Mathias Chouet's avatar
    refactor nubs · 7b6e5403
    Mathias Chouet authored
    merged cParamsCanal and ParamsSection
    Structures are now only defined by their LoiDebit (no more StructureType)
    Session : fixed serialization of lately registered Nubs
    Sections are now defined by a CalculatorType and a NodeType
    fixed bug in findFirstSingleParameter
    added tests for session serialisation
    7b6e5403
structure_cunge80.ts 3.27 KiB
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";
export { RectangularStructureParams };
/**
 * Equation Cunge80
export class StructureCunge80 extends RectangularStructure {
    constructor(prms: RectangularStructureParams, dbg: boolean = false) {
        super(prms, dbg);
        this._loiDebit = LoiDebit.Cunge80;
        if (prms.W.v !== Infinity) {
            this._isZDVcalculable = false;
        // afficher l'ouverture de vanne
        this.prms.W.visible = true;
    /**
     * Calcul du débit avec l'équation Cunge80
     * @param sVarCalc Variable à calculer (doit être égale à Q ici)
    public Equation(sVarCalc: string): Result {
        Structure.CheckEquation(sVarCalc);
        const data = this.getResultData();
        let v: number;
        switch (data.ENUM_StructureFlowRegime) {
            case StructureFlowRegime.FREE:
                if (data.ENUM_StructureFlowMode === StructureFlowMode.WEIR) {
                    const R32: number = 3 * Math.sqrt(3) / 2;
                    v = this.prms.Cd.v * this.prms.L.v * Structure.R2G / R32 * Math.pow(this.prms.h1.v, 1.5);
                    this.debug("StructureCunge80.Equation WEIR FREE Q=" + v);
                } else {
                    v = this.prms.Cd.v * this.prms.L.v * Structure.R2G
                        * this.prms.W.v * Math.pow(this.prms.h1.v - this.prms.W.v, 0.5);
                    this.debug("StructureCunge80.Equation ORIFICE FREE Q=" + v);
                break;
            case StructureFlowRegime.SUBMERGED:
                if (data.ENUM_StructureFlowMode === StructureFlowMode.WEIR) {
                    v = this.prms.Cd.v * this.prms.L.v * Structure.R2G * this.prms.h2.v
                        * Math.sqrt(this.prms.h1.v - this.prms.h2.v);
                    this.debug("StructureCunge80.Equation WEIR SUBMERGED Q=" + v);
                } else {
                    v = this.prms.Cd.v * this.prms.L.v * Structure.R2G
                        * this.prms.W.v * Math.sqrt(this.prms.h1.v - this.prms.h2.v);
                    this.debug("StructureCunge80.Equation ORIFICE SUBMERGED Q=" + v);
        return new Result(v, this, data);
    protected getFlowRegime() {
        if (this.prms.h1.v >= 1.5 * this.prms.h2.v) {
            return StructureFlowRegime.FREE;
        } else {
            return StructureFlowRegime.SUBMERGED;
    protected getFlowMode() {
        const regime: StructureFlowRegime = this.getFlowRegime();
        switch (regime) {
71727374757677787980818283848586
case StructureFlowRegime.FREE: if (this.prms.W.v <= 2 / 3 * this.prms.h1.v) { return StructureFlowMode.ORIFICE; } else { return StructureFlowMode.WEIR; } case StructureFlowRegime.SUBMERGED: if (this.prms.W.v <= this.prms.h2.v) { return StructureFlowMode.ORIFICE; } else { return StructureFlowMode.WEIR; } } } }