We need to ask for raw values for 3000 1Hz tags for a report. What is the best way to get a response to our users using PI Web API in a reasonable amount of time without killing the PI server?
Are you wanting current values (formerly called snapshots) or a time range of raw values? If a time range, how wide is it and how many expected values would there be in a typical call?
We are expecting to query about 3500 attributes for a day's worth of values, where a day would have about 100 values.
So typically around 35,000 values in a query. If you were using AF SDK, this is small enough to be queried in one bulk call to server. As long as your Data Archive version is PI Server 2012 or higher. That's the minimum version needed to support multiple values returned for multiple PIPoints. I know you're dealing with attributes but those attributes are mapped back to PIPoints, so the data archive version matters.
Assuming your data archive is up to date, and returning to your question about what to call with PI Web API, there are some methods to review.
GetRecorded for StreamSets
This call requires all attributes belong to the same element or event frame. A stream set is naturally a set of streams. Beside a time range, you will need to declare a maxCount of returned values.
GetRecorded for Streams
Here a stream would be an individual attribute or PIPoint. This would require 3500 individual calls. So its best to bundle them into a streamset and make the one call on the streamset.
Hi Rick, the StreamSets suggestion was a great idea. However, we need it to return the Name, Description, and Data Reference of the attributes along with their values. Do you have suggestions on how to do that?
To get the attributes on a given element, see:
Also, you may want to see some of our online learning opportunities:
Programming in PI Web API Discussion Forum
As well as YouTube:
osisoft pi web api - YouTube
I agree with Paurav. There are cetain scenarios where PI AF SDK is a better choice, specially if performance is a need.
PI Web API is developed on top of PI AF SDK, therefore we are adding a new layer which decreases the performance. Ideally PI Web API should be used in a client application. The values are retrieved from the PI Data Archive to the browser as the user navigate through the web page. This way, PI Web API will retrieve only the data that the user is interested in.
If you want to retrieve 35.000 values, I assume it is for performing calculations. Is my guess correct? In this case, PI AF SDK makes more sense as it is more efficient and flexible. You can take advantage of the AFDataPipe and AFDataCache in order to cache your results and increase performance.
Another alternative is to develop a custom ASP.NET Web API project. According to what you are trying to develop, this might be a good solution, specially if you need to make calculations on the server-side and not on the client side.
Please provide more details of your project, so we can continue to help you.
The best way to get lots of data also depends on how you want to perceive them in your application.
My client had similar requirement and end solution than changed from PI WebAPI to AF SDK. Please find thread here might be useful to you.
Retrieving data ...