KB-27170: Using Historic’s Average function.

Question:

How can I use the historic’s Average() function?

Solution:

This function returns the average value of a set of data in the historic. The complete command is: Average (src, type, startTime [, endTime])

Where:
– src: name of the tag recorded in the historic.
– type: determines the time interval to be considered when calculating the average (0: year; 1: month; 2: week; 3: day; 4: hour; 5: minute).
– startTime: determines the average’s start time.
– endTime (optional): determines the average’s end time. If used, type parameter is ignored.

Example of script:

Hist1.Open()
resul = Hist1.Average(“tagDemo001”, 5, IniDate, FinDate)
Hist1.Close()

In this example, result, IniDate and FinDate (optional) are RAM tags, and tagDemo001 is the name of the Historic’s field whose average value must be calculated.

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

,

Deixe seu Comentário

Seu endereço de e-mail não será publicado. Campos marcados com asterisco são obrigatórios *