OutputPeriod: IMsPeriod;
OutputPeriod: Prognoz.Platform.Interop.Ms.IMsPeriod;
The OutputPeriod property returns data unloading period parameters
To set up parameters of problem identification and forecasting, use the IMsProblemCalculationSettings.Period property.
Executing the example requires that the repository contains a modeling container with the MS identifier containing a modeling problem with the PROBLEM_TRANSF_OUTPUT identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
MsDescr: IMetabaseObjectDescriptor;
Problem: IMsProblem;
CalcSett: IMsProblemCalculationSettings;
Period: IMsModelPeriod;
ProblemCalc: IMsProblemCalculation;
OutPeriod: IMsDatePeriod;
Begin
Mb := MetabaseClass.Active;
// Get modeling container
MsDescr := Mb.ItemById("MS");
// Get modeling problem
Problem := Mb.ItemByIdNamespace("PROBLEM_TRANSF_OUTPUT", MsDescr.Key).Bind As IMsProblem;
// Create problem calculation parameters
CalcSett := Problem.CreateCalculationSettings;
// Load data only by the calendar levels,
// which are used in the problem calculation chain
CalcSett.FilterLevelsOnLoad := True;
// Specify calculation period
Period := CalcSett.Period;
Period.IdentificationStartDate := DateTime.Parse("01.01.1990");
Period.IdentificationEndDate := DateTime.Parse("31.12.2009");
Period.ForecastStartDate := DateTime.Parse("01.01.2010");
Period.ForecastEndDate := DateTime.Parse("01.01.2015");
// Get data unloading period parameters
OutPeriod := CalcSett.OutputPeriod As IMsDatePeriod;
// Clear parameters of data unloading period
OutPeriod.ClearPeriod;
// Set autoperiod parameters: data unloading period is determined
// by data unloading period of calculated object owner
OutPeriod.AutoPeriod := MsDateAutoPeriodOptions.StartByFact Or MsDateAutoPeriodOptions.EndAsNow;
// Set moving of start and end dates for data unloading period
OutPeriod.StartOffset := 1;
OutPeriod.EndOffset := 2;
// Perform calculation
ProblemCalc := Problem.Calculate(CalcSett);
ProblemCalc.Run;
End Sub UserProc;
After executing the example the problem is calculated by identification, forecasting and data unloading determined before the calculation. Data
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;
Period: IMsModelPeriod;
ProblemCalc: IMsProblemCalculation;
OutPeriod: IMsDatePeriod;
Begin
Mb := Params.Metabase;
// Get modeling container
MsDescr := Mb.ItemById["MS"];
// Get modeling problem
Problem := Mb.ItemByIdNamespace["PROBLEM_TRANSF_OUTPUT", MsDescr.Key].Bind() As IMsProblem;
// Create problem calculation parameters
CalcSett := Problem.CreateCalculationSettings();
// Load data only by the calendar levels,
// which are used in the problem calculation chain
CalcSett.FilterLevelsOnLoad := True;
// Specify calculation period
Period := CalcSett.Period;
Period.IdentificationStartDate := DateTime.Parse("01.01.1990");
Period.IdentificationEndDate := DateTime.Parse("31.12.2009");
Period.ForecastStartDate := DateTime.Parse("01.01.2010");
Period.ForecastEndDate := DateTime.Parse("01.01.2015");
// Get data unloading period parameters
OutPeriod := CalcSett.OutputPeriod As IMsDatePeriod;
// Clear parameters of data unloading period
OutPeriod.ClearPeriod();
// Set autoperiod parameters: data unloading period is determined
// by data unloading period of calculated object owner
OutPeriod.AutoPeriod := (MsDateAutoPeriodOptions.msdapoStartByFact Or MsDateAutoPeriodOptions.msdapoEndAsNow) As integer;
// Set moving of start and end dates for data unloading period
OutPeriod.StartOffset := 1;
OutPeriod.EndOffset := 2;
// Perform calculation
ProblemCalc := Problem.Calculate(CalcSett);
ProblemCalc.Run();
End Sub;
See also: