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

Fix #277: update PAB table display of ZRAM

parent 5c7c1b1d
No related branches found
No related tags found
1 merge request!55Resolve "PAB : interpoler en tenant compte de la longueur des bassins"
......@@ -135,6 +135,7 @@ export class DialogEditPabComponent {
this.vertical
&& (this.selectedItemsAbstract.devices + this.selectedItemsAbstract.wallsDevices) > 1
&& (varDetails.occurrences > 1)
&& ([ "ZRAM", "ZRMB", "ZDV" ].includes(this.variable))
);
}
......
......@@ -8,6 +8,8 @@ import { ResultsComponent } from "../fixedvar-results/results.component";
import { PabResults } from "../../results/pab-results";
import { IYSeries } from "../../results/y-series";
import { CloisonAval } from "jalhyd";
@Component({
selector: "pab-profile-graph",
templateUrl: "./pab-profile-graph.component.html",
......@@ -242,7 +244,8 @@ export class PabProfileGraphComponent extends ResultsComponent {
});
}
// downwall
const ZRAMdw = this._results.cloisonAvalResults.resultElement.getValue("ZRAM");
const dw = (this._results.cloisonAvalResults.sourceNub as CloisonAval);
const ZRAMdw = dw.prms.ZRAM.singleValue;
dataF.push({
x: xs[ xs.length - 1 ],
y: ZRAMdw.toFixed(nDigits)
......
......@@ -110,19 +110,19 @@ export class PabResultsTableComponent extends ResultsComponent {
}
// downstream line
const cloisonAval = (pr.cloisonAvalResults.sourceNub as CloisonAval);
if (pr.cloisonAvalResults.resultElements[vi].vCalc) {
const rln = pr.cloisonAvalResults.resultElements[vi].values;
this._dataSet.push([
this.intlService.localizeText("INFO_LIB_AVAL"),
(pr.Z2[vi] !== undefined ? pr.Z2[vi].toFixed(nDigits) : ""),
rln.ZRAM.toFixed(nDigits),
cloisonAval.prms.ZRAM.singleValue.toFixed(nDigits),
rln.DH.toFixed(nDigits),
rln.Q.toFixed(nDigits),
"", "", "", "",
this.getJetTypes(pr.cloisonAvalResults, vi)
]);
// extra lift gate ?
const cloisonAval = (pr.cloisonAvalResults.sourceNub as CloisonAval);
if (cloisonAval && cloisonAval.hasVanneLevante()) {
const vanneZDV = cloisonAval.result.resultElements[vi].getValue("ZDV");
if (vanneZDV) {
......
......@@ -535,19 +535,30 @@ export class PabTableComponent implements AfterViewInit, OnInit {
for (let i = 0; i < maxNbParams; i++) {
// build device params row
const deviceParamRow = { selectable: cloison, cells: [] };
// basin number
// basin number and ZRAM
if (i === 0) {
// basin number
deviceParamRow.cells.push({
value: childIndex + 1,
rowspan: maxNbParams + 1,
class: "basin_number",
selectable: cloison
});
// 4 empty cells
deviceParamRow.cells.push({
colspan: 4,
rowspan: maxNbParams ,
selectable: cloison
});
// ZRAM
deviceParamRow.cells.push({
model: cloison.prms.ZRAM,
title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "ZRAM")
});
}
// 5 empty cells
if (i === 0) {
// 1 empty cell
if (i === 1) {
deviceParamRow.cells.push({
colspan: 5,
rowspan: maxNbParams,
selectable: cloison
});
......@@ -632,10 +643,6 @@ export class PabTableComponent implements AfterViewInit, OnInit {
{
model: cloison.prms.ZRMB,
title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "ZRMB")
},
{
model: cloison.prms.ZRAM,
title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "ZRAM")
}
]
};
......@@ -671,12 +678,22 @@ export class PabTableComponent implements AfterViewInit, OnInit {
class: "basin_number",
selectable: this.model.downWall
});
// 4 empty cells
deviceParamRowDW.cells.push({
colspan: 4,
rowspan: maxNbParamsDW ,
selectable: this.model.downWall
});
// ZRAM
deviceParamRowDW.cells.push({
model: this.model.downWall.prms.ZRAM,
title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "ZRAM")
});
}
// 5 empty cells
if (i === 0) {
if (i === 1) {
// 1 empty cell
deviceParamRowDW.cells.push({
colspan: 5,
rowspan: maxNbParamsDW,
rowspan: maxNbParamsDW - 1,
selectable: this.model.downWall
});
}
......@@ -1286,9 +1303,24 @@ export class PabTableComponent implements AfterViewInit, OnInit {
const interpolatedValues: number[] = [];
const variableRange = result.variableDetails.last - result.variableDetails.first;
let totalBasinsLengths = 0;
for (const w of walls) {
for (let wi = 0; wi < walls.length; wi++) {
const w = walls[wi];
if (w instanceof Cloisons) {
totalBasinsLengths += w.prms.LB.singleValue;
if (result.variable === "ZRMB") {
// for ZRMB, exclude 1st basin
if (wi > 0) {
// half the previous basin length, half the current basin length
totalBasinsLengths += (
(walls[wi - 1] as Cloisons).prms.LB.singleValue / 2
+ w.prms.LB.singleValue / 2
);
}
} else {
// for other interpolable elevations, exclude last basin
if (wi < walls.length - 1) {
totalBasinsLengths += w.prms.LB.singleValue;
}
}
}
}
console.log(`TOTAL BASINS LENGHTS: ${totalBasinsLengths}, VARIABLE RANGE: ${variableRange}`);
......@@ -1296,23 +1328,48 @@ export class PabTableComponent implements AfterViewInit, OnInit {
interpolatedValues.push(result.variableDetails.first);
let currentValue: number = result.variableDetails.first;
for (let i = 0; i < result.variableDetails.occurrences - 1; i++) {
// compute step as percentage of total length, related to current basin length
const currentBasingLength = (walls[i] as Cloisons).prms.LB.singleValue;
const currentBasinLengthPercentage = currentBasingLength / totalBasinsLengths;
const step = variableRange * currentBasinLengthPercentage;
console.log(`Wall ${i} : length = ${currentBasingLength} / ${totalBasinsLengths}`
+ ` (${currentBasinLengthPercentage}), applying step of ${step}`);
currentValue += step;
interpolatedValues.push(round(currentValue, nDigits));
if (result.variable === "ZRMB") {
// for ZRMB, exclude 1st basin
if (i > 0) {
// compute step as percentage of total length, related to sum of
// half the previous basin length and half the current basin length
const currentLength = (
(walls[i - 1] as Cloisons).prms.LB.singleValue / 2
+ (walls[i] as Cloisons).prms.LB.singleValue / 2
);
const currentBasinLengthPercentage = currentLength / totalBasinsLengths;
const step = variableRange * currentBasinLengthPercentage;
console.log(`Wall ${i} : length = ${currentLength} / ${totalBasinsLengths}`
+ ` (${currentBasinLengthPercentage}), applying step of ${step}`);
currentValue += step;
interpolatedValues.push(round(currentValue, nDigits));
}
} else {
// for other interpolable elevations, exclude last basin
if (i < result.variableDetails.occurrences - 2) {
// compute step as percentage of total length, related to current basin length
const currentBasinLength = (walls[i] as Cloisons).prms.LB.singleValue;
const currentBasinLengthPercentage = currentBasinLength / totalBasinsLengths;
const step = variableRange * currentBasinLengthPercentage;
console.log(`Wall ${i} : length = ${currentBasinLength} / ${totalBasinsLengths}`
+ ` (${currentBasinLengthPercentage}), applying step of ${step}`);
currentValue += step;
interpolatedValues.push(round(currentValue, nDigits));
}
}
}
console.log("INTERPOPOLATED VALUES", interpolatedValues);
// interpolatedValues.push(result.variableDetails.last);
// apply
let idx = 0;
for (const s of this.selectedItems) {
for (const p of s.parameterIterator) { // deep
if (p.symbol === result.variable) {
p.singleValue = interpolatedValues[idx];
idx ++;
// for ZRMB, interpolatedValues length is shorter by 1 element
if (interpolatedValues[idx] !== undefined) {
for (const p of s.parameterIterator) { // deep
if (p.symbol === result.variable) {
p.singleValue = interpolatedValues[idx];
idx ++;
}
}
}
}
......
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