Hi,

I would like to calculate the hourly sum of an AF attribute (attribute A) using PI AF Analyses. The trend for attribute A appears as a piece-wise constant function. I need the hourly sum of the value of A, as sampled by the event frequency of another attribute (attribute B). For example, if over the hour A is constant at 5, and B changes 3 times, the analysis should return 15 for the hour. In this case, I could multiply the value of A by EventCount of B. But this does not work if the value of A changes in the middle of the hour. I can't see a way to do this calculation correctly without looping through the events for B (which I realize is not supported in Analyses). Is there a better approach, maybe by triggering an event frame every time the value of A changes?

Thank you.

I can think of one way to do this using one (or maybe two) tags.

You can run an analysis that will trigger only on attribute B, and when B triggers, multiple B*A and write this to output C.

Periodically, (once an hour), you can get find the event weighted total of C by multiplying the event weighted average by the sum of the events. Basically TagMean() * EventCount(). Let us know if you need the exact formulas, but you seem to have a pretty good feel for this. Of course, using a PI Datalink query, you can compute the event-weighted total using the calculated data function and not write this out. It really depends if you want to share the results with others or have your own report.