Porovnávané verzie
Kľúč
- Tento riadok sa pridal
- Riadok je odstránený.
- Formátovanie sa zmenilo.
GETARCHVAL action
Blok kódu | ||||
---|---|---|---|---|
| ||||
GETARCHVAL valueIdent_Real, archIdent, timeExpression_TmA [STATUS [isDataIdent_Bool], [archFlagsIdent_Int], [archivInstance_Int]] |
valueIdent_Real | out | Reference to one value of historical value, reference to object or item identifier of 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 | Reference to one value of historical value, reference to object or item identifier of Structured variable type object. |
timeExpression_TmA | in | Expression of Absolute time type. |
isDataIdent_Bool | out | Identifier of Boolean type - attribute of successful reading from the archive, optional parameter. |
archFlagsIdent_Int | out | Identifier of Int type: archive flags, optional parameter. |
archivInstance_Int | in | Optional identifier of Int type - identification of archive instance. If the parameter is not defined, the value 0 will replace it. |
If the parameter archIdent is the a reference to an object of Historical value type, the action performance is described above. If the parameter is the a reference to an object (not of Historical value type) or a structured variable item that is not of Object type, the system is attempting will attempt to find an object of Historical value type that archives values of the object (item).
If the parameter archIdent is the a reference to a structured variable item that is of Object type, the item "points" to an object in the system. If the object is of Historical value type, the action will read data from it. If it is not, the system is attempting system will attempt to find an object of Historical value type that archives values of the object.
The result of reading result (value) is to will be assigned to the variable valueIdent_Real
.
If this the identifier isDataIdent_Bool is statedspecified, the action will assign to it the following value:
- True - data are loadedwas read,
- False - no data.
If the identifier isDataIdent_Bool is not used and there are no data was read, the action doesn't modify a the value of the identifier valueIdent_Real.
I the identifier archFlagsIdent_Int
is statedspecified, archive flags for a value, that was read, are saved into the identifier (archive flags are defined as the sum of the following constants):
Kotva | ||||
---|---|---|---|---|
|
- 1 - (ArcStart) - value stored into the database at the moment of D2000 Archiv start
- 2 - (ArcStop) - value stored into the database at the moment of D2000 Archiv stop
- 4 - (ArcBlock) - value stored into the database at the beginning of blocking the archiving (by the stop condition of archiving configured in D2000 CNF)
- 8 - (ArcUnBlock) - value stored into the database at the end of blocking the archiving (by the start condition of archiving configured in D2000 CNF)
- 16 - (ArcDeleted) - value from the archive database that was deleted by an user. The action ignores the deleted value (as if it were not in the archive)
- 32 - (ArcUsermodify) - value in the archive that was modified by an user
- 64 - (ArcOldVal) - old value that was read from a communication station
- 128 - (ArcProcessModify) - value that was modified by a process (not by an user: ESL Script, D2000 VBApi, ...)
- 256 (ArcLoadData) - obsolete: value was obtained from OS/2 database SQL Gupta via On-line archive database import
- 512 (ArcMonoTime) - value is stored with monotonous time
- 1024 (ArcK) - value of periodic archive is generated during reading as a copy of previous value
The logical AND (&), that may be also applied into integer operands, is used to test archive flags.
For example: If the condition aflags archFlagsIdent_Int & 4 = 4 holds 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).
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.
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.
- If the particular archive process is not running, the action generates the error _ERR_ARCHIV_NOT_RUNNING.
- If an an object of Historical value is archived:
- periodically, reading a value out of the period is unsuccessful
- according to a filter, value for the required time is to be derived from the last stored value in the archive.
Reading of archived value:
Blok kódu | ||||
---|---|---|---|---|
| ||||
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 |