AnsweredAssumed Answered

What is the logic of PI web API for summarizing data?

Question asked by TomokiHorio on Jun 18, 2019
Latest reply on Jun 19, 2019 by TomokiHorio

We try to calculate summary data from PI DA by using two methods bellow.

1. get row data from PI DA by using PI web API(⇒Get API) and calculate summary data(Total, Average, Max, Min, Stdev) on Excel Sheet.
 Used API:https://localhost/piwebapi/streamsets/{WEBID}/recorded?startTime=yyyy-mm-dd hh:mm:ss&endTime=yyyy-mm-dd hh:mm:ss


2. get summary data by using only PI web API(⇒Summary API).
   Used API: https://localhost/piwebapi/streamsets/{WEBID}/summary?startTime=yyyy-mm-  dd hh:mm:ss&endTime=yyyy-mm-dd hh:mm:ss&summarytype=Total&summarytype=count&summarytype=Average&summarytype=Maximum&summarytype=Minimum&summarytype=StdDev&calculationbasis=eventweighted

And we compared summary data of 1 with 2. As a result, there were small numerical errors between them, especially Total and Average result.
For example, see bellow.


The comparison of result of two methods (Average, Total)

We suspect that direct factor of the error is logic of rounding off numerical data in PI web API. And after more research, “Summary API” seems to have curious round logic.

If "Summary API" has a curious logic such as rounding 9th effective digit, could you tell us the detail logic of the PI web API?


Test data we used is attached on this ticket.