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

MacroRugoCompound: manage varying parameters and iteration selector

parent 4ae039bc
No related branches found
No related tags found
1 merge request!57WIP: Resolve "Ajout du module "Passe à macro-rugosités complexe""
......@@ -58,27 +58,46 @@ export class MacrorugoCompoundResultsTableComponent extends ResultsComponent {
// lines 1 - n-1
for (let i = 0; i < pr.childrenResults.length; i++) {
if (
pr.childrenResults[i].resultElements[vi].vCalc
) {
const res = pr.childrenResults[i].resultElements[vi].values;
const nub = (pr.childrenResults[i].sourceNub as MacroRugo);
this._dataSet.push([
i + 1, // n° radier
nub.prms.ZF1.singleValue.toFixed(nDigits), // @TODO what if ZF1 or B varies ?
nub.prms.B.singleValue.toFixed(nDigits),
res.Q.toFixed(nDigits),
res.ZF2.toFixed(nDigits),
res.Vdeb.toFixed(nDigits),
res.Fr.toFixed(nDigits),
res.Vmax.toFixed(nDigits),
res.PV.toFixed(nDigits),
this.intlService.localizeText("INFO_ENUM_MACRORUGOFLOWTYPE_" + res.ENUM_MacroRugoFlowType),
res.Q_GuideTech.toFixed(nDigits),
(res.V_GuideTech !== undefined ? res.V_GuideTech.toFixed(nDigits) : "-"),
res.xCenter.toFixed(nDigits)
]);
// @TODO protect loop contents with if(vCalc) ? Will hide erroneous apron results..
const res = pr.childrenResults[i].resultElements[vi].values;
const nub = (pr.childrenResults[i].sourceNub as MacroRugo);
// does ZF1 or B vary ?
let zf1: number;
try {
if (nub.prms.ZF1.hasMultipleValues) {
zf1 = nub.prms.ZF1.getInferredValuesList()[vi];
} else {
zf1 = nub.prms.ZF1.singleValue;
}
} catch (e) {
// silent fail
}
let b: number;
try {
if (nub.prms.B.hasMultipleValues) {
b = nub.prms.B.getInferredValuesList()[vi];
} else {
b = nub.prms.B.singleValue;
}
} catch (e) {
// silent fail
}
this._dataSet.push([
i + 1, // n° radier
(zf1 !== undefined ? zf1.toFixed(nDigits) : "-"),
(b !== undefined ? b.toFixed(nDigits) : "-"),
res.Q.toFixed(nDigits),
res.ZF2.toFixed(nDigits),
res.Vdeb.toFixed(nDigits),
res.Fr.toFixed(nDigits),
res.Vmax.toFixed(nDigits),
res.PV.toFixed(nDigits),
this.intlService.localizeText("INFO_ENUM_MACRORUGOFLOWTYPE_" + res.ENUM_MacroRugoFlowType),
res.Q_GuideTech.toFixed(nDigits),
(res.V_GuideTech !== undefined ? res.V_GuideTech.toFixed(nDigits) : "-"),
res.xCenter.toFixed(nDigits)
]);
}
}
}
......
......@@ -252,7 +252,6 @@ export class MacrorugoCompoundResultsComponent implements DoCheck {
this.generalLogComponent.log = this.globalLog;
}
console.log("update ====>", this._mrcResults);
if (this.hasResults) {
mrcUpdated = this.mrcResultsTableComponent !== undefined;
if (mrcUpdated) {
......
......@@ -79,14 +79,22 @@ export class VariableResultsSelectorComponent {
}
protected entryLabel(index: number): string {
let i = 0;
return this.varValues.map((vv) => {
const kv = [];
for (let i = 0; i < this.varValues.length; i++) {
const vv = this.varValues[i];
const vp = this._results.variatedParameters[i];
i++;
let value = "0";
value = vv[index];
return `${vp.symbol} = ${value}`;
}).join(", ");
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(", ");
}
public get selectedValue(): number {
......
......@@ -215,9 +215,10 @@
"INFO_LIB_Q": "Discharge",
"INFO_LIB_QA": "Attraction flow",
"INFO_LIB_R": "Hydraulic radius",
"INFO_LIB_S": "Orifice area",
"INFO_LIB_RADIER": "Basin bottom",
"INFO_LIB_RADIER_N": "Apron #",
"INFO_LIB_RADIER_N_COURT": "A#",
"INFO_LIB_S": "Orifice area",
"INFO_LIB_SELECT_LOIDEBIT": "Stage-discharge law",
"INFO_LIB_SELECT_LOIDEBIT1_KIVI": "Kindsvater-Carter and Villemonte",
"INFO_LIB_SELECT_LOIDEBIT1": "Stage-discharge law",
......
......@@ -216,6 +216,7 @@
"INFO_LIB_R": "Rayon hydraulique",
"INFO_LIB_RADIER": "Radier",
"INFO_LIB_RADIER_N": "Radier n°",
"INFO_LIB_RADIER_N_COURT": "R",
"INFO_LIB_S": "Surface de l'orifice",
"INFO_LIB_SELECT_LOIDEBIT": "Loi de débit",
"INFO_LIB_SELECT_LOIDEBIT1_KIVI": "Kindsvater-Carter et Villemonte",
......
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