Create the same triggers for Notifications and Event Frames
If you would like create Notifications when certain conditions are met, it is also a good idea to create Event Frames for the same condition. The reason is that the Event Frames provide a history of the Notifications for easier reporting, and other scenarios like creating Pareto charts and BI analysis. In addition, Event Frames give us the duration of the event in question, which you cannot get from the Notifications. The best approach is to use an expression in Analytics to write results to a PI Tag that is used as the trigger for the Notifications and Event Frames. The example below shows how to set up Notifications and Event Frames for uptime/downtime of pumps. This example also shows a very good use of the NoOutput() function.
(Note: for the upcoming PI AF 2.8.5 release in Q4 2016, Notifications will become an extension to Event Frames, so using the outlined approach below will not be need.)
In this example, we will create events and notifications when a pump stops and then when it turns on again. The first thing is to create the Event Frame Templates and the Notification Templates. You should create separate ones because you will want different Attributes and different content for the two different pump conditions, as well as ability to assign different names to the notifications and events.
The Pump Running template has the Attribute FlowRate in addition to what the Pump Stopped template has.
The Figures below show the triggering for the two Notification templates Pump Off Status and Pump On Status.
The next thing to do is to create the trigger that will trigger the events and notifications for all pumps based on the templates we set up above. So for the Pump Template create an Expression to write the value of On or Off to the Pump Status attribute depending on whether the flow rate is greater than 0.
(Note: the use of the NoOutput() function, so that we only write a value to the Pump Status when the condition has changes. This will make our event and notification generation much more efficient.)
The last thing to do is to create Event Frame Generation expressions to create the pump running and stopped events. The expressions are now very simple just checking the Pump Status value, and Bob’s your uncle.