Reading the value of a specified historical value in the given time.
GETARCHVAL valueIdent_Real, archIdent, timeExpression_TmA [STATUS [isDataIdent_Bool], [archFlagsIdent_Int], [archivInstance_Int]] [VALID | INVALID] |
valueIdent_Real | out | A reference to one value of the historical value, reference to an object or an item identifier of the structured variable type object (Note: values of object or item must be 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. |
archIdent | in | A reference to one value of the historical value, reference to an object or an item identifier of the structured variable type object. |
timeExpression_TmA | in | Expression of the Absolute time type. |
isDataIdent_Bool | out | Identifier of the Boolean type - attribute of successful reading from the archive, optional parameter. |
archFlagsIdent_Int | out | Identifier of the Int type: archive flags, optional parameter. |
archivInstance_Int | in | Optional identifier of the Int type - identification of the archive instance. If the parameter is not defined, the value 0 will replace it. |
If the parameter archIdent is a reference to an object of Historical value type, the action performance is described above. If the parameter is a reference to an object (not of the Historical value type) or a structured variable item that is not of the Object type, the system will attempt to find an object of the Historical value type that archives values of the object (item).
If the parameter archIdent is a reference to a structured variable item that is of the Object type, the item "points" to an object in the system. If the object is of the Historical value type, the action will read data from it. If it is not, the system will attempt to find an object of the Historical value type that archives values of the object.
The result of reading (value) will be assigned to the variable valueIdent_Real
.
If the identifier isDataIdent_Bool is specified, the action will assign it the following value:
If the identifier isDataIdent_Bool is not used and no data was read, the action doesn't modify the value of the identifier valueIdent_Real.
If the identifier archFlagsIdent_Int
is specified, archive flags for a value, which were read, are saved into the identifier (archive flags are defined as the sum of the following constants):
The logical AND (&), that may be also applied into integer operands, is used to test archive flags.
For example: If the condition archFlagsIdent_Int & 4 = 4 is true, then the flag of a value that was read from the archive database by means of the action GETARCHVAL is has ArcBlock flag (blocking of the archiving).
The value of the 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.
For versions newer than 21.0.70, you can specify a VALID or INVALID clause. This clause can be used to read the last valid (VALID) or invalid (INVALID) value for a given time (ignoring all following values which are not VALID or INVALID).
Reading of archived value:
REAL _value TIME _bt BOOL _bIsArchData ; calculation of current minute begin _bt := SysTime _bt := _bt - %ModTime(_bt, 60) ; reading of value and active instance of archive GETARCHVAL _value, H.Sec, _bt STATUS _bIsArchData,,0 ; has the value been read? IF _bIsArchData THEN ; processing of value which has been read ENDIF |