Argument: IMsFormulaTerm;
The Argument property determines the term, that corresponds to the variable of gross output (of final use), depending on the current task of interindustrial balance.
Sub Main;
Var
MB: IMetabase;
CrInf: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
EndVar, ValVar, AVar, XVar: IMsVariable;
Dim, Dim1: IDimensionModel;
TransVar: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Industry: IMsInterindustryBalanceTransform;
Term: IMsFormulaTerm;
Begin
MB := MetabaseClass.Active;
CrInf := Mb.CreateCreateInfo;
CrInf.ClassId := MetabaseObjectClass.KE_CLASS_MSMODEL;
CrInf.Id := "New_MOB";
CrInf.Name := "New_MOB";
CrInf.Parent := Mb.ItemById("KONT_MODEL");
CrInf.Permanent := False;
MObj := Mb.CreateObject(CrInf).Edit;
Model := MObj As IMsModel;
Trans := Model.Transform;
Model.Kind := MsModelKind.InterindustryBalance;
//Add a variable of final use in Outputs models, and gross output, a matrix A and matrix X in Inputs
EndVar := MB.ItemByIdNamespace("EndVar", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Model.Output.Add(EndVar);
ValVar := MB.ItemByIdNamespace("Val_Prod", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Model.Input.Add(ValVar);
AVar := MB.ItemByIdNamespace("MatrA", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Model.Input.Add(AVar);
XVar := MB.ItemByIdNamespace("MatrX", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Model.Input.Add(XVar);
//For a variable of final use and gross output the through dimensions are set
Dim := EndVar.Dimensions.Item(0).Model;
Dim1 := ValVar.Dimensions.Item(0).Model;
Trans.DimensionTransparent(Trans.Outputs.Item(0), Dim) := True;
Trans.DimensionTransparent(Trans.Outputs.Item(0), Dim1) := True;
//Fill in the model parameters
//Add the variable of finish use
TransVar := Model.Transform.Outputs.FindById("EndVar");
Tree := TransVar.SlicesTree(Null);
Slice := Tree.CreateSlice(1);
Selector := EndVar.Transform.CreateSelector;
Selector.Slice := Slice;
Formula := Model.Transform.Transform(Selector);
Formula.Kind := MsFormulaKind.InterindustryBalance;
Formula.Level := DimCalendarLevel.Year;
Industry := Formula.Method As IMsInterindustryBalanceTransform;
//Indicate the dimensions by lines
Industry.BranchRowDimension := Dim;
//Assign the variable of gross output
TransVar := Model.Transform.Inputs.FindById("Val_Prod");
Tree := TransVar.SlicesTree(Null);
Slice := Tree.CreateSlice(1);
Term := Industry.Operands.Add(Slice);
Industry.Argument := Term;
//Indicate the dimension by columns
Industry.BranchColumnDimension := Dim1;
//Assign the variable of A matrix
TransVar := Model.Transform.Inputs.FindById("MatrA");
Tree := TransVar.SlicesTree(Null);
Slice := Tree.CreateSlice(1);
Term := Industry.Operands.Add(Slice);
Industry.NewMatrixA := Term;
//Assign the variable of X matrix
TransVar := Model.Transform.Inputs.FindById("MatrX");
Tree := TransVar.SlicesTree(Null);
Slice := Tree.CreateSlice(1);
Term := Industry.Operands.Add(Slice);
Industry.MatrixA := Term;
MObj.Save;
End Sub Main;
After executing the example a new model of interindustrial balance is created in the modeling container. This model solves the problem of finding the final use. The variables of final use, gross output, variables for calculation and uploading of the A matrix are added. Calculation by II and III quadrants is not made.
See also: