Skip to content
Snippets Groups Projects
Commit 0058d669 authored by mathias.chouet's avatar mathias.chouet
Browse files

Completed JS boilerplate

parent dfe74e51
No related branches found
No related tags found
No related merge requests found
......@@ -2,12 +2,65 @@
* JaLHyd must be compiled with "es2016" target and "commonjs" modules
* @see `npm run build-node` and `src/tsconfig.app.node.json`
*/
const { PabChute, PabChuteParams, formattedValue } = require("jalhyd");
const {
CalculatorType,
formattedValue,
LoiDebit,
Props,
Session
} = require("jalhyd");
// ---- example of modules setup and calculation : fish ladder ----
// ---- example of simple modules setup and calculation ----
const pabChute = new PabChute(new PabChuteParams(29.99, 26.81, 0));
const pabChute = Session.getInstance().createSessionNub(
new Props({ calcType: CalculatorType.PabChute })
);
pabChute.prms.Z1.singleValue = 29.99;
pabChute.prms.Z2.singleValue = 26.81;
pabChute.calculatedParam = pabChute.prms.DH;
const res = pabChute.CalcSerie();
console.log("RESULT :", formattedValue(res.vCalc, 3));
const pabNombre = Session.getInstance().createSessionNub(
new Props({ calcType: CalculatorType.PabNombre })
);
pabNombre.prms.N.singleValue = 14;
pabNombre.calculatedParam = pabNombre.prms.DH;
pabNombre.prms.DHT.defineReference(pabChute, "DH");
const pabPuissance = Session.getInstance().createSessionNub(
new Props({ calcType: CalculatorType.PabPuissance })
);
pabPuissance.prms.Q.singleValue = 1.8;
pabPuissance.prms.PV.singleValue = 140;
pabPuissance.calculatedParam = pabPuissance.prms.V;
pabPuissance.prms.DH.defineReference(pabNombre, "DH");
const pabDimension = Session.getInstance().createSessionNub(
new Props({ calcType: CalculatorType.PabDimensions })
);
pabDimension.prms.L.singleValue = 5;
pabDimension.prms.W.singleValue = 3.6;
pabDimension.calculatedParam = pabDimension.prms.Y;
pabDimension.prms.V.defineReference(pabPuissance, "V");
const resDim = pabDimension.CalcSerie();
console.log("Water level in PAB:Dimension :", formattedValue(resDim.vCalc, 3));
const cloisons = Session.getInstance().createSessionNub(
new Props({ calcType: CalculatorType.Cloisons })
);
const struct = Session.getInstance().createNub(
new Props({ calcType: CalculatorType.Structure, loiDebit: LoiDebit.WeirSubmergedLarinier })
);
struct.prms.L.singleValue = 0.5;
struct.prms.CdWSL.singleValue = 0.83;
cloisons.addChild(struct);
cloisons.calculatedParam = cloisons.structures[0].prms.h1;
cloisons.prms.Z1.singleValue = 30.14;
cloisons.prms.LB.singleValue = 4.5;
cloisons.prms.PB.singleValue = 2.5;
cloisons.prms.Q.defineReference(pabPuissance, "Q");
cloisons.prms.BB.defineReference(pabDimension, "W");
cloisons.prms.DH.defineReference(pabNombre, "DH");
const resC = cloisons.CalcSerie();
console.log("Head in Cloisons :", formattedValue(resC.vCalc, 3));
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment