8 Replies Latest reply on May 1, 2017 9:17 PM by Roger Palmen

# PI AF Analysis Optimization

Hi,

Need to calculate percentage of uncertainty, given expression is as below.

Uncertainty = 100*(# of times XXX.PV is bad, uncertain, limit)/43200

I have achieved this in Analysis, but used intermediate tag to store count. This has to be implemented to lot of controls and there are many similar calculations which needs us to create intermediate tags.

I would like to know is there any better way to write this expression to avoid intermediate tag.

• ###### Re: PI AF Analysis Optimization

Hello Doddabasappa,

Under the assumption that your Process Variable is numeric and bad values are identified by statuses from the System Digital State set, you could use PctGood.

• ###### Re: PI AF Analysis Optimization

Thanks Gregor for response.

I have one more expression and implemented as below.

ILC = 100*(# of times o/p at limit)/43200

# of times =SUM(IF(OR(IF(XXX.OP=100,1,0),IF(XXX.OP=0,1,0)),1,0))

Can you please suggest me alternative method to avoid intermediate tag here?

• ###### Re: PI AF Analysis Optimization

Hello Doddabasappa,

This will be more challenging but let's not give up easily

What's the point type of 'Controller Output'?

What do other values than 100 or 0 indicate?

How does the raw data look like? Can you please capture a representative sample and paste it into your reply?

• ###### Re: PI AF Analysis Optimization

Curious about your suggestions. I also do similar counts of events using an intermediate PI Point.

Of course the thing to remember here is that AF Analytics is not geared towards analytics over time, but mainly analytics on the streaming data. A lot of the limitations of AF Analytics show up if analysis over time need to be created: how often did something happen? Did something happen more than x times the last day? So i alwaus break up the analysis in one part that creates a timerange and one part that can get the answer with the limited functions we have to evaluate a PI Point over time.

• ###### Re: PI AF Analysis Optimization

Hi Gregor,

I think this would have become easy if there was an in-built function to count no.of events for specified range where value is 'x', like we have TimeEQ. Because I have few other expressions where need to check for no.of occurrence of specific events over period of time for digital tags as well.

1. Point Type is Float32

2. This expression is used to determine a downstream condition which is limiting the control block action; e.g. the output is at a maximum / minimum limit

3. Below are some sample events. Values may vary from tag to tag and range is 0-100 (span is 100).

 67.9888 4/25/2017 4:33 68.0335 4/25/2017 4:33 68.4937 4/25/2017 4:33 68.6061 4/25/2017 4:33 68.2841 4/25/2017 4:33 68.4137 4/25/2017 4:33 68.379 4/25/2017 4:33 68.8623 4/25/2017 4:33 68.6238 4/25/2017 4:33 68.6404 4/25/2017 4:33 68.644 4/25/2017 4:33 68.7053 4/25/2017 4:33 68.6897 4/25/2017 4:33 68.5438 4/25/2017 4:33 68.6455 4/25/2017 4:33 68.5371 4/25/2017 4:33 68.7634 4/25/2017 4:33 68.4239 4/25/2017 4:33 68.4111 4/25/2017 4:33 68.3639 4/25/2017 4:33 68.5245 4/25/2017 4:33 68.2557 4/25/2017 4:33 68.0335 4/25/2017 4:33 68.1543 4/25/2017 4:33 68.1009 4/25/2017 4:33 68.3975 4/25/2017 4:33 68.2021 4/25/2017 4:33 67.9716 4/25/2017 4:33 68.1757 4/25/2017 4:33 68.735 4/25/2017 4:33 68.5245 4/25/2017 4:33 67.9405 4/25/2017 4:33 68.2093 4/25/2017 4:33 68.2867 4/25/2017 4:33 68.4118 4/25/2017 4:33 68.2068 4/25/2017 4:33 68.0407 4/25/2017 4:33 68.112 4/25/2017 4:33 68.274 4/25/2017 4:33 68.3702 4/25/2017 4:33 68.2909 4/25/2017 4:33 68.1147 4/25/2017 4:33 68.3081 4/25/2017 4:33 67.8874 4/25/2017 4:33 68.2167 4/25/2017 4:33 68.6419 4/25/2017 4:33 68.3978 4/25/2017 4:33 68.1878 4/25/2017 4:33 68.3489 4/25/2017 4:33 68.2978 4/25/2017 4:33 68.6337 4/25/2017 4:33 68.3154 4/25/2017 4:33 68.4116 4/25/2017 4:34 68.978 4/25/2017 4:34 68.4476 4/25/2017 4:34 68.4783 4/25/2017 4:34 68.5573 4/25/2017 4:34 68.5568 4/25/2017 4:34 68.6595 4/25/2017 4:34 68.6596 4/25/2017 4:34 68.9825 4/25/2017 4:34 68.3565 4/25/2017 4:34
• ###### Re: PI AF Analysis Optimization

Couple of ways to do this.  You can configure a PI Point Data Reference with a summary of Count.  You would, however, need to configure the PI Point with a specified time range.  If you're using a client tool, you can pass in a time range.

If you want to use analytics, you can consider using the NumOfChanges function.

--

Steve Kwan

• ###### Re: PI AF Analysis Optimization

Hello Doddabasappa,

Please accept my apologies for the late response.

As mentioned by Steve there are a couple of ways to do what you like to accomplish. Performance wise, the Approach to persist Interim results to a PI Point is likely the best.

You are using an Event Weighted approach to claculate your downstream condition and you mainly need a percentage where a certain condition is met (equal to 0 or equal to 100). Do you think calculating a Time Weighted percentage would be sufficient? In this case you would be able to use TimeEQ. Steve adding a CountEQ to the set of standard functions would be a nice addition

While investigating, I stumbled across KB01120 - Filtered calculations in Asset Analytics which helped me to find the following solution to get the count over a defined period when the High Limit (100) or the Low Limit (0) is met.

The first thing needed is a filter for when the Low Limit and when the High Limit is met. I created Attribute HL_LL_Filter and used the Formula Data Reference

So on each evaluation, HL_LL_Filter will report either 1 (condition met) or 0 (condition not met). Now the challenge was to count the 1's. EventCount is not an option because I would have again to filter for the 1's but cannot. But summing up all the values should work. Unfortunately TagTot is TimeWeighted . So how do we get an Event Weighted Total? I didn't find a corresponding function. Long story short, the trick is to multiply the Event Weighted Average (TagMean) with the EvenetCount.

Depending on how many events are recorded on the raw point (Controller Output) for the time period you specify, you may find this solution not performing well but at least it's an approach to not use a PI Point for the interim results. I would definitely prefer using a PI Point for the interim results, meaning that I would be in favor of your initial solution.

1 of 1 people found this helpful
• ###### Re: PI AF Analysis Optimization

Creative workaround using the basic math!