How to totalize data at each process change

Discussion created by lamaze on Oct 31, 2019


Here is a tricky problem for me... I hope the community can give me some advises.

I have a noisy process signal going to Historian. At irregular time interval the value is reset but not necessarly to zero.

At the moment of the swap the process value varies a lot, thus one can not use the maximum value.

I'm looking for an easier way to get total production: End + ΣSwaps - Start as represented by the diamond values on the plot below.

The solution I found is cumbersome and requires too many steps for an end user:


1. get the start and end value (easy)

2. use a PIAdvCalcExpDat with an expression to calculate the average rate of change on a 30min period, I tried the function "rate('PITag')" but I got an error so I used  "('PITag'-prevval('PITag','*'))/('*'-prevevent('PITag','*'))*scale"

3. apply a condition on the results obtain in step 2, if true get the PITag value for the time stamp.

4. adds all the values from step 3 and step 1


I was hoping to get the same result with something like PISampFilDat('PITag',startTime,stopTime,30m,rate('PItag')<-5000,1,1) but that does not seem to work.

Any suggestion?