2 of 2 people found this helpful
i given this some thought, but i can't find a way that that is possible.
I would suggest a different approach. If the amount of data is not that high, you could do the comparison > 100 client side. For the PI Data Archive it will not make a huge difference, as all values need to be retrieved anyway. This should only increase the volume of data from PI Data Archive to your application, and local memory and CPU to process the data.
2 of 2 people found this helpful
You are correct you can't do the bulk calculations when the filter is different. One trick would be to use the '.' trick but it appears that only works on an attributeList. See this thread for more details: Re: FilteredSummaries to find substituded events on a pointlist
Thanks all for suggestion.
I have used Performance equation before and it is very helpful for aggregate calculation such as SQRT (TagVal(TagA) ^2 + TagVal(TagB) ^2).
My perception for Performance equation calculation is on PI Data Archive Server side (there is a Windows Service
"PI Performance Equation Scheduler" in PI Data Archive Server.) Now I acknowledge that Performance Equation is
calculated on client side (that means the calculation and filtering would need to retrieve all element data to client first
before client side calculation.)
My further question would be what can be done for parameter "filterExpression" in PIPointList.InterpolatedValuesAtTimes?
I would also suggest more elaboration and example can be provided for PE usage in PIPointList Methods in the future.
I will follow Roger Palmen's advice to retrieve all archive values and filtering the data by my own coding. But I would want
to know more idea (e.g. PI AF Analytics) which may helpful for future similar problem to this Osisoft community so I do not
mark any answer as correct currently.
1 of 1 people found this helpful
filterexpression uses PE syntax as expressed in the documentation. And that syntact can be found here: https://livelibrary.osisoft.com/LiveLibrary/content/en/server-v6/GUID-690A048E-1C1A-491D-A5FF-83E9F8DE8DAD
Although i would prefer a syntact in EBNF too...
Or of course searching PI Square!. Some examples of excellent posts for AFSDK programming:
Thanks Roger. But I would like to give some background which drive me to ask the question above.
When I initially join my current job, I picked up the projects which were written based on PI SDK. Due to my former
colleagues do not familiar in PI SDK, when there is a task which want to get the maximum value of a tag in a period,
the previous coding would retrieve all archived or interpolated values in that period and compare all values to find
the maximum value. Indeed there are functions such as FilteredSummaries and usage of Performance Equations (PE)
in PI SDK which can help to give the same result in a much more efficient and I have implemented them. I learned
that the proper use of PE can save much time.
Coming back to the question above, I acknowledge for a single tag or those tags which can be identified
(e.g. SQRT (TagVal(TagA) ^2 + TagVal(TagB) ^2), archived, interpolated or summaries value can be retrieved efficiently.
I am just curious about if a tag is not predefined (i.e. all cases for PIPointList methods), what is the usage of filterExpression
or PE? (i.e. It may not solve my case, but what cases can be solved?)
I certainly confirm the usage of current function "PIPointList.InterpolatedValuesAtTimes" would be much more efficient
than query the interpolated values for each tag one by one since it save much overhead times. And I do appreciate
Osisoft has continuously provided these new functions for us as developers. But since the illustration of parameter "filterExpression"
is not provided (as far as I have read), I am afraid I have missed some valuable techniques for using those new functions.
For non-bulk calls, the filter expression works fine is has many uses. E.g. just return pressure when the pump is running.
For bulk calls, i agree that you would need to be able the "current" attribute (e.g. using [.], So in the case of retrieving interpolated data on a Pi Point in a bulk call, for every individual PI Point in the list you could use the same expression. Maybe a good suggestion to OSIsoft to add to the feature list?
For the moment, best option is to create all your filterexpressions in bulk and call in parallel, or just find the values you need client-side.
Thanks Roger and it seems it is the only method that can be found. So I mark your answer correct.
If Osisoft representative notes this discussion thread, I hope you can show a simple example for using
"filterexpression" parameter in "PIPointList.InterpolatedValuesAtTimes" to inspire this community.