Skip to content
Snippets Groups Projects
Commit 47dc43ab authored by mathias.chouet's avatar mathias.chouet
Browse files

Adaptation to jalhyd#181 : convert Jet fall to elevations

parent f5b1907b
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
{
"id": "fs_jet",
"type": "fieldset",
"fields": [ "V0", "S", "D", "H" ]
"fields": [ "V0", "S", "D", "ZJ", "ZW", "ZF" ]
},
{
"type": "options",
......
......@@ -4,7 +4,12 @@
"V0": "Initial speed",
"S": "Initial slope",
"D": "Impact abscissa",
"ZJ": "Jet start elevation",
"ZW": "Water elevation",
"ZF": "Bottom elevation",
"H": "Fall height",
"Y": "Depth",
"YH": "Depth/height ration",
"t": "Flight time",
"Vx": "Horizontal speed at impact",
"Vz": "Vertical speed at impact",
......@@ -13,7 +18,11 @@
"UNIT_V0": "m/s",
"UNIT_S": "m/m",
"UNIT_D": "m",
"UNIT_ZJ": "m",
"UNIT_ZW": "m",
"UNIT_ZF": "m",
"UNIT_H": "m",
"UNIT_Y": "m",
"UNIT_T": "s",
"UNIT_VX": "m/s",
"UNIT_VZ": "m/s",
......
......@@ -4,7 +4,12 @@
"V0": "Vitesse initiale",
"S": "Pente initiale",
"D": "Abscisse de l'impact",
"ZJ": "Cote de départ du jet",
"ZW": "Cote de l'eau",
"ZF": "Cote du fond",
"H": "Hauteur de chute",
"Y": "Profondeur",
"YH": "Rapport profondeur/chute",
"t": "Temps de vol",
"Vx": "Vitesse horizontale à l'impact",
"Vz": "Vitesse verticale à l'impact",
......@@ -13,7 +18,11 @@
"UNIT_V0": "m/s",
"UNIT_S": "m/m",
"UNIT_D": "m",
"UNIT_ZJ": "m",
"UNIT_ZW": "m",
"UNIT_ZF": "m",
"UNIT_H": "m",
"UNIT_Y": "m",
"UNIT_T": "s",
"UNIT_VX": "m/s",
"UNIT_VZ": "m/s",
......
......@@ -133,7 +133,7 @@ export class JetTrajectoryChartComponent extends ResultsComponent {
}
public set results(r: FixedResults | VarResults) {
this.forceRebuild(); // used for (de)activating legend in generateScatterChart()
this.forceRebuild(); // used for forcing redefinition of xAxes[0].ticks.min/max in generateScatterChart()
this._results = r;
if (this._results && this._results.result) {
......@@ -179,17 +179,31 @@ export class JetTrajectoryChartComponent extends ResultsComponent {
*/
private generateScatterChart() {
const ySeries = this.getYSeries();
// hide legend when there is only 1 series
this.graph_options.legend.display = (ySeries.length > 1);
const nub = (this._results.result.sourceNub as Jet);
this.graph_data = {
datasets: []
};
// find greatest abscissa
let greatestAbscissa = 0;
for (const ys of ySeries) {
if (ys.data.length > 0) {
greatestAbscissa = Math.max(greatestAbscissa, ys.data[ys.data.length - 1].x);
}
}
// adjust chart width
this.graph_options.scales.xAxes[0].ticks.min = 0;
this.graph_options.scales.xAxes[0].ticks.max = greatestAbscissa;
// build Y data series
for (const ys of ySeries) {
if (ys.data.length > 0) {
// add 2 points for related water line
const lastY = ys.data[ys.data.length - 1].y;
ys.data.push({ x: greatestAbscissa, y: lastY });
ys.data.push({ x: 0, y: lastY });
// push series config
this.graph_data.datasets.push({
label: ys.label,
......@@ -200,6 +214,22 @@ export class JetTrajectoryChartComponent extends ResultsComponent {
});
}
}
// draw bottom line
this.graph_data.datasets.push({
label: this.intlService.localizeText("INFO_JET_FOND"),
data: [
{ x: 0, y: nub.prms.ZF.singleValue },
{ x: greatestAbscissa, y: nub.prms.ZF.singleValue }
],
tension: 0,
spanGaps: true,
showLine: "true",
fill: true,
borderColor: "#753F00",
backgroundColor: "#753F00",
pointRadius: 0
});
}
public exportAsImage(element: HTMLDivElement) {
......@@ -236,7 +266,9 @@ export class JetTrajectoryChartComponent extends ResultsComponent {
for (let i = 0; i < trajectories.length; i++) {
const traj = trajectories[i];
ret.push({
label: trajectories.length === 0 ? "" /* legend is hidden */ : this.getLegendForSeries(i),
label: trajectories.length === 1
? this.intlService.localizeText("INFO_JET_TITRE_TRAJECTOIRE_ET_COTE_EAU")
: this.getLegendForSeries(i),
color: palette[i % palette.length],
// map to IYSeries format
data: traj.map((t) => {
......
......@@ -181,6 +181,8 @@
"INFO_WALLS_AND_DEVICES_REMOVED": "%s wall(s) and %s device(s) removed",
"INFO_WALLS_REMOVED": "%s wall(s) removed",
"INFO_JET_TITRE_TRAJECTOIRE": "Trajectory",
"INFO_JET_TITRE_TRAJECTOIRE_ET_COTE_EAU": "Trajectory and water elevation",
"INFO_JET_FOND": "Bottom",
"INFO_LECHAPTCALMON_TITRE_COURT": "Lechapt-C.",
"INFO_LECHAPTCALMON_TITRE": "Lechapt-Calmon",
"INFO_LIB_ABSCISSE": "Abscissa (m)",
......@@ -480,6 +482,10 @@
"INFO_TRIGO_TITRE": "Trigonometric function",
"INFO_TRIGO_TITRE_COURT": "Trigo. f.",
"WARNING_WARNINGS_ABSTRACT": "%nb% warnings occurred during calculation",
"ERROR_JET_SUBMERGED_NO_SOLUTION": "There is no solution",
"WARNING_JET_START_SUBMERGED": "Water elevation is greater than jet start elevation",
"WARNING_JET_START_ELEVATION_UNDERGROUND": "Bottom elevation cannot be higher than jet start elevation",
"WARNING_JET_WATER_ELEVATION_UNDERGROUND": "Bottom elevation cannot be higher than water elevation",
"WARNING_REMOUS_ARRET_CRITIQUE": "Calculation stopped: critical elevation reached at abscissa %x%",
"WARNING_STRUCTUREKIVI_HP_TROP_ELEVE": "h/p must not be greater than 2.5. h/p is forced to 2.5",
"WARNING_STRUCTUREKIVI_PELLE_TROP_FAIBLE": "Threshold height should be greater than 0.1 m. Beta coefficient is forced to 0",
......
......@@ -183,6 +183,8 @@
"INFO_LECHAPTCALMON_TITRE_COURT": "Lechapt-C.",
"INFO_LECHAPTCALMON_TITRE": "Lechapt-Calmon",
"INFO_JET_TITRE_TRAJECTOIRE": "Trajectoire",
"INFO_JET_TITRE_TRAJECTOIRE_ET_COTE_EAU": "Trajectoire et cote de l'eau",
"INFO_JET_FOND": "Fond",
"INFO_LIB_ABSCISSE": "Abscisse (m)",
"INFO_LIB_ALTITUDE": "Altitude (m)",
"INFO_LIB_LENGTHS": "Toutes les longueurs",
......@@ -479,6 +481,10 @@
"INFO_TRIGO_TITRE": "Fonction trigonométrique",
"INFO_TRIGO_TITRE_COURT": "F. trigo.",
"WARNING_WARNINGS_ABSTRACT": "%nb% avertissements rencontrés lors du calcul",
"ERROR_JET_SUBMERGED_NO_SOLUTION": "Il n'y a pas de solution",
"WARNING_JET_START_SUBMERGED": "La cote de l'eau est supérieure à la cote de départ du jet",
"WARNING_JET_START_ELEVATION_UNDERGROUND": "La cote de fond ne peut pas être supérieure à la cote de départ du jet",
"WARNING_JET_WATER_ELEVATION_UNDERGROUND": "La cote de fond ne peut pas être supérieure à la cote de l'eau",
"WARNING_REMOUS_ARRET_CRITIQUE": "Arrêt du calcul&nbsp;: hauteur critique atteinte à l'abscisse %x%",
"WARNING_STRUCTUREKIVI_HP_TROP_ELEVE": "h/p ne doit pas être supérieur à 2,5. h/p est forcé à 2,5",
"WARNING_STRUCTUREKIVI_PELLE_TROP_FAIBLE": "La pelle du seuil doit mesurer au moins 0,1 m. Le coefficient béta est forcé à 0",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment