GrossIssueMatrix: IMsFormulaTerm;
The GrossIssueMatrix property determines the term corresponding to the variable, based on which the final national income structure is calculated.
It is used in III quadrant calculation.
Sub UserProc;
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;
Trans.Kind := MsModelKind.InterindustryBalance;
//Add a variable of final use to Outputs of model, and gross output, matrix A and matrix X to Inputs
EndVar := MB.ItemByIdNamespace("EndVar", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Trans.Outputs.Add(EndVar As IMsVariableStub);
ValVar := MB.ItemByIdNamespace("Val_Prod", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Trans.Inputs.Add(ValVar As IMsVariableStub);
AVar := MB.ItemByIdNamespace("MatrA", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Trans.Inputs.Add(AVar As IMsVariableStub);
XVar := MB.ItemByIdNamespace("MatrX", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Trans.Inputs.Add(XVar As IMsVariableStub);
//Pass-through dimensions are set for variable of final use and gross output
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 model parameters
//Add a variable of final 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;
//Specify dimension by rows
Industry.BranchRowDimension := Dim;
//Set gross output variable
TransVar := Model.Transform.Inputs.FindById("VAL_PROD");
Tree := TransVar.SlicesTree(Null);
Slice := Tree.CreateSlice(1);
Term := Industry.Operands.Add(Slice);
Industry.Argument := Term;
//Specify dimension by columns
Industry.BranchColumnDimension := Dim1;
//Set variable of the A matrix
TransVar := Model.Transform.Inputs.FindById("MATRA");
Tree := TransVar.SlicesTree(Null);
Slice := Tree.CreateSlice(1);
Term := Industry.Operands.Add(Slice);
Industry.NewMatrixA := Term;
//Set variable of the X matrix
TransVar := Model.Transform.Inputs.FindById("MATRX");
Tree := TransVar.SlicesTree(Null);
Slice := Tree.CreateSlice(1);
Term := Industry.Operands.Add(Slice);
Industry.MatrixA := Term;
//Third quadrant
ThirdKvadrVar := MB.ItemByIdNamespace("THIRDKVADR", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Trans.Inputs.Add(ThirdKvadrVar As IMsVariableStub);
ThirdKvadrVar := MB.ItemByIdNamespace("VAR_11", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Trans.Inputs.Add(ThirdKvadrVar As IMsVariableStub);
ThirdKvadrVar := MB.ItemByIdNamespace("VAR_22", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;
Trans.Inputs.Add(ThirdKvadrVar As IMsVariableStub);
//Set 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;
//Set variable , based on which 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;
//Set variable, to which matrix will be 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 UserProc;
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.NewGrossIssueMatrix