Actually I think you just need to use "Compressed Data" in DataLink. This type of query will allow you to specify a time range on a tag and get all collected data points during that time range. As long as you check the box for it, it can also bring the timestamps for those data points. As long as you have your archive compression configured properly you won't miss any data. The "compression" means that a change in value outside the compression limits will result in a new point being saved. That means your compression limits will need to be set small enough to allow all the changes you are interested in to be save.
Many thanks for your prompt reply to my question - I really appreciate the help. Please excuse my relative ignorance to some parts of PI as I'm not an experienced user. My understanding of how compressed data works was that this should show my only when a value changes although it appears that our PI system has been setup so that, regardless on whether a PI tag doesn't change, a reading is taken every 8hours. I am therefore getting the same valve and it's correspondingly time stamp when I run the compressed data as you've suggested across a defined period. Is there a straight forward way that I can filter out repeat values such that I only have the timestamps and corresponding value when it has changed from the previous reading?
I can do this in excel a more long winded way by using VBA although I can't help think that there would be a more simple way within PI Datalink that I can do this with filters.
Thanks once again,
1 of 1 people found this helpful
This will probably do what you want, Alex.
Event=Tag1, IF 'Tag1'= prevval('Tag1') THEN NoOutput() ELSE 'Tag1'
As you and Joseph have mentioned, compression only allows for events to be archived if they exceed the configured compression limits, defined by the Compression Deviation tag attribute. However, if a tag's incoming events do not pass the compression test for a certain amount of time (Compression Max Time) the next event will be archived, even if it does not pass the compression test. This explains why you're seeing the same archived value every 8 hours, which is the default value for Compression Max Time, even though the tag's value does not change.
To filter tag data using PE syntax only in DataLink (no PE tag creation required), you can use the Compressed Data PI DataLink function with the Filter expression TagVal('tag') <> PrevVal('tag'). Here, you can see that the filter only displays archived data that changes:
** Note, this does not affect archived data in any way. It only changes which archived events are displayed in Excel.
Joe's suggestion should also work, but this will result in data being archived twice for your particular tag: once for normal operation and another for the PE. If you're more concerned with preventing the tag from archiving duplicate values in the first place (and not just filtering duplicate values out in Excel reports and such) you should consider updating the tag's compression and exception settings. Please find a list of resources below to learn more about these settings:
- YouTube video on Exception and Compression
- 3226OSI8 - What are recommended Exception and Compression settings
- Compression testing
Hope that helps a bit!