diff --git a/src/app/calculators/remous/remous.config.json b/src/app/calculators/remous/remous.config.json index 61afbc02d7169ac14410ad57926c2b96a6d1d4ff..2110d94c04703d22a68ad4873a1a703318c6a6db 100644 --- a/src/app/calculators/remous/remous.config.json +++ b/src/app/calculators/remous/remous.config.json @@ -26,7 +26,6 @@ { "id": "fs_section_trapez", "type": "fieldset", - "nodeType": "SectionTrapeze", "option": "fix", "dep_exist": [ { @@ -38,21 +37,20 @@ { "type": "input", "id": "LargeurFond", - "unit": "m", - "value": 2.5 + "nodeType": "SectionTrapeze", + "unit": "m" }, { "type": "input", "id": "Fruit", - "unit": "m/m", - "value": 0.56 + "nodeType": "SectionTrapeze", + "unit": "m/m" } ] }, { "id": "fs_section_rect", "type": "fieldset", - "nodeType": "SectionRectangle", "option": "fix", "dep_exist": [ { @@ -64,15 +62,14 @@ { "type": "input", "id": "LargeurBerge", - "unit": "m", - "value": 2.5 + "nodeType": "SectionRectangle", + "unit": "m" } ] }, { "id": "fs_section_circ", "type": "fieldset", - "nodeType": "SectionCercle", "option": "fix", "dep_exist": [ { @@ -84,15 +81,14 @@ { "type": "input", "id": "D", - "unit": "m", - "value": 2 + "nodeType": "SectionCercle", + "unit": "m" } ] }, { "id": "fs_section_puiss", "type": "fieldset", - "nodeType": "SectionPuissance", "option": "fix", "dep_exist": [ { @@ -104,14 +100,14 @@ { "type": "input", "id": "k", - "unit": "", - "value": 0.5 + "nodeType": "SectionPuissance", + "unit": "" }, { "type": "input", "id": "LargeurBerge", - "unit": "m", - "value": 2 + "nodeType": "SectionPuissance", + "unit": "m" } ] }, @@ -123,26 +119,22 @@ { "type": "input", "id": "Ks", - "unit": "m1/3s-1", - "value": 40 + "unit": "m1/3s-1" }, { "type": "input", "id": "Long", - "unit": "m", - "value": 100 + "unit": "m" }, { "type": "input", "id": "If", - "unit": "m/m", - "value": 0.001 + "unit": "m/m" }, { "type": "input", "id": "YB", - "unit": "m", - "value": 1 + "unit": "m" } ] }, @@ -154,20 +146,17 @@ { "type": "input", "id": "Q", - "unit": "m³/s", - "value": 2 + "unit": "m³/s" }, { "type": "input", "id": "Yaval", - "unit": "m", - "value": 0.4 + "unit": "m" }, { "type": "input", "id": "Yamont", - "unit": "m", - "value": 0.15 + "unit": "m" } ] }, @@ -179,8 +168,7 @@ { "type": "input", "id": "Dx", - "unit": "m", - "value": 5 + "unit": "m" }, { "type": "input", diff --git a/src/app/components/remous-results/remous-results.component.ts b/src/app/components/remous-results/remous-results.component.ts index c553ecc73958877ab31f633c1cb1c986f79ed5e1..9b8bccc04773e947f87327da63e34b4d8c810dd6 100644 --- a/src/app/components/remous-results/remous-results.component.ts +++ b/src/app/components/remous-results/remous-results.component.ts @@ -244,8 +244,8 @@ export class RemousResultsComponent { gr1.drawLine(0, 0, 3, "#753F00", this.uitextFond, "#753F00"); // ligne de berge - if (this._remousResults.hautBerge != undefined && this._remousResults.hautBerge.ok) - gr1.drawLine(this._remousResults.hautBerge.vCalc, this._remousResults.hautBerge.vCalc, 4, "#C58F50", this.uitextBerge); + if (this._remousResults.hautBerge) + gr1.drawLine(this._remousResults.hautBerge, this._remousResults.hautBerge, 4, "#C58F50", this.uitextBerge); // hauteur normale if (this._remousResults.hautNormale != undefined && this._remousResults.hautNormale.ok) diff --git a/src/app/formulaire/definition/concrete/form-courbe-remous.ts b/src/app/formulaire/definition/concrete/form-courbe-remous.ts index 2ee61461465b9df3069dc1262b1d0e24c4a1de05..af674161bd45903ef2e50bf56345cf2bbf93437d 100644 --- a/src/app/formulaire/definition/concrete/form-courbe-remous.ts +++ b/src/app/formulaire/definition/concrete/form-courbe-remous.ts @@ -1,4 +1,4 @@ -import { CalculatorType } from "jalhyd"; +import { CalculatorType, ComputeNodeType } from "jalhyd"; import { ParamService } from "../../../services/param/param.service"; import { ApplicationSetupService } from "../../../services/app-setup/app-setup.service"; @@ -23,6 +23,10 @@ export class FormulaireCourbeRemous extends FormulaireDefinition { } protected createNubs() { + this._nubs.set(ComputeNodeType.SectionCercle, this.paramService.createNub(this.calculatorType, ComputeNodeType.SectionCercle)); + this._nubs.set(ComputeNodeType.SectionPuissance, this.paramService.createNub(this.calculatorType, ComputeNodeType.SectionPuissance)); + this._nubs.set(ComputeNodeType.SectionRectangle, this.paramService.createNub(this.calculatorType, ComputeNodeType.SectionRectangle)); + this._nubs.set(ComputeNodeType.SectionTrapeze, this.paramService.createNub(this.calculatorType, ComputeNodeType.SectionTrapeze)); } protected initParse() { diff --git a/src/app/formulaire/definition/form-compute-courbe-remous.ts b/src/app/formulaire/definition/form-compute-courbe-remous.ts index eb0f82842322b923dfcba748caf9f8863c1e8019..fcabe29f5c444de01d8a60aebcabf14138d5546d 100644 --- a/src/app/formulaire/definition/form-compute-courbe-remous.ts +++ b/src/app/formulaire/definition/form-compute-courbe-remous.ts @@ -26,23 +26,14 @@ export class FormComputeCourbeRemous extends FormCompute { } protected compute() { - // var np: [ComputeNode, ParamsEquation] = this.getNubAndParameters(); - // let sect: acSection = np[0] as acSection; - // let prmSect: ParamsEquation = np[1]; - - const sectNub: SectionParametree = this.getCurrentNub() as SectionParametree; - const sect: acSection = sectNub.section; - - let Yamont: number = this._formBase.getParameterValue("Yamont"); // tirant amont - let Yaval: number = this._formBase.getParameterValue("Yaval"); // tirant aval - let Dx: number = this._formBase.getParameterValue("Dx"); // pas de discrétisation - let Long: number = this._formBase.getParameterValue("Long"); // longueur du bief - let If: number = this._formBase.getParameterValue("If"); // pente du fond - let YB: number = this._formBase.getParameterValue("YB"); // hauteur de berge + const cr: CourbeRemous = this.getCurrentNub() as CourbeRemous; + const prmCR: CourbeRemousParams = cr.parameters as CourbeRemousParams; + const sect: acSection = prmCR.Sn; + let Yn: Result = sect.Calc("Yn"); // hauteur normale let Yc: Result = sect.Calc("Yc"); // hauteur critique - this.remousResults.penteFond = If; + this.remousResults.parameters = prmCR; // méthode de résolution @@ -56,21 +47,18 @@ export class FormComputeCourbeRemous extends FormCompute { else if (smeth == "select_resolution_euler") methRes = MethodeResolution.EulerExplicite; else - throw "GenericCalculatorComponent.doComputeRemous() : type de méthode de résolution '" + smeth + "' inconnu"; + throw "FormComputeCourbeRemous.compute() : type de méthode de résolution '" + smeth + "' inconnu"; - // paramètre supplémentaire à calculer + // variable supplémentaire à calculer const extraSymbol: string = this._formBase.getSelectedValue("select_target"); // calcul - let prmCR: CourbeRemousParams = new CourbeRemousParams(sect, Yamont, Yaval, Long, Dx, methRes); - let cr = new CourbeRemous(prmCR); - let res: Result = cr.calculRemous(extraSymbol == "none" ? undefined : extraSymbol); + this.remousResults.result = cr.calculRemous(extraSymbol == "none" ? undefined : extraSymbol); - // affichage du graphe + // données du graphe - this.remousResults.hauteurBerge = new ResultElement(YB); this.remousResults.hauteurNormale = Yn.resultElement; this.remousResults.hauteurCritique = Yc.resultElement; if (extraSymbol != "none") { @@ -79,12 +67,5 @@ export class FormComputeCourbeRemous extends FormCompute { } else this.remousResults.extraGraph = false; - - // résultats numériques - - this.remousResults.result = res; - const xValues = new ParamValues(); - xValues.setValues(0, Long, Dx); - this.remousResults.xValues = xValues; } } diff --git a/src/app/results/remous-results.ts b/src/app/results/remous-results.ts index 1ef254c4c39b753105e6f7c47018c177a57900ed..c450fe10ba384b5717e4e8f49bd3a59f16cb2210 100644 --- a/src/app/results/remous-results.ts +++ b/src/app/results/remous-results.ts @@ -1,4 +1,4 @@ -import { cLog, Result, ResultElement, ParamValues } from "jalhyd"; +import { cLog, Result, ResultElement, ParamValues, CourbeRemousParams } from "jalhyd"; import { CalculatorResults } from "./calculator-results"; @@ -10,7 +10,7 @@ export class RemousResults extends CalculatorResults { /** * hauteur de berge */ - private _hautBerge: ResultElement; + private _hautBerge: number; /** * pente du fond @@ -75,6 +75,24 @@ export class RemousResults extends CalculatorResults { this._extraGraph = false; } + public set parameters(p: CourbeRemousParams) { + // pente du fond + this._penteFond = p.map.If.v; + + // hauteur de berge + this._hautBerge = p.map.YB.v; + + // longueur du bief + const Long = p.map.Long.v; + + // pas d'espace + const Dx = p.map.Dx.v; + + // série de valeurs de X + this._xValues = new ParamValues(); + this._xValues.setValues(0, Long, Dx); + } + public get log() { return this._log; } @@ -83,10 +101,6 @@ export class RemousResults extends CalculatorResults { return this._xValues; } - public set xValues(p: ParamValues) { - this._xValues = p; - } - public get result(): Result { return this._result; } @@ -122,18 +136,10 @@ export class RemousResults extends CalculatorResults { return this._hautBerge; } - public set hauteurBerge(v: ResultElement) { - this._hautBerge = v; - } - public get penteFond() { return this._penteFond; } - public set penteFond(v: number) { - this._penteFond = v; - } - public get hautNormale() { return this._hautNormale; }