AutoPeriod: Integer;
AutoPeriod: integer;
The AutoPeriod property determines the conditions that are used to calculate start and end dates of sample and forecasting periods.
The value is determined by combinations of the MsAutoPeriodOptions enumeration elements. AutoPeriod is taken into account if the IMsModel.UseModelPeriod property is set to True.
If AutoPeriod uses the value of the MsAutoPeriodOptions enumeration, which requires setting additional number of periods, for example, MsAutoPeriodOptions.IdentStartByIdentEnd or MsAutoPeriodOptions.ForecastEndByFact, specify additional parameters in the corresponding property:
Features of calculation start and end dates of sample and forecasting periods
Executing the example requires a modeling container with the MS identifier that contains a model with the MODEL identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MsKey: Integer;
ModelObj: IMetabaseObject;
Model: IMsModel;
ModelPeriod: IMsModelPeriod;
Begin
mb := MetabaseClass.Active;
MsKey := mb.ItemById("MS").Key;
ModelObj := mb.ItemByIdNamespace("MODEL", MsKey).Edit;
Model := ModelObj As IMsModel;
Model.UseModelPeriod := True;
ModelPeriod := Model.Period;
ModelPeriod.AutoPeriod := MsAutoPeriodOptions.IdentStartAsNow +
MsAutoPeriodOptions.IdentEndAsNow +
MsAutoPeriodOptions.ForecastStartAsNow +
MsAutoPeriodOptions.ForecastEndByIdentEnd;
ModelPeriod.IdentificationStartOffset := -10;
ModelPeriod.IdentificationEndOffset := -1;
ModelPeriod.UseForecastStart := True;
ModelPeriod.ForecastStartOffset := 1;
ModelPeriod.ForecastEndOffset := 5;
ModelObj.Save;
End Sub UserProc;
After executing the example the conditions that determine model calculation periods are set:
Sample period start: actual data minus ten periods.
Sample period end: actual data minus one period.
Forecasting period start: current date plus one period.
Forecasting period end: sample end plus five periods.
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;
MsKey: uinteger;
ModelObj: IMetabaseObject;
Model: IMsModel;
ModelPeriod: IMsModelPeriod;
AutoPeriod: integer;
Begin
mb := Params.Metabase;
MsKey := mb.ItemById["MS"].Key;
ModelObj := mb.ItemByIdNamespace["MODEL", MsKey].Edit();
Model := ModelObj As IMsModel;
Model.UseModelPeriod := True;
ModelPeriod := Model.Period;
ModelPeriod.AutoPeriod := (MsAutoPeriodOptions.msapoIdentStartAsNow As integer) +
(MsAutoPeriodOptions.msapoIdentEndAsNow As integer) +
(MsAutoPeriodOptions.msapoForecastStartAsNow As integer) +
(MsAutoPeriodOptions.msapoForecastEndByIdentEnd As integer);
ModelPeriod.IdentificationStartOffset := -10;
ModelPeriod.IdentificationEndOffset := 0;
ModelPeriod.UseForecastStart := True;
ModelPeriod.ForecastStartOffset := 1;
ModelPeriod.ForecastEndOffset := 5;
ModelObj.Save();
End Sub;
See also: