diff --git a/e2e/calculate-all-params.e2e-spec.ts b/e2e/calculate-all-params.e2e-spec.ts
index 39129ac615e92f804560d9bd3db5f34e8d14f98b..9003678bdf375829abd642fb6555a3d8ff243914 100644
--- a/e2e/calculate-all-params.e2e-spec.ts
+++ b/e2e/calculate-all-params.e2e-spec.ts
@@ -4,6 +4,7 @@ import { Navbar } from "./navbar.po";
 import { PreferencesPage } from "./preferences.po";
 import { browser, element, by } from "protractor";
 import { testedCalcTypes } from "./tested_calctypes";
+import { scrollPageToTop } from "./util.po";
 
 /**
  * For all calculators, try to calculate every parameter: check that only one parameter
@@ -65,7 +66,7 @@ describe("ngHyd − calculate all parameters of all calculators", async () => {
                         // that the calculable parameters are shown
                         if (ct === 30 && i > 0) {
                             // prevents "Element is not clickable at point"
-                            await browser.executeScript("window.scrollTo(0, 0);");
+                            await scrollPageToTop();
                             const inputLink = element(by.css("#pb-data-results-selector .drs-item a"));
                             await inputLink.click();
                         }
diff --git a/e2e/calculator.po.ts b/e2e/calculator.po.ts
index 400f4b0abbc88cf80c09be86d6a159f9362823ea..82d81213ae752de04d5fca0cb695ebe9d2e9fd11 100644
--- a/e2e/calculator.po.ts
+++ b/e2e/calculator.po.ts
@@ -1,4 +1,5 @@
-import { by, element, ElementFinder, browser } from "protractor";
+import { by, element, ElementFinder, browser, protractor, ElementArrayFinder } from "protractor";
+import { scrollPageToTop, scrollToElement } from "./util.po";
 
 export class CalculatorPage {
 
@@ -25,6 +26,66 @@ export class CalculatorPage {
         return element(by.css("h1"));
     }
 
+    /**
+     * return all selects in the calculator which id is in the form "select_*"
+     */
+    getAllCalculatorSelects(): ElementArrayFinder {
+        return element.all(by.css("mat-select[id^=select_]")); // all mat-select with id starting with "select_"
+    }
+
+    /**
+     * get the option count of a select
+     */
+    async getMatselectOptionCount(select: string | ElementFinder) {
+        const sel = select instanceof ElementFinder ? select : element(by.id(select));
+        await scrollToElement(sel);
+
+        if (await sel.isPresent() && await sel.isDisplayed()) {
+            await sel.click();
+            const options = element.all(by.css(".cdk-overlay-container mat-option"));
+            await sel.sendKeys(protractor.Key.ESCAPE); // close dropdown
+            return await options.count();
+        }
+    }
+
+    /**
+     * get the text of the all given select options
+     */
+    async getMatselectOptionsText(select: string | ElementFinder): Promise<string[]> {
+        const sel = select instanceof ElementFinder ? select : element(by.id(select));
+        await scrollToElement(sel);
+
+        if (await sel.isPresent() && await sel.isDisplayed()) {
+            await sel.click();
+            const options = element.all(by.css(".cdk-overlay-container mat-option span"));
+            let res = [];
+            const nopt = await options.count();
+            for (let o = 0; o < nopt; o++) {
+                const opt = options.get(o);
+                res.push(await opt.getText())
+            }
+            await sel.sendKeys(protractor.Key.ESCAPE); // close dropdown
+
+            return res;
+        }
+    }
+
+    /**
+     * get select current option
+     */
+    async getSelectCurrentOption(select: ElementFinder): Promise<ElementFinder> {
+        const id = await select.getAttribute("id");
+        return element(by.css("mat-select#" + id + " div[id^=mat-select-value-]"))
+    }
+
+    /**
+     * get text of select current option
+     */
+    async getMatselectCurrentOptionText(select: ElementFinder): Promise<string> {
+        const currentOption = await this.getSelectCurrentOption(select);
+        return await currentOption.element(by.css("span span")).getText();
+    }
+
     getSelectById(id: string) {
         return element(by.id(id));
     }
@@ -91,11 +152,11 @@ export class CalculatorPage {
         return element.all(by.css("fixedvar-results var-results table tbody tr"));
     }
 
-    scrollTo(elt: ElementFinder) {
-        browser.controlFlow().execute(function () {
-            browser.executeScript("arguments[0].scrollIntoView(true)", elt.getWebElement());
-        });
-    }
+    // scrollTo(elt: ElementFinder) {
+    //     browser.controlFlow().execute(function () {
+    //         browser.executeScript("arguments[0].scrollIntoView(true)", elt.getWebElement());
+    //     });
+    // }
 
     getFixedResultsTable() {
         return element(by.css(".fixed-results-inner-container table"));
@@ -246,6 +307,7 @@ export class CalculatorPage {
     }
 
     async clickSaveCalcButton() {
+        await scrollPageToTop();
         return await element(by.css("#save-calc")).click();
     }
 
@@ -287,7 +349,7 @@ export class CalculatorPage {
         const container = await this.findParentContainer(elt);
         // find radio buttons
         const button = container.element(by.css("mat-button-toggle.radio_" + mode + " > button"));
-        await browser.executeScript("window.scrollTo(0, 0);"); // sometimes button slides behind navbar and click() fails
+        await scrollPageToTop(); // sometimes button slides behind navbar and click() fails
         await button.click();
         // for "var" mode, close the modal
         if (mode === "var") {
diff --git a/e2e/clone-all-calc.e2e-spec.ts b/e2e/clone-all-calc.e2e-spec.ts
index e55c8b3f461791ffad1b8207ee81070e7c2b8879..ca352163c6d9e521ff65dd44fc3fc3160867356a 100644
--- a/e2e/clone-all-calc.e2e-spec.ts
+++ b/e2e/clone-all-calc.e2e-spec.ts
@@ -4,6 +4,7 @@ import { Navbar } from "./navbar.po";
 import { browser } from "protractor";
 import { PreferencesPage } from "./preferences.po";
 import { testedCalcTypes } from "./tested_calctypes";
+import { scrollPageToTop } from "./util.po";
 
 /**
  * Clone calculators
@@ -48,7 +49,7 @@ describe("ngHyd − clone all calculators with all possible <select> values", ()
                 const sourceValues = await calcPage.storeAllInputValues();
 
                 // clone calculator
-                await browser.executeScript("window.scrollTo(0, 0);");
+                await scrollPageToTop();
                 await calcPage.clickCloneCalcButton();
                 await browser.sleep(300);
 
diff --git a/e2e/clone-calc.e2e-spec.ts b/e2e/clone-calc.e2e-spec.ts
index c09edd3c8681301af749ec21aeda27dc34e51a54..038a90e661a28a6526a9b143f407842f3bed4329 100644
--- a/e2e/clone-calc.e2e-spec.ts
+++ b/e2e/clone-calc.e2e-spec.ts
@@ -4,6 +4,7 @@ import { CalculatorPage } from "./calculator.po";
 import { Navbar } from "./navbar.po";
 import { browser } from "protractor";
 import { PreferencesPage } from "./preferences.po";
+import { scrollPageToTop } from "./util.po";
 
 /**
  * Clone calculators
@@ -66,7 +67,7 @@ describe("ngHyd − clone a calculator", () => {
         await browser.sleep(500);
 
         // otherwise clickCloneCalcButton() fails with "Element is not clickable at point"
-        await browser.executeScript("window.scrollTo(0, 0);");
+        await scrollPageToTop();
         await calcPage.clickCloneCalcButton();
         await browser.sleep(500);
 
diff --git a/e2e/load-save-session.e2e-spec.ts b/e2e/load-save-session.e2e-spec.ts
index 6535d326565c835c536cb993be69d7025922ca9d..31780b9fe2b1a741ca0798b33fe10baf18afb514 100644
--- a/e2e/load-save-session.e2e-spec.ts
+++ b/e2e/load-save-session.e2e-spec.ts
@@ -3,21 +3,84 @@ import { ListPage } from "./list.po";
 import { CalculatorPage } from "./calculator.po";
 import { Navbar } from "./navbar.po";
 import { SideNav } from "./sidenav.po";
-import { browser } from "protractor";
+import { browser, by, element } from "protractor";
 import { PreferencesPage } from "./preferences.po";
+import { expectNumber } from "./util.po";
+
+const fs = require("fs");
+const path = require("path");
+const os = require("os");
+
+let startPage: AppPage;
+let listPage: ListPage;
+let calcPage: CalculatorPage;
+let navbar: Navbar;
+let sidenav: SideNav;
+let prefPage: PreferencesPage;
+
+async function saveSession(): Promise<string> {
+    await calcPage.clickSaveCalcButton();
+    await browser.sleep(500);
+
+    // see: https://stackoverflow.com/questions/21935696/protractor-e2e-test-case-for-downloading-pdf-file
+    const filename = path.resolve(os.homedir(), "Téléchargements/session.json");
+    if (fs.existsSync(filename)) {
+        // Make sure the browser doesn't have to rename the download.
+        fs.unlinkSync(filename);
+    }
+
+    // Le code laissé en commentaire tente de corriger un bug :
+    // il s'écoule 40 secondes entre le clic sur le bouton menu (en haut à gauche) et l'ouverture du sidenav.
+    // Ceci ne se produit que lorsqu'on sauve effectivement la session : si on annule la sauvegarde, il n'y a pas de délai.
+    // https://stackoverflow.com/questions/75235558/delay-after-downloading-a-file-in-protractor-test
+
+    //browser.manage().timeouts().implicitlyWait(100);
+    //browser.ignoreSynchronization = true;
+    // await browser.waitForAngularEnabled(false);
+
+    if (true) {
+        await calcPage.getSaveSessionButton().click();
+    } else {
+        const cancel = element(by.css("dialog-save-session button.mat-primary"));
+        await cancel.click();
+    }
+    await browser.sleep(200);
+    // browser.ignoreSynchronization = false;
+    // await browser.waitForAngularEnabled(true);
+
+    // browser.executeScript('window.stop();');
+
+    // const wins = await browser.driver.getAllWindowHandles();
+    // await browser.switchTo().window(wins[0]);
+
+    // await browser.switchTo().activeElement();
+
+    // const bd = element(by.css("body"));
+    // await browser.actions().mouseMove(bd, { x: 0, y: 0 }).click().perform();
+
+    // await navbar.clickCalculatorTab(0);
+    // await browser.sleep(200);
+
+    // browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
+
+    return filename;
+}
+
+async function loadSession(path: string) {
+    await navbar.clickMenuButton();
+    await browser.sleep(200);
+
+    await sidenav.clickLoadSessionButton();
+    await browser.sleep(200);
+
+    await sidenav.loadSessionFile(path);
+}
 
 /**
  * Save and load (serialise and unserialise) calculators to/from JSON files
  */
 describe("ngHyd − save and load sessions", () => {
-    let startPage: AppPage;
-    let listPage: ListPage;
-    let calcPage: CalculatorPage;
-    let navbar: Navbar;
-    let sidenav: SideNav;
-    let prefPage: PreferencesPage;
-
-    beforeEach(() => {
+    beforeAll(() => {
         startPage = new AppPage();
         listPage = new ListPage();
         calcPage = new CalculatorPage();
@@ -26,17 +89,16 @@ describe("ngHyd − save and load sessions", () => {
         prefPage = new PreferencesPage();
     });
 
+    beforeEach(() => {
+        jasmine.DEFAULT_TIMEOUT_INTERVAL = 45 * 60 * 1000; // 45 min
+        browser.manage().window().setPosition(2000, 30);
+    });
+
     it("when loading session-6-calc.test.json file from home page, 6 calculators should be loaded", async () => {
         await startPage.navigateTo();
 
-        await navbar.clickMenuButton();
-        await browser.sleep(200);
-
-        await sidenav.clickLoadSessionButton();
-        await browser.sleep(200);
-
-        await sidenav.loadSessionFile("./session/session-6-calc.test.json");
-        await browser.sleep(200);
+        await loadSession("./session/session-6-calc.test.json");
+        await browser.sleep(1000);
 
         expect(await navbar.getAllCalculatorTabs().count()).toBe(6);
     });
@@ -44,13 +106,7 @@ describe("ngHyd − save and load sessions", () => {
     it("when loading session-optional-params.test.json file from home page, the calculator should be loaded", async () => {
         await startPage.navigateTo();
 
-        await navbar.clickMenuButton();
-        await browser.sleep(200);
-
-        await sidenav.clickLoadSessionButton();
-        await browser.sleep(200);
-
-        await sidenav.loadSessionFile("./session/session-optional-params.test.json");
+        await loadSession("./session/session-optional-params.test.json");
         await browser.sleep(200);
 
         expect(await navbar.getAllCalculatorTabs().count()).toBe(1);
@@ -73,19 +129,7 @@ describe("ngHyd − save and load sessions", () => {
         await calcPage.getInputById("Ks").sendKeys("42");
         await browser.sleep(1000);
 
-        await calcPage.clickSaveCalcButton();
-
-        // see: https://stackoverflow.com/questions/21935696/protractor-e2e-test-case-for-downloading-pdf-file
-        const fs = require("fs");
-        const path = require("path");
-        const os = require("os");
-        const filename = path.resolve(os.homedir(), "Téléchargements/session.json");
-        if (fs.existsSync(filename)) {
-            // Make sure the browser doesn't have to rename the download.
-            fs.unlinkSync(filename);
-        }
-
-        await calcPage.getSaveSessionButton().click();
+        const filename = await saveSession();
         await browser.sleep(1000);
         const fileContent = fs.readFileSync(filename, { encoding: "utf8" });
 
@@ -93,4 +137,92 @@ describe("ngHyd − save and load sessions", () => {
         expect(fileContent).toContain(`{"symbol":"Ks","mode":"SINGLE","value":42}`);
     });
 
+    it("select value must be recovered when loading a session file", async () => {
+        // start page
+        await startPage.navigateTo();
+        await browser.sleep(200);
+
+        const calcTypes = await listPage.getAvailableCalcTypes();
+
+        const excludedCalculators = [
+            34, // vérificateur (nécessite d'ouvrir plusieurs calculettes)
+        ];
+
+        for (let i = 0; i < calcTypes.length; i++) {
+            const ct = calcTypes[i];
+            if (!excludedCalculators.includes(ct)) {
+                if (i == 0) {
+                    // enable evil option "empty fields on module creation"
+                    await prefPage.navigateTo();
+                    await prefPage.disableEvilEmptyFields();
+                    await browser.sleep(200);
+
+                    // start page
+                    await navbar.clickNewCalculatorButton();
+                    await browser.sleep(200);
+                }
+                else {
+                    // empty session
+                    await navbar.clickMenuButton();
+                    await browser.sleep(200);
+                    await sidenav.clickNewSessionButton();
+                    await browser.sleep(200);
+                }
+
+                // open calculator
+                await listPage.clickMenuEntryForCalcType(ct);
+                await browser.sleep(200);
+
+                // detect selects
+                const selects = calcPage.getAllCalculatorSelects();
+                const nsel = await selects.count();
+                for (let s = 0; s < nsel; s++) {  // /!\ ElementArrayFinder.each() is ASYNCHRONOUS !! https://www.protractortest.org/#/api?view=ElementArrayFinder.prototype.each
+                    const sel = selects.get(s);
+                    const selId = await sel.getAttribute("id");
+
+                    const options = await calcPage.getMatselectOptionsText(sel);
+                    const optionCount = options.length;
+
+                    if (optionCount > 0) {
+                        // index of current selected option
+                        const optTxt = await calcPage.getMatselectCurrentOptionText(sel);
+                        const ind = options.indexOf(optTxt);
+
+                        // select next select option (optionally looping)
+                        const nextInd = (ind + 1) % optionCount;
+                        await calcPage.changeSelectValue(sel, nextInd);
+                        await browser.sleep(200);
+
+                        // save session
+                        const filename = await saveSession();
+                        await browser.sleep(200);
+
+                        // load session
+                        await loadSession(filename); // bug here : the click on the menu button (top left) takes 40s to take effect and open the side nav!)
+                        await browser.sleep(200);
+                        // the displayed calculator is now the loaded one
+
+                        // check the calculator has been loaded
+                        expectNumber("num calcs", await navbar.getCalculatorEntriesCount(), 2);
+
+                        // check the select in the loaded session points to the same option
+                        const sel2 = calcPage.getSelectById(selId);
+
+                        // check the same option is in the select
+                        const optTxt2 = await calcPage.getMatselectCurrentOptionText(sel2);
+                        await browser.sleep(100);
+                        const ind2 = options.indexOf(optTxt2);
+                        expectNumber("opt index", ind2, nextInd);
+
+                        // close last calculator (the loaded one)
+                        await navbar.middleClickCalculatorTab(1);
+                        await browser.sleep(200);
+
+                        // check last calculator has been closed
+                        expectNumber("num calcs(2)", await navbar.getCalculatorEntriesCount(), 1);
+                    }
+                }
+            }
+        }
+    });
 });
diff --git a/e2e/navbar.po.ts b/e2e/navbar.po.ts
index 4fd34062accddf803373854bdaa30e18aa968298..814da4e216a54d63cb9e2bc443e9786a746a8964 100644
--- a/e2e/navbar.po.ts
+++ b/e2e/navbar.po.ts
@@ -31,8 +31,11 @@ export class Navbar {
         const dropDown = element(by.css("mat-select#selectCalculator"));
         if (await dropDown.isPresent() && await dropDown.isDisplayed()) {
             await dropDown.click();
-            const optionId = ".cdk-overlay-container mat-option#mat-option-" + n;
-            const option = element(by.css(optionId));
+
+            // 1st option is not necessarly "mat-option-0"...
+            const options = element.all(by.css(".cdk-overlay-container mat-option"));
+            const option = options.get(n);
+
             await option.click();
         } else {
             const tabs = this.getAllCalculatorTabs();
diff --git a/e2e/pab.e2e-spec.ts b/e2e/pab.e2e-spec.ts
index 2f75f8df9d326d084d4302160a18b7ff431de7ac..866f67fb57da855a5c8ce10d407efd3da5616ffc 100644
--- a/e2e/pab.e2e-spec.ts
+++ b/e2e/pab.e2e-spec.ts
@@ -5,6 +5,7 @@ import { browser, by, element } from "protractor";
 import { AppPage } from "./app.po";
 import { SideNav } from "./sidenav.po";
 import { PreferencesPage } from "./preferences.po";
+import { scrollPageToTop } from "./util.po";
 
 /**
  * Clone calculators
@@ -124,7 +125,7 @@ describe("ngHyd − Passe à Bassins", () => {
             await calcButtonCl.click();
 
             // make sure "Generate PAB" button is visible (it might be hidden behind navbar)
-            await browser.executeScript("window.scrollTo(0, 0);");
+            await scrollPageToTop();
             // generate PAB
             const genButton = calcPage.getGeneratePabButton();
             await genButton.isPresent();
@@ -182,7 +183,7 @@ describe("ngHyd − Passe à Bassins", () => {
             await calcButtonCl.click();
 
             // make sure "Generate PAB" button is visible (it might be hidden behind navbar)
-            await browser.executeScript("window.scrollTo(0, 0);");
+            await scrollPageToTop();
             // create PAB from it, changing modal parameters
             const genButton = calcPage.getGeneratePabButton();
             await genButton.click();
diff --git a/e2e/solveur.e2e-spec.ts b/e2e/solveur.e2e-spec.ts
index a542f32ba20103af9ac8f1e42e886e1df209998e..89ca70d6ed4b357ddf9999ae61b08f9b4c4e5a9c 100644
--- a/e2e/solveur.e2e-spec.ts
+++ b/e2e/solveur.e2e-spec.ts
@@ -5,6 +5,7 @@ import { Navbar } from "./navbar.po";
 import { browser, by, element } from "protractor";
 import { SideNav } from "./sidenav.po";
 import { PreferencesPage } from "./preferences.po";
+import { scrollPageToTop } from "./util.po";
 
 /**
  * Clone calculators
@@ -124,8 +125,8 @@ describe("Solveur - ", () => {
         const hasResults = await calcPage.hasResults();
         expect(hasResults).toBe(true);
 
-        // otherwise clickCloneCalcButton() fails with "Element is not clickable at point"
-        await browser.executeScript("window.scrollTo(0, 0);");
+        await scrollPageToTop(); // otherwise clickCloneCalcButton() fails with "Element is not clickable at point"
+
         await calcPage.clickCloneCalcButton();
         await browser.sleep(500);
 
diff --git a/e2e/util.po.ts b/e2e/util.po.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e772a28ce9c01e0c54f85d0bce84a01df90e7ac5
--- /dev/null
+++ b/e2e/util.po.ts
@@ -0,0 +1,29 @@
+import { ElementFinder, browser } from "protractor";
+
+/**
+ * scroll page to make element visible
+ */
+export async function scrollToElement(elem: ElementFinder) {
+    await browser.executeScript("arguments[0].scrollIntoView({ block: 'center' });", elem.getWebElement());
+    await browser.sleep(50);
+}
+
+/**
+ * scroll page to top
+ */
+export async function scrollPageToTop() {
+    await browser.executeScript("window.scrollTo(0, 0);");
+}
+
+/**
+ * execute expect() on numbers and displays a failure message
+ * @param msg message in caase of failure
+ * @param val value to check
+ * @param expected expected value
+ */
+export function expectNumber(msg: string, val: number, expected: number) {
+    if (val !== expected) {
+        console.log(msg, "got", val, "expected", expected);
+    }
+    expect(val).toEqual(expected);
+}
diff --git a/src/app/formulaire/definition/form-definition.ts b/src/app/formulaire/definition/form-definition.ts
index b4a34d345034ab8df49e4fbddc5f6e25f97e8e89..146d1746a8b74f4ffbaf36e2655da910816a9d1f 100644
--- a/src/app/formulaire/definition/form-definition.ts
+++ b/src/app/formulaire/definition/form-definition.ts
@@ -117,6 +117,27 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs
         return this._props;
     }
 
+    public parseConfigToProps(): Props {
+        const res: Props = new Props();
+
+        const jp = new ConfigParser(this._jsonConfig);
+        for (const fs of jp.forAll("fieldset")) {
+            const fsp = new ConfigParser(fs["fields"]);
+            for (const sel of fsp.forAll("select")) {
+                const p = sel["property"];
+                if (p !== undefined) { // if select has associated property
+                    const v = sel["default"];
+                    if (v !== undefined) { // if select has a default value for associated property
+                        const enumClass = Props.enumFromProperty[p];
+                        res.setPropValue(p, enumClass[v]);
+                    }
+                }
+            }
+        }
+
+        return res;
+    }
+
     /**
      * Creates a Nub from the given properties, and associates it to the current form
      */
diff --git a/src/app/formulaire/definition/form-pressureloss.ts b/src/app/formulaire/definition/form-pressureloss.ts
index 60c98da99b692a86de8de20bc0025ff96d6327c6..4b1e7ceb4188e1d4cb2d4f4caf03b4da1f827b80 100644
--- a/src/app/formulaire/definition/form-pressureloss.ts
+++ b/src/app/formulaire/definition/form-pressureloss.ts
@@ -1,4 +1,4 @@
-import { PressureLoss, Props, PressureLossType } from "jalhyd";
+import { PressureLoss, Props, PressureLossType, Session, PressureLossLaw, CalculatorType } from "jalhyd";
 import { FormulaireFixedVar } from "./form-fixedvar";
 
 /**
@@ -17,8 +17,19 @@ export class FormulairePressureLoss extends FormulaireFixedVar {
         if (props === undefined) {
             props = new Props();
         }
+
+        // create pressure loss parent nub
+        const pll = this.defaultProperties["pressureLossType"];
         props.setPropValue("calcType", this.calculatorType);
-        props.setPropValue("pressureLossType", this.defaultProperties["pressureLossType"]);
+        props.setPropValue("pressureLossType", pll);
         super.initNub(props);
+
+        // create pressure loss law child nub
+        const propsLaw: Props = new Props();
+        const pressureLossCalc: CalculatorType = PressureLossLaw.calcTypeFromPressureLossLaw[pll];
+        propsLaw.setPropValue("calcType", pressureLossCalc);
+        const law = Session.getInstance().createNub(propsLaw) as PressureLossLaw;
+        const pl: PressureLoss = this.currentNub as PressureLoss;
+        pl.setLaw(law);
     }
 }
diff --git a/src/app/formulaire/definition/form-section.ts b/src/app/formulaire/definition/form-section.ts
index 8f8be0af96d577110333fe270c861ec7297c621f..bf06c16b257e578889469d86dc696f6ea15249a0 100644
--- a/src/app/formulaire/definition/form-section.ts
+++ b/src/app/formulaire/definition/form-section.ts
@@ -7,16 +7,14 @@ import { SectionType } from "jalhyd";
 
 export class FormulaireSection extends FormulaireFixedVar {
 
-    /** for SectionNubs only */
-    protected _defaultSectionType;
-
     /**
      * determine default section type from select configuration
      */
     private parseDefaultSectionType() {
-        if (this._defaultSectionType === undefined) {
+        if (this.defaultProperties["nodeType"] === undefined) // still use "nodeType" for consistency, should be named "sectionType"
+        {
             const def = this.parseSelectDefaultValue(this._jsonConfig, "select_section");
-            this._defaultSectionType = SectionType[def];
+            this.defaultProperties["nodeType"] = SectionType[def];
         }
     }
 
@@ -31,7 +29,7 @@ export class FormulaireSection extends FormulaireFixedVar {
             // add new Section as first child, from given nodeType
             const propsSection = new Props();
             propsSection.setPropValue("calcType", CalculatorType.Section);
-            propsSection.setPropValue("nodeType", this._defaultSectionType);
+            propsSection.setPropValue("nodeType", this.defaultProperties["nodeType"]);
             propsSection.setPropValue(Prop_NullParameters, ServiceFactory.applicationSetupService.enableEmptyFieldsOnFormInit);
             const section = Session.getInstance().createNub(propsSection);
             this.currentNub.setSection(section as acSection);
diff --git a/src/app/formulaire/elements/formulaire-element.ts b/src/app/formulaire/elements/formulaire-element.ts
index 579b62648b34a662d8edba307d86920a98ff32d3..25b5943fa846c1790b151d0aa5d01cfec1aae4da 100644
--- a/src/app/formulaire/elements/formulaire-element.ts
+++ b/src/app/formulaire/elements/formulaire-element.ts
@@ -56,6 +56,10 @@ export abstract class FormulaireElement extends FormulaireNode {
      */
     public get parentForm(): FormulaireDefinition {
         let res = this.parent;
+        if (res === undefined) {
+            return undefined;
+        }
+
         // while (!(res instanceof FormulaireDefinition))
         while (!("calculatorName" in res)) {
             // pour éviter de faire référence au type FormulaireDefinition, supprimer l'import correspondant et
diff --git a/src/app/formulaire/elements/select/select-field-device-structure-type.ts b/src/app/formulaire/elements/select/select-field-device-structure-type.ts
index 7b188d114de529c84e9c403274e689986f9d408a..0d1ce351d60caaf53c572e8f91f7bef415917c0d 100644
--- a/src/app/formulaire/elements/select/select-field-device-structure-type.ts
+++ b/src/app/formulaire/elements/select/select-field-device-structure-type.ts
@@ -21,6 +21,14 @@ export class SelectFieldDeviceStructureType extends SelectField {
         this._configDefaultValue = json["default"];
     }
 
+    /**
+    * get discharge law linked to this select's nub
+    */
+    private get structureType(): StructureType {
+        const child = this.nub.getChildren()[this.parent.indexAsKid()];
+        return child.getPropValue("structureType");
+    }
+
     protected populate() {
         // possible values depend on CalcType
         for (const st in (this.nub as ParallelStructure).getLoisAdmissibles()) {
@@ -30,6 +38,6 @@ export class SelectFieldDeviceStructureType extends SelectField {
     }
 
     protected initSelectedValue() {
-        this.findAndSetDefaultValue();
+        this.findAndSetDefaultValue(StructureType[this.structureType]);
     }
 }
diff --git a/src/app/formulaire/elements/select/select-field.ts b/src/app/formulaire/elements/select/select-field.ts
index 86a9880048beb87da66730ef9ec3b69a45c770b3..2b9b65aa97fc770e1548718791597698decb7a09 100644
--- a/src/app/formulaire/elements/select/select-field.ts
+++ b/src/app/formulaire/elements/select/select-field.ts
@@ -50,6 +50,10 @@ export abstract class SelectField extends Field {
      * associated nub
      */
     protected get nub(): Nub {
+        const parent = this.parentForm;
+        if (parent === undefined) {
+            return undefined;
+        }
         return (this.parentForm as FormulaireDefinition).currentNub;
     }
 
@@ -128,22 +132,39 @@ export abstract class SelectField extends Field {
     }
 
     /**
-     * try to find a default value to select
+     * Try to find a default value to select.
+     * Priority order :
+     *   - passed parameter
+     *   - nub value for associated property
+     *   - default value from configuration file
+     *   - first select entry
      */
     protected findAndSetDefaultValue(value?: string) {
         // default to first available entry if any
         if (this._entries.length > 0) {
             let val: SelectEntry;
+
             if (value !== undefined) {
                 val = this.getEntryFromValue(enumValueFromString(this._associatedProperty, value));
-            } else if (this._configDefaultValue === undefined) {
-                val = this._entries[0];
+                if (val === undefined) {
+                    throw Error("invalid select default value " + value + " for " + this._associatedProperty + " property");
+                }
             } else {
-                val = this.getEntryFromValue(enumValueFromString(this._associatedProperty, this._configDefaultValue));
+                if (this.nub !== undefined) {
+                    val = this.getEntryFromValue(this.nub.getPropValue(this._associatedProperty));
+                    // nub may not have "this._associatedProperty" as a property
+                }
+                if (val === undefined && this._configDefaultValue !== undefined) {
+                    val = this.getEntryFromValue(enumValueFromString(this._associatedProperty, this._configDefaultValue));
+                    if (val === undefined) {
+                        throw Error("invalid select default value " + this._configDefaultValue + " for " + this._associatedProperty + " property");
+                    }
+                }
                 if (val === undefined) {
-                    throw Error("invalid select default value " + this._configDefaultValue + " for " + this._associatedProperty + " property");
+                    val = this._entries[0];
                 }
             }
+
             if (this._multiple) {
                 this.setValue([val]);
             } else {
diff --git a/src/app/services/formulaire.service.ts b/src/app/services/formulaire.service.ts
index 880741539bbb62d7a033a5dedc60ad76cc84eeaf..a32a1aec446448eb849d26fcddc3c5d77b81497f 100644
--- a/src/app/services/formulaire.service.ts
+++ b/src/app/services/formulaire.service.ts
@@ -371,7 +371,9 @@ export class FormulaireService extends Observable {
         if (nub) {
             f.currentNub = nub;
         } else {
-            f.initNub();
+            const confProps = f.parseConfigToProps();
+            confProps.setPropValue("calcType", ct);
+            f.initNub(confProps);
         }
 
         // Restaure le nom du module, sinon affecte le nom par défaut