remous_rect_trapezes_pentefaible.spec.ts 28.6 KB
Newer Older
1
import { MethodeResolution } from "../../src/remous/methode-resolution";
2
3
4
5
import { CourbeRemous } from "../../src/remous/remous";
import { CourbeRemousParams } from "../../src/remous/remous_params";
import { cSnRectang } from "../../src/section/section_rectang";
import { ParamsSectionRectang } from "../../src/section/section_rectang_params";
6
import { SessionSettings } from "../../src/session_settings";
7
8
import { cLog } from "../../src/util/log";
import { Message, MessageCode } from "../../src/util/message";
9
import { precDist } from "../test_config";
10
import { compareExtraResult, compareLog, extraResultLength } from "../test_func";
11

12
13
14
15
16
17
/*
  Le code de modification des lignes fluviale et torrentielle a été modifié, on enlève un point de plus
  ligne d'eau complète : if (iSens * (rXCC - rX) < 0) remplacé par if (iSens * (rXCC - rX) <= 0)
  lign d'eau partielle : if (iSens * (rXCN - xRst) > 0)  remplacé par if (iSens * (rXCN - xRst) >= 0)
  Les données de validation ont été modifiées en conséquence
*/
18

19
20
describe("Class Remous / section rectangulaire :", () => {
    describe("méthode trapèzes :", () => {
21
        it("faible pente, ressaut avant l'amont", () => {
22
            const prms = new ParamsSectionRectang(undefined, // tirant d'eau
23
24
25
26
                2.5, // largeur de fond
                40, //  Ks=Strickler
                2, // Q=Débit
                0.001, // If=pente du fond
27
                1, // YB=hauteur de berge
28
            );
29
            SessionSettings.precision = precDist;
30

31
            const sect = new cSnRectang(prms);
32

33
            const prem = new CourbeRemousParams(100.4, 100.403, 100.1, 100,
34
35
                100,  // Long= Longueur du bief
                5,  // Dx=Pas d'espace
36
37
            );

38
            const rem = new CourbeRemous(sect, prem, MethodeResolution.Trapezes);
39

40
            const res = rem.calculRemous(undefined);
41
42
43

            // données de validation : version PHP (Oct 2017) méthode trapèzes

44
            const f: any = {
Mathias Chouet's avatar
Mathias Chouet committed
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
                100.000: 0.403,
                95.000: 0.524,
                90.000: 0.558,
                85.000: 0.584,
                80.000: 0.604,
                75.000: 0.621,
                70.000: 0.637,
                65.000: 0.65,
                60.000: 0.662,
                55.000: 0.673,
                50.000: 0.684,
                45.000: 0.693,
                40.000: 0.701,
                35.000: 0.709,
                30.000: 0.717,
                25.000: 0.725,
                20.000: 0.731,
                15.000: 0.738,
                10.000: 0.744,
                5.000: 0.75,
                0.000: 0.755
            };
67
68
69
70
            // màj pour jalhyd#146 : ajout de la cote de fond aux valeurs attendues
            for (const fk of Object.keys(f)) {
                f[fk] = f[fk] + rem.getCoteFond(Number(fk));
            }
71
            // compareObject("Yfluvial", res.getValue("flu"), f, 0.03);
72
            compareExtraResult("Yfluvial", res, "flu", f, 0.03);
73

74
            const t = {};
75
            // compareObject("Ytorrentiel", res.getValue("tor"), t, 0.03);
76
            compareExtraResult("Ytorrentiel", res, "tor", t, 0.03);
77

Mathias Chouet's avatar
Mathias Chouet committed
78
            // tslint:disable-next-line:max-line-length
79
            // const x = [0.000, 5.000, 10.000, 15.000, 20.000, 25.000, 30.000, 35.000, 40.000, 45.000, 50.000, 55.000, 60.000, 65.000, 70.000, 75.000, 80.000, 85.000, 90.000, 95.000, 100.000];
80
            // compareArray("abscisses", res.getValue("trX"), x);
81

82
            const expLog = new cLog();
83

84
            let m = new Message(MessageCode.INFO_REMOUS_H_CRITIQUE);
85
            m.extraVar.Yc = 0.403;
86
87
            expLog.add(m);

88
            m = new Message(MessageCode.INFO_REMOUS_H_NORMALE);
89
            m.extraVar.Yn = 0.953;
90
91
            expLog.add(m);

92
            expLog.add(new Message(MessageCode.INFO_REMOUS_CALCUL_FLUVIAL));
93

94
            expLog.add(new Message(MessageCode.INFO_REMOUS_CALCUL_TORRENTIEL));
95

96
            m = new Message(MessageCode.WARNING_REMOUS_ARRET_CRITIQUE);
97
            m.extraVar.x = 5;
98
99
            expLog.add(m);

100
            m = new Message(MessageCode.INFO_REMOUS_RESSAUT_DEHORS);
101
102
            m.extraVar.sens = "amont";
            m.extraVar.x = 0;
103
104
            expLog.add(m);

105
            compareLog(res.globalLog, expLog);
106
107
        });

108
109
        // désactivé suite au changement de format de résultat
        xit("faible pente, ressaut (1 point) à l'intérieur du bief", () => {
110
            const prms = new ParamsSectionRectang(undefined, // tirant d'eau
111
112
113
114
                2.5, // largeur de fond
                40, //  Ks=Strickler
                2, // Q=Débit
                0.001, // If=pente du fond
115
                1, // YB=hauteur de berge
116
            );
117
            SessionSettings.precision = precDist;
118

119
            const sect = new cSnRectang(prms);
120

121
            const prem = new CourbeRemousParams(100.25, 100.403, 100.1, 100,
122
123
                100,  // Long= Longueur du bief
                5,  // Dx=Pas d'espace
124
125
            );

126
            const rem = new CourbeRemous(sect, prem, MethodeResolution.Trapezes);
127

128
            const res = rem.calculRemous(undefined);
129
130
131

            // données de validation : version PHP (Oct 2017) méthode trapèzes

Mathias Chouet's avatar
Mathias Chouet committed
132
            // tslint:disable-next-line:max-line-length
133
            // let f = { 100.000: 0.403, 95.000: 0.524, 90.000: 0.558, 85.000: 0.584, 80.000: 0.604, 75.000: 0.621, 70.000: 0.637, 65.000: 0.65, 60.000: 0.662, 55.000: 0.673, 50.000: 0.684, 45.000: 0.693, 40.000: 0.701, 35.000: 0.709, 30.000: 0.717, 25.000: 0.725, 20.000: 0.731, 15.000: 0.738, 10.000: 0.744, 5.000: 0.75, 0.000: 0.15 };
134
            const f: any = {
Mathias Chouet's avatar
Mathias Chouet committed
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
                100.000: 0.403,
                95.000: 0.524,
                90.000: 0.558,
                85.000: 0.584,
                80.000: 0.604,
                75.000: 0.621,
                70.000: 0.637,
                65.000: 0.65,
                60.000: 0.662,
                55.000: 0.673,
                50.000: 0.684,
                45.000: 0.693,
                40.000: 0.701,
                35.000: 0.709,
                30.000: 0.717,
                25.000: 0.725,
                20.000: 0.731,
                15.000: 0.738,
                10.000: 0.744,
                5.000: 0.75
            };  // dernière valeur supprimée pour la raison en tête de fichier
156
157
158
159
            // màj pour jalhyd#146 : ajout de la cote de fond aux valeurs attendues
            for (const fk of Object.keys(f)) {
                f[fk] = f[fk] + rem.getCoteFond(Number(fk));
            }
160
            // compareObject("Yfluvial", res.getValue("flu"), f, 0.03);
161
            compareExtraResult("Yfluvial", res, "flu", f, 0.03);
162

163
            // let t = { 0.000: 0.15, 5.000: 0.75 };
164
            const t = { 0.000: 0.15 }; // dernière valeur supprimée pour la raison en tête de fichier
165
            // compareObject("Ytorrentiel", res.getValue("tor"), t, 0.03);
166
            compareExtraResult("Ytorrentiel", res, "tor", t, 0.03);
167

Mathias Chouet's avatar
Mathias Chouet committed
168
            // tslint:disable-next-line:max-line-length
169
            // const x = [0.000, 5.000, 10.000, 15.000, 20.000, 25.000, 30.000, 35.000, 40.000, 45.000, 50.000, 55.000, 60.000, 65.000, 70.000, 75.000, 80.000, 85.000, 90.000, 95.000, 100.000];
170
            // compareArray("abscisses", res.getValue("trX"), x);
171

172
            const expLog = new cLog();
173

174
            let m = new Message(MessageCode.INFO_REMOUS_H_CRITIQUE);
175
            m.extraVar.Yc = 0.403;
176
177
            expLog.add(m);

178
            m = new Message(MessageCode.INFO_REMOUS_H_NORMALE);
179
            m.extraVar.Yn = 0.953;
180
181
            expLog.add(m);

182
            expLog.add(new Message(MessageCode.INFO_REMOUS_CALCUL_FLUVIAL));
183

184
            expLog.add(new Message(MessageCode.INFO_REMOUS_CALCUL_TORRENTIEL));
185

186
            m = new Message(MessageCode.WARNING_REMOUS_ARRET_CRITIQUE);
187
            m.extraVar.x = 15;
188
189
            expLog.add(m);

190
            m = new Message(MessageCode.INFO_REMOUS_RESSAUT_HYDRO);
191
192
            m.extraVar.xmin = 0;
            m.extraVar.xmax = 5;
193
194
            expLog.add(m);

195
            compareLog(res.globalLog, expLog);
196
197
        });

Mathias Chouet's avatar
Mathias Chouet committed
198
199
        xit("faible pente, ressaut (plusieurs points) à l'intérieur du bief (1)", () => {
            // désactivé car échoue depuis les modifs apportées depuis la version PHP (calcul du ressaut hydraulique)
200
            const prms = new ParamsSectionRectang(undefined, // tirant d'eau
201
202
203
204
                2.5, // largeur de fond
                40, //  Ks=Strickler
                2, // Q=Débit
                0.001, // If=pente du fond
205
                1, // YB=hauteur de berge
206
            );
207
            SessionSettings.precision = precDist;
208

209
            const sect = new cSnRectang(prms);
210

211
            const prem = new CourbeRemousParams(100.015, 100.403, 100.005, 100,
212
213
                5,  // Long= Longueur du bief
                0.25,  // Dx=Pas d'espace
214
215
            );

216
            const rem = new CourbeRemous(sect, prem, MethodeResolution.Trapezes);
217

218
            const res = rem.calculRemous(undefined);
219
220
221
222

            // données de validation : version PHP (Oct 2017) méthode trapèzes

            // //dx = 0.05
Mathias Chouet's avatar
Mathias Chouet committed
223
            // tslint:disable-next-line:max-line-length
224
225
226
            // let f = { 5.000: 0.403, 4.950: 0.414, 4.900: 0.419, 4.850: 0.423, 4.800: 0.426, 4.750: 0.429, 4.700: 0.432, 4.650: 0.434, 4.600: 0.436, 4.550: 0.438, 4.500: 0.439, 4.450: 0.441, 4.400: 0.443, 4.350: 0.445, 4.300: 0.446, 4.250: 0.447, 4.200: 0.449, 4.150: 0.45, 4.100: 0.451, 4.050: 0.452, 4.000: 0.454, 3.950: 0.455, 3.900: 0.456, 3.850: 0.457, 3.800: 0.458, 3.750: 0.46, 3.700: 0.461, 3.650: 0.462, 3.600: 0.463, 3.550: 0.465, 3.500: 0.466, 3.450: 0.467, 3.400: 0.468, 3.350: 0.469, 3.300: 0.469, 3.250: 0.47, 3.200: 0.471, 3.150: 0.471, 3.100: 0.472, 3.050: 0.472, 3.000: 0.473, 2.950: 0.474, 2.900: 0.474, 2.850: 0.475, 2.800: 0.476, 2.750: 0.476, 2.700: 0.477, 2.650: 0.477, 2.600: 0.478, 2.550: 0.479, 2.500: 0.479, 2.450: 0.48, 2.400: 0.48, 2.350: 0.481, 2.300: 0.482, 2.250: 0.482, 2.200: 0.483, 2.150: 0.483, 2.100: 0.484, 2.050: 0.485, 2.000: 0.485, 1.950: 0.486, 1.900: 0.486, 1.850: 0.487, 1.800: 0.488, 1.750: 0.488, 1.700: 0.489, 1.650: 0.49, 1.600: 0.49, 1.550: 0.491, 1.500: 0.491, 1.450: 0.492, 1.400: 0.493, 1.350: 0.493, 1.300: 0.494, 1.250: 0.494, 1.200: 0.495, 1.150: 0.496, 1.100: 0.496, 1.050: 0.497, 1.000: 0.497, 0.950: 0.498, 0.900: 0.499, 0.850: 0.499, 0.800: 0.5, 0.750: 0.501, 0.700: 0.501, 0.650: 0.502, 0.600: 0.502, 0.550: 0.503, 0.500: 0.504, 0.450: 0.504, 0.400: 0.505, 0.350: 0.505, 0.300: 0.506, 0.250: 0.507, 0.200: 0.507, 0.150: 0.508, 0.100: 0.508, 0.050: 0.509, 0.000: 0.01 };
            // compareObject("Yfluvial", res["flu"], f, 0.03);

Mathias Chouet's avatar
Mathias Chouet committed
227
            // tslint:disable-next-line:max-line-length
228
            // //let t = { 0.000: 0.01, 0.050: 0.011, 0.100: 0.013, 0.150: 0.015, 0.200: 0.016, 0.250: 0.018, 0.300: 0.019, 0.350: 0.02, 0.400: 0.021, 0.450: 0.022, 0.500: 0.022, 0.550: 0.023, 0.600: 0.024, 0.650: 0.025, 0.700: 0.026, 0.750: 0.026, 0.800: 0.027, 0.850: 0.028, 0.900: 0.031750000000000014, 0.95: 0.5042500000000006 }; // ok
Mathias Chouet's avatar
Mathias Chouet committed
229
            // tslint:disable-next-line:max-line-length
230
231
232
            // let t = { 0.000: 0.01, 0.050: 0.011, 0.100: 0.013, 0.150: 0.015, 0.200: 0.016, 0.250: 0.018, 0.300: 0.019, 0.350: 0.02, 0.400: 0.021, 0.450: 0.022, 0.500: 0.022, 0.550: 0.023, 0.600: 0.024, 0.650: 0.025, 0.700: 0.026, 0.750: 0.026, 0.800: 0.027, 0.850: 0.028, 0.900: 0.499 };
            // compareObject("Ytorrentiel", res["tor"], t, 0.03);

Mathias Chouet's avatar
Mathias Chouet committed
233
            // tslint:disable-next-line:max-line-length
234
235
236
            // let x = [0.000, 0.050, 0.100, 0.150, 0.200, 0.250, 0.300, 0.350, 0.400, 0.450, 0.500, 0.550, 0.600, 0.650, 0.700, 0.750, 0.800, 0.850, 0.900, 0.950, 1.000, 1.050, 1.100, 1.150, 1.200, 1.250, 1.300, 1.350, 1.400, 1.450, 1.500, 1.550, 1.600, 1.650, 1.700, 1.750, 1.800, 1.850, 1.900, 1.950, 2.000, 2.050, 2.100, 2.150, 2.200, 2.250, 2.300, 2.350, 2.400, 2.450, 2.500, 2.550, 2.600, 2.650, 2.700, 2.750, 2.800, 2.850, 2.900, 2.950, 3.000, 3.050, 3.100, 3.150, 3.200, 3.250, 3.300, 3.350, 3.400, 3.450, 3.500, 3.550, 3.600, 3.650, 3.700, 3.750, 3.800, 3.850, 3.900, 3.950, 4.000, 4.050, 4.100, 4.150, 4.200, 4.250, 4.300, 4.350, 4.400, 4.450, 4.500, 4.550, 4.600, 4.650, 4.700, 4.750, 4.800, 4.850, 4.900, 4.950, 5.000];
            // compareArray("abscisses", res["trX"], x);

237
            // dx = 0.25
238
            const f: any = {
Mathias Chouet's avatar
Mathias Chouet committed
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
                5.000: 0.403,
                4.750: 0.43,
                4.500: 0.44,
                4.250: 0.448,
                4.000: 0.455,
                3.750: 0.46,
                3.500: 0.465,
                3.250: 0.47,
                3.000: 0.474,
                2.750: 0.479,
                2.500: 0.482,
                2.250: 0.486,
                2.000: 0.489,
                1.750: 0.492,
                1.500: 0.495,
                1.250: 0.498,
                1.000: 0.501,
                0.750: 0.504,
                0.500: 0.506,
                0.250: 0.508,
                0.000: 0.01
            };
261
262
263
264
            // màj pour jalhyd#146 : ajout de la cote de fond aux valeurs attendues
            for (const fk of Object.keys(f)) {
                f[fk] = f[fk] + rem.getCoteFond(Number(fk));
            }
265
            // compareObject("Yfluvial", res.getValue("flu"), f, 0.03);
266
            compareExtraResult("Yfluvial", res, "flu", f, 0.03);
267

268
            const t = { 0.000: 0.01, 0.250: 0.022, 0.500: 0.027, 0.750: 0.033, 1.000: 0.501 };
269
            // compareObject("Ytorrentiel", res.getValue("tor"), t, 0.03);
270
            compareExtraResult("Ytorrentiel", res, "tor", t, 0.03);
271

Mathias Chouet's avatar
Mathias Chouet committed
272
            // tslint:disable-next-line:max-line-length
273
            // const x = [0.000, 0.250, 0.500, 0.750, 1.000, 1.250, 1.500, 1.750, 2.000, 2.250, 2.500, 2.750, 3.000, 3.250, 3.500, 3.750, 4.000, 4.250, 4.500, 4.750, 5.000];
274
            // compareArray("abscisses", res.getValue("trX"), x);
275

276
            const expLog = new cLog();
277

278
            let m = new Message(MessageCode.INFO_REMOUS_H_CRITIQUE);
279
            m.extraVar.Yc = 0.403;
280
281
            expLog.add(m);

282
            m = new Message(MessageCode.INFO_REMOUS_H_NORMALE);
283
            m.extraVar.Yn = 0.953;
284
285
            expLog.add(m);

286
            expLog.add(new Message(MessageCode.INFO_REMOUS_CALCUL_FLUVIAL));
287

288
            expLog.add(new Message(MessageCode.INFO_REMOUS_CALCUL_TORRENTIEL));
289

290
            m = new Message(MessageCode.INFO_REMOUS_RESSAUT_HYDRO);
291
292
            m.extraVar.xmin = 0;
            m.extraVar.xmax = 1;
293
294
            expLog.add(m);

295
            compareLog(res.globalLog, expLog);
296
297
        });

Mathias Chouet's avatar
Mathias Chouet committed
298
299
        xit("faible pente, ressaut (plusieurs points) à l'intérieur du bief (2)", () => {
            // désactivé car échoue depuis les modifs apportées depuis la version PHP (calcul du ressaut hydraulique)
300
            const prms = new ParamsSectionRectang(undefined, // tirant d'eau
301
302
303
304
                2.5, // largeur de fond
                40, //  Ks=Strickler
                2, // Q=Débit
                0.001, // If=pente du fond
305
                1, // YB=hauteur de berge
306
            );
307
            SessionSettings.precision = precDist;
308

309
            const sect = new cSnRectang(prms);
310

311
            const prem = new CourbeRemousParams(100.015, 100.403, 100.005, 100,
312
313
                5,  // Long= Longueur du bief
                0.05,  // Dx=Pas d'espace
314
315
            );

316
            const rem = new CourbeRemous(sect, prem, MethodeResolution.Trapezes);
317

318
            const res = rem.calculRemous(undefined);
319
320
321

            // données de validation : version PHP (Oct 2017) méthode trapèzes

322
            const f: any = {
Mathias Chouet's avatar
Mathias Chouet committed
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
                5.0000: 0.403,
                4.9500: 0.415,
                4.9000: 0.42,
                4.8500: 0.423,
                4.8000: 0.426,
                4.7500: 0.429,
                4.7000: 0.432,
                4.6500: 0.434,
                4.6000: 0.436,
                4.5500: 0.438,
                4.5000: 0.44,
                4.4500: 0.441,
                4.4000: 0.443,
                4.3500: 0.445,
                4.3000: 0.446,
                4.2500: 0.448,
                4.2000: 0.449,
                4.1500: 0.45,
                4.1000: 0.452,
                4.0500: 0.453,
                4.0000: 0.454,
                3.9500: 0.455,
                3.9000: 0.457,
                3.8500: 0.458,
                3.8000: 0.459,
                3.7500: 0.46,
                3.7000: 0.461,
                3.6500: 0.462,
                3.6000: 0.463,
                3.5500: 0.464,
                3.5000: 0.465,
                3.4500: 0.466,
                3.4000: 0.467,
                3.3500: 0.468,
                3.3000: 0.469,
                3.2500: 0.47,
                3.2000: 0.471,
                3.1500: 0.471,
                3.1000: 0.472,
                3.0500: 0.473,
                3.0000: 0.474,
                2.9500: 0.475,
                2.9000: 0.476,
                2.8500: 0.476,
                2.8000: 0.477,
                2.7500: 0.478,
                2.7000: 0.479,
                2.6500: 0.479,
                2.6000: 0.48,
                2.5500: 0.481,
                2.5000: 0.482,
                2.4500: 0.482,
                2.4000: 0.483,
                2.3500: 0.484,
                2.3000: 0.484,
                2.2500: 0.485,
                2.2000: 0.486,
                2.1500: 0.487,
                2.1000: 0.487,
                2.0500: 0.488,
                2.0000: 0.489,
                1.9500: 0.489,
                1.9000: 0.49,
                1.8500: 0.49,
                1.8000: 0.491,
                1.7500: 0.492,
                1.7000: 0.492,
                1.6500: 0.493,
                1.6000: 0.494,
                1.5500: 0.494,
                1.5000: 0.495,
                1.4500: 0.495,
                1.4000: 0.496,
                1.3500: 0.497,
                1.3000: 0.497,
                1.2500: 0.498,
                1.2000: 0.498,
                1.1500: 0.499,
                1.1000: 0.499,
                1.0500: 0.5,
                1.0000: 0.5,
                0.9500: 0.501,
                0.9000: 0.502,
                0.8500: 0.502,
                0.8000: 0.503,
                0.7500: 0.503,
                0.7000: 0.504,
                0.6500: 0.504,
                0.6000: 0.505,
                0.5500: 0.505,
                0.5000: 0.506,
                0.4500: 0.506,
                0.4000: 0.507,
                0.3500: 0.507,
                0.3000: 0.508,
                0.2500: 0.508,
                0.2000: 0.509,
                0.1500: 0.509,
                0.1000: 0.51,
                0.0500: 0.51,
                0.0000: 0.01
            };
425
426
427
428
            // màj pour jalhyd#146 : ajout de la cote de fond aux valeurs attendues
            for (const fk of Object.keys(f)) {
                f[fk] = f[fk] + rem.getCoteFond(Number(fk));
            }
429
            // compareObject("Yfluvial", res.getValue("flu"), f, 0.03);
430
            compareExtraResult("Yfluvial", res, "flu", f, 0.03);
431

432
            const t: any = {
Mathias Chouet's avatar
Mathias Chouet committed
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
                0.0000: 0.01,
                0.0500: 0.011,
                0.1000: 0.013,
                0.1500: 0.014,
                0.2000: 0.015,
                0.2500: 0.017,
                0.3000: 0.018,
                0.3500: 0.019,
                0.4000: 0.02,
                0.4500: 0.021,
                0.5000: 0.022,
                0.5500: 0.024,
                0.6000: 0.025,
                0.6500: 0.026,
                0.7000: 0.027,
                0.7500: 0.028,
                0.8000: 0.029,
                0.8500: 0.03,
                0.9000: 0.502
            };
453
454
455
456
            // màj pour jalhyd#146 : ajout de la cote de fond aux valeurs attendues
            for (const tk of Object.keys(t)) {
                t[tk] = t[tk] + rem.getCoteFond(Number(tk));
            }
457
            // compareObject("Ytorrentiel", res.getValue("tor"), t, 0.03);
458
            compareExtraResult("Ytorrentiel", res, "tor", t, 0.03);
459

Mathias Chouet's avatar
Mathias Chouet committed
460
            // tslint:disable-next-line:max-line-length
461
            // const x = [0.0000, 0.0500, 0.1000, 0.1500, 0.2000, 0.2500, 0.3000, 0.3500, 0.4000, 0.4500, 0.5000, 0.5500, 0.6000, 0.6500, 0.7000, 0.7500, 0.8000, 0.8500, 0.9000, 0.9500, 1.0000, 1.0500, 1.1000, 1.1500, 1.2000, 1.2500, 1.3000, 1.3500, 1.4000, 1.4500, 1.5000, 1.5500, 1.6000, 1.6500, 1.7000, 1.7500, 1.8000, 1.8500, 1.9000, 1.9500, 2.0000, 2.0500, 2.1000, 2.1500, 2.2000, 2.2500, 2.3000, 2.3500, 2.4000, 2.4500, 2.5000, 2.5500, 2.6000, 2.6500, 2.7000, 2.7500, 2.8000, 2.8500, 2.9000, 2.9500, 3.0000, 3.0500, 3.1000, 3.1500, 3.2000, 3.2500, 3.3000, 3.3500, 3.4000, 3.4500, 3.5000, 3.5500, 3.6000, 3.6500, 3.7000, 3.7500, 3.8000, 3.8500, 3.9000, 3.9500, 4.0000, 4.0500, 4.1000, 4.1500, 4.2000, 4.2500, 4.3000, 4.3500, 4.4000, 4.4500, 4.5000, 4.5500, 4.6000, 4.6500, 4.7000, 4.7500, 4.8000, 4.8500, 4.9000, 4.9500, 5.0000];
462
            // compareArray("abscisses", res.getValue("trX"), x);
463

464
            const expLog = new cLog();
465

466
            let m = new Message(MessageCode.INFO_REMOUS_H_CRITIQUE);
467
            m.extraVar.Yc = 0.403;
468
469
            expLog.add(m);

470
            m = new Message(MessageCode.INFO_REMOUS_H_NORMALE);
471
            m.extraVar.Yn = 0.953;
472
473
            expLog.add(m);

474
            expLog.add(new Message(MessageCode.INFO_REMOUS_CALCUL_FLUVIAL));
475

476
            expLog.add(new Message(MessageCode.INFO_REMOUS_CALCUL_TORRENTIEL));
477

478
            m = new Message(MessageCode.INFO_REMOUS_RESSAUT_HYDRO);
479
480
            m.extraVar.xmin = 0;
            m.extraVar.xmax = 0.9;
481
482
            expLog.add(m);

483
            compareLog(res.globalLog, expLog);
484
485
486
487
        });
    });

    it("faible pente, pas de ressaut, Yamont > Yc, Yaval > Yn", () => {
488
        const prms = new ParamsSectionRectang(undefined, // tirant d'eau
489
490
491
492
            2.5, // largeur de fond
            40, //  Ks=Strickler
            2, // Q=Débit
            0.001, // If=pente du fond
493
            1, // YB=hauteur de berge
494
        );
495
        SessionSettings.precision = precDist;
496

497
        const sect = new cSnRectang(prms);
498

499
        const prem = new CourbeRemousParams(100.6, 101, 100.1, 100,
500
501
            100,  // Long= Longueur du bief
            5,  // Dx=Pas d'espace
502
503
        );

504
        const rem = new CourbeRemous(sect, prem, MethodeResolution.Trapezes);
505

506
        const res = rem.calculRemous(undefined);
507
508
509

        // données de validation : version PHP (Oct 2017) méthode trapèzes

510
        const f: any = {
Mathias Chouet's avatar
Mathias Chouet committed
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
            100.000: 1,
            95.000: 0.999,
            90.000: 0.999,
            85.000: 0.998,
            80.000: 0.997,
            75.000: 0.997,
            70.000: 0.996,
            65.000: 0.996,
            60.000: 0.995,
            55.000: 0.994,
            50.000: 0.994,
            45.000: 0.993,
            40.000: 0.992,
            35.000: 0.992,
            30.000: 0.991,
            25.000: 0.991,
            20.000: 0.99,
            15.000: 0.989,
            10.000: 0.989,
            5.000: 0.988,
            0.000: 0.988
        };
533
534
535
536
        // màj pour jalhyd#146 : ajout de la cote de fond aux valeurs attendues
        for (const fk of Object.keys(f)) {
            f[fk] = f[fk] + rem.getCoteFond(Number(fk));
        }
537
        // compareObject("Yfluvial", res.getValue("flu"), f, 0.03);
538
        compareExtraResult("Yfluvial", res, "flu", f, 0.03);
539

540
        expect(extraResultLength(res, "tor") === 0)
Mathias Chouet's avatar
Mathias Chouet committed
541
            .toBeTruthy("la ligne d'eau torrentielle ne devrait comporter aucune valeur");
542

Mathias Chouet's avatar
Mathias Chouet committed
543
        // tslint:disable-next-line:max-line-length
544
        // const x = [0.000, 5.000, 10.000, 15.000, 20.000, 25.000, 30.000, 35.000, 40.000, 45.000, 50.000, 55.000, 60.000, 65.000, 70.000, 75.000, 80.000, 85.000, 90.000, 95.000, 100.000];
545
        // compareArray("abscisses", res.getValue("trX"), x);
546

547
        const expLog = new cLog();
548

549
        let m = new Message(MessageCode.INFO_REMOUS_H_CRITIQUE);
550
        m.extraVar.Yc = 0.403;
551
552
        expLog.add(m);

553
        m = new Message(MessageCode.INFO_REMOUS_H_NORMALE);
554
        m.extraVar.Yn = 0.953;
555
556
        expLog.add(m);

Mathias Chouet's avatar
Mathias Chouet committed
557
        expLog.add(new Message(MessageCode.INFO_REMOUS_CALCUL_FLUVIAL));
558

559
560
        expLog.add(new Message(MessageCode.WARNING_REMOUS_PAS_CALCUL_DEPUIS_AMONT));

561
        compareLog(res.globalLog, expLog);
562
563
564
    });

    it("faible pente, pas de ressaut, Yamont > Yc, Yc < Yaval < Yn", () => {
565
        const prms = new ParamsSectionRectang(undefined, // tirant d'eau
566
567
568
569
            2.5, // largeur de fond
            40, //  Ks=Strickler
            2, // Q=Débit
            0.001, // If=pente du fond
570
            1, // YB=hauteur de berge
571
        );
572
        SessionSettings.precision = precDist;
573

574
        const sect = new cSnRectang(prms);
575

576
        const prem = new CourbeRemousParams(100.6, 100.7, 100.1, 100,
577
578
            100,  // Long= Longueur du bief
            5,  // Dx=Pas d'espace
579
580
        );

581
        const rem = new CourbeRemous(sect, prem, MethodeResolution.Trapezes);
582

583
        const res = rem.calculRemous(undefined);
584
585
586

        // données de validation : version PHP (Oct 2017) méthode trapèzes

587
        const f: any = {
Mathias Chouet's avatar
Mathias Chouet committed
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
            100.000: 0.7,
            95.000: 0.708,
            90.000: 0.716,
            85.000: 0.723,
            80.000: 0.73,
            75.000: 0.737,
            70.000: 0.743,
            65.000: 0.749,
            60.000: 0.754,
            55.000: 0.76,
            50.000: 0.765,
            45.000: 0.77,
            40.000: 0.775,
            35.000: 0.779,
            30.000: 0.783,
            25.000: 0.787,
            20.000: 0.792,
            15.000: 0.795,
            10.000: 0.799,
            5.000: 0.803,
            0.000: 0.806
        };
610
611
612
613
        // màj pour jalhyd#146 : ajout de la cote de fond aux valeurs attendues
        for (const fk of Object.keys(f)) {
            f[fk] = f[fk] + rem.getCoteFond(Number(fk));
        }
614
        // compareObject("Yfluvial", res.getValue("flu"), f, 0.03);
615
        compareExtraResult("Yfluvial", res, "flu", f, 0.03);
616

617
        expect(extraResultLength(res, "tor") === 0)
Mathias Chouet's avatar
Mathias Chouet committed
618
            .toBeTruthy("la ligne d'eau torrentielle ne devrait comporter aucune valeur");
619

Mathias Chouet's avatar
Mathias Chouet committed
620
        // tslint:disable-next-line:max-line-length
621
        // const x = [0.000, 5.000, 10.000, 15.000, 20.000, 25.000, 30.000, 35.000, 40.000, 45.000, 50.000, 55.000, 60.000, 65.000, 70.000, 75.000, 80.000, 85.000, 90.000, 95.000, 100.000];
622
        // compareArray("abscisses", res.getValue("trX"), x);
623

624
        const expLog = new cLog();
625

626
        let m = new Message(MessageCode.INFO_REMOUS_H_CRITIQUE);
627
        m.extraVar.Yc = 0.403;
628
629
        expLog.add(m);

630
        m = new Message(MessageCode.INFO_REMOUS_H_NORMALE);
631
        m.extraVar.Yn = 0.953;
632
633
        expLog.add(m);

Mathias Chouet's avatar
Mathias Chouet committed
634
        expLog.add(new Message(MessageCode.INFO_REMOUS_CALCUL_FLUVIAL));
635

636
637
        expLog.add(new Message(MessageCode.WARNING_REMOUS_PAS_CALCUL_DEPUIS_AMONT));

638
        compareLog(res.globalLog, expLog);
639
    });
640

641
    it("faible pente, pas de fluvial, torrentiel tronqué, calcul Hs", () => {
642
        const prms = new ParamsSectionRectang(undefined, // tirant d'eau
643
644
645
646
            2.5, // largeur de fond
            40, //  Ks=Strickler
            2, // Q=Débit
            0.001, // If=pente du fond
647
            1, // YB=hauteur de berge
648
        );
649
        SessionSettings.precision = precDist;
650

651
        const sect = new cSnRectang(prms);
652

653
        const prem = new CourbeRemousParams(100.25, 100.4, 100.1, 100,
654
655
656
657
            100,  // Long= Longueur du bief
            5,  // Dx=Pas d'espace
        );

658
        const rem = new CourbeRemous(sect, prem, MethodeResolution.Trapezes);
659

660
        const res = rem.calculRemous("Hs");
661
662
663

        // données de validation : version PHP (Oct 2017) méthode trapèzes

664
        expect(extraResultLength(res, "flu") === 0)
Mathias Chouet's avatar
Mathias Chouet committed
665
            .toBeTruthy("la ligne d'eau fluviale ne devrait comporter aucune valeur");
666

667
668
669
670
671
        const t: any = { 0.000: 0.15, 5.000: 0.239, 10.000: 0.34 };
        // màj pour jalhyd#146 : ajout de la cote de fond aux valeurs attendues
        for (const tk of Object.keys(t)) {
            t[tk] = t[tk] + rem.getCoteFond(Number(tk));
        }
672
        // compareObject("Ytorrentiel", res.getValue("tor"), t, 0.008);
673
        compareExtraResult("Ytorrentiel", res, "tor", t, 0.008);
674

675
        // const x = [0.000, 5.000, 10.000];
676
        // compareArray("abscisses", res.getValue("trX"), x);
677

678
        const extraHS: any = { 0.000: 101.7, 5.000: 100.903, 10.000: 100.708 };
679
        // compareObject("extra (Hs)", res.getValue("Hs"), extraHS, 0.001);
680
        compareExtraResult("extra (Hs)", res, "Hs", extraHS, 0.001);
681

682
        const expLog = new cLog();
683

684
        let m = new Message(MessageCode.INFO_REMOUS_H_CRITIQUE);
685
        m.extraVar.Yc = 0.403;
686
687
        expLog.add(m);

688
        m = new Message(MessageCode.INFO_REMOUS_H_NORMALE);
689
        m.extraVar.Yn = 0.953;
690
691
        expLog.add(m);

Mathias Chouet's avatar
Mathias Chouet committed
692
        expLog.add(new Message(MessageCode.WARNING_REMOUS_PAS_CALCUL_DEPUIS_AVAL));
693

694
        expLog.add(new Message(MessageCode.INFO_REMOUS_CALCUL_TORRENTIEL));
695

696
        m = new Message(MessageCode.WARNING_REMOUS_ARRET_CRITIQUE);
697
        m.extraVar.x = 15;
698
699
        expLog.add(m);

700
        compareLog(res.globalLog, expLog);
701
    });
702
});