NewGrossIssueMatrix: IMsFormulaTerm;
The NewGrossIssueMatrix property determines the term corresponding to the variable, to which the calculated national income matrix is loaded. It is used in III quadrant calculation.
Sub Main;
Var
MB: IMetabase;
CrInf: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
EndVar, ValVar, AVar, XVar, ThirdKvadrVar: 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;
//Second quadrant
ThirdKvadrVar := MB.ItemByIdNamespace("ThirdKvadr", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Model.Input.Add(ThirdKvadrVar);
ThirdKvadrVar := MB.ItemByIdNamespace("var_11", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Model.Input.Add(ThirdKvadrVar);
ThirdKvadrVar := MB.ItemByIdNamespace("var_22", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Model.Input.Add(ThirdKvadrVar);
//Assign the variable for III quadrant
TransVar := Model.Transform.Inputs.FindById("ThirdKvadr");
Tree := TransVar.SlicesTree(Null);
Slice := Tree.CreateSlice(1);
Term := Industry.Operands.Add(Slice);
Industry.ThirdQuadrant := Term;
//Assign the variable by which the calculation is executed
TransVar := Model.Transform.Inputs.FindById("var_11");
Tree := TransVar.SlicesTree(Null);
Slice := Tree.CreateSlice(1);
Term := Industry.Operands.Add(Slice);
Industry.GrossIssueMatrix := Term;
//Assign the variable where the matrix is loaded
TransVar := Model.Transform.Inputs.FindById("var_22");
Tree := TransVar.SlicesTree(Null);
Slice := Tree.CreateSlice(1);
Term := Industry.Operands.Add(Slice);
Industry.NewGrossIssueMatrix := Term;
Industry.GenerateGrossIssue := True;
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 of the third quadrant is also adjusted. The structure of the final national income is calculated on the basis of a variable with the var_11 identifier.
See also:
IMsInterindustryBalanceTransform | IMsInterindustryBalanceTransform.ThirdQuadrant | IMsInterindustryBalanceTransform.GrossIssueMatrix