Commit 9a6f835e authored by Dorchies David's avatar Dorchies David
Browse files

Move Nub.V method to getter ParamDefinition.V

Showing with 17 additions and 17 deletions
+17 -17
......@@ -70,7 +70,7 @@ export class MacroRugo extends Nub {
// Cote de fond aval
r.extraResults.ZF2 = this.prms.ZF1.v - this.prms.If.v * this.prms.L.v;
// Vitesse débitante
r.extraResults.Vdeb = this.V(this.prms.Q) / this.prms.B.v / this.prms.Y.v;
r.extraResults.Vdeb = this.prms.Q.V / this.prms.B.v / this.prms.Y.v;
// Froude
const vg: number = r.extraResults.Vdeb / (1 - Math.sqrt(MacroRugo.fracAxAy * this.prms.C.v));
r.extraResults.Fr = vg / Math.sqrt(MacroRugo.g * this.prms.Y.v);
......@@ -81,7 +81,7 @@ export class MacroRugo extends Nub {
Math.pow(r.extraResults.Fr, -2 / 3)
);
// Puissance dissipée
r.extraResults.PV = 1000 * MacroRugo.g * this.V(this.prms.Q) / this.prms.B.v * this.prms.If.v;
r.extraResults.PV = 1000 * MacroRugo.g * this.prms.Q.V / this.prms.B.v * this.prms.If.v;
// Type d'écoulement
if (this.prms.Y.v / this.prms.PBH.v < 1) {
r.extraResults.ENUM_MacroRugoFlowType = MacroRugoFlowType.EMERGENT;
......
......@@ -466,21 +466,6 @@ export abstract class Nub extends ComputeNode implements IObservable {
return this._result;
}
/**
* Renvoie la valeur actuelle d'un paramètre (valeur utilisateur ou résultat)
* @param p Paramètre
*/
public V(p: ParamDefinition): number {
if (p.valueMode === ParamValueMode.CALCUL) {
if (this.result !== undefined) {
if (this.result.resultElement.ok) {
return this.result.vCalc;
}
}
}
return p.currentValue;
}
public addChild(child: Nub, after?: number) {
if (after !== undefined) {
this._children.splice(after + 1, 0, child);
......@@ -931,6 +916,7 @@ export abstract class Nub extends ComputeNode implements IObservable {
ret.hasErrors = true;
}
} else {
// tslint:disable-next-line:no-console
console.error(`session file : cannot find parameter ${p.symbol} in target Nub`);
ret.hasErrors = true;
}
......
......@@ -1057,6 +1057,20 @@ export class ParamDefinition implements INamedIterableValues, IObservable {
return this.calculability === ParamCalculability.EQUATION;
}
/**
* Renvoie la valeur actuelle du paramètre (valeur courante ou résultat si calculé)
*/
get V(): number {
if (this.valueMode === ParamValueMode.CALCUL) {
if (this.parentNub.result !== undefined) {
if (this.parentNub.result.resultElement.ok) {
return this.parentNub.result.vCalc;
}
}
}
return this.currentValue;
}
public clone(): ParamDefinition {
const res = new ParamDefinition(this._parent, this._symbol,
this.domain.clone(), this._unit, this.singleValue, this._family, this.visible);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment