ResidualsSerie: IMsVariableStub;
The ResidualsSerie property determines the variable, to which the residual series is unloaded, at modeling problem calculation. To cancel the data unloading, it is necessary to set the property to Null.
The property is outdated, use IMsMethodSeries.Residuals.
Executing the example requires a modeling problem in the container. The first model of the problem uses the Grey forecast for calculation.
Sub Main;
Var
MB: IMetabase;
KontKey: Integer;
MObj: IMetabaseObject;
Problem: IMsProblem;
CalcSett: IMsProblemCalculationSettings;
Calculation: IMsProblemCalculation;
Model: IMsModel;
Trans: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Grey: IMsGreyForecastTransform;
Residuals_Var: IMsVariableStub;
Begin
MB := MetabaseClass.Active;
KontKey := MB.ItemById("KONT_MODEL").Key;
MObj := MB.ItemByIdNamespace("PROBLEM_1", KontKey).Edit;
//variables to which the data are loaded
Residuals_Var := MB.ItemByIdNamespace("Residuals_Var", KontKey).Edit As IMsVariableStub;
Problem := MObj As IMsProblem;
Model := (Problem.MetaModel.CalculationChain.Item(0) As IMsCalculationChainModel).Model;
Model := (Model As IMetabaseObject).Edit As IMsModel;
Model.Series.Add(Residuals_Var As IMsVariable);
Trans := Model.Transform;
VarTrans := Trans.Outputs.Item(0);
Tree := VarTrans.SlicesTree(VarTrans);
Slice := Tree.CreateSlice(1);
Selector := Model.Transform.CreateSelector;
Selector.Slice := Slice;
Formula := Model.Transform.Transform(Selector);
Grey := Formula.Method As IMsGreyForecastTransform;
//residual series
Grey.ResidualsSerie := Residuals_Var;
//parameters for problem calculation
CalcSett := Problem.CreateCalculationSettings;
Calculation := Problem.Calculate(CalcSett);
Calculation.Run;
(Model As IMetabaseObject).Save;
MObj.Save;
End Sub Main;
After executing the example, the variable with the Residuals_Var identifier is added to the list of output variables of the model. After calculating the problem, the residual series is unloaded to it.
See also: