An error occurred while loading the file. Please try again.
-
Grand Francois authored
- toutes les classes concernant les paramètres sont dans src/param - ComputeNode dans src/compute-node.ts
36da004e
import { Nub } from "./nub";
import { ParamCalculability } from "./param/param-definition";
import { acSection, ParamsSection } from "./section/section_type";
import { Result } from "./util/result";
export class RegimeUniforme extends Nub {
private Sn: acSection;
constructor(s: acSection, dbg: boolean = false) {
super(s.prms, dbg);
this.Sn = s;
}
get prms(): ParamsSection {
return this._prms as ParamsSection;
}
public Equation(sVarCalc: string): Result {
this.debug("RU: Equation(" + sVarCalc + ")")
switch (sVarCalc) {
case "Y":
return this.Sn.Calc("Yn");
case "Q":
return this.Calc_Qn();
default:
throw new Error("RegimeUniforme.Equation() : invalid variable name " + sVarCalc);
}
}
protected setParametersCalculability() {
this.prms.Q.calculability = ParamCalculability.EQUATION;
this.prms.Y.calculability = ParamCalculability.EQUATION;
}
/**
* Calcul du débit en régime uniforme.
* @return Débit en régime uniforme
*/
private Calc_Qn(): Result {
if (this.Sn.prms.If.v <= 0) {
return new Result(0);
}
const rR: Result = this.Sn.Calc("R", this.Sn.prms.Y.v);
if (!rR) {
return rR;
}
const rS: Result = this.Sn.Calc("S", this.Sn.prms.Y.v)
if (!rS) {
return rS;
}
const v = this.Sn.prms.Ks.v * Math.pow(rR.vCalc, 2 / 3) * rS.vCalc * Math.sqrt(this.Sn.prms.If.v);
return new Result(v);
}
}