D2_CalcStatFuncArr

D2_CalcStatFuncArr

Accessing historical values - D2_CalcStatFuncArr function

The function allows you to calculate the specified statistical archive function for all given time intervals on demand.


Declaration

D2_CalcStatFuncArr

(archObjName, bt, et, step, deepTime, statFuncID, validPerc, paramIdent, bDirectionByRow, refresh)

Parameters

archObjName

TEXT type

  • Reference to one value of historical value.

  • Reference to simple value of object (not structured variable).

  • In case of structured variable it is one item (SV.Struct[2]^Item),
    otherwise name of object (e.g. I/O tag).
    In this case the system will automatically look for a "suitable" objet of Historical value type.
    If the column "Item" is of the Object type it is possible to specify a string ",ALL" right after the name of column (e.g. SV.Struct[4]^Item,ALL). This causes the historical values to be obtained for the connected object, not for the item of a structured variable.

bt

ABS. TIME type

Interval begin time.

et

ABS. TIME type

Interval end time.

step

INT type

Time step [s] within the archive block.

deepTime

INT type

Time depth [s] for calculating the statistics.

Note: The parameter must be a positive integer.

statFuncID

INT type

Statistical function type. The type is represented by a numerical value (see the table).

validPerc

INT type

Validation criteria.

paramIdent

REAL or INT types

Parameter for some types of functions.

bDirectionByRow

BOOL type

Time order of cells in matrix.

refresh

 

Optional parameter of optional type.

Description

The return value of the function is of array type. Owing to that fact, this function is predetermined to be used in so-called Matrix.

The action executes the calculation of a statistical function specified by the parameter statFuncID on the values represented by the historical value archObjName for the following time intervals specified by the parameters bt, et, step a deepTime:

  • first time interval - <bt - deepTime; bt>

  • second time interval - <bt + step - deepTime; bt + step>

  • .....

  • n-th time interval - <bt + (N-1)*step - deepTime; bt + (N-1)*step>

The results are returned as an array, whose members represent the individual results of calculation of the statistical function for the given time intervals.

The parameter validPerctIdent_Int represents the Validation criteria used during the evaluation of the statistical function. The permissible values are in range 1 .. 100 (the error ERR_RANGE_ERROR occurs if the condition is not met).

For some statistical archive function, the parameter paramIdent must be specified according to the table:

Statistical function

Parameter description

_STAT_F_INTEGRAL

Integral time units. For individual types, there are also established predefined local variables according to the table:

Constant

Description

_INTEGRAL_HOURUNIT

Hour integral

_INTEGRAL_MINUNIT

Minute integral

_INTEGRAL_SECUNIT

Second integral

_STAT_F_GE_TIME
_STAT_F_GT_TIME
_STAT_F_LE_TIME
_STAT_F_LT_TIME
_STAT_F_ADDITION_PARAM
_STAT_F_INCREMENT_PARAM
_STAT_F_DELTA_PARAM

Reference value