In short: Need analysis to run on archive values only, snapshot values keep interferring.
I am currently struggling with creating an analysis. The goal of the analysis is to perform a delta calculation between two points whenever it is a positive curve. The tag in question is heavily compressed so only the lowpoint and highpoint is recorded (albeit points may at times exceed the compression resulting in a two point rise).
In essence, the input follows an irregular cycle so defining by time is difficult. My initial idea was thus to go back two-three points using prevVal and prevEvent. This is the code, a little bit messy after hours of experimenting.
The delay isn't much of an issue, but the problem I am experiencing lies in the relativity of prevVal. While this works perfectly fine when backfilling, snapshots severly corrupts the process. I am using nested prevVal and prevEvent as I have not been able to find a way to use time as a good locator, which anchors me to the current value. And since analysis operates on snapshot values, this keep moving back and forth spamming out incorrect values and the occational absurdly high value (thus the deltahack segment in an attempt to limit them). I may have gone down the wrong path in creation of my analysis but currently I am at my wits end on how to solve this problem. Does anyone have any inputs on how I can achieve my goal?
The AF server this is running on 2018 SP1. The analysis service is not the 2018 version which allows for variable timestamp in triggering and not scheduled for update before next year.