asoudek

AF Analytics - NoOutput() Function

Blog Post created by asoudek on Aug 31, 2016

Prevent writing the same value to a PI Tag

We used this function in several examples above.  The main thing to be aware about this function is that it is only supported for expressions where the result of the expression is mapped to an Attribute with a PI Tag Data Reference.  It is extremely useful in situations where you want to write values to a PI Tag only when certain conditions are met and nothing if not.

 

(Note: There is an instance where using NoOutput() does not produce expected results. See knowledge based article KB01127.)

 

If you don’t use NoOutput():

Imagine you are creating a trigger tag to for events and notifications to write a value of 1 when the Variable is below 100 and 0 when it is above, as in the example below.  This is very simple and you would be tempted to do it as in the Figure below.

G1.jpg

However, this is not a very good idea since either 1 or 0 will be written to the PI Tag every time this expression is triggered regardless what the previous value was.  This comes to bite you when you are using other expressions or notifications that use this PI Tag for the natural trigger for evaluation.  Now all these expressions evaluate many more time than they need to, resulting much more resources than they need to and much slower backfilling (also, it will be slower when trending the resulting Attribute).  What we really want is to only write a 1 if the previous value was 0, and a 0 if the previous value was a 1.  So this is where the NoOutput() function comes in very handy.  Figure below shows how to rewrite the above expression.

G2.jpg

Outcomes