Exercise 2: Creating an AF Structure

Version 3

    In this exercise, we will create the AF structure necessary to complete the remaining exercises.

     

    Step 1: Create new PI Points on your PI Data Archive using the spreadsheet below and PI tag configurator add-in. (PIPointsForPIWebAPICourse_Exercise.xlsx).

    Step 2: Check if all the new PI points have received new values, which means that none of them should have "Pt Created" as their snapshot. It may take several minutes until all the tags receive their first snapshot values. The tag data for this exercise is generated by OSI Random Simulator Interface (pointsource = R).

     

    Please complete the following using PI Web API. Feel free to use any prebuilt client tools that can send HTTP requests (e.g. Fiddler, Google Chrome extensions such as Advanced REST Client and Postman, etc.). If you are comfortable making HTTP requests, write your own client application to perform the following tasks.

     

    Step 3: Create a new PI AF database.

    Step 4: Create a new element template named "Machines" that contains the following 3 attribute templates according to the table below:

     

    Attribute NameUnitTypeData ReferenceConfig String*
    Percent CPUpercentSinglePI Point\\YourPIDataArchive\%Element%_CPU
    Percent MemorypercentSinglePI Point\\YourPIDataArchive\%Element%_M
    Location(none)String(none)(none)

     

    * You might have to escape the backslashes in the Json request.

     

    Step 5: Create 3 elements from the Machine template and name them MachineA, MachineB, and MachineC.

    Step 6: Check if all the 6 attributes are linked to PI points properly.

    Step 7: Change location attribute template to a configuration item. (Hint: PATCH request)

    Step 8: Add the following location information to each element. (Hint: SetValue)

     

    ElementLocal Attribute Value
    MachineAPhiladelphia
    MachineBSan Leandro
    MachineCHouston

     

     

    Step 9: In one call, get the recorded values of the percent CPU attributes for all three elements for the past hour. (If your PI tags were built less than an hour ago, use a shorter time interval.)

    Step 10: In one call, write the following values to the percent memory attributes for MachineA, B and C respectively:

     

    AttributeTimestamp*Value
    MachineA: Percent MemoryToday at midnight (local time)10
    MachineA: Percent MemoryToday at 1:00 am (local time)20
    MachineB: Percent MemoryToday at 12:30 am (local time)30
    MachineC: Percent MemoryToday at 2:30 am (local time)25
    MachineC: Percent MemoryToday at 3:00 am (local time)

    15

     

     

    * Make sure to perform any time zone adjustments if necessary.

    * If you are working with a brand new installation of the PI System, make sure you have archives covering the time range for the data writes.