6 Replies Latest reply on Oct 2, 2010 12:58 AM by nagarwal

    Renewing Cached PI Values

    mihorrocks

      The result of my ACE calculation uses the previous calculated result as an input. However, the previous result may also be manually updated from an external client - such as a direct edit of the archive value to reset to zero.

       

      The problem I am trying to work around is that the ACE caching of the PI values means that the ACE calculation usually still holds the previous calculated value rather than any edit that may have occured.

       

      For example; my ACE calculation is scheduled once a minute.

       

      12:00 Output = 100

       

      12:01 Output = 110

       

      12:02 Output = 120

       

      <here the user resets the Ouput to zero>

       

      12:03 Output = 130 (this is where I want to Ouput = 10, but because of the cached value the output continues ignoring the user update)

       

      While I understand that the performance may be impacted, does anyone know how to force ACE to read the value from the PI server rather than rely upon the cached value?

       

      Any thoughts would be greatly appreciated.

        • Re: Renewing Cached PI Values
          michaelh

          Mike Horrocks

          Any thoughts would be greatly appreciated


          I think there are ways to contol ACE caching, and perhaps some real ACE experts can tell you exact details.
          IMO, there are general points behind your request: 

           

          - Usually, there should be one source only for any data stream.
          - Try to avoid tags both as Input and Output in ACE whenever possible.
          - Simple systems are easier to maintain.  

          A possible implementation could use a different UserInput point, which would be taken into consideration by your ACE module.
          Depnding on your needs, this UserInput might be a simple ResetToZero trigger, or a Replacement Value

           

          I'd usually prefer such a solution over tweaking "secret" (more or less ) tuning parameters controlling the ACE caching. 

          And, as you are -hopefully- thinking about a redesign now   
          What about this one:

           

          - Prefer to store rates rather than totals in your archive. 
            You can retrieve totals on any period on request.
            (But that might make your ACE module obsolete, so try to forget it again, now )  

           

           

            • Re: Renewing Cached PI Values
              mihorrocks

              Thanks for the response.

               

              Obviously a simple solution is preferable, hence the attempt to simple add the subtotal to the previous result -with the expectation that the previous result is always the correct value (i.e. not necessarily the cached value, hence my complaint)

               

              The method you suggest was a consideration, but the solution I came up seemed at the time more straight forward. The caching problem was not anticipated.

               

              As for the second suggestion of storing rates rather than totals defeats the point of the calculation - these values need to be in the PI archive for other system to grab the values (without the need to make calculation calls) and so we can trend the values in PB. There is also an element of auditability. Thanks anyway.

                • Re: Renewing Cached PI Values
                  nagarwal

                  Hello Mike:

                   

                  If I understand the problem correctly: You have one tag (lets say TotalTag) which is configured both as an Input and Output in the ACE calculation, and you have a clock-scheduled calculation (period=1minute), which is doing something like this:

                   

                  TotalTag.Value = TotalTag.PrevVal + 10.

                   

                  Lets say you finished a calculation at 12:00:00 AM which sets TotalTag to 100. Now, before the calculation at 12:01:00 AM could be carried out, some other application changes the archive value for TotalTag at 12:00:00 AM to (let's say) 0. Following this, when the calculation at 12:01:00 AM is carried out, it uses the cached value of 100, instead of using 0? Does that explain the problem?

                   

                  Since ACE signs up to receive updates for TotalTag, when the external application changed the archive value (at 12:00:00 AM), that change would be communicated to the ACE Cache via the EventPipe mechanism. If the calculation at 12:01:00 AM is executed before the updated value makes it to the Cache, the result would be wrong. Do you think that could be the case?

                   

                  Have you tried running this calculation by disabling the Cache (ofcourse this would degrade performance). Could you also post the exact lines of code you are using? Also, in what ways does the external application change the archive value (need to make sure that this does generate an update for the eventpipe).

                   

                  Thanks

                   

                  Nitin

                    • Re: Renewing Cached PI Values
                      mihorrocks

                      Nitin,

                       

                      you understand my problem perfectly.

                       

                      How do you disable the cache? Can it be done on a calculation basis or is it for all ACE calcs?

                       

                      For testing I am using SMT achive editor to change the historical values.

                        • Re: Renewing Cached PI Values

                          Wouldn't "PI ACE Manager > Server > Disable Caching" do the trick?

                            • Re: Renewing Cached PI Values
                              nagarwal

                              Mike,

                               

                              You can only disable the cache at the scheduler level (i.e. for all calculations) using ACE Manager (as Michael pointed ACE Manager->Server->Disable Caching). Note that with the cache disabled, each PIACEPoint.Value call would go to the PI Server.

                               

                              As I said earlier, with Cache enabled, you would only run into this problem if the edit is made seconds (<5-10 seconds, depending on how long it takes for an edited value to make it to the eventpipe and then to the ACE Cache) before the calculation is carried out. It would be helpful if you could post the exact lines of code used.

                               

                              Thanks

                               

                              Nitin