Commit 0ce46e46 authored by Dorchies David's avatar Dorchies David
Browse files

Closes #51

+ MAJ package.json
+ ParallelStructure Gestion message d'erreur sur débits trop élevé sur calcul d'un paramètre d'ouvrage
parent 7db012b7
......@@ -5,15 +5,15 @@
"requires": true,
"dependencies": {
"@types/jasmine": {
"version": "2.8.2",
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.8.2.tgz",
"integrity": "sha512-RabEJPjYMpjWqW1qYj4k0rlgP5uzyguoc0yxedJdq7t5h19MYvqhjCR1evM3raZ/peHRxp1Qfl24iawvkibSug==",
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.8.8.tgz",
"integrity": "sha512-OJSUxLaxXsjjhob2DBzqzgrkLmukM3+JMpRp0r0E4HTdT1nwDCWhaswjYxazPij6uOdzHCJfNbDjmQ1/rnNbCg==",
"dev": true
},
"@types/node": {
"version": "8.0.53",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.53.tgz",
"integrity": "sha512-54Dm6NwYeiSQmRB1BLXKr5GELi0wFapR1npi8bnZhEcu84d/yQKqnwwXQ56hZ0RUbTG6L5nqDZaN3dgByQXQRQ==",
"version": "10.5.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.2.tgz",
"integrity": "sha512-m9zXmifkZsMHZBOyxZWilMwmTlpC8x5Ty360JKTiXvlXZfBWYpsg9ZZvP/Ye+iZUh+Q+MxDLjItVTWIsfwz+8Q==",
"dev": true
},
"ansi-regex": {
......@@ -28,6 +28,15 @@
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
"dev": true
},
"argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"requires": {
"sprintf-js": "1.0.3"
}
},
"babel-code-frame": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
......@@ -107,10 +116,10 @@
}
}
},
"coffee-script": {
"version": "1.12.7",
"resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz",
"integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==",
"coffeescript": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-2.3.1.tgz",
"integrity": "sha512-DNJmSPMyiz+OjWYyuDXNBcFutDjP2TS2owsZ8YvT65hA8c5IdHWIBqdA3Yf/XHoK23d/f1HqLjQbEJJZJoeV1w==",
"dev": true
},
"color-convert": {
......@@ -152,90 +161,24 @@
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
},
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
},
"esutils": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
"dev": true
},
"exit": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz",
"integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=",
"dev": true
},
"fileset": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/fileset/-/fileset-0.1.8.tgz",
"integrity": "sha1-UGuRqTluqn4y+0KoQHfHoMc2t0E=",
"dev": true,
"requires": {
"glob": "3.2.11",
"minimatch": "0.4.0"
},
"dependencies": {
"glob": {
"version": "3.2.11",
"resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz",
"integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=",
"dev": true,
"requires": {
"inherits": "2.0.3",
"minimatch": "0.3.0"
},
"dependencies": {
"minimatch": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz",
"integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=",
"dev": true,
"requires": {
"lru-cache": "2.7.3",
"sigmund": "1.0.1"
}
}
}
},
"minimatch": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.4.0.tgz",
"integrity": "sha1-vSx9Bg0sjI/Xzefx8u0tWycP2xs=",
"dev": true,
"requires": {
"lru-cache": "2.7.3",
"sigmund": "1.0.1"
}
}
}
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
"gaze": {
"version": "0.3.4",
"resolved": "https://registry.npmjs.org/gaze/-/gaze-0.3.4.tgz",
"integrity": "sha1-X5S92gr+U7xxCWm81vKCVI1gwnk=",
"dev": true,
"requires": {
"fileset": "0.1.8",
"minimatch": "0.2.14"
},
"dependencies": {
"minimatch": {
"version": "0.2.14",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz",
"integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=",
"dev": true,
"requires": {
"lru-cache": "2.7.3",
"sigmund": "1.0.1"
}
}
}
},
"glob": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
......@@ -250,11 +193,16 @@
"path-is-absolute": "1.0.1"
}
},
"growl": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/growl/-/growl-1.7.0.tgz",
"integrity": "sha1-3i1mE20ALhErpw8/EMMc98NQsto=",
"dev": true
"globule": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/globule/-/globule-1.2.1.tgz",
"integrity": "sha512-g7QtgWF4uYSL5/dn71WxubOrS7JVGCnFPEnoeChJmBnyR9Mw8nGoEwOgJL/RC2Te0WhbsEUCejfH8SZNJ+adYQ==",
"dev": true,
"requires": {
"glob": "7.1.2",
"lodash": "4.17.10",
"minimatch": "3.0.4"
}
},
"has-ansi": {
"version": "2.0.0",
......@@ -288,45 +236,61 @@
"dev": true
},
"jasmine": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.8.0.tgz",
"integrity": "sha1-awicChFXax8W3xG4AUbZHU6Lij4=",
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.1.0.tgz",
"integrity": "sha1-K9Wf1+xuwOistk4J9Fpo7SrRlSo=",
"dev": true,
"requires": {
"exit": "0.1.2",
"glob": "7.1.2",
"jasmine-core": "2.8.0"
"jasmine-core": "3.1.0"
}
},
"jasmine-core": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.8.0.tgz",
"integrity": "sha1-vMl5rh+f0FcB5F5S5l06XWPxok4=",
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.1.0.tgz",
"integrity": "sha1-pHheE11d9lAk38kiSVPfWFvSdmw=",
"dev": true
},
"jasmine-growl-reporter": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/jasmine-growl-reporter/-/jasmine-growl-reporter-0.0.3.tgz",
"integrity": "sha1-uHrlUeNZ0orVIXdl6u9sB7dj9sg=",
"dev": true,
"requires": {
"growl": "1.7.0"
}
},
"jasmine-node": {
"version": "1.14.5",
"resolved": "https://registry.npmjs.org/jasmine-node/-/jasmine-node-1.14.5.tgz",
"integrity": "sha1-GOg5e4VpJO53ADZmw3MbWupQw50=",
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/jasmine-node/-/jasmine-node-1.15.0.tgz",
"integrity": "sha512-W8ehdkjov8kaVEdGmqmfobuJk04NmYarfVKAl/HUeVsCxP+E25pcW+l6Y46yXMthjj+3Qi3gaWkC+LU8toqa2w==",
"dev": true,
"requires": {
"coffee-script": "1.12.7",
"gaze": "0.3.4",
"jasmine-growl-reporter": "0.0.3",
"coffeescript": "2.3.1",
"gaze": "1.1.3",
"jasmine-growl-reporter": "1.0.1",
"jasmine-reporters": "1.0.2",
"mkdirp": "0.3.5",
"requirejs": "2.3.5",
"underscore": "1.8.3",
"walkdir": "0.0.12"
},
"dependencies": {
"gaze": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz",
"integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==",
"dev": true,
"requires": {
"globule": "1.2.1"
}
},
"growl": {
"version": "1.10.5",
"resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz",
"integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==",
"dev": true
},
"jasmine-growl-reporter": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/jasmine-growl-reporter/-/jasmine-growl-reporter-1.0.1.tgz",
"integrity": "sha512-dh7VjP3l0OLxL9+sw5vK6RrdH4gdHCNkTnUd9orViHDPr7Fe8LsXY+IObWauS2hX5khMFtjKRZCfTcDHKAjm/A==",
"dev": true,
"requires": {
"growl": "1.10.5"
}
}
}
},
"jasmine-reporters": {
......@@ -344,10 +308,20 @@
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
"dev": true
},
"lru-cache": {
"version": "2.7.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz",
"integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=",
"js-yaml": {
"version": "3.12.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz",
"integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==",
"dev": true,
"requires": {
"argparse": "1.0.10",
"esprima": "4.0.1"
}
},
"lodash": {
"version": "4.17.10",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz",
"integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==",
"dev": true
},
"minimatch": {
......@@ -407,10 +381,10 @@
"integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==",
"dev": true
},
"sigmund": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
"integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=",
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true
},
"strip-ansi": {
......@@ -435,9 +409,9 @@
"dev": true
},
"tslint": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.8.0.tgz",
"integrity": "sha1-H0mtWy53x2w69N3K5VKuTjYS6xM=",
"version": "5.11.0",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz",
"integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=",
"dev": true,
"requires": {
"babel-code-frame": "6.26.0",
......@@ -446,26 +420,29 @@
"commander": "2.12.2",
"diff": "3.4.0",
"glob": "7.1.2",
"js-yaml": "3.12.0",
"minimatch": "3.0.4",
"resolve": "1.5.0",
"semver": "5.4.1",
"tslib": "1.8.1",
"tsutils": "2.13.0"
}
"tsutils": "2.28.0"
},
"dependencies": {
"tsutils": {
"version": "2.13.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.13.0.tgz",
"integrity": "sha512-FuWzNJbMsp3gcZMbI3b5DomhW4Ia41vMxjN63nKWI0t7f+I3UmHfRl0TrXJTwI2LUduDG+eR1Mksp3pvtlyCFQ==",
"version": "2.28.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.28.0.tgz",
"integrity": "sha512-bh5nAtW0tuhvOJnx1GLRn5ScraRLICGyJV5wJhtRWOLsxW70Kk5tZtpK3O/hW6LDnqKS9mlUMPZj9fEMJ0gxqA==",
"dev": true,
"requires": {
"tslib": "1.8.1"
}
}
}
},
"typescript": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.1.tgz",
"integrity": "sha1-7znN6ierrAtQAkLWcmq5DgyEZjE=",
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",
"integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",
"dev": true
},
"underscore": {
......
......@@ -13,13 +13,13 @@
"module": "build/index.js",
"dependencies": {},
"devDependencies": {
"@types/jasmine": "2.8.2",
"@types/node": "8.0.53",
"jasmine": "2.8.0",
"jasmine-core": "2.8.0",
"jasmine-node": "1.14.5",
"tslint": "5.8.0",
"typescript": "2.6.1"
"@types/jasmine": "2.8.8",
"@types/node": "10.5.2",
"jasmine": "3.1.0",
"jasmine-core": "3.1.0",
"jasmine-node": "1.15.0",
"tslint": "5.11.0",
"typescript": "2.9.2"
},
"scripts": {
"build": "npm run preprocess; ./node_modules/typescript/bin/tsc --p src/tsconfig.app.json",
......
......@@ -6,6 +6,7 @@
*/
// import { describe, expect, it, xdescribe, xit } from "../mock_jasmine";
import { MessageCode } from "../../src";
import { CreateStructure } from "../../src/structure/factory_structure";
import { ParallelStructure } from "../../src/structure/parallel_structure";
import { ParallelStructureParams } from "../../src/structure/parallel_structure_params";
......@@ -38,6 +39,12 @@ describe("Class ParallelStructure: ", () => {
itParallelStructure("Q", 30, 15);
itParallelStructure("Z1", 30, 15);
itParallelStructure("Z2", 15, 15);
itParallelStructure("0.ZDV", 0, 15);
itParallelStructure("1.ZDV", 0, 15);
it("shoud return an error Q too high", () => {
pstruct.prms.Q.v = 15;
expect(pstruct.Calc("1.ZDV").code).toBe(MessageCode.ERROR_STRUCTURE_Q_TROP_ELEVE);
});
});
});
......
......@@ -40,7 +40,7 @@ class StructureTest extends Structure {
Structure.CheckEquation(sVarCalc);
const data = this.getResultData();
return new Result(this.prms.Z1.v - this.prms.Z2.v, data);
return new Result(this.prms.Z1.v - this.prms.Z2.v - this.prms.ZDV.v, data);
}
/**
......
......@@ -201,6 +201,8 @@ export class ParallelStructure extends Nub {
// Pour les caractéristiques des ouvrages
const sVC = this.getStructureVarCalc(sVarCalc);
res = this.CalcStructPrm(sVC, rInit, rPrec);
// Suppression des extraResults : ils sont complétés plus bas pour chaque ouvrage
res.resultElement.extraResults = {};
if (res.ok) {
this.structures[sVC.index].getParameter(sVC.prm).setValue(res.vCalc);
}
......
......@@ -144,9 +144,11 @@ export abstract class Structure extends Nub {
default:
rPrm = 0;
}
// TODO Ajouter un message d'erreur
const res: Result = new Result(new Message(MessageCode.ERROR_STRUCTURE_Q_TROP_ELEVE), flagsNull);
res.vCalc = rPrm;
// "Les cotes et le débit ne sont pas cohérents => fermeture de l'ouvrage
return new Result(rPrm, flagsNull);
return res;
}
}
......
......@@ -221,6 +221,11 @@ export enum MessageCode {
*/
ERROR_STRUCTURE_ZDV_PAS_CALCULABLE,
/**
* Le débit passant par les autres ouvrages est trop important
*/
ERROR_STRUCTURE_Q_TROP_ELEVE,
/**
* StructureKivi : La pelle du seuil doit mesurer au moins 0,1 m. Le coefficient béta est forcé à 0.
*/
......
import { JalhydObject } from "../jalhyd_object";
import { NamedIterableValues, NumberIterator, NumberArrayReverseIterator, NumberArrayIterator } from "../param/param-value-iterator";
// tslint:disable-next-line:max-line-length
import { NamedIterableValues, NumberArrayIterator, NumberArrayReverseIterator, NumberIterator } from "../param/param-value-iterator";
import { cLog } from "./log";
import { Message, MessageCode, MessageSeverity } from "./message";
import { ResultElement } from "./resultelement";
......@@ -267,14 +268,11 @@ export class Result extends JalhydObject implements NamedIterableValues {
// interface NamedIterableValues
public get name(): string {
return this._name;
}
public get valuesIterator(): NumberIterator {
const tmp: number[] = [];
for (const re of this._resultElements)
for (const re of this._resultElements) {
tmp.push(re.vCalc);
}
return tmp[Symbol.iterator]() as NumberIterator;
}
......@@ -296,8 +294,9 @@ export class Result extends JalhydObject implements NamedIterableValues {
}
}
if (found)
if (found) {
return res;
}
return undefined;
}
......@@ -308,10 +307,11 @@ export class Result extends JalhydObject implements NamedIterableValues {
vals.push(r.vCalc);
}
if (reverse)
if (reverse) {
this._iterator = new NumberArrayReverseIterator(vals);
else
} else {
this._iterator = new NumberArrayIterator(vals);
}
return this._iterator;
}
......@@ -325,8 +325,9 @@ export class Result extends JalhydObject implements NamedIterableValues {
}
public get currentValue(): number {
if (this._iterator === undefined)
if (this._iterator === undefined) {
return this.vCalc;
}
return this._iterator.currentValue;
}
......@@ -338,6 +339,7 @@ export class Result extends JalhydObject implements NamedIterableValues {
/**
* série de valeurs de résultat complémentaire
*/
// tslint:disable-next-line:max-classes-per-file
export class ExtraResults extends JalhydObject implements NamedIterableValues {
private _name: string;
......@@ -373,10 +375,11 @@ export class ExtraResults extends JalhydObject implements NamedIterableValues {
}
public initValuesIterator(reverse: boolean = false): NumberIterator {
if (reverse)
if (reverse) {
this._iterator = new NumberArrayReverseIterator(this._values);
else
} else {
this._iterator = new NumberArrayIterator(this._values);
}
return this._iterator;
}
......
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