/OSI-Samples-OMF

The OSIsoft samples are introductory, language-specific examples of programming against OSIsoft technologies. They are intended as instructional samples only.

Apache License 2.0Apache-2.0

📢 Notice: samples have transitioned to being hosted in individual repositories

OMF Samples

The Open Message Format (OMF) defines a set of message headers and bodies that can be used to generate messages for ingestion into a compliant back-end system. The PI System and AVEVA Data Hub both have a compliant OMF receiving endpoint.

OMF can be used to develop data acquisition applications on platforms and in languages for which there are no supported OSIsoft libraries. Official documentation can be found here. The PI Square OMF developer community can be found here.

Some tasks and individual language examples have labels as follows:

The official OMF samples are divided in multiple categories depending on the scenario and problem/task, accessible through the following table:

Tasks

Basic API

These samples demonstrate sending some typical OMF messages. The applications are configurable to both PI and AVEVA Data Hub. Details

Language ADH Test Status EDS Test Status PI Test Status
.NET Build Status Build Status Build Status
Python Build Status Build Status Build Status
C++ Build Status Build Status Build Status

Complex Dynamic

This sample demonstrates sending time series data to the AVEVA Data Hub, Edge Data Store, and PI Web API OMF endpoints. It sends 2 values at 1 timestamp. Details

Language ADH Test Status EDS Test Status PI Test Status
Python Build Status Build Status Build Status
NodeJS Build Status Build Status Build Status

Bart Ingress

This sample demonstrates sending time series data to the AVEVA Data Hub, Edge Data Store, and PI Web API OMF endpoints. Details

Language ADH Test Status EDS Test Status PI Test Status
.NET Build Status Build Status Build Status

Bulk Upload

This sample demonstrates sending pre-made OMF files to the AVEVA Data Hub, Edge Data Store, and PI Web API OMF endpoints. Details

Language ADH Test Status EDS Test Status PI Test Status
Python Build Status Build Status Build Status

Azure Functions

This sample demonstrates sending time series data to AVEVA Data Hub using an Azure Function App Service. Details

Language ADH Test Status
.NET Build Status

Temperature Sensor

This sample demonstrates sending periodic temperature data to the OSIsoft Cloud Services, Edge Data Store, and PI Web API OMF endpoints. Details

Language ADH Test Status EDS Test Status PI Test Status
Python Build Status Build Status Build Status

Configuring AVEVA Data Hub or the PI system to accept OMF messages

Sending to AVEVA Data Hub

Configure OMF Connection. This can be done programmatically, but here are the general steps to do it via the AVEVA Data Hub portal:

If you do not already have a Client-Credentials Client set up to use:

  1. After logging in to AVEVA Data Hub, open Clients, or follow the link under the section "Security"
  2. Under "Client Type", select "Client-Credentials"
  3. Click "Add Client" and either grant the "Account Administrator" role or whatever custom roles are required to create and write data to Streams
  4. Click "Continue," then optionally enter a description and/or update the expiration date for the Client Secret
  5. On the "Client Successfully Created" screen, be sure to save the Client Secret as it will not be available again (a new secret can be generated if necessary)

Once you have a Client-Credentials Client for use with OMF:

  1. After logging in to AVEVA Data Hub, open Connections, or follow the link under the section "Data Management"
  2. Under "Type", select "OMF"
  3. Click "Add Connection" and fill in a name for your OMF Connection
  4. Click "Next," and choose the Client-Credentials Client you intend your OMF application to use (or the one you just created above)
  5. Click "Next," and choose the Namespace(s) you intend to write OMF data to
  6. Click "Next," and review the configuration
  7. Click "Save," and you can now use this Client-Credentials Client to write OMF data to the specified Namespace(s) in the samples

Sending to PI

Use the PI Web API OMF endpoint.
PI Connector Relay is currently not tested for and would require some changes to the code to get to work.

OMF limitations on AVEVA Data Hub and PI

This list is not exhuastive, but rather a few key details to know.

  1. PI only accepts DateTime timestamp as the property index
  2. PI can only have 1 index
  3. ADH only accepts Dynamic OMFType classification
  4. ADH does not accept Link type data

Credentials

A credential config.ini or app.config file is used in the examples unless otherwise noted in the example.

 Note: This is not a secure way to store credentials.  This is to be used at your own risk.

You will need to modify these files locally when you run the samples.

About this repo

The style guide describes the organization of the repo and the code samples provided. The test guide goes into detail about the included automated tests. The on prem testing document describes the software installed on our internal build agent.

Feedback

To request a new sample, if there is a feature or capability you would like demonstrated, or if there is an existing sample you would like in your favorite language, please give us feedback at https://feedback.aveva.com under the Developer Samples category. Feedback.

Support

If your support question or issue is related to something with an AVEVA product (an error message, a problem with product configuration, etc...), please open a case with AVEVA Tech Support through myOSIsoft Customer Portal (https://my.osisoft.com).

If your support question or issue is related to a non-modified sample (or test) or documentation for the sample; please email Samples@osisoft.com.

Contributions

If you wish to contribute please take a look at the contribution guide.

License

OSI Samples are licensed under the Apache 2 license.

For the main samples landing page ReadMe