An error occurred while loading the file. Please try again.
-
Arnaud WATLET authored88427840
/**
* IMPORTANT !
* Décommenter temporairement la ligne suivante (import { } from "./mock_jasmine")
* Pour exécuter ce code dans le débugger.
* Faire de même avec le fichier test_func.ts
*/
// import { describe, expect, it, xdescribe, xit } from "../mock_jasmine";
import { ParamDefinition } from "../../src/index";
import { Cloisons } from "../../src/structure/cloisons";
import { CloisonsParams } from "../../src/structure/cloisons_params";
import { CreateStructure } from "../../src/structure/factory_structure";
import { StructureKiviParams } from "../../src/structure/structure_kivi";
import { LoiDebit } from "../../src/structure/structure_props";
// tslint:disable-next-line:max-line-length
import { RectangularStructureParams, StructureWeirSubmergedLarinier } from "../../src/structure/structure_weir_submerged_larinier";
import { testParallelStructures } from "./functions";
const cloisons: Cloisons = new Cloisons(
new CloisonsParams(
0, // Débit total (m3/s)
102, // Cote de l'eau amont (m)
10, // Longueur des bassins (m)
1, // Largeur des bassins (m)
1, // Profondeur moyenne (m)
0.5 // Hauteur de chute (m)
),
false // debug
);
const fente: StructureWeirSubmergedLarinier = new StructureWeirSubmergedLarinier(
new RectangularStructureParams(
0,
101,
102,
101.5,
0.2,
0.65
)
);
cloisons.addChild(fente);
describe("Class Cloisons: ", () => {
describe("Calc(Q) Fente noyée (Larinier 1992)", () => {
it("vCalc should return 0.407", () => {
expect(cloisons.Calc("Q").vCalc).toBeCloseTo(0.407, 3);
});
it("extraResults.PV should return 199.7", () => {
expect(cloisons.Calc("Q").extraResults.PV).toBeCloseTo(199.7, 1);
});
});
const c2: Cloisons = new Cloisons(
new CloisonsParams(
0, // Débit total (m3/s)
102, // Cote de l'eau amont (m)
10, // Longueur des bassins (m)
1, // Largeur des bassins (m)
1, // Profondeur moyenne (m)
0.5 // Hauteur de chute (m)
),
false // debug
);
// Ajout d'une structure de chaque type dans Cloisons
const iLoiDebits: LoiDebit[] = [
LoiDebit.OrificeSubmerged,
LoiDebit.WeirSubmergedLarinier,
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
LoiDebit.KIVI
];
for (let i = 0; i < 3; i++ ) {
c2.addChild(CreateStructure(iLoiDebits[i], c2, false));
}
const prmsKivi: StructureKiviParams = c2.structures[2].prms as StructureKiviParams;
prmsKivi.ZRAM.v = 0;
testParallelStructures(c2, iLoiDebits);
describe("Calcul de ZRAM de l'équation KIVI", () => {
it("ZRAM should be 101", () => {
c2.Calc("Q");
expect(prmsKivi.ZRAM.v).toBeCloseTo(101, 3);
});
});
describe("Calcul avec Calc - ", () => {
const descs = [
"Q",
"Z1",
"DH"
];
for (const desc of descs) {
describe("calcul de " + JSON.stringify(desc), () => {
it("", () => {
expect(cloisons.Calc(desc).vCalc).toBeDefined();
});
});
}
});
describe("Calcul avec CalcSerie - ", () => {
const descs = [
"Q",
"Z1",
"DH",
{ uid: fente.uid, symbol: "ZDV" },
{ uid: fente.uid, symbol: "L" },
{ uid: fente.uid, symbol: "Cd" }
];
for (const desc of descs) {
describe("calcul de " + JSON.stringify(desc), () => {
it("", () => {
expect(cloisons.CalcSerie(0, desc).vCalc).toBeDefined();
});
});
}
});
describe("Calcul avec CalcSerie et calculatedParam - ", () => {
const descs = [
"Q",
"Z1",
"DH",
{ uid: fente.uid, symbol: "ZDV" },
{ uid: fente.uid, symbol: "L" },
{ uid: fente.uid, symbol: "Cd" }
];
for (const desc of descs) {
describe("calcul de " + JSON.stringify(desc), () => {
it("", () => {
let p: ParamDefinition;
if (typeof desc === "string") {
p = cloisons.getParameter(desc);
} else {
p = fente.getParameter(desc.symbol);
}
cloisons.calculatedParam = p;
expect(cloisons.CalcSerie().vCalc).toBeDefined();
141142143144145146
});
});
}
});
});