IMsCalculationHistory.CalculationLog

Syntax

CalculationLog: IMsCalculationLog;

Description

The CalculationLog property returns calculation log.

Example

Executing the example requires a modeling container with the CONT_MODEL identifier. This container must have the problem with the PROBLEM_NON_LINEAR identifier.

Sub Main;

Var

MB: IMetabase;

ModelCont, Descript, DepObj: IMetabaseObjectDescriptor;

Obj: IMetabaseObject;

Problem: IMsProblem;

Calculation: IMsProblemCalculation;

CalcSettings: IMsProblemCalculationSettings;

Deps: IMetabaseObjectDescriptors;

i: Integer;

CalcHist: IMsCalculationHistory;

Log: IMsCalculationLog;

s: String;
LogRecord: IMsCalculationLogRecord;
Attributes:IMsMetaAttributeValueList;

Begin

MB := MetabaseClass.Active;

ModelCont := MB.ItemById("CONT_MODEL");

Descript := MB.ItemByIdNamespace("PROBLEM_NON_LINEAR", ModelCont.Key);

Obj := Descript.Bind;

Problem := Obj As IMsProblem;

CalcSettings := Problem.CreateCalculationSettings;

Calculation := Problem.Calculate(CalcSettings);

Calculation.SaveHistoryMask := MsCalculationHistorySet.Full;

Calculation.Run;

Deps := Obj.Children;

Debug.WriteLine(Total calculations - + Deps.Count.ToString);

Debug.WriteLine(Calculation log # + Deps.Count.ToString);

i := Deps.Count - 1;

DepObj := Deps.Item(i);

CalcHist := DepObj.Bind As IMsCalculationHistory;

Log := CalcHist.CalculationLog;

 

Debug.WriteLine(Notes quantity in the log - + Log.Count.ToString);

Debug.WriteLine("--------");

For i := 0 To Log.Count - 1 Do

LogRecord := Log.Item(i);
Debug.WriteLine(Note + (i + 1).ToString);

Select Case LogRecord.Type.ToString

Case 0: s := Information:;

Case 1: s := Error:;

Case "2": s := Warning:;

Case 3: s := Limitation breaking:;

End Select;

Debug.WriteLine(s);

Debug.WriteLine(LogRecord.Text);

Debug. WriteLine(Event data: + LogRecord.RecordDate.ToString);

If LogRecord.Model <> Null Then

Debug.WriteLine(Model + LogRecord.Model.Name + "'");

Debug.WriteLine(Calendar point + LogRecord.CalendarPoint.ToString + "'");

End If;
Attributes := LogRecord.Attributes;

If Attributes <> Null Then

Debug.WriteLine(Attributes quantity: '" + Attributes.Count.ToString);

End If;

Debug.WriteLine(script: '" + LogRecord.Scenario.ToString + "'");

Debug.WriteLine("--------");

End For;

End Sub Main;

After executing the example the log of last problem calculation is displayed in the console window.

The example of log that is displayed in the console window:

Module execution started

Total calculations - 3

Calculation log #3

Quantity of notes in the log - 11

--------

Note 1

Information

Loading of variable data "w1 -  lrx"

Event date: 23.12.2008 15:47:41

script: '-1'

--------

Note 2

Information

Loading of variable data "w2- lrx"

Event date: 23.12.2008 15:47:42

script: '-1'

--------

Note 3

Information

Loading of variable data InVar - lrx

Event date: 23.12.2008 15:47:42

script: '-1'

--------

Note 4

Information

Problem calculation by script Sc_Param, current date 01.01.2009

Event date: 23.12.2008 15:47:42

Model NON_LINEAR_1

Calendar point 01.01.2009 00:00:00

script: 3681

--------

Note 5

Information

Problem calculation by script Sc_Param, current date 01.01.2010

Event date: 23.12.2008 15:47:42

Model NON_LINEAR_1

Calendar point 01.01.2010 00:00:00

script: 3681

--------

Note 6

Information

Problem calculation by script Sc_Param, current date 01.01.2011

Event date: 23.12.2008 15:47:42

Model NON_LINEAR_1

Calendar point 01.01.2011 00:00:00

script: 3681

--------

Note 7

Information

Problem calculation by script Sc_Param, current data 01.01.2012

Event date: 23.12.2008 15:47:42

Model NON_LINEAR_1

Calendar point 01.01.2012 00:00:00

script: 3681

--------

Note 8

Information

Loading of variable data InVar - lrx

Event date: 23.12.2008 15:47:42

Model NON_LINEAR_1

Calendar point 01.01.2012 00:00:00

script: 3681

--------

Note 9

Information

Loading of variable data "w1 -  lrx"

Event date: 23.12.2008 15:47:42

Model NON_LINEAR_1

Calendar point 01.01.2012 00:00:00

script: 3681

--------

Note 10

Information

Loading of variable data w2- lrx

Event date: 23.12.2008 15:47:42

Model NON_LINEAR_1

Calendar point 01.01.2012 00:00:00

script: 3681

--------

Note 11

Information

Saving of calculation history

Event date: 23.12.2008 15:47:42

Model NON_LINEAR_1

Calendar point 01.01.2012 00:00:00

script: 3681

--------

Module execution finished

See also:

IMsCalculationHistory