PI AF Analyses for Pump On/Off (Pump Cycling)

I want to create a PI tag that counts how many times we are cycling our pumps at a daily and monthly interval, using Analyses.

 

The criteria for a "pump cycle", is it has zero flowrate and pump status = 'Off' for 3 minutes or longer. Attached is a picture of the current logic I created in PI AF.

 

However, the Analyses is not working as I expected, and I am getting really high values (hundreds of daily pump cycles, thousands of monthly pump cycles). I think it is likely because there is no stop trigger once the "pump cycle" condition has been met. Therefore, if a pump is off for an hour, it will count this as many pump cycles instead of one, since it meets the zero flowrate and pump status = 'Off' condition for the entire duration.

 

Does anyone have experience with creating a tag for a scenario like this? Or has suggestions on how to fix the logic.

 

Thanks

 


image.png

Parents
  • Hi Asle,

     

    Thanks for your response. I have made those changes but am still getting incorrect values, and my analysis isn't set up properly. I have the following separate analysis:

     

    PumpOff

    // Check if flowrate is 0 and pump status is 'Off' for last 3 minutes

    If TimeLE('Flowrate', '*-3m', '*', 0.1) = 180 And TimeEq('Pump Status','*-3m', '*', 0) = 180

    Then 1 // If 'Yes', then pump is off, trigger cycle, set to 1

    Else 0 // If 'No', then pump is on, set to 0

     

    CycleTrigger

    // Check if pump is currently 'Off' and previous value value was 'On' - indicates a cycle

    If TagVal('Pump Off','*') = 1 And PrevVal('Pump Off', '*') = 0

    Then 1 // If 'Yes', trigger, set to 1

    Else 0// If 'No', set to 0

     

    CycleCountDaily

    // Totalize no. of times the CycleTrigger tag was equal to 1 since midnight

    EventCount('Cycle Trigger','t','*')

     

    CycleCountMonthly

    // Totalize no. of times the CycleTrigger tag was equal to 1 since midnight at start of the month

    EventCount('Cycle Trigger', BOM('*'), '*')

     

    I'm wondering which of these analysis should be Periodic and which should be Event-Triggered, and at what interval if periodic. How do I get the EventCount function to only count the 1's and not the 0's? Alternatively, should I be using a "counter" to count how many times a cycle has been triggered and utilizing the TagTot function instead?

     

    I believe I have the PumpOff and CycleTrigger functions working as expected, it's just a matter of being able to count how many times at a daily and monthly interval that CycleTrigger = 0. What is the best approach for this?

Reply
  • Hi Asle,

     

    Thanks for your response. I have made those changes but am still getting incorrect values, and my analysis isn't set up properly. I have the following separate analysis:

     

    PumpOff

    // Check if flowrate is 0 and pump status is 'Off' for last 3 minutes

    If TimeLE('Flowrate', '*-3m', '*', 0.1) = 180 And TimeEq('Pump Status','*-3m', '*', 0) = 180

    Then 1 // If 'Yes', then pump is off, trigger cycle, set to 1

    Else 0 // If 'No', then pump is on, set to 0

     

    CycleTrigger

    // Check if pump is currently 'Off' and previous value value was 'On' - indicates a cycle

    If TagVal('Pump Off','*') = 1 And PrevVal('Pump Off', '*') = 0

    Then 1 // If 'Yes', trigger, set to 1

    Else 0// If 'No', set to 0

     

    CycleCountDaily

    // Totalize no. of times the CycleTrigger tag was equal to 1 since midnight

    EventCount('Cycle Trigger','t','*')

     

    CycleCountMonthly

    // Totalize no. of times the CycleTrigger tag was equal to 1 since midnight at start of the month

    EventCount('Cycle Trigger', BOM('*'), '*')

     

    I'm wondering which of these analysis should be Periodic and which should be Event-Triggered, and at what interval if periodic. How do I get the EventCount function to only count the 1's and not the 0's? Alternatively, should I be using a "counter" to count how many times a cycle has been triggered and utilizing the TagTot function instead?

     

    I believe I have the PumpOff and CycleTrigger functions working as expected, it's just a matter of being able to count how many times at a daily and monthly interval that CycleTrigger = 0. What is the best approach for this?

Children
  • Here's what I'd suggest trying:

     

    PumpOff

    <No changes>

     

    CycleTrigger

    // Check if pump is currently 'Off' and previous value value was 'On' - indicates a cycle
    If 'Pump Off' = 1 And PrevVal('Pump Off', '*') = 0
    Then 1 // If 'Yes', trigger, set to 1
    Else 0// If 'No', set to 0

    Change: Don't use TagVal('Pump Off','*') as this function interpolates values (unless you intend to have values interpolated). It might not mean much right now, but once you get into recalculating the analysis later, it could mean trouble. Just refer to the attribute in single quotes to get the current value.

     

    CycleCountDaily

    // Totalize no. of times the CycleTrigger tag was equal to 1 since midnight
    TagTot('Cycle Trigger', 't', '*', "", 100, "EventWeighted")

    Change: Use TagTot instead of EventCount, but make sure you put "EventWeighted" in the last parameter. The fifth parameter is PercentGood, so please specify the lowest percentage good values you can accept and still rely on the calculated number being correct.

     

    CycleCountMonthly

    // Totalize no. of times the CycleTrigger tag was equal to 1 since midnight at start of the month
    TagTot('Cycle Trigger', BOM('*'), '*', "", 100, "EventWeighted")

    Change: TagTot instead of EventCount