FindById(ModelId: String): IMsModel;
ModelId. Identifier of the required model.
The FindById method finds a model in the collection by its identifier.
Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. This container should include a non-linear equation system with the NON_LINEAR_MODEL identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
ModelCont: IMetabaseObjectDescriptor;
Model: IMsModel;
Trans: IMsFormulaTransform;
Formula: IMsFormula;
Equations: IMsNonLinearEquationsTransform;
Descript: IMetabaseObjectDescriptor;
ExtModel: IMsModel;
ExternalEquations: IMsModelList;
Begin
mb := MetabaseClass.Active;
ModelCont := mb.ItemById("CONT_MODEL");
Descript := mb.ItemByIdNamespace("NON_LINEAR_MODEL", ModelCont.Key);
Model := Descript.Edit As IMsModel;
Trans := Model.Transform;
Formula := Trans.EquationsFormula;
Equations := Formula.Method As IMsNonLinearEquationsTransform;
// Getting collection of system equations
ExternalEquations := Equations.ExternalEquations;
ExtModel := ExternalEquations.FindById("EXT_MODEL");
If ExtModel <> Null Then
ExternalEquations.RemoveByKey((ExtModel As IMetabaseObject).Key);
End If;
// Saving changes
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example an external model with the EXT_MODEL identifier (if it is contained in the system) is removed from the system of non-linear equations.
See also: