Metamodel

Mind the following features on creating a metamodel and working with it:

The IMsMetaModel interface is used to work with the model by Fore language. The user can form calculation chain and determine metamodel parameters using properties and methods of this interface.

The IMsCalculationChainEntries interface is used to work with calculation chain. The user can add the following elements to calculation chain using methods of this interface:

The user can determine metamodel parameters that affect the model calculation that are included into the chain. The IMsModelParam interface is used to work with metamodel parameters.

A modeling problem is used to calculate the whole metamodel chain with respect to order of elements, cycles, conditions, and parameters.

Creation of Metamodel

After model creation the user should create a metamodel that contains the Balance of Trade, billion USD model for calculation.

To run the module for creating metamodel, the user needs to add links to the Ms and Metabase assemblies.

Sub Main;

Var

MB: IMetabase;

KMDesc: IMetabaseObjectDescriptor;

CrInfo: IMetabaseObjectCreateInfo;

MObj: IMetabaseObject;

Meta: IMsMetaModel;

Model: IMsModel;

Root: IMsCalculationChainEntries;

Begin

MB := MetabaseClass.Active;

KMDesc := MB.ItemById("MODEL_SPACE");

// Create metamodel

CrInfo := MB.CreateCreateInfo;

CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_MSMETAMODEL;

CrInfo.Id := "META_MODEL_BALANCE";

CrInfo.Name := Metamodel for calculating balance of trade;

CrInfo.Parent := KMDesc;

MObj := MB.CreateObject(CrInfo).Edit;

Meta := MObj As IMsMetaModel;

// Add the Balance of trade, billion USD model to calculation chain

Model := MB.ItemByIdNamespace("BALANCE_MODEL", KMDesc.Key).Bind As IMsModel;

Root := Meta.CalculationChain;

Root.AddModel(Model);

MObj.Save;

Debug.WriteLine(Metamodel is created plus with the MObj.Name plus identifier plus MObj.Id plus );

End Sub Main;

After executing the example the Metamodel for Balance of Trade Calculation metamodel with the META_MODEL_BALANCE identifier is created, information about it is displayed in the console window.

Then the user creates and calculates the modeling problem.

See also:

General Principles of Programming using Ms Assembly