Templates

This article provides general information about templates in P2 Server. For instructions on how to create templates, see:  Creating Templates and Attributes.

A template in P2 Server is a way of defining the characteristics (attributes) of an entity, where an entity is a real world object (such as a pump) or a conceptual object (such as an area).

For example, an organisation may have a number of wells. Some wells produce oil while other wells produce gas. Instinctively, we can understand that oil producing wells share a number of characteristics that we want to model, whereas gas producing wells have a different set of characteristics that we care about.

The grouping of characteristics of a well is called a “template”. In the above example, we have an Oil Producing Well Template and a Gas Producing Well Template.

Related: Entities

Blog_RunTicketsTemplates are a useful tool to help us model what each entity (e.g. well, field, pump) is in the real world. When we assign a template to all of the entities in the system that are of that type, we now have a very robust way of searching for, or processing information about all of the entities of that type. For example, in P2 Sentinel we can easily set up a monitor to scan the entire hierarchy, and monitor the Tubing Head Pressure of all Oil Producing Wells. As wells are added and removed over time, these are automatically added or removed from the items to be monitored. This is one of the more compelling advantages of modelling your entities with templates – you can configure 1 Sentinel monitor and you can watch all 5000 of your wells!

All entities that are assigned a template take on the attributes of that template. For example, all Oil Producing Well templates will have attributes like Tubing Head Pressure, Tubing Head Temperature, and Choke Position; whereas Water Injection Wells might have Injection Pressure, Annulus Pressure, and Water Flowrate.

Related: Attributes

Consider this example:

For a typical site with 50,000-500,000 tags that all look like "AAOW04PS2.PV", it quickly becomes very difficult find the data you want. To get a complete picture of a well from a historian you would need a list of 50 such tags. If you wanted to build a reporting display for each of the 1000 wells, this quickly becomes unmanageable. Templates allow you to more easily map and model the data coming from these wells by identifying points of commonality and allowing data values to be swapped in and out of those touchpoints, depending on the entity being looked at.

Here is a simplified example of an asset model with templates and attributes:

Template Attributes

Oil Producing Well

  • Tubing Head Pressure
  • Casing Pressure
  • Choke Position

Water Injection Well

  • Injection Pressure
  • Water Flowrate

Gas Producing Well

  • Gas Flowrate
  • Gas Production
  • Choke Position

Note that in common usage the meaning of template may change, depending on our frame of reference:

  • When we are generally talking about a template, then we are normally referring to the template definition.
  • When we talk about a template in reference to a particular entity, then we are normally referring to the template instance.

Let’s get a bit more technical and look at how templates are structured.  

Template Group

Templates can be grouped into template groups. These are simply a nice way of organising all of the templates that you use into useful groups, so that your system administrators don’t end up with a single long list of 50 templates.

Related: Creating Template Groups

In the example above, we have 3 templates that describe different types of wells. But in a large organisation, you might also have templates that describe measuring equipment, for example. So you would then have 2 template groups: Wells and Metering Equipment.

You can have as many template groups as required. Template Groups are mainly used for display purposes in P2 Server Management.

Here is an example of a set of template groups and what they represent:

Name Description
Corporate Objects Templates that represent the different areas, regions etc
Metering Equipment Templates that represent the different types of measuring equipment
Wells Templates that represent the different well types

 

Template Definition

A template definition defines the template and the group it belongs to, as well as the attributes that are assigned to these templates. When you create a template in P2 Server Management, you are creating a template definition. The template definition is where you can add new attributes to a template, as well as specify which template group it belongs to.

Related: Creating Templates and Attributes

Example of a template definition for a pump, in P2 Server Management (Server 4.5)

 

Template Instance

When you assign a template to entities in the system, the entities can be modelled with a set of attributes that are mapped to tags so that you can get data.

Templates are assigned to an entity for a period of time, and an entity can have multiple templates assigned to it over its lifetime. For example, Hunter may now be an oil producing well, but in the future once it has stopped producing oil, it may be converted into a water injection well. The system stores the time of this transition so it knows the period of time in the past where it was an Oil Producer and when it became a Water Injector.

When a template is assigned to an entity for a period of time, this is known as a template instance.

Related: Configuring Entities

ServicesLet’s digress a little into something a bit more technical. P2 Server supports a Primary Template, this being the one that defines its primary use, or its type. The system also supports what is known as Secondary Templates. These secondary templates are used to store information that may not need to be presented to end users in P2 Explorer visualisations.

Many P2 systems make use of secondary templates to “mark” entities for special purposes. They are also commonly used to store IDs to other systems, to allow back-end processes to map entities from one system to another. It is important to note that Secondary Templates are generally used for background processing only.

So, no matter how many templates are assigned to an entity, only one template can ever be the Primary Template for a defined time period. The Primary Template is important because this determines the type of the entity (i.e. a Well) and therefore (depending on Link Behaviour and Visibility configuration settings) the attributes that appear in the user interface of consuming applications, such as the trend in P2 Explorer.

For example, before 2019 the Hunter well will have attributes that relate to an oil producing well (e.g. Oil Production). After 2019, Hunter will change to a water injection well and the attributes that we are interested in will be different (e.g. Water Consumption). For this example, its configuration would look like this:

Entity Template Definition Template Start Time Template End Time Primary Start Time Primary End Time
Hunter Oil Producing Well Null Null Null 2019-12-31 at 16:00:00
Hunter Water Injection Well Null Null 2019-12-31 at 16:00:01 Null

Note that a Start Time or End Time of NULL indicates that the template applies for all of time, which would be the most common start and end times in the system for templates. Items would normally only have a primary start or primary end time when an entity transitions from one type to another, such as from an Oil Producer to a Water Injector.

 

Comments are closed