If I remember correctly, you can use WebIds from different attributes from different elements in order to get their recorded values in bulk. Did you try to do the same thing with Channels? Or are you just asking?
I would give a try! Please share your results!
That is exactly what is said on Stream spec page:
A stream set is defined as a collection of streams. Streams inside a stream set can be independent, or share the same base element (e.g. element or event frame) or parent (e.g. parent attribute).
But I am having trouble finding a way of creating such streamset (containing different elements).
Can you make a recorded values call in bulk with independent attributes? Would this work for you? What is you PI Web API version?
Here is the method:
2 of 2 people found this helpful
Assuming you have the right version of the PI Web API (2015 R3 or higher) that supports websockets, it can be done by putting together multiple webids in the url:
The returned message format will be the same as this web api call (although it will only include updated values as they happen, not all values at once)
(Notice the syntax is pretty much the same as the streamsets value web api call, but change the https to wss and value to channel)
If you want to get all values on your initial call add includeInitialValues=true as a url parameter
That is almost what I was looking for from channels. The fact that I have to provide attribute webIds (or am I wrong?) is troublesome for me, as there will be a lot of them. It would be perfect if I was able to do such query with one element id and ask for values for it and its descendants.
I have tested that maximum HTTP GET request length accepted by PI Web API is around 16 KB. That means that I can't bulk as many webIds as I need in one query. If it were possible to make a HTTP POST request it would probably suffice.
What I was originally looking for was a way to retrieve real time values for all elements in one AF database. There are convenient methods for such calls in PI SDK and PI AF SDK. The main reason for switching to PI Web API is that the code is written in Scala (with Spring Framework).
One approach you could chose is to build a separate subtree in AF that contains all the data required for your bulk call. Like a view created in AF.
Note that PI Web API Channels is still in CTP. I don't think the PI Web API teams has tested Channels for that amount of streams. As a result, I would use PI AF SDK AFDataPipe class instead. I am not stating that it won't work on Channels. I am just saying that for your use case, AFDataPipe seems to be a more reliable option.
Although you need to send the webIds through the URL, which can limit the amount of streams you can use per instance, you can create several webSocket instances as a workaround.
Hope this helps!
Have you tried initiating the websocket through an http POST - and put the url in X-PIWEBAPI-RESOURCE-ADDRESS:
POST https://yourpiwebapiserver/piwebapi HTTP/1.1
Authorization: Basic yourhexencodedusernameandpassword
I don't know how big this POST can be. Marcos makes a good point that this is a CTP so you might not want to use in a production use. (Also - a disclaimer - while I work for OSIsoft, I am no expert at these technologies, just someone who is playing with websockets for personal knowledge)