Would like to get the TagAvg() with events, not with timestamp. Another solution is get the timestamp from the tenth sample tag for example and them get the avg value.
Does anyone know about it?
One way to do this would be to nest the PrevEvent() function 10 times to get the timestamp of the 10th event.
PrevEvent('attribute', '*') gives you the timestamp of the previous event before the current time ('*')
PrevEvent('attribute',PrevEvent('attribute', '*')) will give you the timestamp of the event 2 events ago, and so on as you nest the PrevEvent function more and more.
Once you have the timestamp of the 10th event you can feed that into the TagVal() function as you suggest.
This can be a little hard to read, so you may wish to spread this over multiple lines in your analysis.
Thanks for your answer.
Actually i did that. I was looking for a better practice. This was just an example, the calculation has 30 events and it can grow.
Anyway, thanks again for your concern about my issue.
Hello Rérison ,
I've found a techsupport troubleshoot article dealing with problem like this. (https://techsupport.osisoft.com/Troubleshooting/KB/KB01120)
But not with specified number of events... : (
TagMean() can be alternative, if acceptable to calculate the event-weigted average for an ending time period (ex. the last hour or last day) .
Perhaps somehow calculate the proper period based on EventCount()...?
No better idea for AF analysis,
Retrieving data ...