2 Replies Latest reply on Oct 2, 2015 1:44 PM by philiphale

    PI SDK Development

    philiphale

      New to vCampus... Anyone have a simple VB.NET or C# project that demonstrates how to read data from PI?  A charting example would be nice too.

       

      Or directions to OSIsoft examples.  Seems like this would be a FAQ easy to find, but I can not.

       

      Thanks...

        • Re: PI SDK Development
          Eugene Lee

          Hi Philip,

           

          Welcome to PI Square! I would advise you to use AF SDK because PI SDK is an older technology that will be deprecating. This is the complete reference for AF SDK.

           

          For a simple code sample on how to retrieve the current value of a PI Point using AF SDK. Here it is:

           

          // Get the PIPoint from the PIServer on the local computer
           PISystems myPISystems = new PISystems();
           PISystem myPISystem = myPISystems.DefaultPISystem;
           PIServer myPIServer = PIServer.FindPIServer(myPISystem, piServerName);
           PIPoint myPIPoint = PIPoint.FindPIPoint(myPIServer, piPointName);
          
           // Display information about the PIPoint
           Console.WriteLine("Name of the PIPoint = {0}", myPIPoint.Name);
           Console.WriteLine("ID of the PIPoint = {0}", myPIPoint.ID);
          Console.WriteLine("Type of the PIPoint = {0}", myPIPoint.PointType);
          Console.WriteLine("PIPoint Current Value = '{0}'", myPIPoint.CurrentValue());
          

           

           

          There are more code samples in the AF SDK reference that I gave the link to above. Let us know if you have further questions.

          2 of 2 people found this helpful