Query Modes and Time Ranges

When combined, these two parameters determine what report will be generated from a given set of tags. The choice of Mode determines how the raw data will be retrieved. The choice of time range selects the amount of data included in each of Mode's calculations. Each works with the other.

The VTScada Function Reference has the following to say about the Mode parameter in both GetLogand GetTagHistory:

Mode: Required. Indicates the mode of data collection.

Note that the mode is useful only when the TPP(*)  parameter is valid and greater than 0. Mode may be one of:

Mode

Data Collection

0

Time-weighted average

1

Minimum in range

2

Maximum in range

3

Change in value over the range

4

Value at start of range

5

Time of minimum in range

6

Time of maximum in range

7

Sum of zero to non-zero transitions

8

Sum of non-zero time

9

Totalizer

10

Obsolete. Maps to 4

11

Difference between the start and end values of a range (see comments in GetTagHistory)

It is possible to retrieve more than one mode in a single GetTagHistory statement. To do this, pass an array of values in as the Mode parameter.

(*) "TPP" in the above description, is the Time Per Point (or Time Per data Point) parameter.

By adjusting these two parameters, and using the example code shown in the topic "Common Features of a Report Module", you can create a wide variety of reports. The following table provides a few suggestions:

Mode

TPP

Report

7

3600 (1 hour)

Pump starts per hour

8

86400 (1 day)

Daily total running time

9

3600

Hourly totals

1 & 2 in an array

900

Minimum and Maximum values each quarter hour