3 Replies Latest reply on Jul 2, 2013 12:23 PM by Gregor

    PISDK Summaries2

    pt030

      Hi guys,

       

      I have code that looks something like this to return the maximum value for each day in the startTime and endTime range.

       

      PISDKCommon.NamedValues interValues = interdat.Summaries2(startTime, endTime, "1d", ArchiveSummariesTypeConstants.asMaximum,CalculationBasisConstants.cbTimeWeighted, null);

       

      While it returns properly the maximum value for each day, I noticed that the timestamp displays the start of each day and not the timestamp of when the maximum value actually occurred in that day.  Is there an option I'm missing?  I need to know the maximum of each day but also the exact time they occurred.

       

      Thanks.

       

       

       

       

        • Re: PISDK Summaries2
          xwang

          Hi,

           

          If just need to have the maximum value of each day, my suggestion is to use Summary method instead of Summaries2.  Please see the following code as the reference:

           

          interdata.Summary("y","t",ArchiveSummaryTypeConstants.astMaximum,CalculationBasisConstants.cbEventWeighted,null)

           

          If you still need to use Summaries2 to do the calculation, please try change cbTimeWeighted to cbEventWeighted, as cbTimeWeighted might return interpolate value, but cbEventWeighted will not.

           

          Xi Wang

           

          v-Campus team

            • Re: PISDK Summaries2
              pt030

              OK I found it.  This is for reference in case some people looking after the same thing.

               

              There is a valueattribute called TimeOfMaxVal for a PIValue object.  So get the PIValue object from the NamedValues collection for the "Maximum" summary type.

               

              Then retrieve the TimeOfMaxVal attribute.  

               

              From my code above, it seems then that Summaries2 returns the "EarliestTime" by default instead of "TimeOfMaxVal".

               

              I checked the Summary method and it returns the "TimeOfMaxVal".