Exercise 5

Version 1

    Using Rich Data Access and Event Pipes


    Objective: Create a console application to create new PI points, search for PI points, and receive values through EventPipes.


    In this exercise, your console application should:


    1. Create three PI Points using PI AF SDK with Rich Data Access (OSIsoft.AF.PI namespace). These three tags will have the same tag attributes from the PI points that are assigned to the attributes New York_Temperature, New York_Pressure and New York-Humidity and their name should start with "AFSDKWS_". Therefore, the name of a new tag could be AFSDKWS_New York_Temperature. In case the PI points were already created, the end user should be notified of this fact.
    2. Query for "AFSDKWS_*" in order to find the three PI points you have created on the last item, using the method FindPIPoints and store the results in an object form IList<PIPoint>.
    3. The application will then check every second if any of those 3 tags have received a value through EventPipes. Once a new value arrives, the numerical value and its timestamp should be printed on the screen. In case nothing is received, it should be displayed "No new values" with the current time. This would give an indicator of the frequency of data.
    4. Finally, if a customer presses the ESC key, the application should stop and close automatically. Please refer to the code snippet below:


    Console.WriteLine("Press ESC to stop");

    do {

          while (! Console.KeyAvailable) {

                 // Do Something


    } while (Console.ReadKey(true).Key != ConsoleKey.Escape);