Digital Flags

In general, a PI point cannot have a numeric value and a digital state value at the same time. In PI for Windows NT and UNIX, this is still true for data that is unusable.

For example, if an interface is shut down, the digital state code would indicate "Shutdown."

There are, however, three flags available in PI for Windows NT and UNIX that indicate that the data value is valid, but the status of the data value is not normal.

The three flags are labeled substituted, annotated and questionable. All flags can be read using calls to pisn_getsnapshotx, pisn_getsnapshotsx, piar_getarcvaluex and piar_getarcvaluesx. Calls to piar_putarcvaluesx, pisn_sendexceptionqx, pisn_putsnapshotx and pisn_putsnapshotsx can be used to set the questionable flag only; the other flags are reserved for the PI System.

Substituted is used to indicate that the value has been changed from its original value. This value is set only by the PI Archive Subsystem when an existing value is changed.

Annotated indicates that there is a comment about a value that is available elsewhere (value annotations will be available in a future release of PI for Windows NT and UNIX).

Questionable indicates that there is some reason to doubt the accuracy of the value. This is the only flag freely available to interface programs.

The functions in the extended PI-API give programmers access to these flags through a separate argument labeled flags. Interfaces are not required to support flag values. If you do not wish to retrieve a flag value, pass a NULL pointer to the extended PI-API function.

Flag values are set and read using masks define in the extended PI-API include file piapix.h. For example:

/* set the questionable flag before putsnap */

int32 istat = 0;
int16 flags = 0;
flags |= PI_M_QFLAG;
bsize = 0;
error = pisn_putsnapshotx(ptnum, &rval, NULL, NULL, &bsize, &istat, &flags, &t);

/* returned data value substituted? */
error = pisn_getsnapshotx(ptnum, &rval, NULL, NULL, &bsize, &istat, &flags, &t);
if (flags & PI_M_SFLAG)
 printf("Substituted!\n");
}

PI for OpenVMS

PI for Open VMS does not support flags. When putting data into PI, the flag mask is ignored. When retrieving data from PI, the flag mask is always returned as zero.

Enabling Operational Intelligence