CalendarPoint: DateTime;
CalendarPoint: System.DateTime;
The CalendarPoint property determines the calendar point that triggers breakpoint.
This property sets the calendar point for the model, during calculation of which the breakpoint is triggered. The model is determined by the IMsModelCalendarBreakpoint.Model property.
If value is set for CalendarPoint, the IMsModelCalendarBreakpoint.IsCalendarPointFixed property returns True; if value is False, CalendarPoint is ignored.
Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier. This container should include a modeling problem with the PROBLEM identifier that calculates the model with the MODEL identifier. The example uses the MCallback class described in IMsproblemCalculationCallback.OnBreak.
Also, before starting the procedure it is necessary to add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
ModelSpaceDescr: IMetabaseObjectDescriptor;
Problem: IMsProblem;
CalcSettings: IMsProblemCalculationSettings;
CallBack: MCallback;
Calculation: IMsProblemCalculation;
Breakpoints: IMsBreakpoints;
Breakpoint: IMsBreakpoint;
CalendarBreakpoint: IMsModelCalendarBreakpoint;
Model: IMsModel;
Begin
Mb := MetabaseClass.Active;
ModelSpaceDescr := Mb.ItemById("MODEL_SPACE");
Problem := Mb.ItemByIdNamespace("PROBLEM", ModelSpaceDescr.Key).Edit As IMsProblem;
CalcSettings := Problem.CreateCalculationSettings;
CallBack := New MCallback.Create;
CalcSettings.Callback := CallBack;
CalcSettings.FactIncluded := True;
Calculation := Problem.Calculate(CalcSettings);
Breakpoints := Calculation.Breakpoints;
Breakpoints.Clear;
Breakpoint := Breakpoints.Add(MsBreakpointKind.ModelCalendar);
CalendarBreakpoint := Breakpoint As IMsModelCalendarBreakpoint;
CalendarBreakpoint.Name := "CalendarBreakpoint";
Model := Mb.ItemByIdNamespace("MODEL", ModelSpaceDescr.Key).Edit As IMsModel;
CalendarBreakpoint.Model := Model;
CalendarBreakpoint.CalendarPoint := DateTime.ComposeDay(2012, 01, 01);
Calculation.Run;
End Sub UserProc;
After executing the example the breakpoint that is triggered if the MODEL model is calculated for 01.01.2012, is set for the problem.
Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier. This container should include a modeling problem with the PROBLEM identifier that calculates the model with the MODEL identifier. The example uses the MCallback class described in IMsproblemCalculationCallback.OnBreak.
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
ModelSpaceDescr: IMetabaseObjectDescriptor;
Problem: IMsProblem;
CalcSettings: IMsProblemCalculationSettings;
CallBack: MCallback;
Calculation: IMsProblemCalculation;
Breakpoints: IMsBreakpoints;
Breakpoint: IMsBreakpoint;
CalendarBreakpoint: IMsModelCalendarBreakpoint;
Model: IMsModel;
Begin
Mb := Params.Metabase;
ModelSpaceDescr := Mb.ItemById["MODEL_SPACE"];
Problem := Mb.ItemByIdNamespace["PROBLEM", ModelSpaceDescr.Key].Edit() As IMsProblem;
CalcSettings := Problem.CreateCalculationSettings();
CallBack := New MCallback.Create();
CalcSettings.Callback := CallBack;
CalcSettings.FactIncluded := True;
Calculation := Problem.Calculate(CalcSettings);
Breakpoints := Calculation.Breakpoints;
Breakpoints.Clear();
Breakpoint := Breakpoints.Add(MsBreakpointKind.mbkModelCalendar);
CalendarBreakpoint := Breakpoint As IMsModelCalendarBreakpoint;
CalendarBreakpoint.Name := "CalendarBreakpoint";
Model := Mb.ItemByIdNamespace["MODEL", ModelSpaceDescr.Key].Edit() As IMsModel;
CalendarBreakpoint.Model := Model;
CalendarBreakpoint.CalendarPoint := DateTime.Parse("01.01.2012");
Calculation.Run();
End Sub;
After executing the example the breakpoint that is triggered if the MODEL model is calculated for 01.01.2012, is set for the problem.
See also: