regime_uniforme.ts 1.50 KiB
import { Result, IParamsEquation } from "./base";
import { Nub } from "./nub";
import { acSection, cParamsCanal } from "./section/section_type";
export class RegimeUniforme extends Nub {
    private Sn: acSection; ///< Objet section
    constructor(s: acSection, dbg: boolean = false) {
        super(s.v, dbg);
        this.Sn = s;
        this.AddVarEq("Q");
        this.AddVarEq("Y");
    /**
   * Calcul du débit en régime uniforme.
   * @return Débit en régime uniforme
    Calc_Qn(): number {
        this.Sn.Reset(true);
        if (this.Sn.oP.v.If <= 0) {
            var Qn: number = 0; // ? false bool
            //this.oLog.Add('h_normale_pente_neg_nul',true);
        } else {
            Qn = this.Sn.oP.v.Ks * Math.pow(this.Sn.Calc('R', this.Sn.v.Y), 2 / 3) * this.Sn.Calc('S', this.Sn.v.Y) * Math.sqrt(this.Sn.oP.v.If);
            //this.debug("RU : Qn=" + Qn);
        return Qn;
    Equation(sVarCalc: string): Result {
        let v: number;
        switch (sVarCalc) {
            case 'Y':
                v = this.Sn.Calc('Yn');
                break;
            case 'Q':
                v = this.Calc_Qn();
                break;
            // default:
            //     var oDicho = new cDichotomie(this.oLog, this, 'Calc_Qn');
            //     v = oDicho.calculer(this.v['Q'], this.precision, rInit);
            //     break;
            default:
                throw "invalid variable name " + sVarCalc;
        return new Result(v);