Discuss challenges in energy and automation with a global network of peers.

39877members
181208posts

Historic Aggregate equivalent to 'Start Last'

Ensign

Historic Aggregate equivalent to 'Start Last'

So the 'Max' and 'Min' historic aggregates have a 'Max Last' and 'Min Last' version where if the sample period only contains a single value, the aggregate will also grab the last preceding value before the sample period.

 

Is there an equivalent way to do a 'Start Last' for the 'Start' historic aggregate, i.e. if the sample period only contains one single value, don't grab that single value as your 'Start' but look at the immediate preceding value before the sample period?

 

I'm trying to implement a Delta calculation and this is tripping me up because the aggregate will return a 0 if the sample period only has a single value but there is no option to tell it to look for the last preceding value. The latter option would be very useful for doing delta calculations on points that have infrequent sampling.

8 REPLIES 8
Ensign

Historic Aggregate equivalent to 'Start Last'

So the 'Max' and 'Min' historic aggregates have a 'Max Last' and 'Min Last' version where if the sample period only contains a single value, the aggregate will also grab the last preceding value before the sample period.

 

Is there an equivalent way to do a 'Start Last' for the 'Start' historic aggregate, i.e. if the sample period only contains one single value, don't grab that single value as your 'Start' but look at the immediate preceding value before the sample period?

 

I'm trying to implement a Delta calculation and this is tripping me up because the aggregate will return a 0 if the sample period only has a single value but there is no option to tell it to look for the last preceding value. The latter option would be very useful for doing delta calculations on points that have infrequent sampling.

Highlighted
Lt. Commander
Reply
Loading...

Re: Historic Aggregate equivalent to 'Start Last'

'Start' is not a historic aggregate, neither is 'Runtime' if you have that also.  These are 'Historic Algorithms' 😉

 

And both 'Start' and 'Runtime' are custom Historic Algorithms, meaning that they do NOT ship by default with ClearSCADA (or Geo SCADA Expert).

You (or someone else) has had to go into the Server Configuration utility, and go to Database Configuration -> Historic Algorithms and create these.  This means there are some limitations to their configuration which don't exist with the built-in algorithms (since obviously Aveva have access to all the magic in the backend when they are coding up the built-in algorithms).

 

I think that you're potentially out of luck on this.  But it's probably worth raising a feature request to get the 'at end' and 'at start' additions to custom Historic Algorithms.  Although I suspect that even if they are implemented, it wouldn't be within the timeframe that you need.

 

If your interval time isn't dynamic then you could map your starts into Calculation Points, and then use 'Value at end of the interval' and 'Value at start of the interval' to get results... but it's definitely not perfect.


Lead Control Systems Engineer for Alliance Automation (VIC).
All opinions are my own and do not represent the opinions or policies of my employer, or of my cat..
Highlighted
Reply
Loading...

Re: Historic Aggregate equivalent to 'Start Last'

The OPC-HDA quality flags may be of help here, combined with some COUNT(). Its a little messy but might help

Highlighted
Reply
Loading...

Re: Historic Aggregate equivalent to 'Start Last'

@rlao wrote:

So the 'Max' and 'Min' historic aggregates have a 'Max Last' and 'Min Last' version where if the sample period only contains a single value, the aggregate will also grab the last preceding value before the sample period.

This isn't correct, the number of values of in the sample period (zero, one or more) doesn't make any difference with the "Min Last" and "Max Last" algorithms. The last value before the sample period is always included in the calculation.

 

@BevanWeiss wrote:

'Start' is not a historic aggregate, neither is 'Runtime' if you have that also.  These are 'Historic Algorithms' 😉

 

And both 'Start' and 'Runtime' are custom Historic Algorithms, meaning that they do NOT ship by default with ClearSCADA (or Geo SCADA Expert).

This isn't correct. "Start" is a standard historic algorithm, its from the OPC HDA standard and is included in ClearSCADA / Geo SCADA Expert. "Runtime" however is a custom algorithm.

 

 

Whilst there isn't a "Start Last" algorithm, there is the "End Last" algorithm could this be of use? This gives the last value in the sample period or the preceding value if there are no values in the sample period.


Andrew Scott, Lead Engineer, AVEVA
Highlighted
Reply
Loading...

Re: Historic Aggregate equivalent to 'Start Last'

My bad, I ran off on a tangent.  Replace all of my 'Start' mentions with 'Starts' (i.e. count of 0->1 transitions).

I was definitely thinking that we were trying to get a delta on 'Starts'...  which is a Custom Algorithm (like Runtime.. hence why I mentioned that).

 

I see the issue now.  I think this is definitely deserving of a feature request.  If there is an End Last, then there should be a Start Last.  I can imagine quite a few situations where you'd want to obtain the 'oldest' value from the interval (and if there is no value within the interval, then the newest value prior to the start of the interval).

 

You'd need to do some conditional stuff to use EndLast.. since if Start returns a valid value that would be prefered to EndLast of all time before the interval you selected.

 

I think Adam might be right... a historic query might be the only way currently.

 

I feel I did some Delta stuff mid last year which would have used something similar... I think I ended up just doing a calculation point and using Delta.  Perhaps a DeltaInclusive might be more useful... that would always return a delta that is 'valid' across a time interval, even if it has to extend outside of the time interval to retrieve either/or Start / End point.


Lead Control Systems Engineer for Alliance Automation (VIC).
All opinions are my own and do not represent the opinions or policies of my employer, or of my cat..
Highlighted
Reply
Loading...

Re: Historic Aggregate equivalent to 'Start Last'

Hi Andrew,

 

Yes apologies I was mistaken on the my understanding of Min/Max Last algorithms. I should have used 'End Last' as the example of what I was after.

 

Unfortunately, 'End Last' is similar but not exactly what I am after. I was looking for a way to return the first value in the sample period and to look to the preceding value only if there is no values in the sample period, hence 'Start Last'.

 

My ultimate aim was a Delta algorithm that wouldn't simply return a zero value if there were only one sample in the sample period, but instead look to the preceding sample before the sample period to calculate difference between first and last value. If there existed a 'Start Last' algorithm, I can simply do a subtraction between 'Start Last' and 'End' to accomplish this.

 

Although now that I think about it, 'Start Last' minus 'End' probably won't work as I would need 'Start Last' to look at the preceding value if there is only one value in the sample period, not no values in the sample period.

 

In the end I wrote up a bit of scripting to achieve what I wanted, but it would be very handy to have a variant of the Delta algorithm that looks at preceding values if there are insufficient samples in the sampling period. @BevanWeiss more or less hit the nail on the head with his description of a 'DeltaInclusive' algorithm.

 

Time to bug my Schneider support contact with another feature request.

 

 

Highlighted
Reply
Loading...

Re: Historic Aggregate equivalent to 'Start Last'

@rlao If you let me know the PDEV I'll upvote it

I expect that it should be relatively easy for an intern or such to be given it as an introductory Geo SCADA Expert development task...

 

I think even if there was a 'Start Last' and an 'End Last' it wouldn't give you what you wanted... since if you only have one point in your interval, then it is both the Start and the End (the alpha and the omega...) and you'd be back to a delta of 0/0 (but without any magic calculus limits as x->inf) 😉


Lead Control Systems Engineer for Alliance Automation (VIC).
All opinions are my own and do not represent the opinions or policies of my employer, or of my cat..
Highlighted
Reply
Loading...

Re: Historic Aggregate equivalent to 'Start Last'

PDEV-2046, votes from both of you.

Highlighted
Reply
Loading...

Re: Historic Aggregate equivalent to 'Start Last'

Thanks Jesse, I'll mark this as solved.