I have a variable that is a time-weighted average of a pi tag, B, over the past 1 year. It is an output of the TagMean() function applied to some PI tag attribute. Of course, one would expect this PI tag to be a single value, but somehow it also has an output history that is erratic and weird, like random points in the past with lines of interpolation between them.
In another variable expression, I want to reference only the current value of this time-weighted output variable. Let the time-weighted average variable be called A. Then, for example, I define another variable C, to be (B-A)/A, where B is the time-series data which we are taking the time-weighted average of. I only want to the calculation of the variable C to reference the current value of the time-weighted average variable, A. But in the calculation of the backfilling over say a past-time pteriod of 5 years, it makes use of the weird output history of A, resulting in values that I do not want. For example, the current value of A may be 1700, but for some reason, in its output history, it shows that 4 years ago, its value is 1400, after backfilling.
I have tried to use the function TagVal() to capture the value of the time-weighted average at the current instant in time. However, it has not been effective as the TagVal() function somehow also outputs a PI tag with an output history that cannot be understood. To clarify, I am able to know the value history of the PI tag attribute by going to the "Attributes" tab, right-clicking on the output attribute and selecting "Trend" or "Time-series data". From there, I was able to make the observations which I have highlighted above.
The above description is my current context. Now, my question is: Is there any function/method in PI System Explorer (Analysis) that allows me to capture the value of a PI tag at a particular timestamp and then use that value for further computations in the creation of other variables?
I hope that the description of my question which I have given above is clear. Thank you!