Osisoft PI is the most used historian in the Oil&Gas industry. EdgeX needs to be capable to export data to such a platform.
The target is to deliver this feature as part of California Release.
This capability can be implemented by cloning the current EdgeX HTTPS REST export feature and modifying it accordingly to send messages in a format accepted by PI Web API. This is an approach that has been adopted by other IIoT platforms as well.
{ "Links": {}, "Items": [ { "WebId": "s0LOyweq8d50GzEPfROu0oqQMTAuMTI3LjkyLjEzNA", "Id": "7ab0ec2c-1daf-41e7-b310-f7d13aed28a9", "Name": "10.125.23.143", "Path": "\\\\PIServers[10.125.23.143]", "IsConnected": false, "ServerVersion": "", "Links": { "Self": "https://mypiwebapiendpoint/piwebapi/dataservers/s0LOyweq8d50GzEPfROu0oqQMTAuMTI3LjkyLjEzNA", "Points": "https://mypiwebapiendpoint/piwebapi/dataservers/s0LOyweq8d50GzEPfROu0oqQMTAuMTI3LjkyLjEzNA/points", "EnumerationSets": "mypiwebapiendpoint/piwebapi/dataservers/s0LOyweq8d50GzEPfROu0oqQMTAuMTI3LjkyLjEzNA/enumerationsets" } }, { "WebId": "s0AAAAAAAAAAD_____vIRf4ATkRQ", "Id": "00000000-0000-0000-ffff-ffffbc845fe0", "Name": "mypiarchive", "Path": "\\\\PIServers[mypiarchive]", "IsConnected": false, "ServerVersion": "", "Links": { "Self": "https://mypiwebapiendpoint/piwebapi/dataservers/s0AAAAAAAAAAD_____vIRf4ATkRQ", "Points": "https://mypiwebapiendpoint/piwebapi/dataservers/s0AAAAAAAAAAD_____vIRf4ATkRQ/points", "EnumerationSets": "https://mypiwebapiendpoint/piwebapi/dataservers/s0AAAAAAAAAAD_____vIRf4ATkRQ/enumerationsets" } }, { "WebId": "s0YLwbWI-V8kmIc_EPhJ9d-AVVNBLUgwTDY1UzE", "Id": "581bbc60-958f-49f2-8873-f10f849f5df8", "Name": "pisrv002", "Path": "\\\\PIServers[pisrv002]", "IsConnected": false, "ServerVersion": "", "Links": { "Self": "https://mypiwebapiendpoint/piwebapi/dataservers/s0YLwbWI-V8kmIc_EPhJ9d-AVVNBLUgwTDY1UzE", "Points": "https://mypiwebapiendpoint/piwebapi/dataservers/s0YLwbWI-V8kmIc_EPhJ9d-AVVNBLUgwTDY1UzE/points", "EnumerationSets": "https://mypiwebapiendpoint/piwebapi/dataservers/s0YLwbWI-V8kmIc_EPhJ9d-AVVNBLUgwTDY1UzE/enumerationsets" } } ] } |
If the tag already exists, the reply will look like:
{ "TotalHits": 1, "Links": { "Next": "https://mypiwebapiendpoint/piwebapi/search/query?q=name%3Atagname&scope=pi%3Amypiarchive&count=10&start=10", "First": "https://mypiwebapiendpoint/piwebapi/search/query?q=name%3Atagname&scope=pi%3Amypiarchive&count=10", "Last": "https://mypiwebapiendpoint/piwebapi/search/query?q=name%3Atagname&scope=pi%3Amypiarchive&count=10&start=0" }, "Errors": [], "Items": [ { "Name": "tagname", "Description": "Some Description", "MatchedFields": [ { "Field": "name" } ], "ItemType": "pipoint", "AFCategories": [], "UniqueID": "\\\\{044de274-8d72-4cb6-839b-9e415e793dd8}\\?3", "WebId": "P0dOJNBHKNtkyDm55BXnk92AAwAAAAU1JWR0RZUExNT1NJRDAzXENEVDE1OA", "UoM": "deg. c", "DataType": "float32", "Links": { "Self": "https://mypiwebapiendpoint:443/piwebapi/points/P0dOJNBHKNtkyDm55BXnk92AAwAAAAU1JWR0RZUExNT1NJRDAzXENEVDE1OA" }, "Score": 13.62607 } ] } |
In this case the WebId of the tag must be read and stored in EdgeX in order to be used in further iterations. If the tag does not exist, the reply will look something like:
{ "Links": { "Next": "https://mypiwebapiendpoint/piwebapi/search/query?q=name%3ACDT15&scope=pi%3Amypiarchive&count=10&start=10", "First": "https://mypiwebapiendpoint/piwebapi/search/query?q=name%3ACDT15&scope=pi%3Amypiarchive&count=10", "Last": "https://mypiwebapiendpoint/piwebapi/search/query?q=name%3ACDT15&scope=pi%3Amypiarchive&count=10&start=0" }, "Errors": [], "Items": [] } |
In this case the tag will have to be created with the following command
POST https://mypiwebapiendpoint/piwebapi/dataservers/{webId}/points where WebId is riferred to the target dataserver. The payload of the POST request should look like the following:
|
POST https://mypiwebapiendpoint/piwebapi/streamsets/recorded with the following JSON payload containing a section for each WebId corresponding to the tags
[ {"WebId":"P0dOJNBHKNtkyDm55BXnk92AAwAAAAU1JWR0RZUExNT1NJRDAzXENEVDE1OA", "Items":[ {"Timestamp":"2018-01-16T20:31:50.267Z","Value":15308.23}, {"Timestamp":"2018-01-16T20:31:51.234Z","Value":15308.88}, {"Timestamp":"2018-01-16T20:31:51.357Z","Value":15308.04}, {"Timestamp":"2018-01-16T20:31:51.678Z","Value":15309.15}, {"Timestamp":"2018-01-16T20:31:51.907Z","Value":15309.65} ] }, {"WebId":"P0dOJNBHKNtkyDm55BXnk92A3OM1AAU1JWR0RZUExNT1NJRDAzXEZPR0hPUk4uQ1JJTw", "Items":[ {"Timestamp":"2018-01-16T20:31:50.653Z","Value":15308.67}, {"Timestamp":"2018-01-16T20:31:51.124Z","Value":15308.86}, ] }, ] |
To be updated.
Waiting for Go Export Client & Distribution to support HTTPS REST which is mandatory for this export services to work