piar_compvalues

This function returns events from the Archive for the passed point number starting at the time in the first element in the times array, times[0], and traversing the Archive forwards and backwards through time. times[count - 1] must also be set as described below.

C format

int32 piar_compvalues(
int32 pt,
int32 PIPTR * count,
int32 times[],
float rvals [],
int32 istats[],
int32 rev );

Returns

>0

System error

Success

-1 

Bad point number

-101

Date not on line

-103

No data for this point during the specified time range

-105

Bad time stamp

-121

Invalid count parameter

-996

Message too big for PINET protocol

-998

Memory allocation error

Arguments

pt (passed)

Point number

count (passed, returned)

Number of values to retrieve (passed); number of values actually retrieved (returned)

times (passed, returned)

Time stamps of values. times[0] is the start time; times[count-1] should be set to: 0 if an unbounded search is desired; > times[0] if rev is FALSE; < times[0] if rev is TRUE.

rvals (returned)

Values in engineering units. For values which are not of type real, the values returned in rvals are meaningless.

istats (returned)

Integer or status values

rev (passed)

Reverse sequence flag. If false (zero), search will be forwards in time; if true (non zero), search will be backwards.

Usage Notes

The following example demonstrates how to retrieve compressed Archive events for a point over a specified time period.

#define ARRAYSIZE 2000

 

int32 status, pt, count, rev;

int32 times[ARRAYSIZE], istats[ARRAYSIZE];

float rvals[ARRAYSIZE];

 

/* get the point number */

if ( status = pipt_findpoint   ( "sq:f100", &pt ) )

ERRORRETURN( "findpoint", status ); 

 

/* get beginning and ending time stamps */

if ( status = pitm_parsetime

   ( "Y-8h", 0, &(times[0]) ))

ERRORRETURN( "pitm_parsetime", status ); 

 

if ( status = pitm_parsetime( "+24h", times[0],

    &(times[ARRAYSIZE-1]) );

ERRORRETURN( "pitm_parsetime", status ); 

/* get archive data */

count = ARRAYSIZE;

rev = 0; /* FALSE */

status = piar_compvalues( pt, &count, times, rvals,

    istats, rev );

/* ...check status */

/* ...if count == ARRAYSIZE we may need to get more data */

Enabling Operational Intelligence