diff --git a/package-lock.json b/package-lock.json index cf83dd4e2af7dbc28b7e4b7c7c491586daa26b28..17c36c84572cb58c2054150759954b586645446c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2599,8 +2599,7 @@ "ansi-colors": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", - "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==", - "dev": true + "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==" }, "ansi-escapes": { "version": "3.2.0", @@ -2612,7 +2611,6 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/ansi-gray/-/ansi-gray-0.1.1.tgz", "integrity": "sha1-KWLPVOyXksSFEKPetSRDaGHvclE=", - "dev": true, "requires": { "ansi-wrap": "0.1.0" } @@ -2653,8 +2651,7 @@ "ansi-wrap": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", - "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", - "dev": true + "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=" }, "anymatch": { "version": "2.0.0", @@ -4617,8 +4614,7 @@ "color-support": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==" }, "colors": { "version": "1.3.3", @@ -7663,7 +7659,6 @@ "version": "1.3.3", "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.3.tgz", "integrity": "sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw==", - "dev": true, "requires": { "ansi-gray": "^0.1.1", "color-support": "^1.1.3", @@ -12600,6 +12595,14 @@ } } }, + "param-case": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz", + "integrity": "sha1-35T9jPZTHs915r75oIWPvHK+Ikc=", + "requires": { + "no-case": "^2.2.0" + } + }, "parse-asn1": { "version": "5.1.4", "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.4.tgz", @@ -12658,8 +12661,7 @@ "parse-node-version": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz", - "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==", - "dev": true + "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==" }, "parse-path": { "version": "3.0.4", @@ -15862,8 +15864,7 @@ "time-stamp": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", - "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", - "dev": true + "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=" }, "timed-out": { "version": "4.0.1", diff --git a/src/app/components/dialog-edit-pab/dialog-edit-pab.component.ts b/src/app/components/dialog-edit-pab/dialog-edit-pab.component.ts index ba3986a127aafa0f69422d61c870e66ea81bc9db..4065bed84818170c6edfc2050d72bfc442913b25 100644 --- a/src/app/components/dialog-edit-pab/dialog-edit-pab.component.ts +++ b/src/app/components/dialog-edit-pab/dialog-edit-pab.component.ts @@ -130,9 +130,12 @@ export class DialogEditPabComponent { } public get interpolationEnabled() { + const varDetails = this.findVariableDetails(this.variable); return ( this.vertical && (this.selectedItemsAbstract.devices + this.selectedItemsAbstract.wallsDevices) > 1 + && (varDetails.occurrences > 1) + && ([ "ZRAM", "ZRMB", "ZDV" ].includes(this.variable)) ); } diff --git a/src/app/components/pab-profile-graph/pab-profile-graph.component.ts b/src/app/components/pab-profile-graph/pab-profile-graph.component.ts index 016033443eb0f135baf90f4eedf855be877c353f..1fcbeb2d5fe59f8bb3015a6bdaa774af02ed9f21 100644 --- a/src/app/components/pab-profile-graph/pab-profile-graph.component.ts +++ b/src/app/components/pab-profile-graph/pab-profile-graph.component.ts @@ -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, Cloisons } from "jalhyd"; + @Component({ selector: "pab-profile-graph", templateUrl: "./pab-profile-graph.component.html", @@ -224,25 +226,33 @@ export class PabProfileGraphComponent extends ResultsComponent { const pabLength = Number(xs[xs.length - 1]) - Number(xs[0]); const pabLength5Pct = (pabLength * 5) / 100; - // 1. fond du machin + // 1. radier (cotes amont et mi-bassin) const dataF: { x: string, y: string }[] = []; const nDigits = this.appSetupService.displayDigits; - // extend upstrem + // extend upstream dataF.push({ x: (Number(xs[0]) - pabLength5Pct).toFixed(nDigits), y: this._results.cloisonsResults[0].resultElement.getValue("ZRAM").toFixed(nDigits) }); // regular walls for (let i = 0; i < this._results.cloisonsResults.length; i++) { + const c = (this._results.result.sourceNub.getChildren()[i] as Cloisons); const cr = this._results.cloisonsResults[i]; const ZRAM = cr.resultElement.getValue("ZRAM"); // any ResultElement will do + const ZRMB = cr.resultElement.getValue("ZRMB"); // any ResultElement will do + const halfLB = c.prms.LB.singleValue / 2; dataF.push({ x: xs[i], y: ZRAM.toFixed(nDigits) }); + dataF.push({ + x: (Number(xs[i]) + halfLB).toFixed(nDigits), + y: ZRMB.toFixed(nDigits) + }); } // 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) diff --git a/src/app/components/pab-results/pab-results-table.component.ts b/src/app/components/pab-results/pab-results-table.component.ts index aa44671b53593ad07e3ed04c71e2c1f28d18ae5f..d685f450073047bc76b641d483536756e724cd92 100644 --- a/src/app/components/pab-results/pab-results-table.component.ts +++ b/src/app/components/pab-results/pab-results-table.component.ts @@ -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) { diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index a36aee80100e37084915b49f6ab772ba037a44e1..26e13de15eb8371fbb3f4b3876542851d8031d1c 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -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 }); } @@ -1223,6 +1240,7 @@ export class PabTableComponent implements AfterViewInit, OnInit { } } } + const reallySelectedWalls = [...walls]; // array copy // 2nd pass for (const c of this.selectedItems) { if (c instanceof Structure) { @@ -1232,6 +1250,11 @@ export class PabTableComponent implements AfterViewInit, OnInit { } else { vertical = (vertical && (c.findPositionInParent() === firstDevicePosition)); } + // add parent wall for basin-length based interpolation + const parentWall = (c.parent as ParallelStructure); + if (parentWall && ! walls.includes(parentWall)) { + walls.push(parentWall); + } devices.push(c); } } @@ -1244,7 +1267,7 @@ export class PabTableComponent implements AfterViewInit, OnInit { data: { availableVariables: availableVariables, selectedItemsAbstract: { - walls: walls.length, + walls: reallySelectedWalls.length, wallsDevices: wallsDevices.length, devices: devices.length }, @@ -1283,26 +1306,76 @@ export class PabTableComponent implements AfterViewInit, OnInit { case "interpolate": if (result.variableDetails.occurrences > 1) { const nDigits = this.appSetupService.displayDigits; - // build values list const interpolatedValues: number[] = []; - const step = ( - (result.variableDetails.last - result.variableDetails.first) - / (result.variableDetails.occurrences - 1) - ); + const variableRange = result.variableDetails.last - result.variableDetails.first; + let totalBasinsLengths = 0; + for (let wi = 0; wi < walls.length; wi++) { + const w = walls[wi]; + if (w instanceof Cloisons) { + 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}`); + // generate interpolated values list interpolatedValues.push(result.variableDetails.first); let currentValue: number = result.variableDetails.first; - for (let i = 0; i < result.variableDetails.occurrences - 2; i++) { - currentValue += step; - interpolatedValues.push(round(currentValue, nDigits)); + for (let i = 0; i < result.variableDetails.occurrences - 1; i++) { + 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)); + } + } } - interpolatedValues.push(result.variableDetails.last); + // 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 ++; + } } } }