1 Reply Latest reply on Feb 21, 2018 1:40 AM by jyi

    PI SDK C# code to get recorded values


      Can anyone share C#code sample(s) for getting the recorded values over a period of time?  I cannot use AF SDK for reasons beyond my control.  Any help much appreciated!  I need to get the values from the PI archive over a period of time to do custom calculations.  I assume some of the values can be returned from the archive as "Bad Data", "No Data", etc.?  I have had this experience in the past with PI Data.  For the Summaries2 method, can the duration be null or empty?  I am interested in values calculated over all values between the start and end times, not over a small interval or duration.


      Thanks for the patience with a newbie.



        • Re: PI SDK C# code to get recorded values

          Hi Anthony,


          Continuing Rick's answer to your previous question(Link), the possible values for CalculationDuration can be set to null/empty. In this way, the duration will be the same as the whole duration(StartTime-EndTime).

          As for the bad quality data, the Remark>Usage Notes in Summaries2 method state the following:

          The PI server computes time-weighted total by integrating the rate tag values over the requested time range. If some of the data are bad in the time range, the calculated total is divided by the fraction of the time period for which there are good values. Mathematically, this approach is equivalent to assuming that during the period of bad data, the tag takes on the average values for the entire calculation time range. It is important for the user of the data to check the percentGood attribute to determine if the calculation result is suitable for the application's purposes.


          I hope this information helps.