Performance Equation to combine data from two PI tags

Discussion created by gkrueger on Aug 1, 2012
Latest reply on Aug 6, 2012 by gkrueger

Can anyone point me in the direction I'd need to go (functions to use etc.) to create a Performance Equation that can be used to aggregate the data from two or more PI tags into a single PI tag.  I basically need something like ...  If tagA snapshot time>(Now-1scan) then TagA else if TagB snapshot time>(Now-1 scan) then TagB etc.  I couldn't see in the PE function reference a way to get the current snapshot time for a Tag, I just saw functions for getting archive timestamps.  


The application I'm working on is to collect lab data from multiple pieces of analytical equipment and get it into PI so we can run reports and trend it.  The issue we have is that there are multiple vessels in the lab and also multiple analyzers that they use for each vessel.  We want to trend data for a particular vessel, so we need to figure a way to separate the measurements coming in from the different analyzers to get assigned to their particular vessel tags.  


The raw data comes in from each analyzer using OPC, so we have a separate OPC interface for each analyzer and they have their own set of PI tags which get all the results coming from the analyzer (with vessels ID's random based on how the operators are running the samples for the day (ie they might run Vessel 1 first then Vessel 4, then Vessel 3, etc.)


We were thinking of doing this all in one PE  (if VesselID on analyzer 1equals Vessel 1 then the Vessel 1 tags set their values to the current values of analyzer 1, if Vessel ID on analyzer 2 equals vessel 1, then set value to the current values of analyzer 2, etc.)  But the PE's get complex quickly.


Now we're thinking it might make more sense to try to combine the data coming from the multiple analyzers (we have 3 max) into a single set of PI tags, then we can run Datalink queries direct against that set of Tags and filter by Vessel ID.  And then for the individual vessel tags to use for trending, we can create PE's that just say if Vessel ID = Vessel 1, then value = value of the aggregate data stream.  


Any input for approaches to solve this issue is greatly appreciated.