Skip to content

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

License

Notifications You must be signed in to change notification settings

watercannons/OSI-Samples-OMF

 
 

Repository files navigation

Test code for performance metrics

This contains code modified from the OMF Samples (forked from https://github.com/osisoft/OSI-Samples-OMF). Purpose is to test the performance difference between Pi Web API with performance metrics code and non-performance metrics code.

The modified code is located in basic_samples/OMF_API/CSharp/OMF_API/Program.cs. You will need to modify the appsettings.placeholder.json to appsettings.json for the code to work. All that's been modified is a SSL error bypass, and a stopwatch to keep track of code execution time.

Brief instructions:

  1. The test code is located in basic_samples/OMF_API/CSharp/OMF_API/Program.cs
  2. Make sure you change appsettings.placeholder.json to appsettings.json, use your windows login credentials for username and password in place of the stub
  3. Resource in appsettings.json is the link to your server that you're testing, change it to whatever server you're testing on
  4. The runMain method acutually runs the code. There's a variable called countLimit that is the number of requests you run. This number is not the actual # of requests being send to the server, the actual # is countLimit * 8
  5. When it finishes, it will print a timestamp of how long the test took

OMF Samples

The OSIsoft 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 OCS 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.

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:

Task Description Languages    OCS Test Status           EDS Test Status            PI Test Status       
Basic API These samples demonstrate sending some typical OMF messages. The applications are configurable to both PI and OCS. Details .NET
Python
Java
Build Status
Build Status
Build Status
Not Run
Not Run
Not Run
Build Status
Build Status
Build Status
Complex Dynamic This sample demonstrates sending time series data to the OSIsoft Cloud Services, Edge Data Store, and PI Web API OMF endpoints. It sends 2 values at 1 timestamp. Details Python
NodeJS
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
BART Ingress This sample demonstrates sending time series data to the OSIsoft Cloud Services, Edge Data Store, and PI Web API OMF endpoints. Details .NET Build Status Build Status Build Status
Bulk Upload This sample demonstrates sending pre-made OMF files to the OSIsoft Cloud Services, Edge Data Store, and PI Web API OMF endpoints. Details Python Build Status Build Status Build Status
Azure Functions This sample demonstrates sending time series data to OSIsoft Cloud Services using an Azure Function App Service. Details .NET Build Status N/A N/A

Configuring OCS or the PI system to accept OMF messages

Sending to OCS

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

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

  1. After logging in to OCS, 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 OCS, 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 OCS 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. OCS only accepts Dynamic OMFType classification
  4. OCS 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 OSIsoft build agent.

Feedback

If you have a need for a new sample; if there is a feature or capability that should be demonstrated; if there is an existing sample that should be in your favorite language; please reach out to us and give us feedback at https://feedback.osisoft.com under the OSIsoft GitHub Channel. Feedback.

Support

If your support question or issue is related to something with an OSIsoft product (an error message, a problem with product configuration, etc...), please open a case with OSIsoft 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 on master ReadMe

About

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

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 41.3%
  • Python 31.2%
  • Java 21.5%
  • JavaScript 6.0%