CalculationOption(Option: MsCalculationOptions): Boolean;
CalculationOption[Option: Prognoz.Platform.Interop.Ms.MsCalculationOptions]: boolean;
Option. One or several options which can be used for model calculation.
The CalculationOption property determines whether specified option is applied on model calculation.
To apply values of one or several options, set True, to reset - set False.
If on reception the option returns True, it is applied, if False - it is not applied. If value of several options is received, True is returned, if all asked options are applied, otherwise False is returned.
If the MsCalculationOptions.IntersectPeriods and MsCalculationOptions.UseTransformPeriod options are applied, that is model and its parent object periods are intersected, then the following features should be taken into account:
Intersections of identification and forecasting periods are calculated separately.
If model and parent object periods are not intersected, model will not be calculated. Corresponding warning will be displayed.
If sample periods of model and parent object are intersected and forecasting periods are not intersected, forecasting period will be aligned for the end of sample period received after sample periods of model and parent object intersection.
If forecasting periods of model and parent object are intersected, sample period will be aligned for the start of forecasting period obtained after model and parent object forecasting periods intersection.
The IMsModelPeriod.AllowForecastBeforeIdent property value is taken into account.
Example of the model and its parent object periods intersectoin:
The IMsModelPeriod.AllowForecastBeforeIdent value | Week periods | Parent object periods | Periods after intersection | |||
Identification | Forecasting | Identification | Forecasting | Identification | Forecasting | |
False | 1980-2000 | 2001-2010 | 1990-2005 | 2006-2020 | 1990-2000 | 2006-2010 |
False | 1980-2000 | 2001-2010 | 1970-1990 | 1991-1999 | 1980-1990 | 1990-1990 |
False | 1980-2000 | 2001-2010 | 2001-2005 | 2006-2008 | 2006-2006 | 2006-2008 |
False | 1980-2000 | 2001-2010 | 2011-2014 | 2014-2017 | Model is not calculated | |
True | 1980-2000 | 1990-2010 | 1990-2001 | 1998-2005 | 1990-2000 | 1998-2005 |
Executing the example requires that repository contains modeling container with the MS identifier containing modeling problem with the PROBLEM_CALC_OPTIONS identifier. The calculation chain of the problem should include model with the MODEL_CALC_OPTIONS identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
MsKey: Integer;
Problem: IMsProblem;
CalcChain: IMsCalculationChainEntries;
ChainModel: IMsCalculationChainModel;
Model: IMsModel;
Transform: IMsFormulaTransform;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get modeling problem
Problem := mb.ItemByIdNamespace("PROBLEM_CALC_OPTIONS", MsKey).Bind As IMsProblem;
// Get calculation chain used by the problem
CalcChain := Problem.MetaModel.CalculationChain;
// Get the model
ChainModel := CalcChain.FindById("MODEL_CALC_OPTIONS") As IMsCalculationChainModel;
Model := ChainModel.EditModel;
// Get model calculation parameters
Transform := Model.Transform;
// Determine that model and its parent object periods are intersected
Transform.CalculationOption(MsCalculationOptions.IntersectPeriods
Or MsCalculationOptions.UseExistingData) := True;
// Save changes
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example, for the MODEL_CALC_OPTIONS model intersection of its calculation periods and the PROBLEM_CALC_OPTIONS modeling problem calculation periods will be applied.
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;
Problem: IMsProblem;
CalcChain: IMsCalculationChainEntries;
ChainModel: IMsCalculationChainModel;
Model: IMsModel;
Transform: IMsFormulaTransform;
Begin
// Get current repository
mb := Params.Metabase;
// Get modelling container key
MsKey := mb.GetObjectKeyById("MS");
// Get modeling problem
Problem := mb.ItemByIdNamespace["PROBLEM_CALC_OPTIONS", MsKey].Bind() As IMsProblem;
// Get calculation chain used by the problem
CalcChain := Problem.MetaModel.CalculationChain;
// Get the model
ChainModel := CalcChain.FindById("MODEL_CALC_OPTIONS") As IMsCalculationChainModel;
Model := ChainModel.EditModel;
// Get model calculation parameters
Transform := Model.Transform;
// Determine that model and its parent object periods are intersected
Transform.CalculationOption[MsCalculationOptions.mscoIntersectPeriods
Or MsCalculationOptions.mscoUseExistingData] := True;
// Save changes
(Model As IMetabaseObject).Save();
End Sub;
See also: