D2_CalcStatFunc

D2_CalcStatFunc

Accessing historical values - D2_CalcStatFunc function

The function allows you to calculate the specified statistical archive function on demand.


Declaration

D2_CalcStatFunc

(archIdent, bt, et, statFuncID, validPerc, paramIdent, refresh)

Parameters

archIdent

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.

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.

refresh

 

Optional parameter of optional type.

Description

The function calculates the statistical function specified by the parameter statFuncID on the values represented by the historical value archIdent within the time interval given by the parameters bt and et. After successful execution, the function returns a result value.

The parameter validPerctIdent_Int represents Validation criteria used during evaluation of the statistical function. It can get the values within 0 .. 100 (the error ERR_RANGE_ERROR occurs if the condition is broken).

For some statistical function, it is required to enter the parameter paramIdent 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