2 of 2 people found this helpful
If you already have an AF model, the easiest approach would be to utilize a built-in functionality of AF called Asset Analytics. This way, you can avoid writing any code (and having to run it reliably!).
I'll use a very simple AF model to illustrate this method.
Each child element has an attribute (DigAttribute) that is tied to a digital PI Point.
First, I need to create an intermediate analysis on each Child Element:
This will output 0 or 1 to the Analysis1_Output attribute:
Then, I just need to create a rollup analysis on the parent element like this:
And here is the result of the rollup calculation:
One final note: in production, it's best to build this kind of calculation based on a reusable AF Template. Using Templates is a general best practice for AF, and calculations certainly benefit from operating on Elements tied to a Template.
I first thought about this as we have everything setup in AF.But i was concerned about amount of Tags we have. 500 was just example but we can have upto 3000 discrete for which we want to know the count at every second.Also i am not sure how Analysis works performance wise when we have 3000 Tags for 10-15 customers.
5 of 5 people found this helpful
Building upon Anna's reply, you could modify this approach with using just a rollup analysis and some attribute categories. I have taken a similar approach in a recent project.
If your tags are Digitals, and use a digital set of 2 states - 0 = False and 1 = True, you could configure the AF Attributes as an Int data type, and then perform a Rollup analysis to give you the Sum of these attributes. You can target these specific attributes through the use of an Attribute Category if needed. So long as the attribute hierarchy of the target attributes falls within either Root or Child level (and not deeper down an attribute hierarchy) then this should return to you the number of tags == True at the time of evaluation. This approach would allow you to not have to write a separate Expression analysis for each tag to be counted.
I really like John's approach described above!
For the performance question, AF Analytics can easily handle 3000 calculations (and more!) as long as it has enough hardware resources on the server. We don't have official hardware sizing recommendations for this product yet, but I found some recommendations from our developers in this thread AF Server Sizing.
AF Analytics will scale out across all available cores - see Barry's comment for more details: How does Analytics use processor cores?
and into all available RAM as necessary. Patrice gives an in-depth explanation on RAM utilization in this thread: PI Analysis service performance
Edit: server hardware sizing recommendations are here: https://techsupport.osisoft.com/Downloads/File/8d7f6f38-2ed3-43f3-a7f5-a15789e6bca7
Some other sizing guides are here: System Manager Resources, under the PI System Sizing & Configuration section
Anna, could you add in the server sizing link in again. I have come across a situation where several projects are hitting an AF server, so for me there is a consideration to have multiple AF servers, especially as one projects AF database requires the PIFD to be re-indexed every night, so every thing get affected.
Sure, I just edited my post. Have you already been in contact with our Technical Support folks about this issue?