2 Replies Latest reply on May 31, 2018 2:59 AM by JonasOleon

    Tracking a measurement with the datalink

    JonasOleon

      I'm making a database that logs when and for how long a certain measurement is under a certain value.

      But I can't seem to figure out what command I should use.

       

      Basically, whenever the pH measurement drops under 7 I want to know when it started and how long it lasted.

      I'm using the PI datalink 2016 version 5.3.0 and the data is collected from Siemens PCS 7.

       

      Thanks in advance

        • Re: Tracking a measurement with the datalink
          rschmitz

          Hi Jonas,

           

          Thanks for reaching out to us on PI Square.

           

          My recommendation is going to change somewhat based on what exactly you're looking for. In the DataLink calls I'm going over below, I'm using compressed data, so this will find the first time there is a value coming in from the data source that reports in a certain range (rather than using interpolated, which you could use to find the time between samplings when it should have cross the threshold). For finding the first time a value falls below a threshold, you could us a compressed data call with filtering.

           

          This call only returns to me the values for which the tag ("sinusoidu" in my case) is above 50 as compared to the right-hand side where I do no filtering.

           

           

           

          As for finding the time that tag was great than some value, you can use a performance equation in an expression for an Archive call. You can set the time range you're interested in within the performance equation and just set the execution time (i.e. TimeStamp) to now ('*'). TimeGT returns the time in seconds a value was larger than the value specified in the function (in my case 50) between the given time range (in my case yesterday at midnight and today at midnight). There are related Time Less Than, Greater than or Equal to, etc. These functions will use interpolated value for when it cross that threshold values when calculating the number of seconds after it's crossed your specified threshold value.

           

           

          Cheers,

          Rob

          2 of 2 people found this helpful
            • Re: Tracking a measurement with the datalink
              JonasOleon

              Thanks for the response

              I've been trying to get it to work but it appears it's way more difficult than I thought.

               

              Since the measurement will always display a value it doesn't really work to put it in a database.

               

              This measurement only has meaning when the flow rate measurement also has a certain value.

               

              I'm going to practice a bit first with easier things and build up to it.