Hi everyone, I'm trying to find daily, monthly, yearly power consumption of our substation. Could you please check my PI AF analysis . If its correct or not.

Daily:

if Hour('*')=0 and ('import.kwh'<=0 or BadVal('import.kwh')) 

then PrevVal('import.kwh', (PrevEvent('import.kwh', '*')))-TagVal('import.kwh', 'y')

else (TagVal('import.kwh', 't') - TagVal('import.kwh', 'y'))

 

Monthly :

if (Hour('*')=0 and Day('*')=1)

Then TagVal('import.kwh', '*')-TagVal('import.kwh', '*-1mo')

else NoOutput()

 

Yearly:

if (Hour('*')=0 and Day('*')=1 and Month('*')=1)

Then TagVal('import.kwh', '*')-TagVal('import.kwh', '*-1y')

else NoOutput()

Parents
  • A couple suggestions. I don't know much about your solution so take it with a grain of salt. For daily, you can reconfigure your analytic to run on a periodic basis, once a day, at midnight. Then you won't have to check the hour.

     

    The monthly analytic could be a sum of the daily consumptions and yearly could sum monthly. You know someone is going to double check the rollup in excel and ask about it if there are any discrepencies. Plus, it's less data to comb through so you're more likely to have it in cache.

     

    What is the purpose of PRevVal(PrevEvent())? Why not just reference import.kwh directly and get the current value (as you do in the check to ensure it's not 0 or negative)?

    Right now you're checking if current value is BadVal. What if value yesterday was bad val?

Reply
  • A couple suggestions. I don't know much about your solution so take it with a grain of salt. For daily, you can reconfigure your analytic to run on a periodic basis, once a day, at midnight. Then you won't have to check the hour.

     

    The monthly analytic could be a sum of the daily consumptions and yearly could sum monthly. You know someone is going to double check the rollup in excel and ask about it if there are any discrepencies. Plus, it's less data to comb through so you're more likely to have it in cache.

     

    What is the purpose of PRevVal(PrevEvent())? Why not just reference import.kwh directly and get the current value (as you do in the check to ensure it's not 0 or negative)?

    Right now you're checking if current value is BadVal. What if value yesterday was bad val?

Children
No Data