IMsUserTransformImplementation.Params

Syntax

Params: IMsUserMethodParams;

Description

The Params property returns model parameters used in calculation. This property must be predetermined in the user class.

Example

 Public Class My_Method: Object, IMsUserTransformImplementation

Param1, Param2: Double;

 

Sub Execute(Calculation: IMsMethodCalculation; Coo: IMsFormulaTransformCoord; Explained: IMsFormulaTerm; Explanatories: IMsFormulaTermList);

Var

Matr: IMatrix;

Mcoo: IMatrixCoord;

Cub: ICubeInstance;

i: Integer;

Term: IMsFormulaTerm;

ModelAr, FactorAr: Array Of Double;

Period: IMsModelPeriod;

Begin

//Getting the variables matrix, where the calculated data is saved

Matr := Calculation.Variable(Explained.Slice.Variable.VariableStub);

Mcoo := Matr.CreateCoord;

Matr.ValueFlag := Matr.ValueFlag + 1;

ModelAr := Explained.Serie(Calculation);

Period := Calculation.Period;

//Calculation

If Explanatories.Count <> 0 Then

Term := Explanatories.Item(0);

FactorAr := Term.Serie(Calculation);

For i := 0 To Period.ForecastEndDate.Year - Period.IdentificationStartDate.Year Do

MCoo.Item(0) := i;

MCoo.Item(1) := 1;

If Double.IsNan(ModelAr[i]) Then

Matr.Item(Mcoo) := (FactorAr[i] + (FactorAr[i - 1] + FactorAr[i - 2])) * Param1 / Param2;

Else

Matr.Item(Mcoo) := (ModelAr[i] + FactorAr[i]) * Param1 / Param2;

End If;

Calculation.CurrentPoint := DateTime.AddYears(Calculation.CurrentPoint, 1);

End For;

Else

For i := 0 To Period.ForecastEndDate.Year - Period.IdentificationStartDate.Year Do

MCoo.Item(0) := i;

MCoo.Item(1) := 1;

Matr.Item(Mcoo) := Math.RandBetween(0, 100) * Param1 / Param2;

End For;

End If;

//Saving data to the variable

Cub := ((Explained.Slice.Variable.VariableStub As IMsVariable).Cube As IMetabaseObject).Open(Null) As ICubeInstance;

Cub.Destinations.DefaultDestination.CreateStorage.SaveMatrix(Matr, Matr.ValueFlag);

End Sub Execute;

 

Sub Set_params(ParamValue: IMsUserMethodParams);

Begin

Param1 := ParamValue.Item(0).Value As Double;

Param2 := ParamValue.Item(1).Value As Double;

End Sub Set_params;

 End Class My_Method;

This example is a macro that contains a user method of model calculation. On calculating the model that is set up to use the user method, the data based on some dependency between the output series and the model factor is calculated. After the calculation is performed the data is saved to the output variable.

See also:

IMsUserTransformImplementation