Hi PI team,

I am having a problem with filter expression implementation for totalization with calculated data.

The totalization is for flow rates. When there is no flow some of the flow meters indicate negative values which are just noise.

So I usually use filter expression to filter out negative values because PI totalizer adds up negative values as well e.g. 'tagname'<0 . But sometimes there are bad values during the totalization period and calculated data function throws "[-11101] All data events are filtered in summary calculation".

is there any filter expression i can use to filter out negative values and bad (nonnumeric) values as well?

Thanks in advance. Really looking forward for you help.

Adilbek

Hi Adilbek,

That's an excellent question. Please see my reply to Will first if you haven't already.

The behavior you are asking for is where you want to apply a filter expression. This is because when we use a filter expression the value is ignored. Thus, when we filter the value out, Datalink will use the Previous valid value. For example, let say this is what we see in the archives.

00:00 10 L/min

00:10 "Out of Serv"

00:20 10 L/min

00:30 "Bad Data"

00:40 10 L/min

00:50 -10 L/min

And the configuration of the calculated data expression looks like:

Expression: If 'Tag'<>"Bad" and 'Tag'>=0 then 'Tag' else 0

Filter Expression: 'Tag'<>"Out of Serv"

The filter expression will remove "Out of Serv" from the calculation first. Thus, my returned Query from the PI Server will be:

00:00 10 L/min

00:20 10 L/min

00:30 "Bad Data"

00:40 10 L/min

00:50 -10 L/min

As you can see, now, Datalink will assume the value of the tag from 00:00 to 00:20 will be 10 L/min

Then the expression is applied. This transforms my result set to be:

00:00 10 L/min

00:20 10 L/min

00:30 0 L/min

00:40 10 L/min

00:50 0 L/min

This means Datalink will assume that the values at 00:30, and 00:50 to be 0 for the calculation. Thus, the time-weighted average for the flow rate is 6.66 L/min. Since the interval is 60 minutes, the totalized flow will be 6.66 L/min * 60 min = 400 L

Please give this a shot and if you need clarification, let me know. I'd be happy to assist further.

~Jesse