AddModel(Model: IMsModel);
Model. The model to be added.
The AddModel method adds the specified model to the system of equations.
The following types of equations can be added:
To remove the equation from the system, use the IMsCalculationChainSystem.RemoveModel method.
Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier containing a metamodel with the METAMODEL identifier and a determinate equation model with the MODEL_DETERM identifier. The model must not be included in the metamodel calculation chain.
Add links to the Metabase and Ms system assemblies.
Sub AddModel;
Var
mb: IMetabase;
MsObj: IMetabaseObjectDescriptor;
Meta: IMsMetaModel;
CalcChain: IMsCalculationChainEntries;
ChainEntry: IMsCalculationChainEntry;
Model: IMsModel;
i: Integer;
CalcSystem: IMsCalculationChainSystem;
Begin
mb := MetabaseClass.Active;
// Get modeling container
MsObj := mb.ItemById("MODEL_SPACE");
// Get metamodel
Meta := mb.ItemByIdNamespace("METAMODEL", MsObj.Key).Edit As IMsMetaModel;
CalcChain := Meta.CalculationChain;
// If the calculation chain contains the system of equations,
// then add equation to system
For i := 0 To CalcChain.Count - 1 Do
ChainEntry := CalcChain.Item(i);
If ChainEntry.Type = MsCalculationChainEntryType.System Then
CalcSystem := ChainEntry As IMsCalculationChainSystem;
Model := mb.ItemByIdNamespace("MODEL_DETERM", MsObj.Key).Edit As IMsModel;
CalcSystem.AddModel(Model);
End If;
End For;
// Save changes
(Meta As IMetabaseObject).Save;
End Sub AddModel;
After executing the example, if the METAMODEL metamodel calculation chain contains the equation system, the MODEL_DETERM model will be added to it.
See also: