pthivierge

Introduction to PI-AF-SDK-Clues Community Project

Blog Post created by pthivierge Employee on Nov 25, 2015

Hello Everyone,

 

I am really happy today to introduce you to Clues, and I am hoping that this project will inspire you as much as me.

 

You may think that Clues is about the game? Well not really, but somewhat related .

A bit of it is certainly about finding clues to understand how the PI AF SDK works.

More seriously Clues stands for: Command Line Utility & ExampleS

 

Clues is a community project, hosted on GitHub, that provides a code-base to work with the PI AF SDK.

 

It has three main goals:

  • provide code examples
  • provide examples in a re-usable and useful form, for the day to day work
  • act as a container for quick prototyping

 

 

2015-12-01: I invite you to participate and give your idea with the poll: What should Clues to do next? , thanks for your vote

sherlock-holmes-147255_1280.png

Fork me on GitHub

If you can't wait to see all the technical details, you may go directly to the GitHub Repository:

osisoft/PI-AF-SDK-Clues · GitHub

 

Why Clues?

 

Code samples

The development support team writes a lot of code samples, and many of them may be re-used if written in a way that is generic enough. i.g. Connection to PI, Read Tag Value, etc.

We are certain that you are also writing code that could benefit to others right? Clues was created to centralize and make these samples in an easy format,  shareable and available in a command line form.

 

What if you could do this to test a connection to the PI Data Archive with AF SDK?

clues PIConnect -s PIServer01

 

You have heard of EventPipes but you could never test them?

clues PIDataPipeListener -p "optimus" -t simulator.random.15,sinusoid

 

This is now possible with a simple command line utility : clues

 

Re-Use and Prototyping

Clues contains a template that you can copy and paste into a new class and allows you to create a new command line applet on a snap:

You rename the class, give it a description, add the command line parameters, and you are ready to go to write your code in the Run() method.  For simple examples, this means only a single file to maintain.

So you can say goodbye to all those solution1 and Project1 that you have created from visual studio that are not re-usable! (that tells you something?)

 

Imagine that we all have our own personal-clues that (we have forked on GitHub) and we use for our personal testings and recurrent tasks.  When one of us comes up with a useful applet, this would make it much easier to share!

 

Sounds cool, isn't it?

 

What can I do with Clues now?

 

Currently Clues command line has the the following options, and based on your comments / contributions, it will evolve.  So I am not expecting that this list will stay in this post but will be kept up to date in the GitHub Readme.

 

  AFConnect Connects to a PI System (AF)

  AFCreateAttribute Creates an AF attribute on the specified element.
  Supports all standard attributes.

  AFDataPipeListener Illustrates the functionning of the AF Data Pipe, to
  get changes from AFAttributes as changes occurs

  AFElements List and create elements

  AFGetValue To get values from attribute(s) using the Path
  Syntax

  PIConnect Connects to a PI Data Archive Server

  PIConnectSettings This applet allows to change the timeouts of a PI
  Data Archive Connection.

  PIDataPipeListener Illustrates the functionning of the PI Data Pipe, to
  get changes from PI Tags as changes occurs

  PIDelete Deletes data in archive for specified tag(s) and for
  a specific time range.

  PIFindPoints Finds PIPoints based on tag name filter and
  optionally from point source.

  PIGetCurrentValue Reads the most recent value for the specified tag.

  PIGetCurrentValueBulk Reads the most recent value for multiple tags that
  match the search mask.

 

 

What will Clues do tomorrow?

Clues will definitely be an extent to Development Support and serve as a container for code that we believe can bring value in our day to day tasks and support scenarios.  And this is another way to say that Clues will do what you will be asking for , and if you feel even more geeky it will do what you will contribute for!

 

Want to contribute?

 

GitHub is still quite new for the community, so don't hesitate to create new questions on PI Square about it, this way we can start building knowledge about it.

You can also look at GitHub Guidelines  this should give you the main picture.

 

We cannot guarantee that all your contributions will be accepted, and it may require some back and forth before what you are proposing gets integrated in the repository, but this will only be for the best of clues

 

Ah! And in case you are not ready for GitHub yet (this can happen!), you may send the applet text file to pidevclub@osisoft.com, and we will take it from there.  I would not like to prevent any contributions because of technology!

 

 

Ready for GitHub?

A quick and easy explanation here:

GitHub Guides: Forking 4 minutes read

 

In summary:

  • Fork the repository
  • Clone this fork on your dev machine
  • Make the changes, add more code.
  • Commit the changes locally.
  • Push the changes back to your GitHub forked repository. ( in GitHub for Windows, you press the sync button)
  • Make pull request --> the pull request is where you will send back the contribution to our repository, it is optional, if you'd like to keep all the changes only for you, in your repository, this is up to you .  You may ask us to come and peak in yours that would work too!

 

--

 

I am looking forward for your comments and ideas!

 

Have a nice day,

Outcomes