diff --git a/e2e/calculate-all-params.e2e-spec.ts b/e2e/calculate-all-params.e2e-spec.ts index f261a8df7469a6b74f28fa7566bfd8576c8e4dbc..e250d6aac3df00edf9843f4509f22668d66fb1d1 100644 --- a/e2e/calculate-all-params.e2e-spec.ts +++ b/e2e/calculate-all-params.e2e-spec.ts @@ -52,7 +52,9 @@ describe("ngHyd − calculate all parameters of all calculators", async () => { if (inputs.length > 0) { // for each param - for (const input of inputs) { + for (let i = 0; i < inputs.length; i++) { + // grab input again because calculating the module just refreshed all the fieldsets + const input = (await calcPage.getParamInputsHavingCalcMode())[i]; // click "calc" mode button for this parameter await calcPage.setParamMode(input, "cal"); // check that only 1 button is in "calc" state diff --git a/e2e/tested_calctypes.ts b/e2e/tested_calctypes.ts index 9b86493e2a295a54dcab657ee7b032efad09cc7e..e4eed0389b84f201dbe97200e8af3dea74eb3832 100644 --- a/e2e/tested_calctypes.ts +++ b/e2e/tested_calctypes.ts @@ -9,5 +9,5 @@ export const testedCalcTypes = [ // omit 16 - CloisonAval 17, 18, 19, 20, 21, 22, 23, 24, 25, // omit 26 - YAXN - 27 + 27, 29 ]; diff --git a/jalhyd_branch b/jalhyd_branch index b8a4183b440aa2a4486befeca6779728c780a9b7..b270f3f19dec7fced2987fceedb382287ba0d846 100644 --- a/jalhyd_branch +++ b/jalhyd_branch @@ -1 +1 @@ -34-ajout-du-calage-d-une-passe-a-ralentisseurs +201-ajout-de-la-simulation-d-une-passe-a-ralentisseurs-2 diff --git a/src/app/calculators/parsimulation/config.json b/src/app/calculators/parsimulation/config.json new file mode 100644 index 0000000000000000000000000000000000000000..ae430240160c644fa7df13482fc40c7f31b6dfda --- /dev/null +++ b/src/app/calculators/parsimulation/config.json @@ -0,0 +1,60 @@ +[ + { + "id": "fs_param_hydro", + "type": "fieldset", + "fields": [ + "Q", + "Z1", + { + "id": "Z2", + "allowEmpty": true + } + ] + }, + { + "id": "fs_geometry", + "type": "fieldset", + "fields": [ + { + "type": "select", + "id": "select_par_type", + "property": "parType", + "default": "PLANE" + }, + "L", + "S", + { + "id": "P", + "allowEmpty": true + }, + { + "id": "Nb", + "allowEmpty": true + }, + { + "id": "ZD1", + "allowEmpty": true + }, + { + "id": "ZR1", + "allowEmpty": true + }, + { + "id": "ZD2", + "allowEmpty": true + }, + { + "id": "ZR2", + "allowEmpty": true + }, + "a", + "N", + "M" + ] + }, + { + "type": "options", + "selectIds": [ "select_par_type" ], + "help": "par/par_simulation.html" + } +] diff --git a/src/app/calculators/parsimulation/en.json b/src/app/calculators/parsimulation/en.json new file mode 100644 index 0000000000000000000000000000000000000000..3ff2bc405e5f8df41113a61549a7230f0159b0b2 --- /dev/null +++ b/src/app/calculators/parsimulation/en.json @@ -0,0 +1,68 @@ +{ + "fs_param_hydro": "Hydraulic parameters", + + "Q": "Flow", + "Z1": "Upstream water elevation", + "Z2": "Downstream water elevation", + + "fs_geometry": "Pass geometry", + + "ZD1": "Upstream spilling elevation", + "ZR1": "Upstream apron elevation", + "ZD2": "Downstream spilling elevation", + "ZR2": "Downstream apron elevation", + "S": "Slope", + "P": "Space between baffles", + "Nb": "Number of baffles", + "L": "Pass width", + "a": "Baffle / chevron height", + "N": "Number of patterns", + "M": "Number of longitudinal strips", + + "h": "Water level in the pass", + "ha": "Upstream head", + "qStar": "Dimensionless flow", + "V": "Flow velocity", + "ZM": "Minimal rake height of upstream side walls", + "LPI": "Pass length following the slope", + "LPH": "Pass length in horizontal projection", + "A": "A", + "B": "B", + "C": "C", + "D": "D", + "H": "Baffle height", + "Hmin": "Hmin", + "Hmax": "Hmax", + + "select_par_type": "Type de passe", + "select_par_type_0": "Plane baffles", + "select_par_type_1": "Fatou", + "select_par_type_2": "Superactive", + "select_par_type_3": "Mixed / chevrons", + + "UNIT_ZD1": "m", + "UNIT_S": "m/m", + "UNIT_P": "m", + "UNIT_NB": "", + "UNIT_L": "m", + "UNIT_a": "m", + "UNIT_N": "", + "UNIT_M": "", + + "UNIT_H": "m", + "UNIT_HA": "m", + "UNIT_QSTAR": "m³/s", + "UNIT_V": "m/s", + "UNIT_ZM": "m", + "UNIT_ZR1": "m", + "UNIT_A": "m", + "UNIT_B": "m", + "UNIT_C": "m", + "UNIT_D": "m", + "UNIT_HMIN": "m", + "UNIT_HMAX": "m", + "UNIT_ZD2": "m", + "UNIT_ZR2": "m", + "UNIT_LPI": "m", + "UNIT_LPH": "m" +} diff --git a/src/app/calculators/parsimulation/fr.json b/src/app/calculators/parsimulation/fr.json new file mode 100644 index 0000000000000000000000000000000000000000..5748df1e62a2c027ac6137a48692c46db10ec95d --- /dev/null +++ b/src/app/calculators/parsimulation/fr.json @@ -0,0 +1,68 @@ +{ + "fs_param_hydro": "Paramètres hydrauliques", + + "Q": "Débit", + "Z1": "Cote de l'eau amont", + "Z2": "Cote de leau aval", + + "fs_geometry": "Géométrie de la passe", + + "ZD1": "Cote de déversement à l'amont", + "ZR1": "Cote de radier à l'amont", + "ZD2": "Cote de déversement à l'aval", + "ZR2": "Cote de radier à l'aval", + "S": "Pente", + "P": "Espacement entre les ralentisseurs", + "Nb": "Nombre de ralentisseurs", + "L": "Largeur de la passe", + "a": "Hauteur des ralentisseurs / des chevrons", + "N": "Nombre de motifs", + "M": "Nombre de bandes longitudinales", + + "h": "Hauteur d'eau dans la passe", + "ha": "Charge amont", + "qStar": "Débit adimensionnel", + "V": "Vitesse débitante", + "ZM": "Cote d'arase minimale des murs latéraux à l'amont", + "LPI": "Longueur de la passe en suivant la pente", + "LPH": "Longueur de la passe en projection horizontale", + "A": "A", + "B": "B", + "C": "C", + "D": "D", + "H": "Hauteur d'un ralentisseur", + "Hmin": "Hmin", + "Hmax": "Hmax", + + "select_par_type": "Type de passe", + "select_par_type_0": "Ralentisseurs plans", + "select_par_type_1": "Fatou", + "select_par_type_2": "Ralentisseurs suractifs", + "select_par_type_3": "Mixte / chevrons", + + "UNIT_ZD1": "m", + "UNIT_S": "m/m", + "UNIT_P": "m", + "UNIT_NB": "", + "UNIT_L": "m", + "UNIT_a": "m", + "UNIT_N": "", + "UNIT_M": "", + + "UNIT_H": "m", + "UNIT_HA": "m", + "UNIT_QSTAR": "m³/s", + "UNIT_V": "m/s", + "UNIT_ZM": "m", + "UNIT_ZR1": "m", + "UNIT_A": "m", + "UNIT_B": "m", + "UNIT_C": "m", + "UNIT_D": "m", + "UNIT_HMIN": "m", + "UNIT_HMAX": "m", + "UNIT_ZD2": "m", + "UNIT_ZR2": "m", + "UNIT_LPI": "m", + "UNIT_LPH": "m" +} diff --git a/src/app/config.json b/src/app/config.json index 15b90c3af9e0d55dc6f5dc975077eb499994f829..60017219908ef28f6c38d6cb0633eb2204aa2b36 100644 --- a/src/app/config.json +++ b/src/app/config.json @@ -23,7 +23,7 @@ "path": "passe-ralentisseurs.jpg", "credits": "????" }, - "calculators": [ 28 ] + "calculators": [ 28, 29 ] }, { "name": "PASSE_NATURELLE", diff --git a/src/app/formulaire/definition/form-fixedvar.ts b/src/app/formulaire/definition/form-fixedvar.ts index b2051ccbae7fc86927737f23bd6c53b0e411510b..72928a7b9013fb984f089b62fe8102d06bd87f29 100644 --- a/src/app/formulaire/definition/form-fixedvar.ts +++ b/src/app/formulaire/definition/form-fixedvar.ts @@ -90,6 +90,7 @@ export class FormulaireFixedVar extends FormulaireDefinition { protected compute() { this.runNubCalc(this.currentNub); this.reaffectResultComponents(); + this.refreshFieldsets(); } protected reaffectResultComponents() { @@ -117,6 +118,12 @@ export class FormulaireFixedVar extends FormulaireDefinition { } } + protected refreshFieldsets() { + for (const fs of this.allFieldsets) { + fs.updateFields(); + } + } + // interface Observer public update(sender: IObservable, data: any) { diff --git a/src/app/formulaire/elements/fieldset.ts b/src/app/formulaire/elements/fieldset.ts index c6e49fa9b0b25e5c020d4f35523641ba50289af7..338328bed7e724a465302aa78dd6da9aa84223aa 100644 --- a/src/app/formulaire/elements/fieldset.ts +++ b/src/app/formulaire/elements/fieldset.ts @@ -227,7 +227,7 @@ export class FieldSet extends FormulaireElement implements Observer { } /** - * Reflects all properties values in the interface, through the values of the <select> fields + * Reloads the model values and properties, and reloads localisation strings */ public updateFields() { this.parseFields(); diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index e923a2d6be25819cbe1440987c4d59b2a1108712..d26ef7d20eed752df531b151e778f785e77950aa 100644 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -1,4 +1,5 @@ { + "ERROR_AT_LEAST_ONE_OF_THOSE_MUST_BE_DEFINED": "At least one of the following values should be specified : %symbols%", "ERROR_CLOISON_AVAL_UN_OUVRAGE_REGULE": "Only one regulated device is allowed on the downstream wall", "WARNING_DEVER_ZR_SUP_Z1": "Elevation of the river bed can't be higher than water elevation: Impossible to calculate the kinetic energy", "WARNING_DOWNSTREAM_ELEVATION_POSSIBLE_SUBMERSION": "Downstream elevation is higher than weir elevation (possible submersion)", @@ -32,6 +33,8 @@ "ERROR_PAB_CALC_Z1_CLOISON": "Error in calculating the upstream water elevation of a wall", "ERROR_PAB_Z1_LOWER_THAN_Z2": "Upstream water elevation should be higher than downstream water elevation", "ERROR_PAB_Z1_LOWER_THAN_UPSTREAM_WALL": "Upstream water elevation is too low for water to flow through the first wall", + "ERROR_PAR_NB_INCONSISTENT": "Number of baffles should be %stdNb%", + "ERROR_PAR_ZR_ZD_MISMATCH": "Values of %ZR% and %ZD% mismatch : either %ZR% should be %expectedZR%, or %ZD% should be %expectedZD%", "ERROR_PARAM_MUST_BE_A_NUMBER": "Please type a numeric value", "ERROR_PARAM_MUST_BE_AT_LEAST": "Value must be >= %s", "ERROR_PARAM_MUST_BE_POSITIVE": "Please type a positive numeric value", @@ -131,6 +134,8 @@ "INFO_ENUM_OUVRAGE_Q_REGIME_1": "Partially submerged", "INFO_ENUM_OUVRAGE_Q_REGIME_2": "Submerged", "INFO_ENUM_OUVRAGE_Q_REGIME_3": "Zero flow", + "INFO_ENUM_PARFLOWREGIME_0": "Free", + "INFO_ENUM_PARFLOWREGIME_1": "Submerged", "INFO_ENUM_STRUCTUREFLOWMODE_0": "Weir", "INFO_ENUM_STRUCTUREFLOWMODE_1": "Orifice", "INFO_ENUM_STRUCTUREFLOWMODE_2": "Zero flow", @@ -228,6 +233,7 @@ "INFO_LIB_DISTANCE_AMONT": "Distance from upstream (m)", "INFO_LIB_EC": "EC: Kinetic energy", "INFO_LIB_ENUM_MACRORUGOFLOWTYPE": "Flow type", + "INFO_LIB_ENUM_PARFLOWREGIME": "Regime", "INFO_LIB_FLU": "Subcritical water line", "INFO_LIB_FR": "Froude number", "INFO_LIB_FS_OUVRAGE": "Device", @@ -374,6 +380,8 @@ "INFO_PABPUISSANCE_TITRE_COURT": "FL: diss. power", "INFO_PABPUISSANCE_TITRE": "Fish ladder: dissipated power", "INFO_PARALLELSTRUCTURE_TITRE_COURT": "// structures", + "INFO_PARSIMULATION_TITRE": "Humpback fishway: simulation", + "INFO_PARSIMULATION_TITRE_COURT": "HF: simulation", "INFO_PARALLELSTRUCTURE_TITRE": "Parallel structures", "INFO_PAR_TITRE": "Humpback fishway: setup", "INFO_PAR_TITRE_COURT": "HF: setup", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index 2b5e0225766d724d0e378396455325bdde807bf1..7081bbd3090031fd0908dd18d5ee0200d72cccbc 100644 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -1,4 +1,5 @@ { + "ERROR_AT_LEAST_ONE_OF_THOSE_MUST_BE_DEFINED": "Au moins une des valeurs suivantes doit être renseignée : %symbols%", "ERROR_CLOISON_AVAL_UN_OUVRAGE_REGULE": "Un seul ouvrage régulé est autorisé sur la cloison aval", "WARNING_DEVER_ZR_SUP_Z1": "La cote du lit du cours d'eau ne peut pas être supérieure à la cote de l'eau : Impossible de calculer l'énergie cinétique", "WARNING_DOWNSTREAM_ELEVATION_POSSIBLE_SUBMERSION": "La cote de l'eau aval est plus élevée que la cote du seuil (ennoiement possible)", @@ -32,6 +33,8 @@ "ERROR_PAB_CALC_Z1_CLOISON": "Erreur de calcul de la cote de l'eau amont d'une cloison", "ERROR_PAB_Z1_LOWER_THAN_Z2": "La cote de l'eau amont doit être supérieure à la cote de l'eau aval", "ERROR_PAB_Z1_LOWER_THAN_UPSTREAM_WALL": "La cote de l'eau amont est trop basse pour que l'eau s'écoule à travers la première cloison", + "ERROR_PAR_NB_INCONSISTENT": "Le nombre de ralentisseurs devrait être %stdNb%", + "ERROR_PAR_ZR_ZD_MISMATCH": "Les valeurs de %ZR% et %ZD% ne correspondent pas : soit %ZR% devrait valoir %expectedZR%, soit %ZD% devrait valoir %expectedZD%", "ERROR_PARAM_MUST_BE_A_NUMBER": "Veuillez entrer une valeur numérique", "ERROR_PARAM_MUST_BE_AT_LEAST": "La valeur doit être >= %s", "ERROR_PARAM_MUST_BE_POSITIVE": "Veuillez entrer une valeur numérique positive", @@ -131,6 +134,8 @@ "INFO_ENUM_OUVRAGE_Q_REGIME_1": "Partiellement noyé", "INFO_ENUM_OUVRAGE_Q_REGIME_2": "Noyé", "INFO_ENUM_OUVRAGE_Q_REGIME_3": "Débit nul", + "INFO_ENUM_PARFLOWREGIME_0": "Dénoyé", + "INFO_ENUM_PARFLOWREGIME_1": "Noyé", "INFO_ENUM_STRUCTUREFLOWMODE_0": "Surface libre", "INFO_ENUM_STRUCTUREFLOWMODE_1": "En charge", "INFO_ENUM_STRUCTUREFLOWMODE_2": "Débit nul", @@ -227,6 +232,7 @@ "INFO_LIB_DISTANCE_AMONT": "Distance depuis l'amont (m)", "INFO_LIB_EC": "EC: Énergie cinétique", "INFO_LIB_ENUM_MACRORUGOFLOWTYPE": "Type d'écoulement", + "INFO_LIB_ENUM_PARFLOWREGIME": "Régime", "INFO_LIB_FLU": "Ligne d'eau fluviale", "INFO_LIB_FR": "Froude", "INFO_LIB_FS_OUVRAGE": "Ouvrage", @@ -376,6 +382,8 @@ "INFO_PARALLELSTRUCTURE_TITRE": "Lois d'ouvrages", "INFO_PAR_TITRE": "Passe à ralentisseurs : calage", "INFO_PAR_TITRE_COURT": "PAR : calage", + "INFO_PARSIMULATION_TITRE": "Passe à ralentisseurs : simulation", + "INFO_PARSIMULATION_TITRE_COURT": "PAR : simulation", "INFO_PARAMFIELD_AWAITING_CALCULATION": "En attente de calcul", "INFO_PARAMFIELD_BOUNDARY_CONDITIONS": "Conditions aux limites", "INFO_PARAMFIELD_CALCULATED": "Calculé",