From 7eb16ddcf02359dcbb4336a81fc16143ef58b50d Mon Sep 17 00:00:00 2001 From: "francois.grand" <francois.grand@irstea.fr> Date: Tue, 20 Jun 2017 11:48:43 +0200 Subject: [PATCH] - correction de valeurs de certains tests unitaires --- spec/regime_uniforme_rect.spec.ts | 21 +++-- spec/regime_uniforme_trapeze.spec.ts | 28 +++---- spec/section_param_circ_fluvial.spec.ts | 88 ++++++++++----------- spec/section_param_circ_torrentiel.spec.ts | 50 ++++++------ spec/section_param_puiss_fluvial.spec.ts | 88 ++++++++++----------- spec/section_param_puiss_torrentiel.spec.ts | 74 ++++++++--------- spec/section_param_rect_fluvial.spec.ts | 52 ++++++------ spec/section_param_trapez_fluvial.spec.ts | 56 ++++++------- src/section/section_trapez.ts | 9 ++- src/section/section_type.ts | 14 ++-- 10 files changed, 239 insertions(+), 241 deletions(-) diff --git a/spec/regime_uniforme_rect.spec.ts b/spec/regime_uniforme_rect.spec.ts index a442e6fa..d1fe6496 100644 --- a/spec/regime_uniforme_rect.spec.ts +++ b/spec/regime_uniforme_rect.spec.ts @@ -5,7 +5,7 @@ import { RegimeUniforme } from "../src/regime_uniforme"; import { ParamsSectionRectang, cSnRectang } from "../src/section/section_rectang"; import { precDigits, precDist } from "./nubtest"; -xdescribe('Class RegimeUniforme / section rectangulaire :', () => { +describe('Class RegimeUniforme / section rectangulaire :', () => { describe('pas de débordement : ', () => { /** * test de la largeur de fond (= largeur de berge pour le rectangulaire) @@ -20,7 +20,6 @@ xdescribe('Class RegimeUniforme / section rectangulaire :', () => { 1 // YB=hauteur de berge // YCL=Condition limite en cote à l'amont ou à l'aval ); - let sect = new cSnRectang(undefined, prms, false); let ru = new RegimeUniforme(sect, false); @@ -123,7 +122,7 @@ xdescribe('Class RegimeUniforme / section rectangulaire :', () => { let prms = new ParamsSectionRectang(2, // tirant d'eau undefined, // largeur de fond 40, // Ks=Strickler - 1.568, // Q=Débit + 5.31, // Q=Débit 0.001, // If=pente du fond precDist, // précision 1 // YB=hauteur de berge @@ -136,7 +135,7 @@ xdescribe('Class RegimeUniforme / section rectangulaire :', () => { expect(ru.Calc("LargeurBerge").vCalc).toBeCloseTo(2.5, precDigits); }); - it('Strickler should be 30.618', () => { + it('Strickler should be 9.04', () => { let prms = new ParamsSectionRectang(2, // tirant d'eau 2.5, // largeur de fond undefined, // Ks=Strickler @@ -150,14 +149,14 @@ xdescribe('Class RegimeUniforme / section rectangulaire :', () => { let sect = new cSnRectang(undefined, prms); let ru = new RegimeUniforme(sect); - expect(ru.Calc("Ks", 1e-8).vCalc).toBeCloseTo(30.618, precDigits); + expect(ru.Calc("Ks", 1e-8).vCalc).toBeCloseTo(9.04, precDigits); }); it('If should be 0.001', () => { let prms = new ParamsSectionRectang(2, // tirant d'eau 2.5, // largeur de fond - 40, // Ks=Strickler - 1.568, // Q=Débit + 9.04, // Ks=Strickler + 1.2, // Q=Débit undefined, // If=pente du fond precDist, // précision 1 // YB=hauteur de berge @@ -171,7 +170,7 @@ xdescribe('Class RegimeUniforme / section rectangulaire :', () => { expect(ru.Calc("If", 0, precDist).vCalc).toBeCloseTo(0.001, precDigits); }); - it('Q should be 1.568', () => { + it('Q should be 5.31', () => { let prms = new ParamsSectionRectang(2, // tirant d'eau 2.5, // largeur de fond 40, // Ks=Strickler @@ -185,10 +184,10 @@ xdescribe('Class RegimeUniforme / section rectangulaire :', () => { let sect = new cSnRectang(undefined, prms); let ru = new RegimeUniforme(sect); - expect(ru.Calc("Q").vCalc).toBeCloseTo(1.568, precDigits); + expect(ru.Calc("Q").vCalc).toBeCloseTo(5.31, precDigits); }); - it('Q should be 0.731', () => { + it('Q should be 1.624', () => { let prms = new ParamsSectionRectang(2, // tirant d'eau 3, // largeur de fond 30, // Ks=Strickler @@ -202,7 +201,7 @@ xdescribe('Class RegimeUniforme / section rectangulaire :', () => { let sect = new cSnRectang(undefined, prms); let ru = new RegimeUniforme(sect); - expect(ru.Calc("Q").vCalc).toBeCloseTo(0.731, precDigits); + expect(ru.Calc("Q").vCalc).toBeCloseTo(1.624, precDigits); }); it('Y should be 0.663', () => { diff --git a/spec/regime_uniforme_trapeze.spec.ts b/spec/regime_uniforme_trapeze.spec.ts index c5bca80e..3795359d 100644 --- a/spec/regime_uniforme_trapeze.spec.ts +++ b/spec/regime_uniforme_trapeze.spec.ts @@ -5,7 +5,7 @@ import { RegimeUniforme } from "../src/regime_uniforme"; import { ParamsSectionTrapez, cSnTrapez } from "../src/section/section_trapez"; import { precDigits, precDist } from "./nubtest"; -xdescribe('Class RegimeUniforme / section trapèze :', () => { +describe('Class RegimeUniforme / section trapèze :', () => { describe('pas de débordement :', () => { it('LargeurFond should be 2.5', () => { let prms = new ParamsSectionTrapez(undefined, // largeur de fond @@ -118,27 +118,25 @@ xdescribe('Class RegimeUniforme / section trapèze :', () => { }); describe('débordement :', () => { - it('LargeurFond should be 2.5', () => { + it('LargeurFond should be 0.03', () => { let prms = new ParamsSectionTrapez(undefined, // largeur de fond 0.56, // fruit 2, // tirant d'eau 40, // Ks=Strickler - 1.988428, // Q=Débit + 1.2, // Q=Débit 0.001, // If=pente du fond precDist, // précision 1 // YB= hauteur de berge // YCL=Condition limite en cote à l'amont ou à l'aval ); - let sect = new cSnTrapez(undefined, prms); - let ru = new RegimeUniforme(sect, false); - expect(ru.Calc("LargeurFond", 0, precDist).vCalc).toBeCloseTo(2.5, precDigits); + expect(ru.Calc("LargeurFond", 0, precDist).vCalc).toBeCloseTo(0.03, precDigits); }); it('Fruit should be 0.56', () => { - let prms = new ParamsSectionTrapez(2.5, // largeur de fond + let prms = new ParamsSectionTrapez(0.03, // largeur de fond undefined, // fruit 2, // tirant d'eau 40, // Ks=Strickler @@ -155,7 +153,7 @@ xdescribe('Class RegimeUniforme / section trapèze :', () => { expect(ru.Calc("Fruit").vCalc).toBeCloseTo(0.56, precDigits); }); - it('Ks should be 24.14', () => { + it('Ks should be 5.744', () => { let prms = new ParamsSectionTrapez(2.5, // largeur de fond 0.56, // fruit 2, // tirant d'eau @@ -166,11 +164,10 @@ xdescribe('Class RegimeUniforme / section trapèze :', () => { 1 // YB= hauteur de berge // YCL=Condition limite en cote à l'amont ou à l'aval ); - let sect = new cSnTrapez(undefined, prms); let ru = new RegimeUniforme(sect); - expect(ru.Calc("Ks", 1e-8).vCalc).toBeCloseTo(24.14, precDigits); + expect(ru.Calc("Ks", 1e-8).vCalc).toBeCloseTo(5.744, precDigits); }); it('If should be 0.001', () => { @@ -178,25 +175,24 @@ xdescribe('Class RegimeUniforme / section trapèze :', () => { 0.56, // fruit 2, // tirant d'eau 40, // Ks=Strickler - 1.2, // Q=Débit + 8.356, // Q=Débit undefined, // If=pente du fond precDist, // précision 1 // YB= hauteur de berge // YCL=Condition limite en cote à l'amont ou à l'aval ); - let sect = new cSnTrapez(undefined, prms); let ru = new RegimeUniforme(sect); expect(ru.Calc("If").vCalc).toBeCloseTo(0.001, precDigits); }); - it('Q should be 1.2', () => { + it('Q should be 8.356', () => { let prms = new ParamsSectionTrapez(2.5, // largeur de fond 0.56, // fruit 2, // tirant d'eau 40, // Ks=Strickler - 0, // Q=Débit + undefined, // Q=Débit 0.001, // If=pente du fond precDist, // précision 1 // YB= hauteur de berge @@ -206,7 +202,7 @@ xdescribe('Class RegimeUniforme / section trapèze :', () => { let sect = new cSnTrapez(undefined, prms); let ru = new RegimeUniforme(sect); - expect(ru.Calc("Q").vCalc).toBeCloseTo(1.2, precDigits); + expect(ru.Calc("Q").vCalc).toBeCloseTo(8.356, precDigits); }); it('Y should be 0.587', () => { @@ -217,7 +213,7 @@ xdescribe('Class RegimeUniforme / section trapèze :', () => { 1.2, // Q=Débit 0.001, // If=pente du fond precDist, // précision - 0.1 // YB= hauteur de berge + 1 // YB= hauteur de berge // YCL=Condition limite en cote à l'amont ou à l'aval ); diff --git a/spec/section_param_circ_fluvial.spec.ts b/spec/section_param_circ_fluvial.spec.ts index e3577187..521651e7 100644 --- a/spec/section_param_circ_fluvial.spec.ts +++ b/spec/section_param_circ_fluvial.spec.ts @@ -35,7 +35,7 @@ function createSectionDebordement(prec: number): cSnCirc { return new cSnCirc(undefined, paramSection); } -xdescribe('Section paramétrée circulaire : ', () => { +describe('Section paramétrée circulaire : ', () => { beforeEach(() => { sect = createSection(precDist); }); @@ -53,12 +53,12 @@ xdescribe('Section paramétrée circulaire : ', () => { // largeur au miroir it('B should equal to 1.959', () => { - expect(sect.Calc_B()).toBeCloseTo(1.959, precDigits); + expect(sect.Calc_B()).toBeCloseTo(1.959, 2); }); // périmètre mouillé it('P should equal to 2.738', () => { - expect(sect.Calc_P()).toBeCloseTo(2.738, precDigits); + expect(sect.Calc_P()).toBeCloseTo(2.738, 2); }); // surface mouillée @@ -72,13 +72,13 @@ xdescribe('Section paramétrée circulaire : ', () => { }); // vitesse moyenne - it('V should equal to 1.022', () => { - expect(sect.Calc_V()).toBeCloseTo(1.022, precDigits); + it('V should equal to 1.023', () => { + expect(sect.Calc_V()).toBeCloseTo(1.023, precDigits); }); // nombre de Froude - it('Fr should equal to 0.421', () => { - expect(sect.Calc_Fr()).toBeCloseTo(0.421, precDigits); + it('Fr should equal to 0.422', () => { + expect(sect.Calc_Fr()).toBeCloseTo(0.422, precDigits); }); // tirant d'eau critique @@ -87,8 +87,8 @@ xdescribe('Section paramétrée circulaire : ', () => { }); // tirant d'eau normal - it('Yn should equal to 0.975', () => { - expect(sect.Calc_Yn()).toBeCloseTo(0.975, precDigits); + it('Yn should equal to 0.976', () => { + expect(sect.Calc_Yn()).toBeCloseTo(0.976, precDigits); }); // tirant d'eau fluvial @@ -119,27 +119,27 @@ xdescribe('Section paramétrée circulaire : ', () => { }); // impulsion hydraulique - it('Imp should equal to xx', () => { - expect(sect.Calc_Imp()).toBeCloseTo(-1, precDigits); + it('Imp should equal to 5076.304', () => { + expect(sect.Calc_Imp()).toBeCloseTo(5076.304, precDigits); }); // force tractrice (contrainte de cisaillement) - it('Tau0 should equal to 8.504', () => { - expect(sect.Calc_Tau0()).toBeCloseTo(8.504, precDigits); + it('Tau0 should equal to 8.505', () => { + expect(sect.Calc_Tau0()).toBeCloseTo(8.505, precDigits); }); }); }); -xdescribe('Section paramétrée circulaire : ', () => { +describe('Section paramétrée circulaire : ', () => { beforeEach(() => { sect = createSectionDebordement(precDist); }); describe('fluvial / débordement :', () => { // charge spécifique - it('Hs should equal to 2.007', () => { - expect(sect.Calc_Hs()).toBeCloseTo(2.007, precDigits); + it('Hs should equal to 2.006', () => { + expect(sect.Calc_Hs()).toBeCloseTo(2.006, precDigits); }); // charge critique @@ -148,33 +148,33 @@ xdescribe('Section paramétrée circulaire : ', () => { }); // largeur au miroir - it('B should equal to 0', () => { - expect(sect.Calc_B()).toBeCloseTo(0, precDigits); + it('B should equal to 2', () => { + expect(sect.Calc_B()).toBeCloseTo(2, precDigits); }); // périmètre mouillé - it('P should equal to 6.283', () => { - expect(sect.Calc_P()).toBeCloseTo(6.283, precDigits); + it('P should equal to 5.142', () => { + expect(sect.Calc_P()).toBeCloseTo(5.142, precDigits); }); // surface mouillée - it('S should equal to 3.141', () => { - expect(sect.Calc_S()).toBeCloseTo(3.141, precDigits); + it('S should equal to 3.571', () => { + expect(sect.Calc_S()).toBeCloseTo(3.571, precDigits); }); // rayon hydraulique - it('R should equal to 0.5', () => { - expect(sect.Calc_R()).toBeCloseTo(0.5, precDigits); + it('R should equal to 0.694', () => { + expect(sect.Calc_R()).toBeCloseTo(0.694, precDigits); }); // vitesse moyenne - it('V should equal to 0.382', () => { - expect(sect.Calc_V()).toBeCloseTo(0.382, precDigits); + it('V should equal to 0.336', () => { + expect(sect.Calc_V()).toBeCloseTo(0.336, precDigits); }); // nombre de Froude - it('Fr should equal to 0', () => { - expect(sect.Calc_Fr()).toBeCloseTo(0, precDigits); + it('Fr should equal to 0.08', () => { + expect(sect.Calc_Fr()).toBeCloseTo(0.08, precDigits); }); // tirant d'eau critique @@ -183,13 +183,13 @@ xdescribe('Section paramétrée circulaire : ', () => { }); // tirant d'eau normal - it('Yn should equal to 0.975', () => { - expect(sect.Calc_Yn()).toBeCloseTo(0.975, precDigits); + it('Yn should equal to 0.976', () => { + expect(sect.Calc_Yn()).toBeCloseTo(0.976, precDigits); }); // tirant d'eau fluvial - it('Yf should equal to 1.999', () => { - expect(sect.Calc_Yf()).toBeCloseTo(1.999, precDigits); + it('Yf should equal to 2', () => { + expect(sect.Calc_Yf()).toBeCloseTo(2, precDigits); }); // tirant d'eau torrentiel @@ -198,30 +198,30 @@ xdescribe('Section paramétrée circulaire : ', () => { }); // tirant d'eau conjugué - it('Yco should equal to 0.084', () => { - expect(sect.Calc_Yco()).toBeCloseTo(0.084, precDigits); + it('Yco should equal to 0.24', () => { + expect(sect.Calc_Yco()).toBeCloseTo(0.24, precDigits); }); // perte de charge - it('J should equal to 0.0002', () => { - sect = createSection(0.00001); - expect(sect.Calc_J()).toBeCloseTo(0.0002, precDigits); + it('J should equal to 0.0001', () => { + sect = createSectionDebordement(0.00001); + expect(sect.Calc_J()).toBeCloseTo(0.0001, precDigits); }); // Variation linéaire de l'énergie spécifique - it('I-J should equal to 0.00077', () => { - sect = createSection(0.00001); - expect(sect.Calc("I-J")).toBeCloseTo(0.00077, precDigits); + it('I-J should equal to 0.001', () => { + sect = createSectionDebordement(0.00001); + expect(sect.Calc("I-J")).toBeCloseTo(0.001, precDigits); }); // impulsion hydraulique - it('Imp should equal to xx', () => { - expect(sect.Calc_Imp()).toBeCloseTo(-1, precDigits); + it('Imp should equal to 6943.271', () => { + expect(sect.Calc_Imp()).toBeCloseTo(6943.271, precDigits); }); // force tractrice (contrainte de cisaillement) - it('Tau0 should equal to 1.127', () => { - expect(sect.Calc_Tau0()).toBeCloseTo(1.127, precDigits); + it('Tau0 should equal to 0.782', () => { + expect(sect.Calc_Tau0()).toBeCloseTo(0.782, precDigits); }); }); }); diff --git a/spec/section_param_circ_torrentiel.spec.ts b/spec/section_param_circ_torrentiel.spec.ts index 8e7b8387..f98fa9c4 100644 --- a/spec/section_param_circ_torrentiel.spec.ts +++ b/spec/section_param_circ_torrentiel.spec.ts @@ -21,7 +21,7 @@ function createSection(prec: number): cSnCirc { return new cSnCirc(undefined, paramSection); } -xdescribe('Section paramétrée circulaire : ', () => { +describe('Section paramétrée circulaire : ', () => { beforeEach(() => { sect = createSection(precDist); }); @@ -33,18 +33,18 @@ xdescribe('Section paramétrée circulaire : ', () => { }); // charge critique - it('Hsc should equal to 2.296', () => { - expect(sect.Calc_Hsc()).toBeCloseTo(2.296, precDigits); + it('Hsc should equal to 2.263', () => { + expect(sect.Calc_Hsc()).toBeCloseTo(2.263, precDigits); }); // largeur au miroir - it('B should equal to 1.959', () => { - expect(sect.Calc_B()).toBeCloseTo(1.959, precDigits); + it('B should equal to 1.960', () => { + expect(sect.Calc_B()).toBeCloseTo(1.960, precDigits); }); // périmètre mouillé - it('P should equal to 2.738', () => { - expect(sect.Calc_P()).toBeCloseTo(2.738, precDigits); + it('P should equal to 2.739', () => { + expect(sect.Calc_P()).toBeCloseTo(2.739, precDigits); }); // surface mouillée @@ -58,28 +58,28 @@ xdescribe('Section paramétrée circulaire : ', () => { }); // vitesse moyenne - it('V should equal to 8.521', () => { - expect(sect.Calc_V()).toBeCloseTo(8.521, precDigits); + it('V should equal to 8.522', () => { + expect(sect.Calc_V()).toBeCloseTo(8.522, precDigits); }); // nombre de Froude - it('Fr should equal to 3.515', () => { - expect(sect.Calc_Fr()).toBeCloseTo(3.515, precDigits); + it('Fr should equal to 3.516', () => { + expect(sect.Calc_Fr()).toBeCloseTo(3.516, precDigits); }); // tirant d'eau critique - it('Yc should equal to 1.533', () => { - expect(sect.Calc_Yc()).toBeCloseTo(1.533, precDigits); + it('Yc should equal to 1.581', () => { + expect(sect.Calc_Yc()).toBeCloseTo(1.581, precDigits); }); // tirant d'eau normal - it('Yn should equal to xxx', () => { - expect(sect.Calc_Yn()).toBeCloseTo(-1, precDigits); + it('Yn should equal to 4.624', () => { + expect(sect.Calc_Yn()).toBeCloseTo(4.624, precDigits); }); // tirant d'eau fluvial - it('Yf should equal to 1.999', () => { - expect(sect.Calc_Yf()).toBeCloseTo(1.999, precDigits); + it('Yf should equal to 4.43', () => { + expect(sect.Calc_Yf()).toBeCloseTo(4.43, precDigits); }); // tirant d'eau torrentiel @@ -88,25 +88,25 @@ xdescribe('Section paramétrée circulaire : ', () => { }); // tirant d'eau conjugué - it('Yco should equal to 99.999', () => { - expect(sect.Calc_Yco()).toBeCloseTo(99.999, precDigits); + it('Yco should equal to 0.8', () => { + expect(sect.Calc_Yco()).toBeCloseTo(0.8, precDigits); }); // perte de charge - it('J should equal to 0.14', () => { + it('J should equal to 0.141', () => { //sect = createSection(0.00001); - expect(sect.Calc_J()).toBeCloseTo(0.14, precDigits); + expect(sect.Calc_J()).toBeCloseTo(0.141, precDigits); }); // Variation linéaire de l'énergie spécifique - it('I-J should equal to -0.139', () => { + it('I-J should equal to -0.14', () => { //sect = createSection(0.00001); - expect(sect.Calc("I-J")).toBeCloseTo(-0.139, precDigits); + expect(sect.Calc("I-J")).toBeCloseTo(-0.14, precDigits); }); // impulsion hydraulique - it('Imp should equal to xxx', () => { - expect(sect.Calc_Imp()).toBeCloseTo(-1, precDigits); + it('Imp should equal to 89065.861', () => { + expect(sect.Calc_Imp()).toBeCloseTo(89065.861, precDigits); }); // force tractrice (contrainte de cisaillement) diff --git a/spec/section_param_puiss_fluvial.spec.ts b/spec/section_param_puiss_fluvial.spec.ts index c5b08401..ead8d5fe 100644 --- a/spec/section_param_puiss_fluvial.spec.ts +++ b/spec/section_param_puiss_fluvial.spec.ts @@ -37,7 +37,7 @@ function createSectionDebordement(prec: number): cSnPuiss { return new cSnPuiss(undefined, paramSection); } -xdescribe('Section paramétrée puissance :', () => { +describe('Section paramétrée puissance :', () => { beforeEach(() => { sect = createSection(precDist); }); @@ -54,13 +54,13 @@ xdescribe('Section paramétrée puissance :', () => { }); // largeur au miroir - it('B should equal to 3.577', () => { - expect(sect.Calc_B()).toBeCloseTo(3.577, precDigits); + it('B should equal to 3.578', () => { + expect(sect.Calc_B()).toBeCloseTo(3.578, precDigits); }); // périmètre mouillé - it('P should equal to 4.009', () => { - expect(sect.Calc_P()).toBeCloseTo(4.009, precDigits); + it('P should equal to 4.223', () => { + expect(sect.Calc_P()).toBeCloseTo(4.223, precDigits); }); // surface mouillée @@ -69,8 +69,8 @@ xdescribe('Section paramétrée puissance :', () => { }); // rayon hydraulique - it('R should equal to 0.476', () => { - expect(sect.Calc_R()).toBeCloseTo(0.476, precDigits); + it('R should equal to 0.452', () => { + expect(sect.Calc_R()).toBeCloseTo(0.452, precDigits); }); // vitesse moyenne @@ -89,8 +89,8 @@ xdescribe('Section paramétrée puissance :', () => { }); // tirant d'eau normal - it('Yn should equal to 0.726', () => { - expect(sect.Calc_Yn()).toBeCloseTo(0.726, precDigits); + it('Yn should equal to 0.742', () => { + expect(sect.Calc_Yn()).toBeCloseTo(0.742, precDigits); }); // tirant d'eau fluvial @@ -121,87 +121,87 @@ xdescribe('Section paramétrée puissance :', () => { }); // impulsion hydraulique - it('Imp should equal to xx', () => { - expect(sect.Calc_Imp()).toBeCloseTo(-1, precDigits); + it('Imp should equal to 6744.616', () => { + expect(sect.Calc_Imp()).toBeCloseTo(6744.616, precDigits); }); // force tractrice (contrainte de cisaillement) - it('Tau0 should equal to 3.105', () => { - expect(sect.Calc_Tau0()).toBeCloseTo(3.105, precDigits); + it('Tau0 should equal to 3.16', () => { + expect(sect.Calc_Tau0()).toBeCloseTo(3.16, precDigits); }); }); }); -xdescribe('Section paramétrée puissance :', () => { +describe('Section paramétrée puissance :', () => { beforeEach(() => { sect = createSectionDebordement(precDist); }); describe('fluvial / débordement :', () => { // charge spécifique - it('Hs should equal to 0.818', () => { - expect(sect.Calc_Hs()).toBeCloseTo(0.818, precDigits); + it('Hs should equal to 2.001', () => { + expect(sect.Calc_Hs()).toBeCloseTo(2.001, precDigits); }); // charge critique - it('Hsc should equal to 0.43', () => { - expect(sect.Calc_Hsc()).toBeCloseTo(0.43, precDigits); + it('Hsc should equal to 0.559', () => { + expect(sect.Calc_Hsc()).toBeCloseTo(0.559, precDigits); }); // largeur au miroir - it('B should equal to 2.5', () => { - expect(sect.Calc_B()).toBeCloseTo(2.5, precDigits); + it('B should equal to 4', () => { + expect(sect.Calc_B()).toBeCloseTo(4, precDigits); }); // périmètre mouillé - it('P should equal to 4.1', () => { - expect(sect.Calc_P()).toBeCloseTo(4.1, precDigits); + it('P should equal to 6.098', () => { + expect(sect.Calc_P()).toBeCloseTo(6.098, precDigits); }); // surface mouillée - it('S should equal to 2', () => { - expect(sect.Calc_S()).toBeCloseTo(2, precDigits); + it('S should equal to 7.542', () => { + expect(sect.Calc_S()).toBeCloseTo(7.542, precDigits); }); // rayon hydraulique - it('R should equal to 0.488', () => { - expect(sect.Calc_R()).toBeCloseTo(0.488, precDigits); + it('R should equal to 1.237', () => { + expect(sect.Calc_R()).toBeCloseTo(1.237, precDigits); }); // vitesse moyenne - it('V should equal to 0.6', () => { - expect(sect.Calc_V()).toBeCloseTo(0.6, precDigits); + it('V should equal to 0.159', () => { + expect(sect.Calc_V()).toBeCloseTo(0.159, precDigits); }); // nombre de Froude - it('Fr should equal to 0.214', () => { - expect(sect.Calc_Fr()).toBeCloseTo(0.214, precDigits); + it('Fr should equal to 0.037', () => { + expect(sect.Calc_Fr()).toBeCloseTo(0.037, precDigits); }); // tirant d'eau critique - it('Yc should equal to 0.286', () => { - expect(sect.Calc_Yc()).toBeCloseTo(0.286, precDigits); + it('Yc should equal to 0.419', () => { + expect(sect.Calc_Yc()).toBeCloseTo(0.419, precDigits); }); // tirant d'eau normal - it('Yn should equal to 0.663', () => { - expect(sect.Calc_Yn()).toBeCloseTo(0.663, precDigits); + it('Yn should equal to 0.742', () => { + expect(sect.Calc_Yn()).toBeCloseTo(0.742, precDigits); }); // tirant d'eau fluvial - it('Yf should equal to 0.8', () => { - expect(sect.Calc_Yf()).toBeCloseTo(0.8, precDigits); + it('Yf should equal to 2', () => { + expect(sect.Calc_Yf()).toBeCloseTo(2, precDigits); }); // tirant d'eau torrentiel - it('Yt should equal to 0.131', () => { - expect(sect.Calc_Yt()).toBeCloseTo(0.131, precDigits); + it('Yt should equal to 0.178', () => { + expect(sect.Calc_Yt()).toBeCloseTo(0.178, precDigits); }); // tirant d'eau conjugué - it('Yco should equal to 0.068', () => { - expect(sect.Calc_Yco()).toBeCloseTo(0.068, precDigits); + it('Yco should equal to 0.044', () => { + expect(sect.Calc_Yco()).toBeCloseTo(0.044, precDigits); }); // perte de charge @@ -217,13 +217,13 @@ xdescribe('Section paramétrée puissance :', () => { }); // impulsion hydraulique - it('Imp should equal to 8568', () => { - expect(sect.Calc_Imp()).toBeCloseTo(8568, precDigits); + it('Imp should equal to 59384.242', () => { + expect(sect.Calc_Imp()).toBeCloseTo(59384.242, precDigits); }); // force tractrice (contrainte de cisaillement) - it('Tau0 should equal to 2.804', () => { - expect(sect.Calc_Tau0()).toBeCloseTo(2.804, precDigits); + it('Tau0 should equal to 0.145', () => { + expect(sect.Calc_Tau0()).toBeCloseTo(0.145, precDigits); }); }); }); diff --git a/spec/section_param_puiss_torrentiel.spec.ts b/spec/section_param_puiss_torrentiel.spec.ts index 413e6f41..1cac7936 100644 --- a/spec/section_param_puiss_torrentiel.spec.ts +++ b/spec/section_param_puiss_torrentiel.spec.ts @@ -22,97 +22,97 @@ function createSection(prec: number): cSnPuiss { return new cSnPuiss(undefined, paramSection); } -xdescribe('Section paramétrée puissance :', () => { +describe('Section paramétrée puissance :', () => { beforeEach(() => { sect = createSection(precDist); }); describe('torrentiel / pas de débordement :', () => { // charge spécifique - it('Hs should equal to 0.818', () => { - expect(sect.Calc_Hs()).toBeCloseTo(0.818, precDigits); + it('Hs should equal to 2.2', () => { + expect(sect.Calc_Hs()).toBeCloseTo(2.2, precDigits); }); // charge critique - it('Hsc should equal to 0.43', () => { - expect(sect.Calc_Hsc()).toBeCloseTo(0.43, precDigits); + it('Hsc should equal to 1.616', () => { + expect(sect.Calc_Hsc()).toBeCloseTo(1.616, precDigits); }); // largeur au miroir - it('B should equal to 2.5', () => { - expect(sect.Calc_B()).toBeCloseTo(2.5, precDigits); + it('B should equal to 3.578', () => { + expect(sect.Calc_B()).toBeCloseTo(3.578, precDigits); }); // périmètre mouillé - it('P should equal to 4.1', () => { - expect(sect.Calc_P()).toBeCloseTo(4.1, precDigits); + it('P should equal to 4.223', () => { + expect(sect.Calc_P()).toBeCloseTo(4.223, precDigits); }); // surface mouillée - it('S should equal to 2', () => { - expect(sect.Calc_S()).toBeCloseTo(2, precDigits); + it('S should equal to 1.908', () => { + expect(sect.Calc_S()).toBeCloseTo(1.908, precDigits); }); // rayon hydraulique - it('R should equal to 0.488', () => { - expect(sect.Calc_R()).toBeCloseTo(0.488, precDigits); + it('R should equal to 0.452', () => { + expect(sect.Calc_R()).toBeCloseTo(0.452, precDigits); }); // vitesse moyenne - it('V should equal to 0.6', () => { - expect(sect.Calc_V()).toBeCloseTo(0.6, precDigits); + it('V should equal to 5.241', () => { + expect(sect.Calc_V()).toBeCloseTo(5.241, precDigits); }); // nombre de Froude - it('Fr should equal to 0.214', () => { - expect(sect.Calc_Fr()).toBeCloseTo(0.214, precDigits); + it('Fr should equal to 2.291', () => { + expect(sect.Calc_Fr()).toBeCloseTo(2.291, precDigits); }); // tirant d'eau critique - it('Yc should equal to 0.286', () => { - expect(sect.Calc_Yc()).toBeCloseTo(0.286, precDigits); + it('Yc should equal to 1.186', () => { + expect(sect.Calc_Yc()).toBeCloseTo(1.186, precDigits); }); // tirant d'eau normal - it('Yn should equal to 0.663', () => { - expect(sect.Calc_Yn()).toBeCloseTo(0.663, precDigits); + it('Yn should equal to 1.916', () => { + expect(sect.Calc_Yn()).toBeCloseTo(1.916, precDigits); }); // tirant d'eau fluvial - it('Yf should equal to 0.8', () => { - expect(sect.Calc_Yf()).toBeCloseTo(0.8, precDigits); + it('Yf should equal to 2.126', () => { + expect(sect.Calc_Yf()).toBeCloseTo(2.126, precDigits); }); // tirant d'eau torrentiel - it('Yt should equal to 0.131', () => { - expect(sect.Calc_Yt()).toBeCloseTo(0.131, precDigits); + it('Yt should equal to 0.8', () => { + expect(sect.Calc_Yt()).toBeCloseTo(0.8, precDigits); }); // tirant d'eau conjugué - it('Yco should equal to 0.068', () => { - expect(sect.Calc_Yco()).toBeCloseTo(0.068, precDigits); + it('Yco should equal to 1.746', () => { + expect(sect.Calc_Yco()).toBeCloseTo(1.746, precDigits); }); // perte de charge - it('J should equal to 0.00059', () => { - sect = createSection(0.00001); - expect(sect.Calc_J()).toBeCloseTo(0.00059, precDigits); + it('J should equal to 0.05', () => { + //sect = createSection(0.00001); + expect(sect.Calc_J()).toBeCloseTo(0.05, precDigits); }); // Variation linéaire de l'énergie spécifique - it('I-J should equal to 0.00041', () => { - sect = createSection(0.00001); - expect(sect.Calc("I-J")).toBeCloseTo(0.00041, precDigits); + it('I-J should equal to -0.049', () => { + //sect = createSection(0.00001); + expect(sect.Calc("I-J")).toBeCloseTo(-0.049, precDigits); }); // impulsion hydraulique - it('Imp should equal to 8568', () => { - expect(sect.Calc_Imp()).toBeCloseTo(8568, precDigits); + it('Imp should equal to 58397.786', () => { + expect(sect.Calc_Imp()).toBeCloseTo(58397.786, precDigits); }); // force tractrice (contrainte de cisaillement) - it('Tau0 should equal to 2.804', () => { - expect(sect.Calc_Tau0()).toBeCloseTo(2.804, precDigits); + it('Tau0 should equal to 219.455', () => { + expect(sect.Calc_Tau0()).toBeCloseTo(219.455, precDigits); }); }); }); diff --git a/spec/section_param_rect_fluvial.spec.ts b/spec/section_param_rect_fluvial.spec.ts index 9292c344..5c0af5b9 100644 --- a/spec/section_param_rect_fluvial.spec.ts +++ b/spec/section_param_rect_fluvial.spec.ts @@ -35,7 +35,7 @@ function createSectionDebordement(prec: number): cSnRectang { return new cSnRectang(undefined, paramSection); } -xdescribe('Section paramétrée rectangulaire : ', () => { +describe('Section paramétrée rectangulaire : ', () => { beforeEach(() => { sect = createSection(precDist); }); @@ -131,15 +131,15 @@ xdescribe('Section paramétrée rectangulaire : ', () => { }); -xdescribe('Section paramétrée rectangulaire : ', () => { +describe('Section paramétrée rectangulaire : ', () => { beforeEach(() => { sect = createSectionDebordement(precDist); }); describe('fluvial / débordement :', () => { // charge spécifique - it('Hs should equal to 0.818', () => { - expect(sect.Calc_Hs()).toBeCloseTo(0.818, precDigits); + it('Hs should equal to 2.003', () => { + expect(sect.Calc_Hs()).toBeCloseTo(2.003, precDigits); }); // charge critique @@ -153,28 +153,28 @@ xdescribe('Section paramétrée rectangulaire : ', () => { }); // périmètre mouillé - it('P should equal to 4.1', () => { - expect(sect.Calc_P()).toBeCloseTo(4.1, precDigits); + it('P should equal to 6.5', () => { + expect(sect.Calc_P()).toBeCloseTo(6.5, precDigits); }); // surface mouillée - it('S should equal to 2', () => { - expect(sect.Calc_S()).toBeCloseTo(2, precDigits); + it('S should equal to 5', () => { + expect(sect.Calc_S()).toBeCloseTo(5, precDigits); }); // rayon hydraulique - it('R should equal to 0.488', () => { - expect(sect.Calc_R()).toBeCloseTo(0.488, precDigits); + it('R should equal to 0.769', () => { + expect(sect.Calc_R()).toBeCloseTo(0.769, precDigits); }); // vitesse moyenne - it('V should equal to 0.6', () => { - expect(sect.Calc_V()).toBeCloseTo(0.6, precDigits); + it('V should equal to 0.24', () => { + expect(sect.Calc_V()).toBeCloseTo(0.24, precDigits); }); // nombre de Froude - it('Fr should equal to 0.214', () => { - expect(sect.Calc_Fr()).toBeCloseTo(0.214, precDigits); + it('Fr should equal to 0.0542', () => { + expect(sect.Calc_Fr()).toBeCloseTo(0.0542, precDigits); }); // tirant d'eau critique @@ -188,18 +188,18 @@ xdescribe('Section paramétrée rectangulaire : ', () => { }); // tirant d'eau fluvial - it('Yf should equal to 0.8', () => { - expect(sect.Calc_Yf()).toBeCloseTo(0.8, precDigits); + it('Yf should equal to 2', () => { + expect(sect.Calc_Yf()).toBeCloseTo(2, precDigits); }); // tirant d'eau torrentiel - it('Yt should equal to 0.131', () => { - expect(sect.Calc_Yt()).toBeCloseTo(0.131, precDigits); + it('Yt should equal to 0.078', () => { + expect(sect.Calc_Yt()).toBeCloseTo(0.078, precDigits); }); // tirant d'eau conjugué - it('Yco should equal to 0.068', () => { - expect(sect.Calc_Yco()).toBeCloseTo(0.068, precDigits); + it('Yco should equal to 0.012', () => { + expect(sect.Calc_Yco()).toBeCloseTo(0.012, precDigits); }); // perte de charge @@ -209,19 +209,19 @@ xdescribe('Section paramétrée rectangulaire : ', () => { }); // Variation linéaire de l'énergie spécifique - it('I-J should equal to 0.00041', () => { + it('I-J should equal to 0.0009', () => { sect = createSection(0.00001); - expect(sect.Calc("I-J")).toBeCloseTo(0.00041, precDigits); + expect(sect.Calc("I-J")).toBeCloseTo(0.0009, precDigits); }); // impulsion hydraulique - it('Imp should equal to 8568', () => { - expect(sect.Calc_Imp()).toBeCloseTo(8568, precDigits); + it('Imp should equal to 49338', () => { + expect(sect.Calc_Imp()).toBeCloseTo(49338, precDigits); }); // force tractrice (contrainte de cisaillement) - it('Tau0 should equal to 2.804', () => { - expect(sect.Calc_Tau0()).toBeCloseTo(2.804, precDigits); + it('Tau0 should equal to 0.385', () => { + expect(sect.Calc_Tau0()).toBeCloseTo(0.385, precDigits); }); }); }); diff --git a/spec/section_param_trapez_fluvial.spec.ts b/spec/section_param_trapez_fluvial.spec.ts index 9b04df03..cfe42854 100644 --- a/spec/section_param_trapez_fluvial.spec.ts +++ b/spec/section_param_trapez_fluvial.spec.ts @@ -37,7 +37,7 @@ function createSectionDebordement(prec: number): cSnTrapez { return new cSnTrapez(undefined, paramSection); } -xdescribe('Section paramétrée trapèze : ', () => { +describe('Section paramétrée trapèze : ', () => { beforeEach(() => { sect = createSection(precDist); }); @@ -132,15 +132,15 @@ xdescribe('Section paramétrée trapèze : ', () => { }); -xdescribe('Section paramétrée trapèze : ', () => { +describe('Section paramétrée trapèze : ', () => { beforeEach(() => { sect = createSectionDebordement(precDist); }); describe('fluvial / débordement :', () => { // charge spécifique - it('Hs should equal to 0.813', () => { - expect(sect.Calc_Hs()).toBeCloseTo(0.813, precDigits); + it('Hs should equal to 2.002', () => { + expect(sect.Calc_Hs()).toBeCloseTo(2.002, precDigits); }); // charge critique @@ -149,33 +149,33 @@ xdescribe('Section paramétrée trapèze : ', () => { }); // largeur au miroir - it('B should equal to 3.396', () => { - expect(sect.Calc_B()).toBeCloseTo(3.396, precDigits); + it('B should equal to 3.62', () => { + expect(sect.Calc_B()).toBeCloseTo(3.62, precDigits); }); // périmètre mouillé - it('P should equal to 4.334', () => { - expect(sect.Calc_P()).toBeCloseTo(4.334, precDigits); + it('P should equal to 6.792', () => { + expect(sect.Calc_P()).toBeCloseTo(6.792, precDigits); }); // surface mouillée - it('S should equal to 2.358', () => { - expect(sect.Calc_S()).toBeCloseTo(2.358, precDigits); + it('S should equal to 6.68', () => { + expect(sect.Calc_S()).toBeCloseTo(6.68, precDigits); }); // rayon hydraulique - it('R should equal to 0.544', () => { - expect(sect.Calc_R()).toBeCloseTo(0.544, precDigits); + it('R should equal to 0.983', () => { + expect(sect.Calc_R()).toBeCloseTo(0.983, precDigits); }); // vitesse moyenne - it('V should equal to 0.509', () => { - expect(sect.Calc_V()).toBeCloseTo(0.509, precDigits); + it('V should equal to 0.18', () => { + expect(sect.Calc_V()).toBeCloseTo(0.18, precDigits); }); // nombre de Froude - it('Fr should equal to 0.195', () => { - expect(sect.Calc_Fr()).toBeCloseTo(0.195, precDigits); + it('Fr should equal to 0.042', () => { + expect(sect.Calc_Fr()).toBeCloseTo(0.042, precDigits); }); // tirant d'eau critique @@ -189,24 +189,24 @@ xdescribe('Section paramétrée trapèze : ', () => { }); // tirant d'eau fluvial - it('Yf should equal to 0.8', () => { - expect(sect.Calc_Yf()).toBeCloseTo(0.8, precDigits); + it('Yf should equal to 2', () => { + expect(sect.Calc_Yf()).toBeCloseTo(2, precDigits); }); // tirant d'eau torrentiel - it('Yt should equal to 0.127', () => { - expect(sect.Calc_Yt()).toBeCloseTo(0.127, precDigits); + it('Yt should equal to 0.077', () => { + expect(sect.Calc_Yt()).toBeCloseTo(0.077, precDigits); }); // tirant d'eau conjugué - it('Yco should equal to 0.061', () => { - expect(sect.Calc_Yco()).toBeCloseTo(0.061, precDigits); + it('Yco should equal to 0.009', () => { + expect(sect.Calc_Yco()).toBeCloseTo(0.009, precDigits); }); // perte de charge - it('J should equal to 0.00036', () => { + it('J should equal to 0.00002', () => { let sect = createSection(0.00001); - expect(sect.Calc_J()).toBeCloseTo(0.00036, precDigits); + expect(sect.Calc_J()).toBeCloseTo(0.00002, precDigits); }); // Variation linéaire de l'énergie spécifique @@ -215,13 +215,13 @@ xdescribe('Section paramétrée trapèze : ', () => { }); // impulsion hydraulique - it('Imp should equal to 9396.158', () => { - expect(sect.Calc_Imp()).toBeCloseTo(9396.158, precDigits); + it('Imp should equal to 63915.169', () => { + expect(sect.Calc_Imp()).toBeCloseTo(63915.169, precDigits); }); // force tractrice (contrainte de cisaillement) - it('Tau0 should equal to 1.944', () => { - expect(sect.Calc_Tau0()).toBeCloseTo(1.944, precDigits); + it('Tau0 should equal to 0.199', () => { + expect(sect.Calc_Tau0()).toBeCloseTo(0.199, precDigits); }); }); }); diff --git a/src/section/section_trapez.ts b/src/section/section_trapez.ts index 9b309683..f6a20769 100644 --- a/src/section/section_trapez.ts +++ b/src/section/section_trapez.ts @@ -51,9 +51,12 @@ export class cSnTrapez extends acSection { return this.prms.Y.v > this.prms.YB.v; } - Calc_B(bBerge = false): number { - if (!bBerge && this.isDebordement()) - return this.prms.LargeurBerge.v; + // Calc_B(bBerge = false): number { + Calc_B(): number { + // if (!bBerge && this.isDebordement()) + if (this.isDebordement()) + //return this.prms.LargeurBerge.v; + return this.prms.LargeurFond.v + 2 * this.prms.Fruit.v * this.prms.YB.v; return this.prms.LargeurFond.v + 2 * this.prms.Fruit.v * this.prms.Y.v; } diff --git a/src/section/section_type.ts b/src/section/section_type.ts index dbd9a608..63a911ef 100644 --- a/src/section/section_type.ts +++ b/src/section/section_type.ts @@ -209,14 +209,14 @@ export abstract class acSection extends ComputeNode { this.debug("reset(" + bGeo + ")"); this.arCalc = {}; if (bGeo) { - this.debug("reset Geo"); + // this.debug("reset Geo"); this.arCalcGeo = {}; this.bSnFermee = false; } - this.debug("reset arCalc :"); - this.debug(this.arCalc); - this.debug("reset arCalcGeo :"); - this.debug(this.arCalcGeo); + // this.debug("reset arCalc :"); + // this.debug(this.arCalc); + // this.debug("reset arCalcGeo :"); + // this.debug(this.arCalcGeo); } /** @@ -425,8 +425,8 @@ export abstract class acSection extends ComputeNode { * @return La largeur au miroir en cas de débordement */ Calc_B_Debordement(): number { - // return this.prms.LargeurBerge.v; - return this.CalcGeo("B"); + return this.prms.LargeurBerge.v; + // return this.CalcGeo("B"); } /** -- GitLab