SaveToXml(Xml: IXmlDomElement);
Xml. XML file that stores calculation statistics.
The SaveToXml method saves statistics tree to XML file.
It is used on comparing calculation statistics using the IMsCalculationStats.Compare method.
To load calculation statistics from XML file, use the IMsCalculationStats.LoadFromXml method.
Executing the example requires that the repository includes a modeling container with the CONT_MODEL identifier containing a modeling problem with the PROBLEM identifier.
Add links to the Metabase, Ms, Xml system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Problem: IMsProblem;
Settings: IMsProblemCalculationSettings;
Calc: IMsProblemCalculation;
Doc: IXMLDOMDocument3;
Elem: IXmlDomElement;
Begin
Mb := MetabaseClass.Active;
// Get modeling problem
Problem := Mb.ItemByIdNamespace("PROBLEM", Mb.GetObjectKeyById("CONT_MODEL")).EditTemporary As IMsProblem;
Settings := Problem.CreateCalculationSettings;
// Set calculation statistics drill down
Settings.StatsLevel := MsCalculationStatsLevel.Basic;
Calc := Problem.Calculate(Settings);
// Calculate modeling problem and calculation statistics
Calc.Run;
// Save statistic to XML file
Doc := New FreeThreadedDOMDocument60.Create;
Elem := doc.createElement("Stats");
Doc.appendChild(Elem);
Calc.Stats.SaveToXml(Elem);
Doc.Save("D:\Work\Stats.xml");
End Sub UserProc;
After executing the example, the specified modeling problem is calculated. The calculation statistic is saved to the Stats.xml file.
See also: