Accessing historical values - D2_ArchArr function

The function D2_ArchArr provides a more effective access to historical values of D2000 system.


Declaration
D2_ArchArr
(archObjName,bt, et, step, attribute, 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 Begin time of the archive block.
et ABS. TIME type End time of the archive block.
step INT type Time step [s] within the archive block.
attribute TEXT type Required attribute of historical value.
bDirectionByRow BOOL type Time order of cells in matrix.
refresh   Optional parameter.

Description
Return value of the function is of Value array type. The feature designates it to use in so-called Matrix.
Some matrix features:
  1. Matrix is a continuous set of one or several cells (rectangular shape).
  2. Expression defining a value of cells in the matrix is the same for all the cells.
  3. A change of the expression in a cell must be confirmed by pressing the keys CTRL+SHIFT+ENTER (The consequence of item 2 is the automatic update of all other expressions for all cells in the matrix).
  4. To create a matrix:
    1. Select the range (selection of cells).
    2. Press the F2 key and type required expression in a cell (e.g. =1).
    3. To finish editing press the keys CTRL+SHIFT+ENTER.

    The procedure above has created a matrix containing selected cells. Expression is the same in all the cells.

  5. Expression for a cell included in a matrix is enclosed between combined brackets in the Formula bar: .
  6. Only a whole matrix can be deleted. You must select all the cells of the matrix.
  7. For all cells of a matrix, the expression (the same for all the cells) is evaluated just once. If the expression gets a value of Array type, the values of cells in the matrix will correspond to the values of the array.

The function returns an array of required attributes of the archive values (the parameter attribute – see the function D2_GetValue) of defined historical value. The parameters bt and et defines a time order of cells of the matrix. It is important only for matrix containing at once several rows and several columns. If the value of the parameter is TRUE, the values (ascending order by time) are inserted into cells row by row. Otherwise the values are inserted into cells column by column.

The parameter refresh - see the function D2_GetValue.
Value time from the archive is defined by is defined by the relative position of the cell containing the function call and the matrix in which the cell is placed.


Example
The parameters for the archive block are:
BT
= 10:00:00 1.1.2000
ET =
12:00:00 1.1.2000
STEP =
30*60 = 1800 (1/2 hour)

the times of individual values in cells, according the matrix range and the parameter bDirectionByRow, will be as follows:

  1. The matrix A1:A6, bDirectionByRow=FALSE or TRUE

     

  2. The matrix A1:B3, bDirectionByRow=FALSE

     

  3. The matrix A1:B3, bDirectionByRow=TRUE

The return value of the function for all the values out of required interval is an error message: #Value, or the value of the cell named SUPP_NO_ARCH_DATA if exists (see the topic Predefined cells).



0 komentárov

Nie ste prihlásený. Akékoľvek zmeny, ktoré vykonáte, sa označia ako anonymné. Ak už máte svoj účet, pravdepodobne sa budete chcieť prihlásiť .