An error occurred while loading the file. Please try again.
-
b31d543e
import { Nub } from "../nub";
import { ParamCalculability } from "../param/param-definition";
import { Result } from "../util/result";
import { PabCloisons } from "./pab_cloisons";
import { PabParams } from "./pab_params";
export { PabParams };
export class Pab extends Nub {
/**
* paramètres castés au bon type
*/
get prms(): PabParams {
return this._prms as PabParams;
}
/** Tableau des cloisons en série */
protected _pabCloisons: PabCloisons[] = [];
/**
* Calcul analytique
* @param sVarCalc Variable à calculer (Z1 uniquement)
*/
public Equation(sVarCalc: string): Result {
const r: Result = new Result(0, this);
let Z: number = this.prms.Z2.v;
for (const cloison of this._pabCloisons) {
cloison.prms.Z2.v = Z;
cloison.Calc("Z1");
Z = cloison.prms.Z1.v;
}
this.prms.Z1.v = Z;
return r;
}
/**
* Ajout d'une cloison en série
* @param structure La structure à rajouter
* @param after position après laquelle insérer la cloison, à la fin sinon
*/
public addChild(pabCloisons: PabCloisons, after?: number) {
if (after !== undefined) {
this._pabCloisons.splice(after + 1, 0, pabCloisons);
} else {
this._pabCloisons.push(pabCloisons);
}
// add reference to parent collection (this)
pabCloisons.parent = this;
// propagate precision
pabCloisons.prms.Pr.setValue(this.prms.Pr.v); // does not write to .v to bypass calculability control
}
/**
* paramétrage de la calculabilité des paramètres
*/
protected setParametersCalculability() {
this.prms.Z1.calculability = ParamCalculability.EQUATION;
this.prms.Z2.calculability = ParamCalculability.DICHO;
this.prms.Q.calculability = ParamCalculability.DICHO;
}
}