IMsMethod.Execute

Syntax

Execute(Calculation: IMsMethodCalculation; Coord: IMsFormulaTransformCoord): IMsModelCalculationResult;

Parameters

Calculation. Settings that are necessary for model calculation

Coord. The slice, by which calculation is executed.

Description

The Execute method calculates model and returns calculation results.

Example

Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier. The container includes a model with the MODEL_LINREG identifier. The model uses the method of linear regression (OLS estimation) for calculation.

Sub Main;

Var

MB: IMetabase;

Model: IMsModel;

Transform: IMsFormulaTransform;

VarTrans: IMsFormulaTransformVariable;

Tree: IMsFormulaTransformSlicesTree;

Slice: IMsFormulaTransformSlice;

Selector: IMsFormulaTransformSelector;

Formula: IMsFormula;

LinReg: IMsLinearRegressionTransform;

Coord: IMsFormulaTransformCoord;

Calc: IMsModelCalculation;

CalcRes: IMsModelCalculationResult;

Begin

MB := MetabaseClass.Active;

Model := MB.ItemByIdNamespace("MODEL_LINREG", MB.ItemById("MODEL_SPACE").Key).Bind As IMsModel;

Transform := Model.Transform;

VarTrans := Transform.Outputs.Item(0);

Tree := VarTrans.SlicesTree(VarTrans);

Slice := Tree.CreateSlice(1);

Selector := Model.Output.Item(0).Transform.CreateSelector;

Selector.Slice := Slice;

Formula := Model.Transform.Transform(Selector);

LinReg := Formula.Method As IMsLinearRegressionTransform;

Coord := Model.Transform.CreateCoord(VarTrans);

Calc := Model.CreateCalculation;

Calc.Period.IdentificationStartDate := DateTime.ComposeDay(1990, 01, 01);

Calc.Period.IdentificationEndDate := DateTime.ComposeDay(2007, 12, 31);

Calc.Period.ForecastStartDate := DateTime.ComposeDay(2008, 01, 01);

Calc.Period.ForecastEndDate := DateTime.ComposeDay(2010, 12, 31);

CalcRes := LinReg.Execute(Calc As IMsMethodCalculation, Coord);

End Sub Main;

After executing the example the model is calculated.

See also:

IMsMethod