diff --git a/src/nub.ts b/src/nub.ts index 22aa2f40fc13fcb7257f048fd8cccb1a77ead0c8..21463a8c472f252637c6d665058a50a8846fbbb9 100644 --- a/src/nub.ts +++ b/src/nub.ts @@ -339,17 +339,9 @@ export abstract class Nub extends ComputeNode implements IObservable { } // find calculated parameter - let computedSymbol: any; - if (sDonnee) { - computedSymbol = sDonnee; - } else { - if (this.calculatedParam === undefined) { - throw new Error(`CalcSerie() : aucun paramètre à calculer`); - } - computedSymbol = this.calculatedParamDescriptor; - } + const computedSymbol = this.findCalculatedParameter(sDonnee); - if (rInit === undefined) { + if (rInit === undefined && this.calculatedParam) { rInit = this.calculatedParam.v; } @@ -436,8 +428,10 @@ export abstract class Nub extends ComputeNode implements IObservable { this.progress = 100; } - const realSymbol = (typeof computedSymbol === "string") ? computedSymbol : computedSymbol.symbol; - this._result.name = realSymbol; + if (computedSymbol !== undefined) { + const realSymbol = (typeof computedSymbol === "string") ? computedSymbol : computedSymbol.symbol; + this._result.name = realSymbol; + } this.notifyResultUpdated(); @@ -1141,6 +1135,19 @@ export abstract class Nub extends ComputeNode implements IObservable { this._observable.notifyObservers(data, sender); } + protected findCalculatedParameter(sDonnee: any): any { + let computedSymbol: any; + if (sDonnee) { + computedSymbol = sDonnee; + } else { + if (this.calculatedParam === undefined) { + throw new Error(`CalcSerie() : aucun paramètre à calculer`); + } + computedSymbol = this.calculatedParamDescriptor; + } + return computedSymbol; + } + protected doCalc(computedSymbol?: any, rInit?: number) { return this.Calc(computedSymbol, rInit); } diff --git a/src/section/section_parametree.ts b/src/section/section_parametree.ts index a943d060ed1deca347f252d88c2fc4907ad70f0c..4a7da8dd7a88443c80029c378ebfe83eb616696e 100644 --- a/src/section/section_parametree.ts +++ b/src/section/section_parametree.ts @@ -137,6 +137,12 @@ export class SectionParametree extends SectionNub { return this._result; } + // calculated param is always "Y" + protected findCalculatedParameter(sDonnee: any): any { + return undefined; + } + + // calculated param is always "Y" protected doCalc(computedSymbol?: any, rInit?: number) { return this.Calc(); }