After Class Sample Projects, Advanced Topics & Challenges

Document created by jkim Employee on Oct 19, 2017Last modified by rdavin on Nov 3, 2017
Version 2Show Document
  • View in full screen mode

Learners enrolled in the online course should first and foremost focus their energies on reviewing the other course material, working through the exercises, and developing a final project. Once the course is over, there is still plenty of learning to be done.  So much to do, so little time!  There are several additional resources that offer examples of more detailed projects with AF SDK, and that number will surely grow over the years.  If you haven't read it already, you want to read Where to Find HELP.  If you haven't read it lately, it may be worthwhile to refresh yourself with the material.


Below are various other projects or discussions about projects that are chock full of interesting AF SDK code.


Beginner Level


  • AF SDK Getting Started Guide  GitHub, C#, Console
    The title says it all.  Though quite similar to this online course, the Getting Started Guide, or GSG, is longer with more code examples in a self-paced PDF document.  This course also comes with its own VLE with the most recent PI products, and will be available in different languages.


  • PI AF SDK Basic Samples   GitHub, C#, Console
    This repository provides self-contained and reproducible samples of basic operations using AF SDK. The aim is to provide an accessible hands-on experience with the PI AF SDK using code examples that are portable and easy to follow.  Each example demonstrates a basic operation within the PI AF SDK. These examples present PI AF SDK as a set of basic "building blocks", rather than an entire "pre-packaged solution". The goal is to enable the user to learn the basic operations of PI AF SDK so they then have the tools to build more specific applications and a foundation to learn more advanced PI AF SDK concepts.



  • Python 3.6 and AFSDK Example (PIthon!)   PI Square, Python
    Kenji Hashimoto extends a discussion originated by Rafael Borges on using Python and PI AF SDK.  There are links inside of links here as you may go to another PI Square thread or jump over to GitHub.


Intermediate Level


This offers 5 versions of the same application, with each version adding new features, which require additional coding or obstacles to overcome.  This retrieves data for a requested AFAttribute, much like the Weather app, however it is more generic and does nothing with Notifications.  Version 1 starts out at an Intermediate level and progresses to Advanced around Version 4.


  • Timestamp Inspector   GitHub, C#, WinForm
    The primary purpose of this app is to easily diagnose issues regarding time stamps of a PI point. Greater attention is given to detecting duplicated timestamps, as well as timestamps with subsecond precision, while less attention is given to the value itself.  The secondary purpose of the app is to demonstrate (a) making async PI calls, (b) how to cancel upon request, and (c) how to keep the form UI responsive while the async calls run in a background task.  This project includes a dependency on the PIDevClub.Library, which is a DLL of many useful extension methods.


  • Implementing the AF Data Pipe in a Custom Data Reference   PI Square, C#, Data Reference DLL
    The title speaks for itself.  This PI Square blog post has lots of links and discussions.  Daphne Ng does a great job of walking you through the concepts.  At the very bottom she has a link to her GitHub repository AFSDK CustomDR SQL.  The prime focus of Daphne's original was on implementing the data pipe.  There is a version AFSDK CustomDR SQL V2 that implements Rich Data Access calls to SQL, and allows for an optional tag name or state code column.


  • Analysis Back Fill   GitHub, C#, Console
    Programmatically backfill and recalculate AF Analyses



Advanced Level


  • TechCon Lab 2016 - Advanced Programming with PI AF SDK  PI Square, C#, Console
    Assorted topics include (1) finding and loading assets, (2) AF Server RPC metrics, (3) Using Typed AFValue, (4) asynchronous data access, and (5) real-time analytics.  The link includes attachments for the presentation and workbook, as well as another link to GitHub.


  • Data Reader CmdLine  GitHub, C#, Console
    This app helps export a huge amount of PI data from the archives into text files.  Uses .NET Parallel and background Task calls.





  • TechCon Lab 2017 - Aggregating Event Frame Data PI Square, C#
    This 9 part series goes into detail on using several new aggregation methods to speed up AFEventFrameSearch.  Requires AF 2.9.x or later.  Part 3 has general discussions on how to generate the query string for AFSearch.  Part 4 discusses how to easily add RPC metrics in your code.