2 Replies Latest reply on May 7, 2018 2:05 PM by EricHore

    Split consumption based on time of day




      I hope someone can guide me to a working solution.


      I has a solution which reads energy meter data into PI for an energy management system. One thing I want to do is split the total energy consumption into the 3 tariff we have in SA, namely Peak, Standard & Off-peak, to report on it and apply the 3 different costing to the total energy consumption in each of the 3 periods.


      My thinking is to have 3 PI points that increments/totalize indefinitely:

      • EnergyConsumption_Peak
      • EnergyConsumption_Standard
      • EnergyConsumption_Off-peak


      I already have a PI PE point, ElectricityTraiff, that change its value to Peak/Standard/Off-peak based on the time of day.


      The idea is to have the following logic:

      IF ElectricityTraiff = Peak THEN totalize EnergyConsumption_Peak ELSE
      ElectricityTraiff = Standard THEN totalize EnergyConsumption_ Standard ELSE

      IF ElectricityTraiff = Off-peak THEN totalize EnergyConsumption_ Off-peak ELSE NoOutput()


      The end result should look like this - consumption during Peak, Standard & Off-peak periods should add up to the total consumption measured/read from device:


      (This is a hand drawn graph - so please excuse/ignore the negative consumption represented by he negative slope. This will never happen in this case)


      Consumption data available from the device are the consumption rate tag and the consumption total tag.


      I have tried using the rate tag in a PI Totalizer Point with the following configurations:

      Source Tag:       EnergyConsumptionRate

      Totalizer Type:   Summary Calculation > Block > Time Weighted > Total    

      Sampling:          Natural

      Filter:                 ‘ElectricityTraiff’ = “Peak”      

      Results:             After a time period elapses

                                       Start schedule at 0 Hours after midnight

                                       Results every 15 Minutes

      >>> I am not sure whether I can use a PI Point in the filter other that the Source Tag - no errors are seen when the Test button is pressed, but the Point value stays "Error" <<<

      >>> I really only need a update value of the Totalizer Point every 15 min, but should account for all value changes in this period <<<

      >>> The Totalizers should never reset to Zero,


      I would think that there should be a way to use the total tag too to achieve the same outcome. Here I would think that the difference in the total consumption value can be calculated (from the beginning of the current tariff period to now) and added to totalized tag for the appropriate period.


      I am sure that this type of calculation bust be common, but I have not been successful in finding a workable solution to date.


      Thanks and looking forward to some suggestions.

        • Re: Split consumption based on time of day

          Hello Eric,


          If your ElectricityTraiff tag does not receives duplicates, I believe you could get a solution with PI Analysis.


          I did not test this solution but assuming the EnergyConsumption attribute is the tag to be totalized and ElectricityTraiff is the type attribute you could totalize the values based on the ElectricityTraiff timestamp with an expression like:


               IF 'ElectricityTraiff' = "Peak" THEN TagTot('EnergyConsumption', TimeStamp('ElectricityTraiff'), '*') + tagval('EnergyConsumption_peak', TimeStamp('ElectricityTraiff')-Second('00:00:01')) ELSE NoOutput()




          Hope this helps.

            • Re: Split consumption based on time of day

              Hi Gustavo,


              The time difference in the expression TagTot('EnergyConsumption', TimeStamp('ElectricityTraiff'), '*') is ZERO. Looks like TimeStamp('ElectricityTraiff') looks at he snapshot timestamp which is the same as '*'. I have to use the TagTot('EnergyConsumption', PrevEvent('ElectricityTraiff',PrevEvent('ElectricityTraiff','*')), '*') to get the start of the new tariff period.


              I am not very familiar with AF Event Frames (and just learning PI now), but is there not an more elegant way to create an Event Frame template that will be triggered by the 'ElectricityTraiff' point and also track the energy consumed during the period the trigger condition is true?