Run analyses in the context event frames (EF)
As a user of asset analytics I would like to have an analysis run on event frame while the event frame is opened / in progress so that I can perfrom real time calculations in the event frame context.
This is in PI Server 2017 R2, available now on https://techsupport.osisoft.com/
Thomas Bernier commented
I´m updating the workaround link :
Hi, yes we have two other backlog items related to this. One is to allow an expression to run when the event frame first opens and the other one is to allow an expression to run while the event frame is open.
For the first one, an example use case is to capture info from Batch operations into attributes.
For the 2nd one, an example use case is to allow users to do comparisons with golden batch while the event frame is open.
These are of course just examples, there are many other use cases.
There is a separate UserVoice suggestion on creating child event frames.
Good to hear that you start implementing this use case, but why only when the eventframe is closing. Then it will still not possible to create child eventframes with a proper relation to the parent eventframe. Will this be still on the roadmap
Another example: how long was something running during this shift?
Shift = EF
How long would use TimeEq analysis expression.
To achieve this currently is quite tricky.
In response to Stephen Kwan, "Understood. As a workaround, maybe you..."
Yes, you could. But that does require keeping this together. To get the value into the EF, you would need to trigger an analysis on the start trigger conditions to save it on the EF start time, and pull it into the EF based on the EF starttime. Or some similar approach.
Understood. As a workaround, maybe you can consider having 1 expression analysis to write to the attribute and 1 EF analysis to create the EF.
My specific case is that i have a number of KPI calculations that result in a status: Normal, Warning or Critical. For every Warning or Critical i need to create an Event Frame. The triggers are simple, start when warning or critical, end when normal.
However, in the EventFrame i want to collect e.g. the name of the KPI calculation, or the StdDev of the associated process value. To do that i need one EF template for each instance. If i could set the value from the analysis evaluation at the start (or end) of the EF, i could simply write this value to an AF attribute and need only 1 EF template for all instances. The templates are identical, only the data mapping between the EF template and the source data varies and the Analysis triggers and as i suggested the other analysis expressions i could evaluate at that time could map the data into the EF too.
Why cannot i use Element Templates? I have a lots of units, and they are all different. But on all units i have one or more KPI calculations. I need to have the EF linked to the Unit (Primary referenced element) to be able to use functions in e,g, PI Vision.
Jim Gavigan commented
I would like to understand too. I am thinking of a way you could do things if I am thinking correctly, as I have a similar use case. I am looking at where a downtime event is occurring, but I get the location via a digital set in a PI tag. I would get something like "running" or "location 1 down," "location 2 down," etc. So, I could make my EF trigger equal to NOT "running" and in my EF template, grab the location state at the start of the EF for analysis later (I could filter based on location 1, 2, etc.). Not sure if that is exactly what you are looking for though.
Can I get your use case example for EF start?
Currently you can save the start trigger name or expression in an EF attribute.
I want to create a variable on the EF analysis and save the output of that to an EF attribute.
Use case: i have 10 different places where a downtime can occur on a machine (=1 Element). The only difference is the trigger conditions. Currently if i want to know which item is causing the downtime, i need to create 10 EF templates to capture this information. But if i create a simple analysis to determine the downtime location, i can use 1 EF template and re-use that in 10 Analysis. Each analysis setting the downtime location based on the analysis expression.
I would see this as an addition to the variable option we currently have on the EF Analysis: be able to map each variable to an EF attribute. Resolved and saved on EF start.
We could go further and allow configuration when to resolve this analysis: at EF start, at each trigger received, or at EF close.
Nicolas Isambourg commented
Dear Mr Stephen Kwan,
I need to calculate attribute values between starttime and entime of Event Frames and their children when Event Frames has finished.
I created the "Recuit" and "StepRecuit" EF templates.
The Event Frames are generated by PI EF GEN.
A "Recuit" is composed of 5 "StepRecuit".
Root : Parent EF based on the "Recuit" template
|_ Step 1 - CH1 : Child EF based on the "StepRecuit" template
|_ Step 2 -PI : Child EF based on the "StepRecuit" template
|_ Step 3 -CH2 : Child EF based on the "StepRecuit" template
|_ Step 4 -MHT : Child EF based on the "StepRecuit" template
|_ Step 5 -Ref : Child EF based on the "StepRecuit" template
The recuit template has the following attributes:
|_ Timestamp TB_150 => Timestamp when the "Temperature Zone Basse" attribute value is equal to the setpoint temperature of the 2nd step (150°C) for the first time from the starting of the step
|_ Timestamp TH_150 => Timestamp when the "Temperature Zone Haute" attribute value is equal to the setpoint temperature of the 2nd step (150°C) for the first time from the starting of the step
|_ Temperature Zone Sole at Min(TB_150,TH_150)
|_ Temperature Zone Secu at Min(TB_150,TH_150)
|_ Temperature Zone Sole at end of the 2nd Step
|_ Timestamp TB_385 => Timestamp when the "Temperature Zone Basse" attribute value is equal to the setpoint temperature of the 4th step (385°C) for the first time from the starting of the step
|_ Timestamp TH_385 => Timestamp when the "Temperature Zone Haute" attribute value is equal to the setpoint temperature of the 4th step (385°C) for the first time from the starting of the step
|_ Temperature Zone Sole at Min(TB_385,TH_385)
|_ Temperature Zone Secu at Min(TB_385,TH_385)
|_ Timestamp TB_210 => Timestamp when the "Temperature Zone Basse" attribute value is equal to 210°C during the 3rd step
|_ Timestamp TH_210 => Timestamp when the "Temperature Zone Haute" attribute value is equal to 210°C during the 3rd step
|_ Timestamp TB_145 => Timestamp when the "Temperature Zone Basse" attribute value is equal to 145°C during the 5th step
|_ Timestamp TH_145 => Timestamp when the "Temperature Zone Haute" attribute value is equal to 145°C during the 5th step
As I cannot use Analyses and Performance Equation to do it because of restriction on PI Event Frames, I had to develop a .NET application which uses performance equation like for example:
Timestamp TB_150 := FindEq('Temperature Zone Basse', %starttime%,%endtime%,150)
Timestamp TH_150 := FindEq('Temperature Zone Haute', %starttime%,%endtime%,150)
Mini_Timestamp := Min(Timestamp TB_150,Timestamp TH_150)
Temperature Zone Sole at Min(TB_150,TH_150) := TagVal('Temperature Zone Sole, Mini_Timestamp)
Temperature Zone Secu at Min(TB_150,TH_150) := TagVal('Temperature Zone Secu, Mini_Timestamp)
Temperature Zone Sole at end of the 2nd Step := TagVal('Temperature Zone Sole, %endtime%)
It would be so much easier if I could run PI Analyses in the context event frames.
I need analyses within the event frame template because it would be a good way to keep the calculations consistent with each event.
The analyses would use the same PE as I use in my .NET app.
To my mind, this feature is important to make PI Event Frame an interesting tool.
The use case we can think of:
-Advanced calculation based on attributes which can't be done with the Formula data reference. For instance calculating the average of an attribute when an other attribute is below or above a setpoint (defined in an attribute).
-creation of child event frames. A batch process mostly exists of more sub events. These sub events are related to its parent event. So the triggers for creating sub events should be running when the parent eventframe is active. When a child eventframe is created it should have a relation with its parent.
When the parent eventframe is closed, also the child eventframes should be closed (or the parent can not be closed till all child events are closed).
Amos Hall commented
An immediate use case that I have would be the ability to run an analysis at the close of the event frame with the event frame context accessible.
EF was created by Pump Pressure exceeding 1000 psi
EF was closed by Pump Pressure falling below 800 psi
*** Calculate how long Tank Temperature was greater than 100 F in the context of the Event Frame (TimeGE type functionality)
What would be even more cool is the ability to also define Filter Expressions for Aggregate functions! For instance: Calculate the Average tank temperature for values ONLY when 'Pump Pressure' > 1100 psi.... also in the context of the event frame.
I can do some of this now but I have TONs of intermediate tags that I'm saving duplicate data for that seems like a waste. It'd be awesome to calculate metrics within the event frame with no intermediate tags!
Benjamin Cassani commented
This discussion is really beneficial I think on this feature.
Ability to do summing and calculations on batches of events.
I'd had to talk to engineers more. They've mentioned they'd like to have the ability to calculate based off events themselves. Say over a time period of a month or a week.
We have an AF tree with a series of elements (all of them have a pressure transmitter value as an attribute) all based on the same template. We then create temporary "clusters" of elements (e.g. bind two elements into a cluster, one being the master and the other the associated element) and want to calculate the differential pressure between the master and the associated element.
The calculations cannot be performed directly in the AF tree, because the clustering is random. Only the event frame contains the clustering information and knows which elements are temporarily bound together.
The simplest example i can think of is a more complex batch yield calculation i has to make. Now i need to define the analysis on an Element and pull in the value to the EventFrame. I use other properties on the EventFrame (like e.g. batch start) so i need to duplicate my business rules to detect batch starts etc. and store them in an Element attribute too.
Keeping the definition of the analysis closed to where it runs and where the data is needed to avoind duplication of logic, or stacks of intermediate calculations used for multiple purposes.
To add, Analysis would also need be be able to run at the end of the EventFrame. (even more than start or during).
At the moment Analysis are only possible on attributes of an element. It should be very useful if analysis are also available for an eventframe. In that case it become possible to do calculation in te context of an eventframe and create eventframes that are childs of the eventframe. The analysis is only running between start and stop of the eventframe.