ReadInterpolatedTags
  • 30 Jan 2024
  • PDF

ReadInterpolatedTags

  • PDF

Article summary

The general query structure is as follows:

SELECT

       tagName,

       timestamp ,

       value, --value as a double

       lValue, --value as a long

       sValue, --value as a string

       quality, --numeric opc da quality (0 = bad, >= 64 = uncertain, >= 192 = good)

       squality,   --string quality (good, bad, uncertain)

       historianQuality, --numeric historian quality

       sHistorianQuality --string historian quality (raw, calculated, interpolated, nobound, etc)

FROM

       ctc_fn_PARCdata_ReadInterpolatedTags

(

       'Plantname.Sample.1,Plantname.Sample.2' , --tag list. The last parameter passed is the character used to separate the tags

       GetDate ()-1, --read start date (either a string or datetime value)

       GetDate (), --read end date (either a string or datetime value)

       ' AVERAGE ', --aggregate to read

       120, --aggregate step size in seconds

       ',' --tag delimiter in tag list

)

The arguments for the function are:

TagList (string): List of tags for which to get raw data. If there is more than one, use the Delimiter argument.

StartDate (datetime): Start time of the query.

EndDate (datetime): End time of query.

Aggregate (string): The OPCHDA aggregate type used for the returned data. The options are listed below.

Stepsize (integer): The step size for the aggregate in seconds.

Delimiter (string): The character used to separate the tags in the TagList argument.

Results come back ordered by tag then by timestamp if no ORDER BY clause is specified.

Aggregates types:

INTERPOLATIVE

TOTAL

AVERAGE

TIMEAVERAGE

COUNT

STDEV

MINIMUMACTUALTIME

MINIMUM

MAXIMUMACTUALTIME

MAXIMUM

START

END

DELTA

REGSLOPE

REGCONST

REGDEV

VARIANCE

RANGE

DURATIONGOOD

DURATIONBAD

PERCENTGOOD

PERCENTBAD

WORSTQUALITY

ANNOTATIONS

Sample output:

tagName

timestamp

value

lValue

sValue

quality

squality

historianQuality

sHistorianQuality

Camas.Sample.1

11/11/15 15:27

4.3136

4

4.3136

192

good

524480

Calculated

Camas.Sample.1

11/11/15 15:29

3.8967

4

3.8967

192

good

524480

Calculated

Camas.Sample.1

11/11/15 15:31

3.5854

4

3.5854

192

good

524480

Calculated

Camas.Sample.1

11/11/15 15:33

0

0

0

bad

2097152

NoData

Camas.Sample.1

11/11/15 15:35

0

0

0

bad

2097152

NoData

 


Was this article helpful?

What's Next