2 of 2 people found this helpful
My first comment is that the analysis is going to use the trigger time of the analysis, unless you specify otherwise. Outside of modifying the output timestamp, the most likely reason for the "delay" in your analyses will be within your calculations.
Nevertheless, I have noticed an error in your calculation which could be the root cause for your delay. Your PreviousRate calculation will always be 0 as you have:
TagVal('Level', '*-3h') - TagVal('Level', '*-3h')
which should be
TagVal('Level', '*-3h') - TagVal('Level', '*-3.5h')
This effect of this is that the value for "tankage" will always be false when the current rate is less than -1000. In this case, the PreviousRate (which is 0) is used for the LoadingCheck value which in turn is less than the threshold. This will have a flow-on effect in your other analysis.
If this doesn't help, it might be handy to do a bit of "shotgun debugging" and map the individual calculations out to PI Tags (via attributes) or continue to use the "Preview" functionality.
If you're still stuck let me know and I (or someone else who beats me to it!) can help step through the analyses in more detail
ha, so I was attempting to mess with the time frames to see if that's what is causing it. I forgot to revert it back before i took a picture. I ended up fixing that, and checked it again. Unfortunately I still have the same issue (it just changes the delay from 4.5 hours instead of 3.5 when i move it 4 hours back).
Now when you say use the trigger time on analysis, does that mean I should switch one to execution time? Sorry for my ignorance. I'm just unsure of what you meant by the trigger time of analysis since both of my calculations are set to output it at the trigger time.
So when I preview results to help try to debug it, the "Product Check" triggers as expected at 11:10 PM. Everything result shows correct until I go to "Product Status", and then it reads the delay. I'm not sure why it's doing that. All the other triggers work correctly with exception of reading the "Product Check" value.
Can I ask how you resolved it? The only issue I can see that differs is not having an output history for the tags. Is there an explanation of scenarios when it's not needed?
2 of 2 people found this helpful
We did a lot of optimizations actually and we considered a lot of factors but looking at your calculations and syntax, you can try mapping the Tag value for the last 30 h and Tag Average into an attribute then map that attribute on your calculations.
instead of TagVal('Level','*') - TagVal('Level','*-30h')
create an attribute For example Level for last 30 hours and use the pi point data reference.
So in your calculation it might look like
Level - Level30h something like this.
The same with getting the average for a tag. The reason is because using TagAvg in the analysis requests data from the Data Archive every time the analysis is triggered which might cause lagging.
Another thing to look at is to look at the Analysis Service statistics.
Look for the value for Current Lag if this is going up then check the analysis log to know what is causing the lag.
Awesome, creating an attribute with the relative time worked!
Thank you very much. I didn't realize the analysis would cause that much of an issue since it reads off of a historized pi point.