Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

CALCSTATFUNC action


Function
Evaluation of a statistical archive function on demand.
Declaration


Blok kódu
languageesl
themeConfluence
 CALCSTATFUNC archIdent, timeFromIdent_TmA, timeToIdent_TmA, statFuncIdent_Int, validPercIdent_Int, paramIdent, retValueIdent, statusIdent_Int [,archivInstance_Int]
Parameters


archIdentinReference to one value of historical value or reference to object, values of which have been archived.

Warning: If the parameter is the reference to an object archived several times, there is not specified which one of the historical objects is to be used.
timeFromItemIdent_TmAinIdentifier of AbsTime type - interval beginning.
timeToItemIdent_TmAinIdentifier of AbsTime type - interval end.
statFunctIdentinIdentifier of Int type - statistical function type.
validPercIdentinIdentifier of Int type - validation criteria.
paramIdentinIdentifier of Int or Real types - parameter for some types of functions.
retValueIdentoutIdentifier for calculation result.
statusIdentoutCalculation (action) success.
archivInstance_IntinOptional identifier of Int type - identification of archive instance. If the parameter is not defined, the value 0 will replace it.
Description

The action executes calculation of the statistical function given by the parameter statFuncIdent_Int on the values represented by the historical value archIdent within the time interval given by the parameter timeFromIdent_TmA and timeToIdent_TmA . After successful execution of the action, the parameter retValueIdent contains a result value of the calculation. The parameter statusIdent_Intgets one of the following values:

  • _ERR_TRANS_ABORT
  • _ERR_TRANS_ERROR
  • _ERR_TRANS_IGNORED
  • _ERR_NO_ERROR

Set of implemented functions is equal with the functions, which may be configured for statistical archive (except the FILTER and EACOAVG functions).  For the individual functions, there are predefined local constants in ESL.

The parameter validPerctIdent_Int represents Validation criteria used during the evaluation of the statistical function. It can get values within 1 .. 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 functionParameter description
_STAT_F_INTEGRAL

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

ConstantDescription
_INTEGRAL_HOURUNITHour integral
_INTEGRAL_MINUNITMinute integral
_INTEGRAL_SECUNITSecond 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
Compare value

For the other statistical archive functions, the parameter paramIdent is not being evaluated.

Value of parameter archivInstance_Int defines the instance of archive which executes the request. If the parameter is not defined (or the value is 0), the active instance of archive will execute the request.

Note: When calculating CALCSTATFUNC action, a time limitation which is active in the computations of statistical archives and does not allow for calculation for future times, is no applied. With CALCSTATFUNC, it is therefore possible, for example, to calculate statistics over a script filled archive that has data in the future.

Example


Blok kódu
languageesl
themeRDark
 TIME _bt
 TIME _et
 REAL _retValue
 INT _retCode


 _bt := %StrToTime("8:01:00 16-10-2003")
 _et := %StrToTime("8:02:00 16-10-2003")

 CALCSTATFUNC H.ArchObj, _bt, _et,  _STAT_F_SUM, 100, 0, _retValue, _retCode 

 IF _retCode = _ERR_NO_ERROR THEN
 ; calculation done
 ELSE
   ; an error occurred
 ENDIF 
Note
Using the action CALCSTATFUNC does not allow to evaluate the FILTER and ECOAVG statistical functions.

Info
titleRelated pages:

Script actions