Allow nested operations in AF Asset Analytic functions for 'attribute attname'
KB00868 recommends Asset Analytics as the right job, but there are some major limitations that inhibit ease of use and deployment, specifically around operations on >1 attribute or tag simultaneously.
To improve this, AF analyses functions that take in data of type "attribute attname" should be able to process an expression that returns type attribute. Perhaps limited to periodic analyses other toggleable somehow, as there is potential to use a lot of CPU cycles.
== Example 1: Totalized Mass Flow ==
Given FIT001 and DIT002, return the totalized mass flow (say, kg) over an interval. The current process:
1. Create shortinterval periodic, or eventbased analyses to write the product of flow & density to a taglinked attribute WIT003 (I don't think you can use an attribute as we care about the history).
2. TagTot(WIT003, '*'. '*1w')
Better solution:
AF should be able to see that I'm asking for a 1week total of an expression, so run the expression and totalize the result.
TagTot((FIT001 * DIT002), '*'. '*1w')
This is basically what the SUMPRODUCT function in Excel does, and we haven't found a better way to do it in AF yet.
== 2. Conditional Expressions ==
We monitor processes and create KPIs for utilization and value delivered. PIAF makes it cumbersome to compute utilization or value based on multiple conditions. Utilization of an application APP001 might depend on x=1, y=2, z=3.
Current process:
1. Create shortinterval periodic, or eventbased analyses to write the result of ('x' = 1) AND ('y' = 2) AND ('z' = 3) to a tagbased attribute, MYTAG001.
2. Create an analysis to run TimeEq('MYTAG001', '*', '*1w', 'true')
Better solution:
AF should be able to process something like this:
TimeEq((('x' = 1) AND ('y' = 2) AND ('z' = 3)), '*', '*1w', 'true')
The current process is inefficient and a bad use of tags (both a waste of a tag license and adding a lowvalue intermediary calculated result to the data archive). There are also complexities around scheduling the preliminary analytics to ensure the results are ready for the insightgenerating analytics.
Thanks for your feedback. I'd also be overjoyed to hear there's an easy solution we're overlooking.
3 comments

This is the LiveLibrary URL to Formula Data Reference:
This will help you learn how to create an attribute that is configured to be a Formula Data Reference. Once you have this attribute, you can use it as an input to an Analysis.
I want to emphasize the performance aspect of this per my previous post. Please take great care in ensuring you're not overwhelming the system by calculating excessive amount of data with the Formula Data Reference attribute.

bneufeld commented
Thanks Stephen  that's definitely useful, I have shared with our team here to see if that meets our needs.
Can you advise where this is documented? We have been looking for this functionality for a while. It's not intuitive to find.
Thanks!

Hi,
For Example 1, there is a way to do that with existing shipping product. What you need to do is create another attribute (no PI Point, just an attribute) and configure it as a Formula Data Reference. What you would do is configure the Formula to be a*b, with a=FIT001 and b=DIT002. Now you can create an Analysis Expression for TagTot('Formula_Attribute', '*1w', '*') to get the weekly total. Things to keep in mind:
1) The Formula Data Reference is computed on demand. In this case, it's computed when the TagTot is triggered. When the Formula DR is computed, it will retrieve all the values from FIT001 and also all the values from DIT002 for the entire time range, then do the computation client side. Therefore you should test and be aware of potential performance issues due to the Formula being computed client side and also the cost of retrieving all the values from the server (network latency).
2) As a way to test this, create this Formula DR attribute in PI System Explorer, then you can perform a "Time Series Data" or "Trend" (via rightclick on the attribute) to see what it does.
3) With your Analysis Expression, you should save the output to a PI Point, but in this case it's only 1 PI Point.In general, AF supports ondemand type calculations via Formula Data Reference and Analysis Data Reference and streaming (scheduled) calculations via Analyses. There are PROs and CONs to both so you need to decide which works best for you.
As to Example 2 Conditional Expressions, you can also tried the same as above by creating a Formula DR attribute with a=x, b=y, c=z, then a AND b AND c. Make sure you have a corresponding AF Enumeration set that you would configure for the Formula DR attribute and you would want to configure the Formula DR attribute to be "stepped". Once you have that Formula DR attribute, you can then configure an Analysis Expression with TimeEq. As a reminder, the same caveat as Example 1 above apply here. Check to make sure the performance is adequate for your needs.
Let me know if you need additional information.