In this video I’ll show you how to set up an event frame template. Event frame templates are necessary to be able to create events through the event frames generation analysis. Let’s start off with first, what is an event frame? Event frames allow you to capture important events in your process, and then collect the relevant information to help understand why they occurred. As an example here I am looking at the production rate for a particular piece of equipment, and I can see that the production rate went all the way down to zero for this particular time period. With event frames I can capture information on the start time, the end time, the duration, and I can also capture other relevant information that I choose. For instance, what was the downtime cause and how did it impact the total production rate for that particular line. Event frames can also be used to track other types of events in your data, things like production phases, start ups, shutdowns, operator shifts and other excursions. Let’s walk through the steps to create an event frame template for monitoring equipment downtime. Here I’m looking at an AF database in PI System Explorer, and you can see that there’s various pieces of equipment, such as the one that we’re looking at, and each piece of equipment has a status attribute, which will indicate whether or not it’s running or if it’s experiencing a downtime event. And this is the type of information that I want to be able to track for each piece of equipment. And you’ll notice that each piece of equipment is part of a production line. In order to create this template I’ll go to Library and select the event frame templates tab, and from there I’ll choose new template. The event frame template specifies which attributes to capture for an event, while the triggering of an event frame, basically what defines the start and end of the event, can be done with the event frame generation analysis, which is shown in a subsequent video. However, before you can set up that type of analysis you need an event frame template, which is why we’re starting right here. I’ll go ahead and click new template. The first thing I’ll do is I will give the event frame template a name and a description to help keep track of things. I’ll then hit okay; and I’ll double click on this to open it up. The attributes I want captured in an event frame will need to be defined under the attribute templates; so I’ll go ahead and click new attribute template. Let’s talk about what things we want to capture in this particular event frame. The first thing is, what is the status, which was whether or not that piece of equipment is running. So I’m going to name this attribute status; I’ll give it a description as well. To keep things organized I try to always use categories and the status is an availability metric so I’ll use that category. You can use this new category button to create your own categories to help keep things organized and easy to search for. And the status does not have a default unit of measure because it’s a string, and for the value type, since the status attribute was actually set up with a enumeration set to describe the running and downtime, I’ll choose that. In this case I’m just matching it with my AF attributes value type. For the data reference I’ll select PI point. And then I’ll configure it using the settings right here. Now, the PI point data reference, you can set it up to directly reference a PI tag, or an AF attribute. In this case the status is an AF attribute, so I want to use this option. However if I use the drop down you’ll see there’s nothing listed. And that’s because there are no AF attributes in this event frame template. The status attribute is actually in the element rather than the event frame template. And in order to reference the element we’ll need to use a particular syntax that I’ll type in here. Okay. Let me break this down. The dot back slash elements, open square bracket dot close square bracket, returns the primary referenced element. The primary referenced element is essentially the asset that is linked to the event. In this example it is the piece of equipment experiencing a downtime that the event will be generated for. And then the pipe status indicates to give us the value of the attribute that has the name of status that’s under that primary referenced element. We’ll leave the retrieval methods by time as automatic, but we’re going to make a change to this by a time range. Currently the selection is end time, which means this attribute will be evaluated at the end of event frame. However the event frame will be triggered when the status attribute goes into a downtime. We want to make sure that this attribute is evaluated at the start of the event frame rather than the end, where it might have switched back to be in a running state. So I’ll choose start time here and hit okay. The next piece of information that I’m interested in capturing in the event frame is the reason for the downtime event. And there’s another equipment AF attribute that describes the fault code, and that’s what I need to put in event frame next. So I’ll do a right click, new attribute template, and this one is fault code, and I’ll give it a description as well. For categories I’m going to label this as a downtime event category. The default unit of measure will be none because it’s a string, and because it’s a string and the way it was set up is with an enumeration set, I’ll make that choice for the value type. Again, matching that of the AF attribute of the element itself. For the data reference I’ll again choose PI point and click on settings. This is an attribute, and we’ll use the same syntax as before to pull the fault code from the primary reference element. And I’ll also change the PI time range to the start time, since I want the fault code to be evaluated at the beginning of the event frame as well. I also want to capture the duration of the downtime event, so I’ll do a new attribute template with a right click, and this will be described as a downtime event. For my category and for unit of measure I’m interested in the duration being reported in minutes, so I’ll choose that unit of measure. And I’ll have this reported as a double, and I’ll again choose PI point and settings. Acquiring the duration of an event frame is a little bit different because there’s no attribute that describes the duration itself. However there’s a special way that you can use the attribute and the value retrieval methods to get the duration. First you’ll still need to pick an attribute, even though there isn’t a specific duration attribute, and you can just pick any attribute from the reference element. To make things easy I’ll use the status attribute again for my reference, and there are specific value retrieval methods that are needed. First, for the by time, we’ll have to change that option to not supported; and then second we’ll need to choose the by time range to be reported as a count. And just one thing you might have noticed, is this will present the source units as seconds, but we know that how we selected our default unit of measure was minutes based on how we want that attribute to look. And that’s fine because AF will do that unit conversion. You can go ahead and hit okay. The final attribute that I’m interested in capturing in this event frame is how does this downtime affect the production for the line that this piece of equipment is in. If you remember, looking back under elements, there are several pieces of equipment in a line, and we want to know how is this affecting the line’s production. And you can see that the line also has a particular production rate attribute, which is what we’ll be pulling in the event frame. Let’s navigate back to our template and look at how to do that. I’ll do a new attribute template for the average production rate of the parent line for each equipment piece, and I’ll give it a description. I’ll select the performance category and appropriate unit of measure; this will be a count, I’ll leave my value type as double, and I’ll change the data reference to PI Point and hit settings. This is an attribute but this is not an attribute that’s within the primary reference element, that element that corresponds to the asset that’s going through that downtime event; this is actually in the parent of that element. So in order to navigate up we’re going to use this type of syntax. We’re going to use a backslash, two dots, and then another backslash, before doing the | for production rate- the name of the attribute. Another thing is that we’re interested in the average production rate over the event time period. So before, for the time range we’ve been looking at evaluating attributes at the start time. In this case we’ll use the by time range to calculate what the average would be. And now I’ll hit okay. At this point I’m going to check in my changes, and after I have created an event frame template I like to create a test event frame to make sure that all my values are coming through appropriately. In order to create the test event frame I’m going to navigate down here to the event frames tab and I’m going to click on new event frame. And I will use the downtime event frame template that we just created and hit okay. Right now it’s just using the current time for the start time and it doesn’t have an end time. I’ll need to choose an element for this to reference, so I’m going to switch to the referenced elements, and when selecting my reference element I can pick any element, but in order to get a good idea of what the values would look like during a downtime I happen to have gotten some inside information that our Cleveland facility in line three, there’s a problem right now going on with P199, so I’m going to take a look at that, and hit okay. And then I’m going to switch over here to the attributes tab to see how things look. Okay. And I can see that I have values for all of my attributes, that indeed there is a downtime going on due to a components jam, and as a result my average line production is 37 count, which is below the 40 count that is our production target. So everything looks good with my event frame template, so I’m going to go ahead and cancel that. At this point I am now ready to apply this template to all the pieces of equipment with a trigger condition for generating downtime events. In order to do that I will set up event frames generation analysis, which is shown in the next video.