Commit 74c1e6b7 authored by Mathias Chouet's avatar Mathias Chouet 🍝
Browse files

Merge branch 'devel' into 'master'

Devel - PAR

Closes #223, #226, nghyd#424, #234, #231, #240, #233, #232, #242, #244, #253, and #229

See merge request cassiopee/jalhyd!86
parents 330a416d b3b17a08
......@@ -6,16 +6,13 @@
"configurations": [
{
"name": "Launch Program",
"name": "Jasmine current file",
"type": "node",
"request": "launch",
"program": "${file}",
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/build/**/*.js"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "buildspec"
"program": "${workspaceFolder}/node_modules/jasmine-ts/lib/index",
"args": ["--config=./spec/jasmine.json", "${file}"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "chrome",
......
stable - 2020-07-28
===================
new features
------------
* Baffle fishway setup
* Baffle fishway simulation
* Allow to link parameters of sections of identical types, without using families
bug fixes
---------
* Fix discharge coefficient of submerged rectangular orifice
* Cloisons: a (negative) sill is calculated for orifices, which triggers unwanted warnings
* Prevent linking to invisible parameters
* MRC: after variated calculation, fixed calculation is broken
stable - 2020-07-21
===================
......
......@@ -382,9 +382,7 @@ public update(sender: any, data: any) {
}
```
@TODO
Fournir l'association propriété-enum dans `src/app/formulaire/elements/select-field.ts` (exemple pour l'opération, dans le module Trigo)
Update property-enum associations list in `src/app/formulaire/elements/select-field.ts` (example for operation property in Trigo module)
```typescript
public static enumFromProperty = {
......@@ -393,13 +391,6 @@ public static enumFromProperty = {
};
```
If the acceptable values for a property are picked from an **enum**, then to properly serialize it one has to add a `case` in `invertEnumKeysAndValuesInProperties()` method of `session.ts`:
```typescript
case "trigoOperation":
res[k] = TrigoOperation[res[k]];
break;
```
Finally, for all the property values to be properly tested by fuzzy unit tests, one has to add a `case` in `CreateTestNub()` method, as well as a new method, in `spec/fuzzing.spec.ts`:
```typescript
......
......@@ -54,7 +54,7 @@ module.exports = function (config) {
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
// logLevel: config.LOG_INFO,
logLevel: config.LOG_DEBUG,
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
......
This diff is collapsed.
......@@ -42,12 +42,13 @@
},
"devDependencies": {
"@types/jasmine": "^3.5.9",
"@types/node": "^13.9.0",
"@types/node": "^13.9.1",
"buffer": "^5.5.0",
"find": "^0.3.0",
"jasmine": "^3.5.0",
"jasmine-core": "^3.5.0",
"jasmine-node": "^3.0.0",
"jasmine-ts": "^0.3.0",
"karma": "^4.4.1",
"karma-chrome-launcher": "^3.1.0",
"karma-jasmine": "^3.1.1",
......@@ -55,9 +56,10 @@
"replace-in-file": "^5.0.2",
"requirejs": "^2.3.6",
"rimraf": "^3.0.2",
"ts-node": "^8.10.2",
"tslint": "^6.1.0",
"typedoc": "^0.16.11",
"typescript": "^3.7.5"
"typescript": "~3.7.5"
},
"scripts": {
"preprocess": "node scripts/preprocessors.js",
......
import { CalculatorType } from "../src/compute-node";
import { Grille, ParamDomainValue, Session, SPP, YAXN, YAXNParams } from "../src/index";
import { Grille, ParamDomainValue, Session, SPP, YAXN, YAXNParams, Par, ParSimulation, ParSimulationParams } from "../src/index";
import { MacrorugoCompound } from "../src/macrorugo/macrorugo_compound";
import { Trigo, TrigoOperation } from "../src/math/trigo";
import { Nub } from "../src/nub";
......@@ -136,6 +136,11 @@ function setRandomSppOperation(sn: SPP) {
sn.operation = op;
}
function setRandomParType(sn: Par | ParSimulation) {
const pt = Math.floor(Math.random() * 4);
sn.parType = pt;
}
function addRandomYAXNs(n: SPP, nYMax: number = 3) {
const nY = Math.floor(Math.random() * nYMax) + 1;
for (let i = 0; i < nY; i++) {
......@@ -204,6 +209,12 @@ function CreateTestNub(iCalType: number): Nub {
addRandomYAXNs(n as SPP);
setRandomSppOperation(n as SPP);
}
if (iCalType === CalculatorType.Par) {
setRandomParType(n as Par);
}
if (iCalType === CalculatorType.ParSimulation) {
setRandomParType(n as ParSimulation);
}
for (const p of n.parameterIterator) {
if (p.visible) {
randomizeParameter(p);
......
......@@ -39,7 +39,7 @@ describe("iterator : ", () => {
pst.addChild(st);
const symbs = [
"Q", "Z1", "Z2", "CdWR", "CdGR", "CdCunge", "CdWSL", "CdWS", "h1", "h2", "L", "Q", "W", "Z1", "Z2", "ZDV"
"Q", "Z1", "Z2", "CdWR", "CdGR", "CdGRS", "CdCunge", "CdWSL", "CdWS", "h1", "h2", "L", "Q", "W", "Z1", "Z2", "ZDV"
];
const vals = [1, 2, 3];
checkParams(pst.parameterIterator, symbs, vals);
......
{
"spec_dir": "spec",
"spec_files": ["**/*.spec.ts"],
"stopSpecOnExpectationFailure": false,
"random": false
}
\ No newline at end of file
import { Session } from "../../src/session";
import { MacrorugoCompound } from "../../src/macrorugo/macrorugo_compound";
import { ParamValueMode } from "../../src/param/param-value-mode";
describe("Class MacroRugoCompound: ", () => {
describe("jalhyd #253 no water after variated calculation − ", () => {
it("case 1: no warnings", () => {
const sess = `{"header":{"source":"jalhyd","format_version":"1.3","created":"2020-07-22T20:24:55.753Z"},"settings":{"precision":1e-7,"maxIterations":100,"displayPrecision":3},"documentation":"","session":[{"uid":"b3hmeH","props":{"calcType":"MacroRugoCompound","inclinedApron":"NOT_INCLINED"},"meta":{"title":"Rhins-PontdesAllees"},"children":[{"uid":"bWxoNW","props":{"calcType":"MacroRugo"},"children":[],"parameters":[{"symbol":"ZF1","mode":"SINGLE","value":276.89},{"symbol":"B","mode":"SINGLE","value":3}]},{"uid":"YTlnbX","props":{"calcType":"MacroRugo"},"children":[],"parameters":[{"symbol":"ZF1","mode":"SINGLE","value":277.09},{"symbol":"B","mode":"SINGLE","value":3}]}],"parameters":[{"symbol":"L","mode":"SINGLE","value":1},{"symbol":"If","mode":"SINGLE","value":0.036},{"symbol":"Ks","mode":"SINGLE","value":0.15},{"symbol":"C","mode":"SINGLE","value":0.114},{"symbol":"PBD","mode":"SINGLE","value":0.34},{"symbol":"PBH","mode":"SINGLE","value":0.41},{"symbol":"Cd0","mode":"SINGLE","value":2},{"symbol":"Z1","mode":"MINMAX","min":276.75,"max":277.8,"step":0.05,"extensionStrategy":0},{"symbol":"DH","mode":"SINGLE","value":1}]}]}`;
Session.getInstance().clear();
Session.getInstance().unserialise(sess);
const mrc = Session.getInstance().findNubByUid("b3hmeH") as MacrorugoCompound;
// variated calculation : ok
const res1 = mrc.CalcSerie();
expect(res1.ok).toBe(true);
expect(res1.hasMultipleValues()).toBe(true, "1st calculation should be variated");
expect(mrc.getChildren()[0].result.values.Q).toBeGreaterThan(0);
// subsequent fixed calculation : fails
mrc.prms.Z1.valueMode = ParamValueMode.SINGLE;
mrc.prms.Z1.singleValue = 277;
const res2 = mrc.CalcSerie();
expect(res2.hasMultipleValues()).toBe(false, "2nd calculation should not be variated");
expect(res2.ok).toBe(true);
expect(mrc.getChildren()[0].result.values.Q).toBeGreaterThan(0);
});
});
});
import { getEmptyCloisonsTest } from "./cloisons.spec";
import { CreateStructure } from "../../src/structure/factory_structure";
import { LoiDebit } from "../../src/structure/structure_props";
describe("Cloison Jalhyd #242", () => {
it("Orifice in cloison should not return hauteur de pelle", () => {
const cloisons = getEmptyCloisonsTest();
cloisons.addChild(CreateStructure(LoiDebit.OrificeSubmerged));
cloisons.prms.Q.setCalculated();
expect(cloisons.CalcSerie().values.P).toBeUndefined();
});
});
\ No newline at end of file
......@@ -5,7 +5,7 @@ import { CloisonsParams } from "../../src/pab/cloisons_params";
import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params";
import { CreateParalleleStructureTest, testParallelStructures } from "../structure/functions";
function getEmptyCloisonsTest(): Cloisons {
export function getEmptyCloisonsTest(): Cloisons {
return new Cloisons(
new CloisonsParams(
0, // Débit total (m3/s)
......
This diff is collapsed.
This diff is collapsed.
......@@ -50,7 +50,7 @@ describe("when a parameter is varying, ", () => {
});
it("jalhyd#222 iterator should not be shared by linked parameter", () => {
const sess = `{"header":{"source":"jalhyd","format_version":"1.3","created":"2020-05-14T12:32:41.289Z"},"settings":{"precision":1e-7,"maxIterations":100,"displayPrecision":3},"documentation":"","session":[{"uid":"ODBiMG","props":{"calcType":"ParallelStructure"},"meta":{"title":"Orifice -> seuil"},"children":[{"uid":"aGR2eW","props":{"calcType":"Structure","structureType":"VanneRectangulaire","loiDebit":"GateCunge80"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":100},{"symbol":"W","mode":"MINMAX","min":0.7,"max":1.01,"step":0.01,"extensionStrategy":0},{"symbol":"L","mode":"SINGLE","value":1},{"symbol":"CdGR","mode":"LINK","targetNub":"dnhrNW","targetParam":"CdGR"}]},{"uid":"dnhrNW","props":{"calcType":"Structure","structureType":"VanneRectangulaire","loiDebit":"GateCem88d"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":100},{"symbol":"W","mode":"LINK","targetNub":"aGR2eW","targetParam":"W"},{"symbol":"L","mode":"SINGLE","value":1},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[{"symbol":"Q","mode":"CALCUL"},{"symbol":"Z1","mode":"SINGLE","value":101},{"symbol":"Z2","mode":"SINGLE","value":100.8}]}]}`;
const sess = `{"header":{"source":"jalhyd","format_version":"1.3","created":"2020-05-14T12:32:41.289Z"},"settings":{"precision":1e-7,"maxIterations":100,"displayPrecision":3},"documentation":"","session":[{"uid":"ODBiMG","props":{"calcType":"ParallelStructure"},"meta":{"title":"Orifice -> seuil"},"children":[{"uid":"aGR2eW","props":{"calcType":"Structure","structureType":"VanneRectangulaire","loiDebit":"GateCunge80"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":100},{"symbol":"W","mode":"MINMAX","min":0.7,"max":1.01,"step":0.01,"extensionStrategy":0},{"symbol":"L","mode":"SINGLE","value":1}]},{"uid":"dnhrNW","props":{"calcType":"Structure","structureType":"VanneRectangulaire","loiDebit":"GateCem88d"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":100},{"symbol":"W","mode":"LINK","targetNub":"aGR2eW","targetParam":"W"},{"symbol":"L","mode":"SINGLE","value":1},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]}],"parameters":[{"symbol":"Q","mode":"CALCUL"},{"symbol":"Z1","mode":"SINGLE","value":101},{"symbol":"Z2","mode":"SINGLE","value":100.8}]}]}`;
Session.getInstance().clear();
Session.getInstance().unserialise(sess);
const n = Session.getInstance().findNubByUid("ODBiMG") as Cloisons;
......
......@@ -152,21 +152,18 @@ describe("serialising / deserialising session - ", () => {
expect(Session.getInstance().getNumberOfNubs()).toBe(5);
});
it ("serialized files should contain 11 LINK parameters", () => {
it ("serialized files should contain 8 LINK parameters", () => {
createEnv();
dever.addChild(CreateStructure(LoiDebit.RectangularOrificeFree, dever, false));
// define links
dever.prms.Z1.defineReference(rem, "Z2");
(dever.structures[0].prms as TriangularTruncStructureParams).ZT.defineReference(cloisons, "ZRMB");
(dever.structures[1].prms as RectangularStructureParams).ZDV.defineReference(cloisons.structures[0], "ZDV");
(dever.structures[0].prms as TriangularTruncStructureParams).ZT.defineReference(cloisons, "Z1");
cloisons.prms.BB.defineReference(rem.section, "LargeurFond");
(cloisons.structures[0].prms as RectangularStructureParams).h1.defineReference(dever.structures[0], "h1");
conduite.prms.D.defineReference(sp.section, "D");
conduite.prms.Lg.defineReference(rem, "Long");
rem.prms.ZF1.defineReference(cloisons, "ZRMB");
rem.prms.ZF1.defineReference(cloisons, "Z1");
rem.section.prms.Q.defineReference(dever, "Q");
sp.section.prms.YB.defineReference(cloisons, "PB");
sp.section.prms.Q.defineReference(cloisons.structures[0], "Q");
// serialise / unserialise
const session = Session.getInstance().serialise();
......@@ -176,18 +173,16 @@ describe("serialising / deserialising session - ", () => {
// check that links are still here and pointing to the right targets
checkLink(dever.prms.Z1, rem, "Z2");
checkLink((dever.structures[0].prms as TriangularTruncStructureParams).ZT, cloisons, "ZRMB");
checkLink((dever.structures[1].prms as RectangularStructureParams).ZDV, cloisons.structures[0], "ZDV");
checkLink((cloisons.structures[0].prms as RectangularStructureParams).h1, dever.structures[0], "h1");
checkLink((dever.structures[0].prms as TriangularTruncStructureParams).ZT, cloisons, "Z1");
cloisons.prms.BB.defineReference(rem.section, "LargeurFond");
checkLink(conduite.prms.D, sp.section, "D");
checkLink(conduite.prms.Lg, rem, "Long");
checkLink(rem.prms.ZF1, cloisons, "ZRMB");
checkLink(rem.prms.ZF1, cloisons, "Z1");
checkLink(rem.section.prms.Q, dever, "Q");
checkLink(sp.section.prms.YB, cloisons, "PB");
checkLink(sp.section.prms.Q, cloisons.structures[0], "Q");
// count parameters in LINK mode in session file
expect(session.split("LINK").length - 1).toBe(11);
expect(session.split("LINK").length - 1).toBe(8);
// serialise / unserialise, giving parent Nubs UIDs
const options: any = {};
......@@ -198,7 +193,7 @@ describe("serialising / deserialising session - ", () => {
options[sp.uid] = "Super section paramétrée";
const session2 = Session.getInstance().serialise(options);
// count parameters in LINK mode in session file
expect(session2.split("LINK").length - 1).toBe(11);
expect(session2.split("LINK").length - 1).toBe(8);
});
it("when saving a SectionParametree, the edited values should be present in the file", () => {
......
import { Session } from "../../src/session";
import { Pab } from "../../src/pab/pab";
describe("PAB and Cloisons", () => {
it("Hidden Cloison params should not be linkable to PAB", () => {
const sess = `{"header":{"source":"jalhyd","format_version":"1.3","created":"2020-07-27T15:02:25.988Z"},"settings":{"precision":1e-7,"maxIterations":100,"displayPrecision":3},"documentation":"","session":[{"uid":"NXB0eX","props":{"calcType":"Cloisons"},"meta":{"title":"Cloisons"},"children":[{"uid":"Z3ZjMT","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"h1","mode":"CALCUL","value":2},{"symbol":"L","mode":"SINGLE","value":0.3},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"NXZiMG","props":{"calcType":"Structure","structureType":"Orifice","loiDebit":"OrificeSubmerged"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":0.04},{"symbol":"CdO","mode":"SINGLE","value":0.7}]}],"parameters":[{"symbol":"Q","mode":"SINGLE","value":0.15},{"symbol":"Z1","mode":"SINGLE","value":1021312.48},{"symbol":"LB","mode":"SINGLE","value":1.7},{"symbol":"BB","mode":"SINGLE","value":1.2},{"symbol":"PB","mode":"SINGLE","value":1.055},{"symbol":"DH","mode":"SINGLE","value":0.292}]},{"uid":"cHBtaD","props":{"calcType":"Pab"},"meta":{"title":"PAB"},"children":[{"uid":"dTd6bW","props":{"calcType":"Cloisons"},"children":[{"uid":"OHFxNW","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":1312.19},{"symbol":"L","mode":"SINGLE","value":0.3},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"cm15MG","props":{"calcType":"Structure","structureType":"Orifice","loiDebit":"OrificeSubmerged"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":0.04},{"symbol":"CdO","mode":"SINGLE","value":0.7}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":1.7},{"symbol":"BB","mode":"SINGLE","value":1.2},{"symbol":"ZRMB","mode":"SINGLE","value":1311.133},{"symbol":"ZRAM","mode":"SINGLE","value":1311.279},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"a2g4Ym","props":{"calcType":"Cloisons"},"children":[{"uid":"M3A4NW","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":1311.898},{"symbol":"L","mode":"SINGLE","value":0.3},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"dDk1em","props":{"calcType":"Structure","structureType":"Orifice","loiDebit":"OrificeSubmerged"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":0.04},{"symbol":"CdO","mode":"SINGLE","value":0.7}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":1.7},{"symbol":"BB","mode":"SINGLE","value":1.2},{"symbol":"ZRMB","mode":"SINGLE","value":1310.84},{"symbol":"ZRAM","mode":"SINGLE","value":1310.986},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"ZDZxMD","props":{"calcType":"Cloisons"},"children":[{"uid":"N2k5NW","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":1311.605},{"symbol":"L","mode":"SINGLE","value":0.3},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"ajFken","props":{"calcType":"Structure","structureType":"Orifice","loiDebit":"OrificeSubmerged"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":0.04},{"symbol":"CdO","mode":"SINGLE","value":0.7}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":1.7},{"symbol":"BB","mode":"SINGLE","value":1.2},{"symbol":"ZRMB","mode":"SINGLE","value":1310.548},{"symbol":"ZRAM","mode":"SINGLE","value":1310.694},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"Z3NxYW","props":{"calcType":"Cloisons"},"children":[{"uid":"MXpzZz","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":1311.313},{"symbol":"L","mode":"SINGLE","value":0.3},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"OTNiaj","props":{"calcType":"Structure","structureType":"Orifice","loiDebit":"OrificeSubmerged"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":0.04},{"symbol":"CdO","mode":"SINGLE","value":0.7}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":1.7},{"symbol":"BB","mode":"SINGLE","value":1.2},{"symbol":"ZRMB","mode":"SINGLE","value":1310.255},{"symbol":"ZRAM","mode":"SINGLE","value":1310.401},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"aHZ6em","props":{"calcType":"Cloisons"},"children":[{"uid":"Nmxwem","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":1311.02},{"symbol":"L","mode":"SINGLE","value":0.3},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"ZXJvcG","props":{"calcType":"Structure","structureType":"Orifice","loiDebit":"OrificeSubmerged"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":0.04},{"symbol":"CdO","mode":"SINGLE","value":0.7}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":1.7},{"symbol":"BB","mode":"SINGLE","value":1.2},{"symbol":"ZRMB","mode":"SINGLE","value":1309.963},{"symbol":"ZRAM","mode":"SINGLE","value":1310.109},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"OGJ5Mn","props":{"calcType":"Cloisons"},"children":[{"uid":"bmhnN2","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":1310.728},{"symbol":"L","mode":"SINGLE","value":0.3},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"Nm9ob3","props":{"calcType":"Structure","structureType":"Orifice","loiDebit":"OrificeSubmerged"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":0.04},{"symbol":"CdO","mode":"SINGLE","value":0.7}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":1.7},{"symbol":"BB","mode":"SINGLE","value":1.2},{"symbol":"ZRMB","mode":"SINGLE","value":1309.67},{"symbol":"ZRAM","mode":"SINGLE","value":1309.816},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"NXV1OH","props":{"calcType":"Cloisons"},"children":[{"uid":"cjlxYm","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":1310.435},{"symbol":"L","mode":"SINGLE","value":0.3},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"YjEzZm","props":{"calcType":"Structure","structureType":"Orifice","loiDebit":"OrificeSubmerged"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":0.04},{"symbol":"CdO","mode":"SINGLE","value":0.7}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":1.7},{"symbol":"BB","mode":"SINGLE","value":1.2},{"symbol":"ZRMB","mode":"SINGLE","value":1309.378},{"symbol":"ZRAM","mode":"SINGLE","value":1309.524},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"Njdtcn","props":{"calcType":"Cloisons"},"children":[{"uid":"bzczNG","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":1310.143},{"symbol":"L","mode":"SINGLE","value":0.3},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"YnQxcD","props":{"calcType":"Structure","structureType":"Orifice","loiDebit":"OrificeSubmerged"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":0.04},{"symbol":"CdO","mode":"SINGLE","value":0.7}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":1.7},{"symbol":"BB","mode":"SINGLE","value":1.2},{"symbol":"ZRMB","mode":"SINGLE","value":1309.085},{"symbol":"ZRAM","mode":"SINGLE","value":1309.231},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"ajV6Yj","props":{"calcType":"Cloisons"},"children":[{"uid":"eWNmeW","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":1309.85},{"symbol":"L","mode":"SINGLE","value":0.3},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"d21haT","props":{"calcType":"Structure","structureType":"Orifice","loiDebit":"OrificeSubmerged"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":0.04},{"symbol":"CdO","mode":"SINGLE","value":0.7}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":1.7},{"symbol":"BB","mode":"SINGLE","value":1.2},{"symbol":"ZRMB","mode":"SINGLE","value":1308.793},{"symbol":"ZRAM","mode":"SINGLE","value":1308.939},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"YndkYm","props":{"calcType":"Cloisons"},"children":[{"uid":"cTdlM2","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":1309.558},{"symbol":"L","mode":"SINGLE","value":0.3},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"bHBnOD","props":{"calcType":"Structure","structureType":"Orifice","loiDebit":"OrificeSubmerged"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":0.04},{"symbol":"CdO","mode":"SINGLE","value":0.7}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":1.7},{"symbol":"BB","mode":"SINGLE","value":1.2},{"symbol":"ZRMB","mode":"SINGLE","value":1308.5},{"symbol":"ZRAM","mode":"SINGLE","value":1308.646},{"symbol":"QA","mode":"SINGLE","value":0}]},{"uid":"ZzhnM2","props":{"calcType":"Cloisons"},"children":[{"uid":"ZzdiaW","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":1309.265},{"symbol":"L","mode":"SINGLE","value":0.3},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"ZXpzaG","props":{"calcType":"Structure","structureType":"Orifice","loiDebit":"OrificeSubmerged"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":0.04},{"symbol":"CdO","mode":"SINGLE","value":0.7}]}],"parameters":[{"symbol":"LB","mode":"SINGLE","value":1.7},{"symbol":"BB","mode":"SINGLE","value":1.2},{"symbol":"ZRMB","mode":"SINGLE","value":1308.208},{"symbol":"ZRAM","mode":"SINGLE","value":1308.354},{"symbol":"QA","mode":"SINGLE","value":0}]}],"parameters":[{"symbol":"Q","mode":"CALCUL","value":0.15},{"symbol":"Z1","mode":"LISTE","values":[1312.18,1312.48,1312.8],"extensionStrategy":0},{"symbol":"Z2","mode":"SINGLE","value":1021312.48}],"downWall":{"uid":"bnQ5Yn","props":{"calcType":"CloisonAval"},"children":[{"uid":"YjRzcD","props":{"calcType":"Structure","structureType":"SeuilRectangulaire","loiDebit":"WeirVillemonte"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":1308.973},{"symbol":"L","mode":"SINGLE","value":0.3},{"symbol":"CdWR","mode":"SINGLE","value":0.4}]},{"uid":"dnM2YT","props":{"calcType":"Structure","structureType":"Orifice","loiDebit":"OrificeSubmerged"},"children":[],"parameters":[{"symbol":"S","mode":"SINGLE","value":0.04},{"symbol":"CdO","mode":"SINGLE","value":0.7}]}],"parameters":[{"symbol":"ZRAM","mode":"SINGLE","value":1308.061}]}}]}`;
Session.getInstance().clear();
Session.getInstance().unserialise(sess);
const pab = Session.getInstance().findNubByUid("cHBtaD") as Pab;
const lp = Session.getInstance().getLinkableValues(pab.prms.Z2);
expect(lp.length).toBe(1);
expect(lp[0].symbol).toBe("Z1", "Cloisons.Z1 should be the only linkable parameter");
});
});
......@@ -86,10 +86,10 @@ describe("référence d'un paramètre à un autre : ", () => {
const psp: ParallelStructureParams = new ParallelStructureParams(1, 2, 3);
const pst = new ParallelStructure(psp);
const st1: Structure = CreateStructure(LoiDebit.WeirCem88d, pst);
const st1: Structure = CreateStructure(LoiDebit.GateCem88v, pst);
pst.addChild(st1);
const prmS1 = (st1.prms as RectangularStructureParams);
const st2: Structure = CreateStructure(LoiDebit.WeirCem88d, pst);
const st2: Structure = CreateStructure(LoiDebit.GateCem88v, pst);
const prmS2 = (st2.prms as RectangularStructureParams);
pst.addChild(st2);
pst.calculatedParam = prmS1.L;
......
......@@ -128,7 +128,7 @@ export function floatDivAndMod(a: number, b: number, e: number = 1E-7): { q: num
* number of decimals specified in app preferences; if given number is too low and
* more decimals would be needed, keep as much significative digits as the number of
* decimals specified in app preferences, except potential trailing zeroes;
* returns "ERR" if value is not a number or is undefined
* returns "-" to point out an error if value is not a number or is undefined
*
* ex. with 3 decimals:
* 1 => 1.000
......@@ -144,7 +144,7 @@ export function formattedValue(value: number, nDigits: number) {
nDigits = Math.max(nDigits, 1);
nDigits = Math.min(nDigits, 100);
if (typeof value !== "number" || value === undefined) {
return "ERR";
return "-";
}
const minRenderableNumber = Number("1E-" + nDigits);
// if required precision is too low, avoid rendering only zeroes
......
......@@ -35,7 +35,9 @@ export enum CalculatorType {
Trigo, // Fonctions trigonométriques
SPP, // Somme et produit de puissances
YAXN, // Y = A.X^N
ConcentrationBlocs
ConcentrationBlocs,
Par, // Passe à ralentisseurs, calage
ParSimulation // Passe à ralentisseurs, simulation
}
/** types de sections */
......
Markdown is supported
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