4 Replies Latest reply on Nov 28, 2017 11:54 PM by NicPickering

    Pi Calculations

    NicPickering

      Hi Guys,

       

      I want to create a Pi Calc that does something similar to the expression EventCount. What I really want is to create a trend that only displays the previous 20 event changes. I've been playing around with the Pi Calcs and I think there might be a way to do this if I combine a few expressions  together.
      Does anyone know if this is possible?

        • Re: Pi Calculations
          jru

          Hi Nic,

           

          Thanks for posting on PI Square.

           

          Since you are asking for a PI Calc, I'm assuming you are looking to trend this in a Processbook display.  Unfortunately, is not supported.  Our trend objects in both Processbook and Vision are designed around a start time and an end time. 

           

          PI Calcs will also follow that convention when you call them in a trend object so even if there was a way to create a PI Calc to do this you are still restricted by the behavior of trend objects.

           

          What you are looking for is recursive in nature.  In other words, you need to keep searching through your historical data until you find 20 events.  None of our Client Tools really have that option at this moment.

           

          PI Datalink would be the closest thing that you can easily use to get what you need.  In Datalink  you can use the compressed data function and ask it to return a certain number of values.  Then you can trend the results using the Excel Trend objects.

           

          However, this does not ensure that the consecutive events are unique.  It just returns number of events you specified.  In order to ensure your use case, you need to adjust the exception and compression settings so that it only records different consequential events and not archive events that come in with the same value as the previous value.

           

          If you don't want to mess with the exception and compression settings, then you can create a Performance Equation Tag that scrubs the historical events.  Something in the syntax will work:

           

          If 'Tag'=PrevVal('Tag','*') then NoOutput() else 'Tag'

           

          Sorry for the info dump and I hope you find this useful.

           

          ~Jesse

          1 of 1 people found this helpful
            • Re: Pi Calculations
              NicPickering

              Thanks for your reply Jesse,

               

              Unfortunately I think you are right. I've learnt that you can use SQC charts to create a trend based on the previous 20 data changes. My overall goal is to create a PI Vision display but apparently SQC charts do not work in Pi Vision. It would be really handy if there was an option for the trends to have an option to change the x - axis, so instead of being time dependent it would be event dependent. However, at this time, this is not possible.

               

              I have used Data Link in excel as well, but that doesn't help because I need a live updating table to display on PI Vision. I have not figured out how to create a table using data link that updates automatically. Do you know of a way to do this? I know you can embed an excel table, which does not update, and you can link an excel table, which is meant to update. But i have not had any success in this. When I link an excel chart or table I still need to manually update it. Do you know how to fix this? Also is it even possible to upload an Excel table that is being displayed in PI ProcessBook into Pi Vision?

               

              Thanks in advance
              - Nic

                • Re: Pi Calculations
                  jru

                  Hi Nic,

                   

                  Thanks for your post.  I did not think of the SQC chart but that's 1 valid way to do this.  However, as you've said, you can't import an SQC Chart Object from Processbook to Vision.  It'll just look like a normal trend.

                   

                  I know that the SQC Chart is a heavily requested object for Vision and we should see one in later iterations of Vision.

                   

                  Which brings us back to our original issue.

                   

                  You can have a Datalink link query using the update button:

                   

                   

                  As long as your queries have a dynamic start time (such as '*'), it will automatically requery the data in regular intervals (default is 5 seconds)

                   

                  With regards to embedding an Excel Sheet in Processbook and still having it dynamically update, there's no way to do that.  By token, once the sheet is embedded, the data will become static.  Uploading to Vision would also not work.

                   

                  Finally, I would like to add that since you're end goal is to use Vision.  You can leverage Vision's Extensibility features and create a custom symbol of your own that can be like a table of the last 20 events.

                   

                  I've attached a reference should you be interested in this option:

                  Getting started with PI Vision Extensibility

                   

                  ~Jesse

                    • Re: Pi Calculations
                      NicPickering

                      Yeah that's what I thought. Thanks for the information though, it's good to know the capabilities of both ProcessBook and Vision.

                       

                      I'll have a look at the link you gave me and I'll update you on how it goes. Thanks again.

                       

                      - Nic