Snapshot table (PISNAP and PISNAP2)
- Last UpdatedJan 13, 2023
- 2 minute read
- PI System
- PI Server
The snapshot and snapshot2 tables provide access to PI Snapshot Subsystem, both for listing or editing. The snapshot is the most recent event for a point. It can be viewed as a buffer that is only one element deep. When a new event arrives, it becomes the new snapshot, unless it has a timestamp older than the snapshot. The previous snapshot is evaluated according to the compression specifications and is either sent to the event queue or discarded.
Events that have a timestamp older than the snapshot are sent to PI Archive Subsystem through the event queue. These events are referred to as out-of-order events. Out-of-order events are never evaluated for compression.
Event values are always stored in full precision in the snapshot. Scaling, if applicable, is applied when the event is stored into the archive.
When the archive events for a point are listed or trended by PI ProcessBook and other tools, the snapshot is included in the list if the requested listing covers the snapshot time.
The snapshot table resides in memory. Every 15 minutes or less, PI Snapshot Subsystem flushes the table to disk, where it is stored in the piarcmem.dat file.
The table names are PISNAP and PISNAP2. The primary key is TAG.
|
PISNAP and PISNAP2 Attributes |
Description |
Comment |
|
TAG |
The tag name |
(Read only) |
|
PointID |
The point ID |
(Read only) |
|
Type |
The point type (float32 …) |
(Read only) |
|
Value |
||
|
TIME |
Event timestamp in the format DD-MMM-YY hh:mm:ss.ssss |
|
|
TimeNum |
Timestamp as a number in seconds past 01-Jan-70 |
|
|
Status |
The value status |
(Read only) |
|
Flags |
(Q)uestionable, (M)odifed, (A)nnotated |
Only Q is read/write |
|
Annot |
Annotation |
To read snapshot data, use list mode. To change the data, use edit mode. Other modes are not applicable.
If a numerical snapshot value is invalid, the Data Archive server shows the value as “Digital State” and the status attribute shows the digital state that describes the status. If a numerical value is valid, the actual value is shown and the status attribute shows the digital state “GOOD.”
To change a digital point value, you can specify either the digital state name or the numeric offset (digital state number).
The file pisnap.dif, included with every system, is a quick way to list snapshot values.
$ piconfig input pisnap.dif
* (Ls - PISNAP) piconfig> @sele tag=c*
* (Ls - PISNAP) piconfig> @ends
CDEP158,2,GOOD,20-Nov-02 17:02:00
CDM158,Manual,GOOD,20-Nov-02 17:09:30
CDT158,53.03498,GOOD,20-Nov-02 17:10:00
The PISNAP2 table is useful for debugging classic PI API applications. It uses RVAL and ISTAT attributes instead of Value and Status.
In PI 2.x, ISTAT for digital tags is the negative of the state number. In the PISNAP2 table, ISTAT contains a 32-bit number that represents both set and state. The set number is in the most significant 16 bits and the state number is in the least significant 16 bits. The system set number is 0. Be aware that some PI API functions truncate the most significant 16 bits. String values cannot be used in PISNAP2 table.
|
PISNAP2 Attributes |
Description |
|
RVAL |
real values; or 0 for other point types |
|
ISTAT |
Positive integer value for integers, status for invalid real values, or set and state number for digitals. |