Commit a55fa4f0 authored by Dorchies David's avatar Dorchies David
Browse files

Merge branch...

Merge branch '218-controler-le-domaine-de-definition-lors-de-l-affectation-de-singlevalue' into 'master'

Resolve "Contrôler le domaine de définition lors de l'affectation de .singleValue"

Closes #218

See merge request cassiopee/jalhyd!73
parents 09ae5a5a 29366ab6
......@@ -18,7 +18,7 @@ describe("Class ConcentrationBlocs − ", () => {
});
it("calc C", () => {
nub.prms.C.singleValue = 666;
nub.prms.C.singleValue = 1;
nub.prms.C.setCalculated();
const res = nub.CalcSerie();
expect(res.vCalc).toBeCloseTo(0.49, 2);
......@@ -26,7 +26,7 @@ describe("Class ConcentrationBlocs − ", () => {
});
it("calc C, round N", () => {
nub.prms.C.singleValue = 666;
nub.prms.C.singleValue = 1;
nub.prms.N.singleValue = 9.89;
nub.prms.C.setCalculated();
const res = nub.CalcSerie();
......@@ -85,7 +85,7 @@ describe("Class ConcentrationBlocs − ", () => {
});
it("calc D", () => {
nub.prms.D.singleValue = 666;
nub.prms.D.singleValue = 2;
nub.prms.D.setCalculated();
const res = nub.CalcSerie();
expect(res.vCalc).toBeCloseTo(0.35, 2);
......
......@@ -51,7 +51,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdT",
"mode": "SINGLE",
"value": 215219.392
"value": 10
}
]
},
......@@ -71,12 +71,12 @@ function getPabJalhyd131(): Pab {
{
"symbol": "alpha2",
"mode": "SINGLE",
"value": 547480.854
"value": 90
},
{
"symbol": "CdT",
"mode": "SINGLE",
"value": 695727.833
"value": 10
}
]
},
......@@ -101,7 +101,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdWR",
"mode": "SINGLE",
"value": 471832.179
"value": 10
}
]
}
......@@ -166,7 +166,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdT",
"mode": "SINGLE",
"value": 72612.054
"value": 10
}
]
}
......@@ -221,7 +221,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdO",
"mode": "SINGLE",
"value": 254975.526
"value": 10
}
]
},
......@@ -246,7 +246,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdWSL",
"mode": "SINGLE",
"value": 143157.249
"value": 10
}
]
},
......@@ -271,7 +271,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdWR",
"mode": "SINGLE",
"value": 119796.263
"value": 10
}
]
}
......@@ -326,12 +326,12 @@ function getPabJalhyd131(): Pab {
{
"symbol": "alpha2",
"mode": "SINGLE",
"value": 844538.962
"value": 90
},
{
"symbol": "CdT",
"mode": "SINGLE",
"value": 657719.871
"value": 10
}
]
}
......@@ -386,7 +386,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdO",
"mode": "SINGLE",
"value": 396113.123
"value": 10
}
]
},
......@@ -406,12 +406,12 @@ function getPabJalhyd131(): Pab {
{
"symbol": "alpha2",
"mode": "SINGLE",
"value": 381441.611
"value": 90
},
{
"symbol": "CdT",
"mode": "SINGLE",
"value": 629687.001
"value": 10
}
]
},
......@@ -436,7 +436,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdWR",
"mode": "SINGLE",
"value": 410711.955
"value": 10
}
]
}
......@@ -491,12 +491,12 @@ function getPabJalhyd131(): Pab {
{
"symbol": "alpha2",
"mode": "SINGLE",
"value": 12030.035
"value": 90
},
{
"symbol": "CdT",
"mode": "SINGLE",
"value": 54831.623
"value": 10
}
]
},
......@@ -516,7 +516,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdO",
"mode": "SINGLE",
"value": 919858.034
"value": 10
}
]
}
......@@ -576,7 +576,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdWR",
"mode": "SINGLE",
"value": 69976.261
"value": 10
}
]
},
......@@ -601,7 +601,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdWSL",
"mode": "SINGLE",
"value": 524111.51
"value": 10
}
]
}
......@@ -656,7 +656,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdO",
"mode": "SINGLE",
"value": 769223.09
"value": 10
}
]
},
......@@ -681,7 +681,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdWSL",
"mode": "SINGLE",
"value": 184926.268
"value": 10
}
]
},
......@@ -701,12 +701,12 @@ function getPabJalhyd131(): Pab {
{
"symbol": "alpha2",
"mode": "SINGLE",
"value": 520326.61
"value": 90
},
{
"symbol": "CdT",
"mode": "SINGLE",
"value": 516359.934
"value": 10
}
]
}
......@@ -761,7 +761,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdO",
"mode": "SINGLE",
"value": 464769.605
"value": 10
}
]
}
......@@ -821,7 +821,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdWR",
"mode": "SINGLE",
"value": 706623.422
"value": 10
}
]
},
......@@ -841,12 +841,12 @@ function getPabJalhyd131(): Pab {
{
"symbol": "alpha2",
"mode": "SINGLE",
"value": 325309.763
"value": 90
},
{
"symbol": "CdT",
"mode": "SINGLE",
"value": 816772.664
"value": 10
}
]
},
......@@ -866,12 +866,12 @@ function getPabJalhyd131(): Pab {
{
"symbol": "alpha2",
"mode": "SINGLE",
"value": 418326.307
"value": 90
},
{
"symbol": "CdT",
"mode": "SINGLE",
"value": 608510.929
"value": 10
}
]
}
......@@ -931,7 +931,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdWSL",
"mode": "SINGLE",
"value": 235453.03
"value": 10
}
]
},
......@@ -956,7 +956,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdWR",
"mode": "SINGLE",
"value": 900438.187
"value": 10
}
]
}
......@@ -1011,7 +1011,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdO",
"mode": "SINGLE",
"value": 700902.051
"value": 10
}
]
}
......@@ -1066,7 +1066,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdO",
"mode": "SINGLE",
"value": 160953.984
"value": 10
}
]
}
......@@ -1148,7 +1148,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdWR",
"mode": "SINGLE",
"value": 391320.536
"value": 10
}
]
},
......@@ -1168,7 +1168,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdWR",
"mode": "SINGLE",
"value": 114113.602
"value": 10
},
{
"symbol": "minZDV",
......@@ -1203,7 +1203,7 @@ function getPabJalhyd131(): Pab {
{
"symbol": "CdO",
"mode": "SINGLE",
"value": 715404.326
"value": 10
}
]
}
......
......@@ -5,7 +5,7 @@ describe("Dever", () => {
describe("jalhyd#123", () => {
it("1-CalcSerie() should return consistent result with no NaN or Infinity", () => {
// tslint:disable-next-line:max-line-length
const sessionJson = `{"header":{"source":"jalhyd","format_version":"1.1","created":"2019-08-02T13:08:02.502Z"},"session":[{"uid":"ZTVndH","props":{"calcType":"Dever"},"children":[{"uid":"YWdpdz","props":{"calcType":"Structure","loiDebit":"TriangularTruncWeirFree"},"children":[],"parameters":[{"symbol":"ZDV","mode":"SINGLE","value":435224.52874659264},{"symbol":"BT","mode":"SINGLE","value":834000.9388248117},{"symbol":"ZT","mode":"SINGLE","value":122035.3210189593},{"symbol":"CdT","mode":"SINGLE","value":373098.1230344667}]}],"parameters":[{"symbol":"Q","mode":"CALCUL"},{"symbol":"Z1","mode":"SINGLE", "value": 435224.52874657186},{"symbol":"BR","mode":"SINGLE","value":377590.4669003834},{"symbol":"ZR","mode":"SINGLE","value":1783112.6327096}]}]}`;
const sessionJson = `{ "header": { "source": "jalhyd", "format_version": "1.1", "created": "2019-08-02T13:08:02.502Z" }, "session": [ { "uid": "ZTVndH", "props": { "calcType": "Dever" }, "children": [ { "uid": "YWdpdz", "props": { "calcType": "Structure", "loiDebit": "TriangularTruncWeirFree" }, "children": [], "parameters": [ { "symbol": "ZDV", "mode": "SINGLE", "value": 435224.52874659264 }, { "symbol": "BT", "mode": "SINGLE", "value": 834000.9388248117 }, { "symbol": "ZT", "mode": "SINGLE", "value": 122035.3210189593 }, { "symbol": "CdT", "mode": "SINGLE", "value": 10 } ] } ], "parameters": [ { "symbol": "Q", "mode": "CALCUL" }, { "symbol": "Z1", "mode": "SINGLE", "value": 435224.52874657186 }, { "symbol": "BR", "mode": "SINGLE", "value": 377590.4669003834 }, { "symbol": "ZR", "mode": "SINGLE", "value": 1783112.6327096 } ] } ] }`;
Session.getInstance().unserialise(sessionJson);
const nub = Session.getInstance().findNubByUid("ZTVndH");
nub.CalcSerie();
......
......@@ -89,9 +89,9 @@ export class CourbeRemousParams extends ParamsEquation {
* durant le calcul
*/
public setYamontYavalFromElevations() {
this._Yamont.singleValue = (this._Z1.v - this._ZF1.v);
this._Yamont.singleValue = Math.max(1e-12, (this._Z1.v - this._ZF1.v));
this._Yamont.v = this._Yamont.singleValue;
this._Yaval.singleValue = (this._Z2.v - this._ZF2.v);
this._Yaval.singleValue = Math.max(1e-12, (this._Z2.v - this._ZF2.v));
this._Yaval.v = this._Yaval.singleValue;
}
}
......@@ -435,6 +435,7 @@ export class ParamDefinition implements INamedIterableValues, IObservable {
public set singleValue(v: number) {
this.checkValueMode([ParamValueMode.SINGLE, ParamValueMode.CALCUL, ParamValueMode.LINK]);
this.checkValueAgainstDomain(v);
this.paramValues.singleValue = v;
this.initValue = v;
this.notifyValueModified(this);
......
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