Jerome Lefebvre

Linking Denso Wave's IoT Data Share with a PI System via OMF

Blog Post created by Jerome Lefebvre on Mar 23, 2020

Linking Densowave's IoT Data Share with a PI System

Denso Wave built IoT Data Share to be a middleware translation layer between industrial protocols. It is used a lot in Japan, particularly due to our so called Galápagos syndrome, in which solution vendor love to reinvent the wheel.

List of devices already supported is quite long, here is a subset of it: 

 

I want to show a sample project that helps push this data to a PI System via OMF.

To make a simple projects, we will send only values to a single tag and not create any AF structures. A sample project is attached and it was only tested with version 1.8.0 of IoT Data Share and PI Web API 2019. I am also assuming that you are familiar with IoT Data Share, thus I am only pointing out gotchas and general concepts of OMF.

The request involved

To send data to a single tag we need to use 3 different requests:

  1. Create a type
  2. Create a container
  3. Send the time series data

The last step is the one that is repeated continuously. The first two steps are only done in two cases, initialization (first time the tags are created), recovery (something bad happen to the tags created or PI Web API). In this example, we will flip the order to the following:

  1. Send the time series data
  2. If step 1 returns an error regarding container, send the container data again and then send the data
  3. If step 2 returns an error regarding the type, send the type data again and then send the container data

With this set up, we don't need to keep track if we are still in the initialization steps. Recovery from a bad state or initialization are handled both the same way.

The connection

There are no dedicated OMF plugins in IoT Data Share as of today, but there is a JSON output option that we can configure.

 

In this example, I want to send tire pressure data, thus my containerid will contain the name of the tire (e.g. left front tire), the data will be a pair of a timestamp and a pressure value. For example, it will look like this:

[{ "containerid": "left-front", "values": [ { "time": "2020-03-23T00:00:00Z", "pressure": 32 } ] }]

Two things to notice

  1. The format of the timestamp this a specific ISO 8601 format and in UTC. In particular, OMF doesn't support timezone offset, so this timezone shifting must be done by the OMF client application
  2. Even if you send a single value, you must still send a list

The time format

To configure the timestamp, we will use execution time. Luckily, IoT data share allows us to grab the current time in UTC via the @GLOBAL_TIME variable.

 

 

All we need to do is format it correctly:

 

Create the JSON format

The JSON utility that IoT Data Share supports allows you to build a JSON object via a GUI editor that is made up of the usual keys and values, values being of string, number or array type. Thus, we can build up our object this way:

 

 

The GUI doesn't allow to send an array of JSON objects, thus to do so we will use a string operation to create our list of one JSON object.

 

 

Sending data to PI

We are now able to send data to PI via the HTTP Request object.

 

Note that IoT Data Share will not work against a untrusted certificate, thus make sure PI Web API has a valid trusted certificate.

Adding in the container information

The above request was to send data, this request will fail if the containers (and the type) is not created ahead of time. In this case, PI Web API will return two pieces of information, the request will return with a status of 400 ("Bad Request", i.e. there is an issue with the request) and it will contain a further error code of 5002 that states that the particular reason why the request is bad is that the container mentioned does not exist. It is the duty of your IoT Data Share project to handle these various OMF Event Codes, this sample only deals with the lack of a container.

We can now see the completed project. 

 

Note that we didn't add a step that handles the failure to have a type, thus this will be up to the reader to add this.

Attachments

Outcomes