2 Replies Latest reply on Jul 12, 2017 7:20 PM by Rick Davin

    Need to validate if values is updating form past 15 mins using PI ACE

    jainc_paresh

      Hello Folks,

       

      Greetings for the day!

       

      Using PI ACE (VB.NET), I would like to know if the value for a given tags has been updated from past 15 mins.

      Is there any method in ACE that would do the same. Or How could I write a look to pull the values by providing the starttime and end time and loop around by comparing the 2 values.

       

      Note: I am using PI Module database to configure the signals (Input_Aliases).

       

      Thanks in Advance.

       

      Thanks & Regards,

      Paresh

        • Re: Need to validate if values is updating form past 15 mins using PI ACE
          Marcos Vainer Loeff

          Hi Paresh,

           

          Could you please explain what do you mean by "if the value for a given tags has been updated from past 15 min"? Are you replacing some values? Are those tags inputs of your PI ACE calculation or not?

           

          The property "Substituted" from each value which was replaced changes from false to true. So this is one way to detect replace values.

           

          For every PI ACE project you can add a reference to PI SDK or PI AF SDK. You can make a RecordedValues calls to retrieve all compressed values from a selected list of PI Points for a given time range. This way you can check if there is a value on the PI Data Archive which satisfies some conditions that you will impose.

           

          Is this what you are looking for?

           

          Hope it helps!

          • Re: Need to validate if values is updating form past 15 mins using PI ACE
            Rick Davin

            Hi Paresh,

             

            Are you trying to detect stale tags?

             

            If you ACE module using Natural (or Event) triggering, then it won't really perform as you want it to.  If a tag is stale, then it won't be having an event coming in any time soon to fire off the trigger.  If a new event does come in for the tag, then it's not stale anymore.  Plus you would have a circular reference where your tag is both input and output. 

             

            Instead your ACE module must be Periodic.  It's not as simple as grabbing the value at trigger time and the previous value.  Why?  Because the trigger value could be interpolated since it's Periodic, and the previous value to the trigger might actually be the snapshot value.  That means your ACE module should do the following per tag:

             

            1. Get the tag's snapshot which should include the timestamp OR just get the event timestamp.
            2. Get the previous event prior to the snapshot timestamp
            3. See if the time delta is greater than your staleness duration of 15 minutes

             

            One trick to get the actual recorded or snapshot value and not the interpolated trigger time would be to use something PrevEvent like:

             

            Dim currentTime As PITime = PrevEvent(tagname, "*+1s")

             

            This adds 1-second to the trigger time, and then finds the event previous to that.  This effectively finds the recorded value or snapshot time.  Once you have that you would issue yet another:

             

            Dim prevTime as PITime = PrevEvent(tagname, currentTime)

             

            And yes you would have to make both calls for every tag you care about monitoring.