Result: IMsFormulaTerm;
Result: Prognoz.Platform.Interop.Ms.IMsFormulaTerm;
The Result property returns the term corresponding to output variable.
To get collection of terms used to compose model equation, use the IMsDeterministicTransform.Operands property.
Executing the example requires that the repository contains a modeling container with the MS identifier that contains a determinate equation model with the MODEL_D identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
ModelCont: IMetabaseObjectDescriptor;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
Determ: IMsDeterministicTransform;
i: integer;
Calc: IMsMethodCalculation;
arr: Array Of Double;
Period: IMsModelPeriod;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get modeling container
ModelCont := mb.ItemById("MS");
// Get error correction model
Model := mb.ItemByIdNamespace("MODEL_D", ModelCont.Key).Edit As IMsModel;
// Set formula actual period
Model.CalculationPeriod := MsCalculationPeriod.Both;
// Get model parameters
Transform := Model.Transform;
Formula := Transform.FormulaItem(0);
Determ := Formula.Method As IMsDeterministicTransform;
// Create an object with model calculation parameters
Calc := Transform.CreateCalculation;
// Set calculation periods
Period := Model.Transform.Period;
Calc.Period.IdentificationStartDate := Period.IdentificationStartDate;
Calc.Period.IdentificationEndDate := Period.IdentificationEndDate;
Calc.Period.ForecastStartDate := Period.ForecastStartDate;
Calc.Period.ForecastEndDate := Period.ForecastEndDate;
Calc.CurrentPoint := Period.IdentificationStartDate;
// Get output variable data and display it in the console window
arr := Determ.Result.Serie(Calc);
For i := 0 To arr.Length - 1 Do
Debug.WriteLine(arr[i]);
End For;
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the console displays values of output variable.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
ModelCont: IMetabaseObjectDescriptor;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
Determ: IMsDeterministicTransform;
i: integer;
Calc: IMsMethodCalculation;
arr: System.Array;
Period: IMsModelPeriod;
Begin
// Get current repository
mb := Params.Metabase;
// Get modeling container
ModelCont := mb.ItemById["MS"];
// Get error correction model
Model := mb.ItemByIdNamespace["MODEL_D", ModelCont.Key].Edit() As IMsModel;
// Set formula actual period
Model.CalculationPeriod := MsCalculationPeriod.mcpBoth;
// Get model parameters
Transform := Model.Transform;
Formula := Transform.FormulaItem[0];
Determ := Formula.Method As IMsDeterministicTransform;
// Create an object with model calculation parameters
Calc := Transform.CreateCalculation();
// Set calculation periods
Period := Model.Transform.Period;
Calc.Period.IdentificationStartDate := Period.IdentificationStartDate;
Calc.Period.IdentificationEndDate := Period.IdentificationEndDate;
Calc.Period.ForecastStartDate := Period.ForecastStartDate;
Calc.Period.ForecastEndDate := Period.ForecastEndDate;
Calc.CurrentPoint := Period.IdentificationStartDate;
// Get output variable data and display it in the console window
arr := Determ.Result.Serie[Calc];
For i := 0 To arr.Length - 1 Do
System.Diagnostics.Debug.WriteLine(arr[i]);
End For;
(Model As IMetabaseObject).Save();
End Sub;
See also: