From fb8e21cf6ccbeec07ec9a9ed55c8b240d845e798 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Thu, 5 Sep 2019 09:37:05 +0200
Subject: [PATCH 1/7] Update jalhyd_branch

---
 jalhyd_branch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jalhyd_branch b/jalhyd_branch
index 1f7391f92..8147c7899 100644
--- a/jalhyd_branch
+++ b/jalhyd_branch
@@ -1 +1 @@
-master
+138-lechapt-calmon-enregistrer-la-propriete-materiau-dans-le-nub
-- 
GitLab


From e03c9ddca39eca39254e4094bed0eb19ce7c7996 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Wed, 21 Aug 2019 10:43:40 +0200
Subject: [PATCH 2/7] Fix #268 - PAB : interpoler en tenant compte de la
 longueur des bassins

---
 .../dialog-edit-pab.component.ts              |  2 ++
 .../pab-table/pab-table.component.ts          | 24 +++++++++++++------
 2 files changed, 19 insertions(+), 7 deletions(-)

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 ba3986a12..be2ee2315 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,11 @@ 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)
     );
   }
 
diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts
index a36aee801..b1c5ca849 100644
--- a/src/app/components/pab-table/pab-table.component.ts
+++ b/src/app/components/pab-table/pab-table.component.ts
@@ -1283,19 +1283,29 @@ 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 (const w of walls) {
+                                    if (w instanceof Cloisons) {
+                                        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++) {
+                                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));
                                 }
-                                interpolatedValues.push(result.variableDetails.last);
+                                // interpolatedValues.push(result.variableDetails.last);
                                 // apply
                                 let idx = 0;
                                 for (const s of this.selectedItems) {
-- 
GitLab


From c880438a56893ade0d6d4fbab1ce023501228485 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Tue, 30 Jul 2019 16:42:51 +0200
Subject: [PATCH 3/7] First attempt of modules diagram

---
 package-lock.json | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index cf83dd4e2..17c36c845 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",
-- 
GitLab


From 636665bd38a9fbd3a470c21d746d92a91b298285 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Wed, 4 Sep 2019 15:53:25 +0200
Subject: [PATCH 4/7] Fix #277: update PAB table display of ZRAM

---
 .../dialog-edit-pab.component.ts              |   1 +
 .../pab-profile-graph.component.ts            |   5 +-
 .../pab-results-table.component.ts            |   4 +-
 .../pab-table/pab-table.component.ts          | 109 +++++++++++++-----
 4 files changed, 90 insertions(+), 29 deletions(-)

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 be2ee2315..4065bed84 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
@@ -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))
     );
   }
 
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 016033443..a4fe27e1d 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 } 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)
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 aa44671b5..d685f4500 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 b1c5ca849..0586b8273 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
                 });
             }
@@ -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 ++;
+                                            }
                                         }
                                     }
                                 }
-- 
GitLab


From 0ba8357a2560d809610f300a29d95c47ec10a793 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Wed, 4 Sep 2019 17:47:58 +0200
Subject: [PATCH 5/7] Fix #268

---
 .../pab-table/pab-table.component.ts          | 20 ++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts
index 0586b8273..26e13de15 100644
--- a/src/app/components/pab-table/pab-table.component.ts
+++ b/src/app/components/pab-table/pab-table.component.ts
@@ -1240,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) {
@@ -1249,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);
                     }
                 }
@@ -1261,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
                         },
@@ -1323,7 +1329,7 @@ export class PabTableComponent implements AfterViewInit, OnInit {
                                         }
                                     }
                                 }
-                                console.log(`TOTAL BASINS LENGHTS: ${totalBasinsLengths}, VARIABLE RANGE: ${variableRange}`);
+                                // console.log(`TOTAL BASINS LENGHTS: ${totalBasinsLengths}, VARIABLE RANGE: ${variableRange}`);
                                 // generate interpolated values list
                                 interpolatedValues.push(result.variableDetails.first);
                                 let currentValue: number = result.variableDetails.first;
@@ -1339,8 +1345,8 @@ export class PabTableComponent implements AfterViewInit, OnInit {
                                             );
                                             const currentBasinLengthPercentage = currentLength / totalBasinsLengths;
                                             const step = variableRange * currentBasinLengthPercentage;
-                                            console.log(`Wall ${i} : length = ${currentLength} / ${totalBasinsLengths}`
-                                                + ` (${currentBasinLengthPercentage}), applying step of ${step}`);
+                                            /* console.log(`Wall ${i} : length = ${currentLength} / ${totalBasinsLengths}`
+                                                + ` (${currentBasinLengthPercentage}), applying step of ${step}`); */
                                             currentValue += step;
                                             interpolatedValues.push(round(currentValue, nDigits));
                                         }
@@ -1351,14 +1357,14 @@ export class PabTableComponent implements AfterViewInit, OnInit {
                                             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}`);
+                                            /* console.log(`Wall ${i} : length = ${currentBasinLength} / ${totalBasinsLengths}`
+                                                + ` (${currentBasinLengthPercentage}), applying step of ${step}`); */
                                             currentValue += step;
                                             interpolatedValues.push(round(currentValue, nDigits));
                                         }
                                     }
                                 }
-                                console.log("INTERPOPOLATED VALUES", interpolatedValues);
+                                // console.log("INTERPOPOLATED VALUES", interpolatedValues);
                                 // interpolatedValues.push(result.variableDetails.last);
                                 // apply
                                 let idx = 0;
-- 
GitLab


From a19196be657e176b5adc2bf8680bbc0778558333 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Thu, 5 Sep 2019 10:18:44 +0200
Subject: [PATCH 6/7] PAB profile: plot ZRMB in apron line, along with ZRAM

---
 .../pab-profile-graph.component.ts                  | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

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 a4fe27e1d..1fcbeb2d5 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,7 +8,7 @@ import { ResultsComponent } from "../fixedvar-results/results.component";
 import { PabResults } from "../../results/pab-results";
 import { IYSeries } from "../../results/y-series";
 
-import { CloisonAval } from "jalhyd";
+import { CloisonAval, Cloisons } from "jalhyd";
 
 @Component({
     selector: "pab-profile-graph",
@@ -226,22 +226,29 @@ 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 dw = (this._results.cloisonAvalResults.sourceNub as CloisonAval);
-- 
GitLab


From 7bf4b4354853516a4473478fd31a47a399744157 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Thu, 5 Sep 2019 12:03:14 +0200
Subject: [PATCH 7/7] Fix #276 LC material selector

---
 .../lechapt-calmon/lechapt-calmon.config.json |  1 +
 .../concrete/form-lechapt-calmon.ts           | 47 -------------------
 src/app/formulaire/fieldset.ts                | 20 +++++++-
 src/app/formulaire/select-field.ts            |  1 -
 .../services/formulaire/formulaire.service.ts |  5 --
 5 files changed, 20 insertions(+), 54 deletions(-)
 delete mode 100644 src/app/formulaire/definition/concrete/form-lechapt-calmon.ts

diff --git a/src/app/calculators/lechapt-calmon/lechapt-calmon.config.json b/src/app/calculators/lechapt-calmon/lechapt-calmon.config.json
index 9d2e58903..35f9c27fd 100644
--- a/src/app/calculators/lechapt-calmon/lechapt-calmon.config.json
+++ b/src/app/calculators/lechapt-calmon/lechapt-calmon.config.json
@@ -2,6 +2,7 @@
     {
         "id": "fs_materiau",
         "type": "fieldset",
+        "defaultMaterial": "UnlinedCastIronCoarseConcrete",
         "fields": [
             {
                 "id": "select_material",
diff --git a/src/app/formulaire/definition/concrete/form-lechapt-calmon.ts b/src/app/formulaire/definition/concrete/form-lechapt-calmon.ts
deleted file mode 100644
index 2d7376222..000000000
--- a/src/app/formulaire/definition/concrete/form-lechapt-calmon.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import { LechaptCalmon, Observer } from "jalhyd";
-import { SelectField } from "../../select-field";
-import { FormulaireBase } from "./form-base";
-import { NgParamInputComponent } from "../../../components/ngparam-input/ngparam-input.component";
-
-export class FormulaireLechaptCalmon extends FormulaireBase implements Observer {
-
-    protected completeParse(json: {}) {
-        super.completeParse(json);
-        // abonnement au changement de valeur du select de matériau
-        this.getFormulaireNodeById("select_material").addObserver(this);
-        // abonnement au changement de valeur de l'un des trois champs affectés par le changement de matériau
-        this.getParamFromSymbol("L").addObserver(this);
-        this.getParamFromSymbol("M").addObserver(this);
-        this.getParamFromSymbol("N").addObserver(this);
-    }
-
-    // interface Observer
-
-    public update(sender: any, data: any) {
-
-        super.update(sender, data);
-
-        // en cas de changement de valeur du select de matériau, effacement des résultats et MAJ des champs L,M,N
-        if (sender instanceof SelectField) {
-            if (data.action === "select") {
-                if (data.value._value !== "") {
-                    (this.currentNub as LechaptCalmon).applyMaterialPreset(data.value._value);
-                }
-                // update GUI
-                this.getParamFromSymbol("L").notifyValueModified(this);
-                this.getParamFromSymbol("M").notifyValueModified(this);
-                this.getParamFromSymbol("N").notifyValueModified(this);
-                this.reset();
-
-            }
-        }
-        if (sender instanceof NgParamInputComponent) {
-            if (data.action === "ngparamAfterValue") {
-                // value of L, M or N changed
-                const materialSelect = this.getFormulaireNodeById("select_material") as SelectField;
-                // reset material select field to "" (empty)
-                materialSelect.setValue(materialSelect.entries[0]);
-            }
-        }
-    }
-}
diff --git a/src/app/formulaire/fieldset.ts b/src/app/formulaire/fieldset.ts
index fcfbb4e88..43516325d 100644
--- a/src/app/formulaire/fieldset.ts
+++ b/src/app/formulaire/fieldset.ts
@@ -1,4 +1,14 @@
-import { CalculatorType, ComputeNodeType, ParamDefinition, LoiDebit, Props, Observer, Nub, MethodeResolution, StructureType } from "jalhyd";
+import {
+    CalculatorType,
+    ComputeNodeType,
+    ParamDefinition,
+    LCMaterial,
+    LoiDebit,
+    Props,
+    Observer,
+    Nub,
+    MethodeResolution,
+} from "jalhyd";
 
 import { FormulaireElement } from "./formulaire-element";
 import { Field } from "./field";
@@ -223,6 +233,10 @@ export class FieldSet extends FormulaireElement implements Observer {
                 this.setSelectValueFromProperty("select_resolution", "methodeResolution");
                 break;
 
+            case "fs_materiau":
+                this.setSelectValueFromProperty("select_material", "material");
+                break;
+
             case "fs_target_data": // courbe de remous
                 this.setSelectValueFromProperty("select_target", "varCalc");
                 break;
@@ -290,6 +304,7 @@ export class FieldSet extends FormulaireElement implements Observer {
         this.setPropertyValueFromConfig(json, "defaultStructType", "structureType");
         this.setPropertyValueFromConfig(json, "defaultLoiDebit", "loiDebit", LoiDebit);
         this.setPropertyValueFromConfig(json, "methodeResolution", "methodeResolution", MethodeResolution);
+        this.setPropertyValueFromConfig(json, "defaultMaterial", "material", LCMaterial);
         this.setPropertyValueFromConfig(json, "varCalc", "varCalc");
 
         this.updateFields();
@@ -358,6 +373,9 @@ export class FieldSet extends FormulaireElement implements Observer {
                         case "select_target": // courbes de remous, variable à calculer
                             this.setPropValue("varCalc", data.value.value);
                             break;
+                        case "select_material": // Lechapt-Calmon, matériau
+                            this.setPropValue("material", data.value.value);
+                            break;
                     }
                     break;
             }
diff --git a/src/app/formulaire/select-field.ts b/src/app/formulaire/select-field.ts
index 7e87dd83b..ff15ce822 100644
--- a/src/app/formulaire/select-field.ts
+++ b/src/app/formulaire/select-field.ts
@@ -108,7 +108,6 @@ export class SelectField extends Field {
         switch (source) {
 
             case "lechapt_calmon_material":
-                this.addEntry(new SelectEntry(this._entriesBaseId + "empty", ""));
                 let i = 0;
                 for (const mat of LechaptCalmon.materials) {
                     const e: SelectEntry = new SelectEntry(this._entriesBaseId + (i + 1), i);
diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts
index c88c9681a..50007ca1d 100644
--- a/src/app/services/formulaire/formulaire.service.ts
+++ b/src/app/services/formulaire/formulaire.service.ts
@@ -25,7 +25,6 @@ import { InputField } from "../../formulaire/input-field";
 import { SelectField } from "../../formulaire/select-field";
 import { StringMap } from "../../stringmap";
 import { FormulaireBase } from "../../formulaire/definition/concrete/form-base";
-import { FormulaireLechaptCalmon } from "../../formulaire/definition/concrete/form-lechapt-calmon";
 import { FormulaireSectionParametree } from "../../formulaire/definition/concrete/form-section-parametree";
 import { FormulaireCourbeRemous } from "../../formulaire/definition/concrete/form-courbe-remous";
 import { FormulaireRegimeUniforme } from "../../formulaire/definition/concrete/form-regime-uniforme";
@@ -273,10 +272,6 @@ export class FormulaireService extends Observable {
         let f: FormulaireDefinition;
         switch (ct) {
 
-            case CalculatorType.LechaptCalmon:
-                f = new FormulaireLechaptCalmon();
-                break;
-
             case CalculatorType.SectionParametree:
                 f = new FormulaireSectionParametree();
                 break;
-- 
GitLab