CurrentPoint: DateTime;
The CurrentPoint property returns current calendar point of calculation step.
Executing the example requires a modeling container with the CONT_MODEL identifier. The forecasting problem with the OBJ_problem identifier must be present in this container.
Sub Main;
Var
mb: IMetabase;
pModelSpace: IMetabaseObjectDescriptor;
_prob: IMsProblem;
settings: IMsProblemCalculationSettings;
_calc: IMsProblemCalculation;
state: IMsCalculationState;
slice: IMsFormulaTransformSlice;
ds: IMatrixDataSource;
mt: IMatrix;
iter: IMatrixIterator;
TrVar: IMsFormulaTransformVariable;
Begin
mb := MetabaseClass.Active;
pModelSpace := mb.ItemById("CONT_MODEL");
_prob := mb.ItemByIdNamespace("OBJ_PROBLEM", pModelSpace.Key).Bind As IMsProblem;
settings := _prob.CreateCalculationSettings;
_calc := _prob.Calculate(settings);
Repeat
_calc.StepOver;
state := _calc.CalculationState;
Debug.WriteLine(state.Message);
Until state.Model <> Null;
Debug.WriteLine("Current calculation point: " + state.CurrentPoint.ToString);
Debug.WriteLine("Scenario key: " + state.script.ToString);
Debug.WriteLine("Model: " + (state.Model As IMetabaseObject).Name);
TrVar := state.Model.Transform.Outputs.Item(0);
slice := TrVar.Slices.Item(0);
ds := state.Data(slice);
mt := ds.Execute(Null);
Debug.WriteLine("Output variable current values '" + TrVar.Name+"'");
Iter := mt.CreateIterator;
Iter.Move(IteratorDirection.First);
While Iter.Valid Do
Debug.WriteLine(" " + Iter.Value);
Iter.Move(IteratorDirection.Next);
End While;
Debug.WriteLine("=== Aborting calculation ===");
_calc.Stop;
End Sub Main;
After executing the example the information about the step-by-step problem calculation is displayed in the console window:
The performed calculation steps description.
Current calendar point.
Calculated model name.
Output variable calculated data.
Scenario key.
After calculating the first calendar point, problem calculation is aborted.
For example:
Module execution started
Calculation initialization
The Export (all) variable data loading
The Intermediate data variable data loading
The Summary data variable data loading
The problem calculation for 01.01.1981 by the Base scenario
Current calculation point: 01.01.1981 00:00:00
Scenario key: 7063
Model: Transformation of the source data to intermediate data
Current values of the 'Intermediate data' output variable.
2
=== Aborting calculation ===
Module execution finished
See also: