pisn_flushputsnapq

This function sends any values in the snapshot queue to the PI home node and returns a list of errors, if any. This function is called by pisn_putsnapshotq and pisn_sendexceptionq when the queue is full.

C format

LPQERRORS PIWIN pisn_flushputsnapq ( void )

Returns

LPQERRORS type, which is a pointer to a qerrors structure as defined in piapi.h. The structure contains the system error and a list of point errors, if any. The structure and typedef are as follows:

typedef struct qerrors

{

int32 syserror; /* current system errors */ 

int32 numbpterrs; /* # of individual pt errors */ 

struct qerror qerr[MAXPUTSNAP]; /* list of pts in error */ 

}PIPTR *LPQERRORS;

typedef struct qerror

{

int32 point; 

int32 error; 

}PIPTR *LPQERROR;

syserror

>0 System error 

0 Success 

numbpterrs

Number of points in error list 

point

Point in error 

error

-1 Point does not exist 

-8 Time is after the current time or less than 0 

-9 Illegal status or integer value 

Usage Notes

This function is useful if the snapshot rates are not fast enough to force flushing of the queue automatically. On DEC VAX systems, queuing is already part of the snapshot calls, thus this routine will always return syserror and numbpterrs = 0.

The same structure is used for each queue call, thus it is advisable to process the return information or copy the structure before making another queue call.

Example

The following example sends a group of point values, collected at the same time to the queue and then calls flush. This reduces network traffic while minimizing the time that values remain in memory before being transmitted to the home node.

LPQERRORS qerrors;

#define NUMINTERFACEPOINTS 10

float rval[NUMINTERFACEPOINTS];

int32 istat[NUMINTERFACEPOINTS];

int32 timedate[NUMINTERFACEPOINTS];

int32 pointNum[NUMINTERFACEPOINTS];

int i

... 

... Load the pointNum array with the desired
points
 

for (i=0;i<NUMINTERFACEPOINTS;++i){
.... load point values ...
 

pisn_putsnapshotq(pointNum[i],rval[i],istat[i], 

timedate[i]); 

qerrors = pisn_flushputsnapq(); 

for(i=0;i<qerrors->numbpterrors;++i){ 

printf("Error %ld with point %ld\n",qerror[i].error, 

qerror[i].point); 

Enabling Operational Intelligence