AddComputingSerie(
Name: String;
DisplayName: String;
BaseSerieName: String;
Type: EmComputingSerieType;
Condition: Variant): IEmComputingSerie;
AddComputingSerie(
Name: string;
DisplayName: string;
BaseSerieName: string;
Type: Prognoz.Platform.Interop.Modeller.EmComputingSerieType;
Condition: object): Prognoz.Platform.Interop.Modeller.IEmComputingSerie;
Name. Calculated series identifier.
DisplayName. Calculated series name.
BaseSerieName. Series identifier, based on its values calculated series is calculated.
Type. Series values calculation method.
Condition. Series values calculation parameter.
The AddComputingSerie method adds a calculated series to the express modeling source series.
Features of the method use, depending on the Type parameter value:
EmComputingSerieType.Lag. Lag. Specify lag value in the Condition parameter.
EmComputingSerieType.Logarithm. Taking a logarithm. Specify logarithm degree in the Condition parameter.
EmComputingSerieType.User. Custom function. The BaseSerieName parameter value is not taken into account, specify the calculation formula in the Condition parameter.
To execute the example, add a link to the Modeller system assembly.
Sub CompSerie;
Var
ExprMod: IExpressModeller;
Ar: Array[6] Of Double;
Series: IEmSeries;
Serie: IEmSerie;
CSerie: IEmComputingSerie;
Begin
ExprMod := New ExpressModeller.Create;
Ar[0] := 56; Ar[2] := 45; Ar[3] := 23; Ar[4] := 45;
Ar[1] := Double.Nan; Ar[5] := Double.Nan;
Series := ExprMod.Series;
// Adding data series
Serie := Series.Add(Ar, "X1", "Initial series");
// Deducting its values
Debug.WriteLine("Initial data series:");
PrintSerie(Serie);
// Adding calculated data series
CSerie := Series.AddComputingSerie("F1", "Initial series ( considering lag)", "X1", EmComputingSerieType.Lag, 1);
// Deducting its values
Debug.WriteLine("Initial data series ( considering lag):");
PrintSerie(CSerie As IEmSerie);
// Modifying calculated series formula
CSerie.BaseName := "";
CSerie.Name := "F2";
CSerie.DisplayName := "Expanded data series";
CSerie.Type := EmComputingSerieType.User;
CSerie.Condition := "X1+6";
// Deducting its modified values
Debug.WriteLine("Expanded initial data series:");
PrintSerie(CSerie As IEmSerie);
End Sub CompSerie;
// Series values output procedure
Sub PrintSerie(Serie: IEmSerie);
Var
i: Integer;
Begin
Debug.Indent;
If Serie.Count > 0 Then
For i := 0 To Serie.Count - 1 Do
Debug.WriteLine(Serie.Item(i));
End For;
Else
Debug.WriteLine("Data series is empty");
End If;
Debug.Unindent;
End Sub PrintSerie;
Example execution result: simple data series is added to the initial data, its values are displayed in the console window. Based on this series calculated series is created, and its values are displayed in the console window. Then calculated series calculation formula is changed, and its new values are displayed in the console window.
Imports Prognoz.Platform.Interop.Modeller;
…
Public Shared Sub CompSerie();
Var
ExprMod: IExpressModeller;
Ar: Array[6] Of Double;
Series: IEmSeries;
Serie: IEmSerie;
CSerie: IEmComputingSerie;
Begin
ExprMod := New ExpressModeller.Create();
Ar[0] := 56; Ar[2] := 45; Ar[3] := 23; Ar[4] := 45;
Ar[1] := Double.Nan; Ar[5] := Double.Nan;
Series := ExprMod.Series;
// Adding data series
Serie := Series.Add(Ar, "X1", "Initial series");
// Deducting its values
System.Diagnostics.Debug.WriteLine("Initial data series:");
PrintSerie(Serie);
// Adding calculated data series
CSerie := Series.AddComputingSerie("F1", "Initial series ( considering lag)", "X1", EmComputingSerieType.Lag, 1);
// Deducting its values
System.Diagnostics.Debug.WriteLine("Initial data series ( considering lag):");
PrintSerie(CSerie As IEmSerie);
// Modifying calculated series formula
CSerie.BaseName := "";
CSerie.Name_2 := "F2";
CSerie.DisplayName_2 := "Expanded data series";
CSerie.Type := EmComputingSerieType.cstUser;
CSerie.Condition := "X1+6";
// Deducting its modified values
System.Diagnostics.Debug.WriteLine("Expanded initial data series:");
PrintSerie(CSerie As IEmSerie);
End Sub CompSerie;
// Series values output procedure
Public Shared Sub PrintSerie(Serie: IEmSerie);
Var
i: Integer;
Begin
System.Diagnostics.Debug.Indent();
If Serie.Count > 0 Then
For i := 0 To Serie.Count - 1 Do
System.Diagnostics.Debug.WriteLine(Serie.Item[i]);
End For;
Else
System.Diagnostics.Debug.WriteLine("Data series is empty");
End If;
System.Diagnostics.Debug.Unindent();
End Sub PrintSerie;
Example execution result: simple data series is added to the initial data, its values are displayed in the console window. Based on this series calculated series is created, and its values are displayed in the console window. Then calculated series calculation formula is changed, and its new values are displayed in the console window.
See also: