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

Work on #431 - proper display of variating QA in boundaries selector and chart

parent 368df9aa
No related branches found
No related tags found
No related merge requests found
Pipeline #138293 passed
......@@ -12,6 +12,7 @@ import { AppComponent } from "../../app.component";
import { CloisonAval, Cloisons, LoiDebit } from "jalhyd";
import { sprintf } from "sprintf-js";
import { CalculatorResults } from 'app/results/calculator-results';
@Component({
selector: "pab-profile-chart",
......@@ -452,13 +453,14 @@ export class PabProfileChartComponent extends ResultsComponentDirective {
* @param n index of the variating parameter(s) iteration
*/
private getLegendForSeries(n: number): string {
let i = 0;
/* let i = 0;
return this.varValues.map((vv) => {
const vp = this._results.variatedParameters[i];
i++;
let value = "0";
value = vv[n];
return `${vp.symbol} = ${value}`;
}).join(", ");
}).join(", "); */
return CalculatorResults.variatingModalityLabel(this.varValues, this._results.variatedParameters, n);
}
}
import { Component, Input, Output, EventEmitter, OnInit, AfterViewInit } from "@angular/core";
import { LoiDebit } from "jalhyd";
import { LoiDebit, ParamValueMode } from "jalhyd";
import { MatDialog } from "@angular/material/dialog";
......@@ -1057,7 +1057,10 @@ export class PabTableComponent implements AfterViewInit, OnInit {
);
// copy parameter values
for (const p of si.prms) {
newChild.getParameter(p.symbol).singleValue = p.singleValue;
// @TODO QA may vary
if (p.visible && p.symbol !== "QA") { // QA might vary !
newChild.getParameter(p.symbol).singleValue = p.singleValue;
}
}
// copy children
if (si instanceof ParallelStructure) {
......@@ -1242,7 +1245,8 @@ export class PabTableComponent implements AfterViewInit, OnInit {
for (const av of availableVariables) {
for (const c of this.selectedItems) {
for (const p of c.parameterIterator) {
if (p.visible && p.symbol === av.value) {
// @TODO what todo when p varies (QA only) ?
if (p.visible && p.symbol === av.value && ! p.hasMultipleValues) {
av.occurrences ++;
if (av.first === undefined) {
av.first = p.singleValue;
......@@ -1319,6 +1323,10 @@ export class PabTableComponent implements AfterViewInit, OnInit {
case "set-value":
for (const s of this.selectedItems) {
for (const p of s.parameterIterator) { // deep
// force single mode (QA only)
if (p.hasMultipleValues) {
p.valueMode = ParamValueMode.SINGLE;
}
if (p.symbol === result.variable) {
p.singleValue = result.value;
}
......@@ -1329,6 +1337,10 @@ export class PabTableComponent implements AfterViewInit, OnInit {
case "delta":
for (const s of this.selectedItems) {
for (const p of s.parameterIterator) { // deep
// force single mode (QA only)
if (p.hasMultipleValues) {
p.valueMode = ParamValueMode.SINGLE;
}
if (p.symbol === result.variable) {
p.singleValue += result.delta;
}
......@@ -1405,6 +1417,10 @@ export class PabTableComponent implements AfterViewInit, OnInit {
// for ZRMB, interpolatedValues length is shorter by 1 element
if (interpolatedValues[idx] !== undefined) {
for (const p of s.parameterIterator) { // deep
// force single mode (QA only)
if (p.hasMultipleValues) {
p.valueMode = ParamValueMode.SINGLE;
}
if (p.symbol === result.variable) {
p.singleValue = interpolatedValues[idx];
idx ++;
......
......@@ -3,6 +3,7 @@ import { Component, Output, EventEmitter } from "@angular/core";
import { I18nService } from "../../services/internationalisation.service";
import { fv, longestVarNgParam } from "../../util";
import { MultiDimensionResults } from "../../results/multidimension-results";
import { CalculatorResults } from "../../results/calculator-results";
@Component({
selector: "variable-results-selector",
......@@ -72,22 +73,7 @@ export class VariableResultsSelectorComponent {
}
protected entryLabel(index: number): string {
const kv = [];
for (let i = 0; i < this.varValues.length; i++) {
const vv = this.varValues[i];
const vp = this._results.variatedParameters[i];
let symbol = vp.symbol;
// is vp a parameter of a child Nub ?
if (
vp.paramDefinition.parentNub
&& vp.paramDefinition.parentNub !== vp.paramDefinition.originNub
) {
const pos = vp.paramDefinition.parentNub.findPositionInParent() + 1;
symbol = this.intlService.localizeText("INFO_LIB_RADIER_N_COURT") + pos + "_" + symbol;
}
kv.push(`${symbol} = ${vv[index]}`);
}
return kv.join(", ");
return CalculatorResults.variatingModalityLabel(this.varValues, this._results.variatedParameters, index);
}
public get selectedValue(): number {
......
......@@ -2,7 +2,7 @@ import { Pab, Result } from "jalhyd";
import { FormulaireDefinition } from "./form-definition";
import { PabResults } from "../../results/pab-results";
import { NgParameter } from "../elements/ngparam";
import { NgParameter, ParamRadioConfig } from "../elements/ngparam";
import { longestVarNgParam } from "../../util";
import { CalculatorResults } from "../../results/calculator-results";
......@@ -78,6 +78,21 @@ export class FormulairePab extends FormulaireDefinition {
}
}
public getVariatedParameters(): NgParameter[] {
const res: NgParameter[] = super.getVariatedParameters();
// add artificial NgParameters for any variated QA @WARNING clodo trick
if (this.pabNub) {
for (const c of this.pabNub.children) {
if (c.prms.QA.hasMultipleValues) {
const qaParam = new NgParameter(c.prms.QA, this);
qaParam.radioConfig = ParamRadioConfig.VAR;
res.push(qaParam);
}
}
}
return res;
}
public get pabResults() {
return this._pabResults;
}
......
import { Nub, capitalize } from "jalhyd";
import { Nub, capitalize, MacrorugoCompound, Pab } from "jalhyd";
import { NgParameter } from "../formulaire/elements/ngparam";
import { ServiceFactory } from "../services/service-factory";
......@@ -45,6 +45,39 @@ export abstract class CalculatorResults {
return res;
}
/**
* Returns a label showing the boundary conditions values of all variating parameters,
* for the given iteration
* @param varvalues array of values: one element per variating parameter, itself an array of
* values, one per iteration
* @param variatedParameters array of variating parameters, in the same order as varvalues
* @param n index of the variating parameter(s) iteration
*/
public static variatingModalityLabel(varValues: any[], variatedParameters: NgParameter[], index: number): string {
const kv = [];
for (let i = 0; i < varValues.length; i++) {
const vv = varValues[i];
const vp = variatedParameters[i];
let symbol = vp.symbol;
// is vp a parameter of a child Nub ?
if (
vp.paramDefinition.parentNub
&& vp.paramDefinition.parentNub !== vp.paramDefinition.originNub
) {
let nCourt = "";
if (vp.paramDefinition.originNub instanceof MacrorugoCompound) {
nCourt = ServiceFactory.i18nService.localizeText("INFO_LIB_RADIER_N_COURT");
} else if (vp.paramDefinition.originNub instanceof Pab) {
nCourt = ServiceFactory.i18nService.localizeText("INFO_LIB_CLOISON_N_COURT");
}
const pos = vp.paramDefinition.parentNub.findPositionInParent() + 1;
symbol = nCourt + pos + "_" + symbol;
}
kv.push(`${symbol} = ${vv[index]}`);
}
return kv.join(", ");
}
/**
* remet tous les résultats à zero
*/
......
......@@ -254,6 +254,7 @@
"INFO_LIB_CDT": "Discharge coefficient triangular weir",
"INFO_LIB_CDO": "Discharge coefficient orifice",
"INFO_LIB_CLOISON": "Cross wall #",
"INFO_LIB_CLOISON_N_COURT": "W",
"INFO_LIB_COTE": "Elevation (m)",
"INFO_LIB_COTE_VANNE_LEVANTE": "Lift gate elevation",
"INFO_LIB_CV": "Cv: Velocity coefficient",
......
......@@ -255,6 +255,7 @@
"INFO_LIB_CDT": "Coefficient de débit seuil triangulaire",
"INFO_LIB_CDO": "Coefficient de débit orifice",
"INFO_LIB_CLOISON": "Cloison n°",
"INFO_LIB_CLOISON_N_COURT": "C",
"INFO_LIB_COTE": "Cote (m)",
"INFO_LIB_COTE_VANNE_LEVANTE": "Cote vanne levante",
"INFO_LIB_CV": "Cv&nbsp;: Coefficient de vitesse d'approche",
......
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