12 Replies Latest reply on Nov 9, 2017 6:36 AM by AlbertoColombo

    Dashboard KPI development

    AlbertoColombo

      Hi, I am new on PI AF development and I am developing a dashboard to show some KPI.

      I need to develop a running KPI which shows "consumption saving" year (2017) over year (2016) of a "consumption" data series. So, I should calculate:

      running KPI  = [Total Consumption for 2017 = sum of value from Jan-1 2017 until 'today')] - [Total Consumption for 2016 = sum of value from Jan-1 2016 until 'same day of today in 2016')

      I made some try with Analysis and Formula, but i am looking for the best way to develop the KPI without any hard coded value to have a valid KPI also for 2018, 2019 and beyond without any huge amount of changes.

       

      Can someone suggest me the best solution to use?

       

      Alberto

        • Re: Dashboard KPI development
          Dan Fishman

          There are a lot of solutions and the best one depends on a number of factors such as data density.  The fact that you are thinking about how to make it maintainable is a great start.  

           

          One way to do this would be to use "1/1" as January first of the current year and "-1Year" relative time to subtract a year ago.  For example:

          TagTot('Nox Concentration','1/1', '*') - TagTot('Nox Concentration','1/1 - 1year', '*-1year')

           

          This works but it gives you a timeweighted total.  Let us know if you want an event weighted sum and not time weighted.  If you are doing this often or have very dense data, you might want be cautions.  Depending on what you need, you can calculate for each day and then total the results.  Also, you could calculate the year to date total in another tag using back-filling and reference that tag as well. 

           

          Regards,

          Dan

          2 of 2 people found this helpful
            • Re: Dashboard KPI development
              AlbertoColombo

              Hi Dan,

              my data series is 15-minutes data, so I have sample every 15 minute and i need to calculate a total for day/month/year. But the main KPI is a difference year over year, which means i calculate the SUM as you said. Honestly, i don't know if this data serie (15 minutes sample) is dense or not and requires timeweighted total or not.

               

              what do you suggest?

               

              Alberto

                • Re: Dashboard KPI development
                  Kenji Hashimoto

                  I believe 15 minutes frequency is quite low. So it should be fine. In PI world, there are exception and compression features and a lot of users need to use time weighted total. So tagtot should be fine.

                  • Re: Dashboard KPI development
                    Rick Davin

                    Hello Alberto,

                     

                    Since you have nothing else to compare it to, 15-minutes is not considered dense data.  Even if every value was archived, that would be 96 values a day or 35,040 a year.  I worked at sites where the rate was every 30 seconds resulting in 2880 a day or 1,051,200 in year.  In this comparison, 30 second polling would certainly be denser than 15 minute polling, yet on its own I would say 30 second polling is only somewhat dense.  And then there are those that have 10 second, 1 second, or even sub-second polling.

                     

                    Obviously, the more data archived during the requested duration (one year), the longer it will take to generate the summary value.  As Kenji Hashimoto  pointed out, 15 minute polling should be fine.  Processing 35K values for a year should be manageable enough and perform reasonably fast.

                • Re: Dashboard KPI development
                  Dan Fishman

                  I am in alignment with Rick Davin and Kenji Hashimoto.  Also, the newer PI Systems offer a lot of features such as back-filling to allow you to change your strategy if you find this is not efficient or you want change it later on.  Once you learn more about any potential issues and what the end users want, you can always go back and try a more advanced or different solution. 

                    • Re: Dashboard KPI development
                      AlbertoColombo

                      Hi and thank you everybody. I will make some test today with TagTot into an Analysis and run it in backfilling for the data series. Due to the fact it is a non critical dashboard, i would run the analysis once a day. I should not have issue on performance.

                      I will try and let you know the result.

                       

                      Alberto

                        • Re: Dashboard KPI development
                          AlbertoColombo

                          Hi, I made the test but i am confusing. Calculation is fine but result are way different. My case:

                          • I have successfully uploaded the data series (15 minutes interval data, 4 sample per hour) into PI Data Archive and created the tag (checked with PI SMT, good value).
                          • I have run the Analysis on PI AF to calculate the Total (sum of Value) for 2017 (1 Jan 2017 until today), using TagTot (‘Attribute’, ‘1/1’,’*’). I did the backfilling execution.

                          the result are very different:

                          - sum of the value (calculated from my spreadsheet) is 877,559 (kWh)

                          - result of TagTot analysis is 9,141.1 (kWh)

                          Should i consider any conversion factor? My unit of measure is kW per hour (kWh). Am i missing something?

                           

                          Alberto

                            • Re: Dashboard KPI development
                              Dan Fishman

                              That is pretty good because you are off by a factor of 96!!!  Of course, 24

                              • 4 = 96.

                               

                              The factor of 4 is because you are summing 15 minutes of data (4 values an

                              hour).  Are you trying to get the total kW from the kWh?  If so, you will

                              want to divide by 4 on your spreadsheet since you have 4 samples per hour.

                               

                              You are right about a conversion factor.  PI assumes units per day and

                              there are 24 hours in a day.  To get the total kW per day, you will have to

                              use a conversion factor of 24 (multiple the total by 24).  It appears you

                              are using an event weighted total for the spreadsheet.  This is working

                              fine since all the data is 15 minutes apart on the spreadsheet so it is all

                              given equal weight.  PI is using a time-weighted total.

                               

                               

                              Without knowing all the details I would recommend:

                               

                              Dividing the spreadsheet by 4.

                               

                              Multiple the PI equation by 24.

                               

                               

                              Regards,

                               

                              Dan