TagTot use for counter that resets a few times during a 12 hours shift

Hello,

I need some help with the TagTot function. In our manufacturing operations, we run 2 x 12 hrs shift (7 am - 7 pm, 7 pm - 7 am). Currently use a PLC tag set up in PI for bottle counts. This bottle counts tag in the PLC gets reset automatically with every work order change, with an average of 2 to 4 work order changes per shift. I have been trying to use the TagTot function to calculate the total for the shift but the results in the temporary analysis I created differ from the data I am seeing in PI Vision for the bottle counts tag. For instance, at 7am I have a total bottle counts of 10,380 and just before the work order changed, the bottle counts was at 14,083. After work order was changed until now, total bottle counts is 9,024. Basically my total should be (14,083-10,380)+9,024=12,727 bottle counts but in the analysis using the TagTot it shows 2832.3.

I need some help figuring out how to use the TagTot for this scenario, or, is the TagTot not the right function in this case ?

Thank you so much for the help.

  • If I understand correctly, the PLC increases the count until a work order change, then resets the value to 0 and starts incrementing again.

    Your 12-hour shift total should be the sum of the peak values from the PLC counter (last value before reset to 0) during the 12 hour shift plus the PLC counter at the shift change.

    So, let's say 3 work order changes with total of 3000, 2000, 5000 and an end of shift value of 1500 for a total of 11,500.

    Create an analysis that is event based to monitor the PLC counter, when the current values is less than the previous value, you have a work order - write the previous value to the PLC count attribute. This attribute should be set to step to prevent interpretation.

    Create a periodic analysis at shift change; it will use an event weighted total for the PLC counter from the start of the shift to the end of the shift.

    Then add the current PLC counter value and subtract the PLC counter total from the beginning of the previous shift.

    That should give you a total for the shift.

  • Hi Tim,

    Yes, the PLC increases the counts until a work order change resets it to 0.

    When you say create an analysis that is event based, do you mean Analysis Type: Event Frame Generation ?

    Thank you,

    Emerson

  • No, more like this for the work order change.

    If the new values is less than the old value (work order change), write the old value to the attribute


    image.png

  • Thanks, Tim. I will have to watch some videos online to learn more about analysis. No trained in PI here and trying to learn it on the fly.