24 Replies Latest reply on Jan 14, 2019 2:36 AM by Dr.Zhou

    Statistics on start-up and shut-down - question about PI archive data compressing

    Dr.Zhou

      Dear All,

       

      We made a set of Performance Equations to monitor the operation status concerning key equipments. Corresponding PI tags were set to be 1 for start-up while 0 for shutdown, as shown in figure 1.

      q3.png figure 1

       

      The above mentioned equipment started before 1-Jan-2019, and then shut down at 5-Jan-2019 11:22:16, and then started again at around 5-Jan-2019 14:28:15, where the red arrow points to.

      When I retrieved the data with DataLink PINCompDat fomula, I got the following figure 2.

      q1.png figure 2

       

      There are totally 1 round of shut-down and start-up. Why do I got 10 startups and 2 shut-down there? It leads me to the suspect of compressing setting, which I attached here as figure 3.

      q2.png figure 3

       

      Could you please point me to the reight direction to get only 1 start-up and 1 shutdown, according to my example here?

       

      Thanks in advance.

      Regards

      ZYY

      2019.01.09

        • Re: Statistics on start-up and shut-down - question about PI archive data compressing
          Dan Fishman

          To start with, in order to visualize the archive data I would turn on "markers" on the PI Procesbook Display.  You will notice that your data is spaced eight hours out on average due to your compression max time.  Basically, the value is not changing, but in order to show you that data is still coming in and not stale, the compression max will make sure the next value after eight hours will be archived if previous eight hours have been compressed.

           

          Of course, I will have to recommend AF Analytics since PE service is now optional on the PI Server installation, but realities for some customers mean AF is not available.

           

          For this type of tag I would recommend turning on "Step" since you probably don't want interpolated values if you were to sample the point.  The second zero was saved due to the compression algorithm.  It it rather tricky and typically not possible to obtain the desired spacing you require by adjusting compression.  For what you need, it comes down to understanding the PE equation scheduling (periodic or event based) and looking at the current state and the last value written to decide if you should write a value.  If the state has not changed, you could write no value using "NoOutput()" and only write values on state changes.

           

          Let us know if you need help with the performance equation syntax to get this to work.

           

          Regards,

          Dan

          3 of 3 people found this helpful
            • Re: Statistics on start-up and shut-down - question about PI archive data compressing
              Dr.Zhou

              Thanks for the quick response, Dan. I was just noticing the same thing - "compressing duration" setting may be the cause. And, the "step" setting thing really helps me a lot. I read through the document before, but when it comes to practice, not always fully awared. But "practice makes perfect", ^_^

               

              I notice that AF offers a variety of functinalties as for the data handling, but unfortunately we don't have that installation. We only have PE in hand so we need to make the most of it. Always got stuck though, we figured out a few interesting applications of PE.

               

              Well, again, THANKS!

              ZYY

              2019.01.09

            • Re: Statistics on start-up and shut-down - question about PI archive data compressing
              VasanthakumarR

              Hi Yuang,

               

              As Dan Fishman suggested, you need to turn on the step attribute in order to ignore the interpolated values.  Please refer the below link for filtered calculations,

               

              KB01637 - How do I count the number of specific PI Point values in a time period?

               

              Regards,

              Vasanth.

              1 of 1 people found this helpful
              • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                Dr.Zhou

                To be more specific, let me get back to the way I'm wading through.

                 

                I need to keep a close eye on a certain tag, say TANK_LEVEL. When it exceeds the limit, the flag is set up to be 1, while when it goes down under the limit, the flag is 0.

                 

                I tried 3 approaches for this purpose. The 1,2 do not work, while the 3 works, but in the opposite way.

                 

                approach 1:

                if (prevval('TANK_LEVEL','*') <= 100 and tagval('TANK_LEVEL','*') > 100) then 1 else (if (prevval('TANK_LEVEL','*') > 100 and tagval('TANK_LEVEL','*') <= 100) then 0 else nooutput())

                 

                approach 2:

                if (tagval('TANK_LEVEL',prevEvent('TANK_LEVEL','*')) <= 100 and tagval('TANK_LEVEL','*') > 100) then 1 else (if (tagval('TANK_LEVEL',prevEvent('TANK_LEVEL','*')) > 100 and tagval('TANK_LEVEL','*') <= 100) then 0 else nooutput())

                 

                approach 3:

                if (prevval('TANK_LEVEL',prevEvent('TANK_LEVEL','*')) <= 100 and prevval('TANK_LEVEL','*') > 100) then 1 else (if (prevval('TANK_LEVEL',prevEvent('TANK_LEVEL','*')) > 100 and prevval('TANK_LEVEL','*') <= 100) then 0 else nooutput())

                 

                Those "prevval" "tagval" "prevevent" functions are not obscure. I might make mistakes other than those fomulas above?

                Thanks in advance!

                ZYY

                2019.01.10

                  • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                    VasanthakumarR

                    Hi Yuyang,

                     

                    Yes, you are absolutely right, you need to use the equation as below to achieve your requirement,

                     

                    if (prevval('TANK_LEVEL',prevEvent('TANK_LEVEL','*')) <= 100 and prevval('TANK_LEVEL','*') > 100) then 1 else (if (prevval('TANK_LEVEL',prevEvent('TANK_LEVEL','*')) > 100 and prevval('TANK_LEVEL','*') <= 100) then 0 else nooutput())

                     

                    The condition in the KB article talks about the current value which means if you use PrevVal ('Tank Level','*') < 1,  it will give you the current value. if you want to compare the previous value and current value you need to use prevEvent('TANK_LEVEL','*') to get the previous timestamp and us this as a timestamp in prevval function to get the previous value.

                     

                    Hope this will help.

                     

                    Thanks & Regards,

                    Vasanth.

                    1 of 1 people found this helpful
                      • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                        Dr.Zhou

                        Dear Vasanth,

                         

                        Is there any simplified way of doing this? The formula looks a little wordy, since I got 2,000+ tags to monitor. Um, I mean within the PE scope.

                         

                        Thanks!

                        ZYY

                        2019.01.10

                          • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                            Dan Fishman

                            Some more official documentation on this is in KB0464 (see #1).

                             

                            I am not sure why #2 of your equations doesn't work. If you are calling the current value, shortcut way to it just call the tag name such as 'Tank Level' instead of using TagVal('Tank Level', '*').  Are you doing this on a periodic schedule or event trigger? 

                             

                            You could also check the output point as an alternative.  For example:

                            if (prevval('TANK_LEVEL',prevEvent('TANK_LEVEL','*')) <= 100 and 'outputTag' =0 then 1 else (if (prevval('TANK_LEVEL',prevEvent('TANK_LEVEL','*')) > 100 and 'outputTag' =1  then 0 else nooutput())

                             

                            If you have to make many of these you might want to make an Excel template where you can plug in the tag names and use Excel PI SMT plugin to generate the tags. In the past, some people used ACE as a way to manage thousands of contexts.  Now, many people are using AF Templates to do this sort of logic.

                             

                            Also, depending on what you need this tag for, there it might not be necessary to even remove the duplicate values in the output steam.   There was ways using client side filtering to determine how many shutdowns occurred without having the cleaned stream you are after.  When I first started using PE equations, I often hit the type of issues you are experiencing.

                             

                             

                             

                             

                            1 of 1 people found this helpful
                              • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                                Dr.Zhou

                                Thanks for the explanation, Dan.

                                 

                                I'm utilizing the "TANK_LEVEL" as event trigger by means of "the timestamp of the triggering event". I guess the "outputTag" in your content is the output of the formula, say, TANK_LEVEL_OVER_LIMIT. When the trigger clicked, the outputTag stands for the last value of itself could be employed here to simplify the calculation.

                                 

                                As for the EXCEL plugin, yes, that is the way I'm making inputs for large quantity of PEs. Should there be an installation of AF, I'll definitely give it a try.

                                 

                                I agree that several client side ways could be used here to count the times of on/off or beyond/under limits. But the requirement is not only the time slot, but the duration and maximum. The solution in my mind was to,

                                1, to calculate the 1/0 by PE, as being discussed here.

                                2, to have the DataLink PINCompFilDat function with the filter being 'TANK_LEVEL_OVER_LIMIT'=1 or 'TANK_LEVEL_OVER_LIMIT'=0.

                                3, to ask EXCEL to compute the time span, while to ask DataLink again to search out the maximum.

                                 

                                I wish this solution could work.

                                 

                                Again, I'm grateful for your help. Thanks!!!

                                ZYY

                                2019.01.10

                                  • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                                    Dan Fishman

                                    You are welcome.  One trick in PI Datalink to count the number of step changes given the original steam is to do something like this for compressed data:Filter = 'Tank_LEVEL_Over_Limit'=1 and PrevVal('Tank_Level_Over_Limit') = 0 .

                                      • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                                        Dr.Zhou

                                        Dear Dan, I thought things were settled, but obviously the Rome was not built in a day.

                                         

                                        I made a test run last night for a certain temperature-over-limit supervisory, by means of PrevVal and PrevEvent etc., like we discussed. Supposingly, the monitor would offer "1" when exceeding were detected, while "0" after getting back to normal, no other tricky "1" or "0" during the stage. Taking the following figure-5 for example, there should be two times of "0 to 1" and "1 to 0" cycles, illustrated by the 4 red circles.

                                        q6.png figure-5

                                         

                                        By moving the sliding gauge, I notice the timestamp regarding the 4 red circles are as follows.

                                        (1) 22:36:59

                                        (2) 22:38:39

                                        (3) 22:39:52

                                        (4) 22:45:35

                                         

                                        But, when I draw those information from DataLink, I got the figure-6 as enclosed.

                                        q7.png figure-6

                                         

                                        A few bothersome timestamps slide into the sheet, while there are distinctive overlaps. I was wondering any other tips should be alert to?

                                         

                                        FYI, the fomula employed here is

                                        Event=TANK_TEMPERATURE, if (prevval('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*')) <= 572 and prevval('TANK_TEMPERATURE','*') > 572) then 1 else (if (prevval('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*')) > 572 and prevval('TANK_TEMPERATURE','*') <= 572) then 0 else nooutput())

                                         

                                        And, the attribute for this tag is.

                                        q8.png figure-7

                                         

                                        Best Regards

                                        ZYY

                                        2019.01.11

                                          • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                                            Dr.Zhou

                                            I realize to turn on the "marker" to show the details, then I got figure-8 as enclosed. As pointed by the red arrow three times in the figure, we do have these 3 nuisances stepped into the record, in accrodance with the change of supervised tag - TANK_TEMPERATURE. We also make TANK_TEMPERATURE the trigger of the formula, while it looks like most of the triggers remain normal other than those three ones. On the other hand, we notice that the TANK_LEVEL_OVER_LIMIT signal genrated by the formula always make a few seconds delay.

                                             

                                            q9.png figure-9

                                             

                                            Anything wrong with the trigge setting, or something tricky that we don't know of?

                                             

                                            Regards, ZYY

                                            1 of 1 people found this helpful
                                              • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                                                Dan Fishman

                                                Ah, the joys of PE equations and realities of working with data streams!  In the past, I also have spent days working on what would seems like simple PEs.  Thanks for turning on the markers and I appreciate you digging in!

                                                 

                                                A few ideas that might help. 

                                                I don't like this line: prevval('TANK_TEMPERATURE','*') > 572).  I am not sure what the PE scheduler will do.  What if '*' is the same time as the current event, will it look back to the previous event?  I no longer recall but probably knew at one point six years back!    Maybe it is safer to just use 'Tank_Temperature' so you know you will be reading the most current value.

                                                 

                                                How fast is the input stream?  If the data is coming in more than once a second you will have issues.  Also, if the data is ever buffered and comes in "fast" PE's can definitely give some very unexpected results. 

                                                 

                                                The time being shifted probably is due to a delay in the input data.  For event based scheduling, change the timestamp of the resulting expression to be "the timestamp of the triggered event" (location code 3 set to 1) instead of "the time when the expression is evaluated" to get the data aligned.  

                                                 

                                                Also, maybe checking the shutdown/startup tag will be safer and resolve this issue.  I'm glad you are getting close.

                                                 

                                                Regards,

                                                Dan

                                                  • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                                                    Dr.Zhou

                                                    I recall you said "why #2 of your equations doesn't work", which reminds me of the possible mistake with respect to the retrieval of current TANK_TEMPERATURE value.

                                                    As for the #3 equation, the expression of prevval('TANK_TEMPERATURE','*') may lead to a value not exactly the time the equation being carried out. Therefore the euqation has been modified to be like,

                                                     

                                                    Event=TANK_TEMPERATURE, if (tagval('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*')) <= 572 and tagval('TANK_TEMPERATURE','*') > 572) then 1 else (if (tagval('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*')) > 572 and tagval('TANK_TEMPERATURE','*') <= 572) then 0 else nooutput())

                                                     

                                                    I also make an equation without '*' within TagVal, as you mentioned. Currently they both are running well. I will get back to you after a few hours running.

                                                    BTW, the trigger was set to be "the timestamp of the triggered event" ever since the test run.

                                                     

                                                    I feel like getting close to the right point.

                                                    Best Regards

                                                    ZYY

                                                    2019.01.11

                                                    • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                                                      Dr.Zhou

                                                      I'm still in the way of working it out. Here is my latest find-out.

                                                       

                                                      w7.png figure-10

                                                      curve in light blue

                                                      if (tagVal('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*')) <= 572 and 'TANK_TEMPERATURE' > 572) then 1 else (if (tagVal ('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*')) > 572 and 'TANK_TEMPERATURE' <= 572) then 0 else nooutput())

                                                       

                                                      curve in yellow

                                                      if (prevval('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*')) <= 572 and 'TANK_TEMPERATURE' > 572) then 1 else (if (prevval ('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*')) > 572 and 'TANK_TEMPERATURE' <= 572) then 0 else nooutput())

                                                       

                                                      It looks like the light blue one could prevent those annoying additional records from happening, but sometimes off-duty. While the blue one keeps the characteristics as pointed out before.

                                                       

                                                      Regards, ZYY, 2019.01.12

                                                        • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                                                          Dan Fishman

                                                          I wouldn't expect the blue to work since I believe you will get the current value using: (tagVal('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*'))

                                                          One trick, would be to do something like: (tagVal('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*-2s')).

                                                           

                                                          Other options are to try to read the current value of the output tag.  Also, use exception so if the values accidentally repeats, exception testing will remove it. 

                                                          1 of 1 people found this helpful
                                                            • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                                                              Dr.Zhou

                                                              if (tagVal('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*-2s')) <= 572 and 'TANK_TEMPERATURE' > 572) then 1 else (if (tagVal ('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*-2s')) > 572 and 'TANK_TEMPERATURE' <= 572) then 0 else nooutput())

                                                               

                                                              Let me give it a try and get back to you.

                                                                • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                                                                  Dr.Zhou

                                                                  w8.png figure-11

                                                                   

                                                                  I'm sorry for making this lead long overdue. I feel like picking up the wrong way to employ the "prevVal" and "prevEvent" function. Please refer to figure-11. The curve in fuchsia is the signal generated for testing, while the curve in red shows the characteristic of equation as follows,

                                                                   

                                                                  Event=signal-in-fuchsia, prevVal('signal-in-fuchsia', prevEvent('signal-in-fuchsia','*'))

                                                                   

                                                                  You may figure out a few bump-up, which I believe the guy that leads to those errors said above. On the other side, I don't believe that curve in red shows the correct value of "last event".

                                                                   

                                                                  I was wondering the difference between,

                                                                  1, tagVal('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*')

                                                                  2, prevVal('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*')

                                                                  and,

                                                                  3, tagVal('TANK_TEMPERATURE','*')

                                                                  4, prevVal('TANK_TEMPERATURE','*')

                                                                   

                                                                  In my way of thinking, 1 should be equal to 2, but as a matter of fact, it is not.

                                                                  And 4 looks like the equivalent format of 3, well, skeptical.

                                                                   

                                                                  Regards, ZYY

                                          • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                                            Dr.Zhou

                                            I ought to say, there should be something that is past my understanding. After several days' trail and error, I am still away from the right path. Fortunately, I'm offering a few ways that might not work, so people would be alert before they heading the direction figuring out the right start and end timestamp for tag beyond limits.

                                             

                                            f12.png figure-12

                                             

                                            curve in green

                                            TANK_TEMPERATURE

                                             

                                            curve in megenta

                                            TANK_TEMPERATURE_ONOFF:

                                            Event=TANK_TEMPERATURE, if 'TANK_TEMPERATURE'>570 then 1 else 0

                                             

                                            curve in red

                                            Event=TANK_TEMPERATURE_ONOFF, prevval('pfxsp-b1',prevevent('pfxsp-b1','*'))

                                             

                                            curve in yellow

                                            Event=TANK_TEMPERATURE_ONOFF, if (tagval('PFXSP-b1','*-2s') =0 and 'PFXSP-b1'=1) then 1 else (if (tagval('PFXSP-b1','*-2s') =1 and 'PFXSP-b1' = 0) then 0 else nooutput())

                                             

                                            curve in blue

                                            Event=TANK_TEMPERATURE, if (tagval('TANK_TEMPERATURE',prevevent('TANK_TEMPERATURE','*-2s')) <= 570 and 'TANK_TEMPERATURE' > 570) then 1 else (if (tagval('TANK_TEMPERATURE',prevevent('TANK_TEMPERATURE','*-2s')) > 570 and 'TANK_TEMPERATURE' <= 570) then 0 else nooutput())

                                             

                                            Regards

                                            ZYY

                                            2019.01.13

                                              • Re: Statistics on start-up and shut-down - question about PI archive data compressing
                                                Dan Fishman

                                                I'll attempt to answer the difference between the following:

                                                 

                                                1, tagVal('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*')

                                                This is probably not a great use for PE.  This most likely will be the current snapshot value.

                                                2, prevVal('TANK_TEMPERATURE',prevEvent('TANK_TEMPERATURE','*')

                                                This is most likely the previous value before the snapshot.  If you have very fast moving data, you might be unexpected results.

                                                and,

                                                3, tagVal('TANK_TEMPERATURE','*')  This should be the current value at the time the PE was evaluated, which should be the same as 'Tank_Temperature'

                                                4, prevVal('TANK_TEMPERATURE','*'). This will be the same as #1.  The prevVal evaluated now should be the most current value. 

                                                 

                                                Note, AF Analysis does not have this delay issue.