I would like to get something close to real-time data from a PI system.
I would like this to be flexible and able to work with both the AF and PI (Archive) databases.
I'm new to the PI system and the AF SDK, but I suspect that there are two basic ways to approach this.
- Request current values at regular intervals.
- Cache to increase interval at expense of delay.
- Problem is unnecessary traffic
- Asynchronous updates
- Raising events
- Minimizes traffic
I would like the second option if possible, something like a subscription model. From what I'm seeing, should I use a DataPipe (either PI or AF) coupled with an IObserver then?
If a DataPipe is the way to go, then should I use snapshots, time-series, or archive events? I'm assuming Archive events to get any recently archived value, otherwise I'll persist my locally available last archived value?
Another hangup I have is that I'm not interested in any attributes except the current value. How do I optimize for this for both a PIDataPipe and AFDataPipe?
Also, it sounds like an AFDataCache might be another way to go, vs an AFDataPipe. What are the advantages of one vs the other? Is there a similar mechanism to the DataCache for the PI (Archive) database?
A little cross-referencing here to a similar question: Real Time Extract from OSI PI