rdavin

Using PI with the new AFSDK

Blog Post created by rdavin Employee on Dec 14, 2012

Earlier in the year I blogged about using the AFSDK 2.5 to write tag-centric apps.  See the original post here:

 

http://vcampus.osisoft.com/bloggers_place/b/ricksblog/archive/2012/05/16/tag-centric-apps-and-afsdk-2-5.aspx

 

I mentioned how I would be glad to try writing a traditional PISDK app using only AFSDK.  Not only have I done this but my boss Randy has as well.  Using the managed objects in AFSDK for traditional PI apps is a goal for both Randy and me.  Plus Randy finally agreed to let us use C# instead of VB.NET.  Both C# and AFSDK 2.5 has been easy to work with.

 

Regrettably I can't post the apps or some of the code.  I think many Americans are muffled by such notions as 'proprietary' or 'competitive advantage'.  Not that I think we have brilliant code.  Far from it.  Yet oftentimes both my boss and I have stumbled on a few things in our code writing so we are reluctant to share in the sincere hope that our competitors will stumble harder upon!

 

But I can briefly describe in general what we did with each app.  Randy wrote an app to perform data fanning across PI collectives.  He was truly amazed about how simple it is to work with a collective and its member servers.  What used to take dozens of lines of code now takes 2 or 3.  Not 2 or 3 dozen, but 3 as in 1-2-3 or the answer to "How Stooges are there?"

 

I wrote a PI app to scan a tag's archived values looking for a certain digital state and 'changing' it to another digital state.  I quoted 'changing' because it actually deletes the archived value and writes the new value - all this just to remove the substituted flag.  This required fetching a tag's RecordedValues filtered for the 1st digital state and then issuing 2 UpdateValues - the first with AFUpdateOption.Remove to delete prior values, and the second to write the new values.  

 

Sure there was some syntax change and a few things done differently but it was all-in-all about the same effort to write a PISDK app.  For me anyway.  For Randy it was actually easier to write because the PI collectives and member servers are just so much easier to work with in AFSDK.

Outcomes