lechaptcalmon.ts 1.44 KiB
import { Nub, Result, IParametres } from "base";
interface IParamLechaptCalmon extends IParametres {
    /** Débit */
    Q: number; 
    /** Diamètre */
    D: number;
    /** Perte de charge */
    J: number;
    /** Longueur de la conduite */
    Lg: number;
    /** Paramètre de rugosité L */
    L: number;
    /** Paramètre de rugosité M */
    M: number;
    /** Paramètre de rugosité N */
    N: number;
class LechaptCalmon extends Nub {
    constructor(parametres: IParamLechaptCalmon) {
        super(parametres);
        this.AddVarEq("Q");
        this.AddVarEq("D");
        this.AddVarEq("J");
        this.AddVarEq("Lg");
    Equation(sVarCalc: string): Result {
        let res: Result;
        switch (sVarCalc) {
            case "Q":
                res.varCalc = Math.pow((((this.v.J * Math.pow(this.v.D, this.v.N)) / this.v.L) * (1000 / this.v.Lg)), 1 / this.v.M);
                break;
            case "D":
                res.varCalc = Math.pow((((this.v.L * Math.pow(this.v.Q, this.v.M)) / this.v.J) * (this.v.Lg / 1000)), 1 / this.v.N);
                break;
            case "J":
                res.varCalc = ((this.v.L * Math.pow(this.v.Q, this.v.M)) / Math.pow(this.v.D, this.v.N)) * (this.v.Lg / 1000);
                break;
            case "Lg":
                res.varCalc = ((this.v.J * Math.pow(this.v.D, this.v.N)) / (this.v.L * Math.pow(this.v.Q, this.v.M))) * 1000;
        return res;