3 Replies Latest reply on Dec 21, 2018 4:39 PM by Dan Fishman

    Totalize batches

    igreguri

      I have some totalizer for batches (PI totalizer) and want to build another totalizer (PI or AF analysis) which sumarize two or more batches if time between batches is less than 4 hours. I hope I was able to explain.

      How to do this?

       

      Regards,

      Igor

        • Re: Totalize batches
          Dan Fishman

          There are a few ways to do this and I have "merged" events using AF SDK and AF analysis depending on the complexity of the merging rules.  For this, you should be fine with analysis.

           

          I would recommend creating an analysis that writes a 1 when the EF starts and a zero when the EF ends.  From here, you should be able to use the PE like functions to perform your totalizer.  On each event start, you will have to look back and see if the timestamp of the last event tag is less than four hours and continue totaling from the current total value.  It can be pretty tricky to get this right!

            • Re: Totalize batches
              igreguri

              I just did it, but I did not succeed.

              Can you give me an example of how to do it?

                • Re: Totalize batches
                  Dan Fishman

                  I have done this several times and each time have used different analysis rules depending on customer requirements.  I just created this mock one just for you!  I have not fully tested, but it should give you an idea.  Note, this is event triggered and variable2 outputs to "outputDuplicated" which points to the same tag as "output" attribute.  For a real production environment, I would clean this up.  I hope this gives you a good start. 

                   

                  You could write similar logic for a periodic equation...

                   

                  1 of 1 people found this helpful