IMsCalculationState.CurrentPoint

Syntax

CurrentPoint: DateTime;

Description

The CurrentPoint property returns the current calendar point of calculation step.

Example

Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. This container should include a forecasting problem with the OBJ_problem identifier.

Add links to the Matrix, Metabase, Ms system assemblies.

Sub UserProc;

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.Scenario.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("Current values of output variable '" + 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("=== Abort calculation ===");
    _calc.Stop;
End Sub;

After executing the example the console window displays information about the step-by-step problem calculation:

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:

IMsCalculationState