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 )
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.
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).
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.
Wouldn't "PI ACE Manager > Server > Disable Caching" do the trick?
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.