5 Replies Latest reply on Jun 7, 2018 12:40 PM by Kata

    Tricky sum Tags

    Kata

      I have tag(s) which take readings every 15 minutes. I  need to create tag(s) for monitoring analysis, which

      would take the sum of the values within a timeframe (9:00 am 1st day till 8:45 on the 2nd day) once a day

      and put a single total value against day 1 timestamp at 4:00 am.

      Is this possible without using an external database or programmatical calculation? Perhaps with AF Analytics?

       

      Thanks.

        • Re: Tricky sum Tags
          TimCarmichael

          If I understand this correctly...

          sum(tag a) from day 1 @ 9:00 AM to day 2 @ 8:45 +

          sum(tag b) from day 1 @ 9:00 AM to day 2 @ 8:45

          with a value 5 hours BEFORE the 9:00 AM on day 1.

           

          Without fully testing it (I haven't written the value back out), using Asset Analytics (AF):

          TagTot('Tag A','y+9h','t+8h+45m') +

          TagTot('Tag B','y+9h','t+8h+45m')

           

          Then, changes the calculation to periodic, daily with a calculation time of your choosing... let's say 10:00 AM to give the data time to get in the archive. Click advanced and set the output time stamp relative to the trigger time.

          If the calculation executes at 10:00 AM on day 2, the output time will be 26 hours BEFORE the trigger time.

          1 of 1 people found this helpful
            • Re: Tricky sum Tags
              Kata

              Thanks very much Tim, for the quick response. I will try it out today and let you know if I need anymore help.

              • Re: Tricky sum Tags
                Kata

                I'm sorry for bothering you again Tim, but you might be able to help. I created the Tags and they were calculating fine for the first day. But for the second day I get Calc Failed for two of them. Evaluate works fine. Also all of my 4 Tags are set up on the same server, the same way. I get the System Digital State error with the grey exclamation mark for the Calc Failed ones. I couldn't fine any differences between the good and the bad tags. I'm absolutely new with AF Analysis. The Tags are on a Different PI archive server than the AF is running on, but if that would be a problem the good ones weren't working as well. Data has no Bad Value. Could you help me please?

              • Re: Tricky sum Tags
                Dan Fishman

                I would go with what Tim suggested.  Depending on your logic, you might want to break it out like this: EventCount('Attribute1','y+9h','t+8h+45m')*TagMean('Attribute1','y+9h', 't+8h+45m').

                 

                EventCount * TagMean will make sure you are performing an event weighted total.