DataLoadingPeriod: IMsDataLoadingPeriod;
DataLoadingPeriod: Prognoz.Platform.Interop.Ms.IMsDataLoadingPeriod;
The DataLoadingPeriod property returns parameters of data loading period during modeling problem calculation.
DataLoadingPeriod is used to optimize data loading. Only the necessary data can be loaded by changing the period limits.
Executing the example requires a modeling container with the MS identifier containing a modeling problem with the PROBLEM identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
MsDescr: IMetabaseObjectDescriptor;
Problem: IMsProblem;
CalcSett: IMsProblemCalculationSettings;
LoadingPeriod: IMsDataLoadingPeriod;
ProblemCalc: IMsProblemCalculation;
Begin
Mb := MetabaseClass.Active;
// Get modeling problem
MsDescr := Mb.ItemById("MS");
Problem := Mb.ItemByIdNamespace("PROBLEM", MsDescr.Key).Edit As IMsProblem;
// Get model calculation parameters
CalcSett := Problem.CreateCalculationSettings;
// Set data loading period
LoadingPeriod := CalcSett.DataLoadingPeriod;
LoadingPeriod.UseDefault := False;
LoadingPeriod.StartDate := DateTime.Parse("01.01.2003");
LoadingPeriod.EndDate := DateTime.Parse("01.01.2013");
// Set warning display mode
CalcSett.FilterWarnings := True;
// Set mode of displaying data to output series
CalcSett.ClearSeriesOnWarning := True;
// Perform calculation
ProblemCalc := Problem.Calculate(CalcSett);
ProblemCalc.Run;
// Save the model
(Problem As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the problem is calculated with data that was loaded at the specified period. If on calculating the warning occurred, the output series is cleared.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
MsDescr: IMetabaseObjectDescriptor;
Problem: IMsProblem;
CalcSett: IMsProblemCalculationSettings;
LoadingPeriod: IMsDataLoadingPeriod;
ProblemCalc: IMsProblemCalculation;
Begin
Mb := Params.Metabase;
// Get modeling problem
MsDescr := Mb.ItemById["MS"];
Problem := Mb.ItemByIdNamespace["PROBLEM", MsDescr.Key].Edit() As IMsProblem;
// Get model calculation parameters
CalcSett := Problem.CreateCalculationSettings();
// Set data loading period
LoadingPeriod := CalcSett.DataLoadingPeriod;
LoadingPeriod.UseDefault := False;
LoadingPeriod.StartDate := DateTime.Parse("01.01.2003");
LoadingPeriod.EndDate := DateTime.Parse("01.01.2013");
// Set warning display mode
CalcSett.FilterWarnings := True;
// Set mode of displaying data to output series
CalcSett.ClearSeriesOnWarning := True;
// Perform calculation
ProblemCalc := Problem.Calculate(CalcSett);
ProblemCalc.Run();
// Save the model
(Problem As IMetabaseObject).Save();
End Sub;
See also: