OSIsoft: Create/edit Element Templates. v2010


Uploaded by OSIsoftLearning on 10.05.2011

Transcript:

AF supports
creating templates that you can then use to create
Elements that are based on that template.
And, so let's take a look at some existing
templates. I'm going to go ahead and leave the database we've been
working on lately, go over to this Training Sample
that we use a lot in training.
And, if you look through this Training Sample, if you were to do a
Search, a quick one of our Advanced Searches through this,
you'll notice one of the things that you can Search for
is you can search for things by the template that they're
based on. So, for example, if I look for Chemical Tank,
I can find that there are, are
large number of Chemical Tank based Elements
here. These, these are all based on the Template called
Chemical Tank, and that's because at some point
I sat down and I defined, well, what is it that I would
need in a Chemical Tank? What Attributes would I
need? A Lever, Level, a Temperature, maybe
Strapping Table Calculations -- all those types of things I built
into the Template, and then when I needed to build the
Elements, I built the Elements from that Template.
Same for this Flow Meter or Heat Exchanger.
If I go out and search for all the Heat Exchangers,
there are a lot of different Heat Exchangers
in my entire database here
and they're all based on that one Heat Exchanger
Type. So, and, I can drill down through here and, and
find them this way as well. Well, anyway,
the point of this section is to discuss these
templates. Why would you want to build a template? And, you know,
if you're a developer, if you're a C-Sharp guy, or
you've worked with a lot of object-oriented
programming languages, the, the concept of
templates is a no-brainer. I mean, it's defining a class
and from, once you have a class to find you instantiate objects of
that class, etc., etc. But, to be honest, if you're not
a developer, it's not really that obvious
what a, what we mean by a template.
I like the analogy that Microsoft uses. Microsoft
says, hey, you know, if you're not, if you haven't been programming for the last
ten years, this is, this is, might be a brand new
topic, but, here's a, here's something you may be familiar with. You're familiar
with cookie cutters. You know, I'm going to go out and want to make a bunch of
cookies that are shaped like apples. No problem. I just create a
cookie cutter that's shaped like an apple, and then I just go
ahead and stamp, or instantiate,
a cookie from that, from that cookie cutter.
I go ahead and stamp this six times, I have six cookies that are shaped like
apples. Same for this Mix Tank here
that's suspiciously shaped like a deer.
Anyway, this, these different templates or,
you know, that's what they are basically; a cookie cutter
is a template, is used to create objects of the same
type. And, of course, it has all the same Attributes.
For example, this Mix Tank has a nose,
two little ears, and a little furry tail. So, any Element
you create from that template will have those same specific
Attributes. All of these things have specific Attributes.
This has four leave. You know, this has little leaves at the
top. This has wheels at the bottom. Those are the Attributes
of that template. And,
that's what we do with AF. You create a template.
That template has specific
Attributes, and then, as you stamp these
events, or these Elements out of these templates, you
create Elements that have all the same Attributes.
So, let's take a look at where this is done. It's actually done in
the Library Section. So, if we take a look at
our, our Collection of Templates,
we'll see among them is the Element Templates
Collection, and from there I can
find this Chemical Tank. And, as you can see, the Chemical
Tank has a variety of different
Attributes, all the different Attributes that you would
associate with a Chemical Tank. It's got an Inside Temperature Level,
Outside Temp, Product, etc. So,
every single Element I build based off of this
Element Template is going to have all
these things. Now, when you're creating
templates, there are issues as to, you know, what
do you pre-define in advance,
so that every single
Element that's created from that template has those Attributes,
and what do you leave to define later when you're actually create
the Element, when you stamp the Element
out of the Element Template? And we'll discuss that as
we get into, you know, making those choices.
Now one of the first questions you'd ask yourself is,
do, do I really need a, a, an AF Systems that's got
templates? Can I just create Elements one at a time?
It's a good question, and if you are not
creating Elements that are similar in any way,
if you never have a situation in which you're going to build more
than one Element that look pretty much the
same as another Element, then you probably don't
need Element Templates. Now, if you take a look
at this Houston
area here. I look at our Tanks. We've got two Tanks
established in Houston, and then, in addition,
whoever is setting up AF here, he's also
got Montreal and San Leandro, and
these different places also have Tanks.
In this case, he's definitely going to, at some
point, need to define what
a Tank looks like. And, as you can see, in this case
the Tanks that are defined consistently
with these Elements, they have the same Attributes
in Montreal vs San Leandro vs
Houston. They're all built off of the same
Element Template. So, if you don't have a
situation like that, then you might be able to get away without
using Element Templates. But, its just, it's going to save you some time
if you, if you do have more than one
Element that you would base on that template. It's
going to save you time to create a template. The other
big advantage of this, of course, is that you've got
consistent definition from one
Element to the other. So, if they're all based
on an Element Template, you know, whether
you're in Montreal, whether in Houston or San Leandro, you're
always going to have the same Attributes.
Now, I'll just, I'm going to tell you a brief
aside here. We've seen over the years how
systems, as they grow, if they don't have
some kind of a templetizing methodology,
if they're not using Element Templates or doing some
procedure to try to uni...make uniform
representations of their equipment, then what you
end up finding is, you know, some areas,
well, they define a Tank one way and within that
definition they've got some nice little calculations that they use a great deal.
They build these reports off these calculations,
and, hey, great, you know great for the Houston guys. They've got this wonderful
representation. You know the guys up in Montreal, however, they
may have a different set of Attributes, and
they may not have all the calculations. Their reports
don't look the same as the guys in Houston.
And, if they ever try to take the guys,
the Houston reports, and say hey, that looks good. Let's
use those. First thing they find out is there's a lot of things
in the Definitions in Houston that they don't have
in Montreal. So, they can't really use that same Report Format.
So, you know, that, the, the attempt to be
consistent throughout your organization is really what
drives the, the concept of using templates.
So, you know, it's not just,
it's not just an extra feature, you know, looking for somebody
willing to use it. It's actually a problem that will
crop up in a system over time, and
this is the solution to that problem. You base things on
templates so that, as time goes on, you can be
consistent. And, of course, one of the beautiful things about these templates is
if I decide, after two years of working with this,
that we need to extend this template so that it's got
more Attributes, well, that's no problem.
Just change the Element Template and all the
Elements that are built on that Element Template will get those
updates. So, if you add three new Attributes to the Template,
you'll find those three new Attributes in
Houston, in Montreal, and in San Leandro. They'll show up
in all of these, you know, all of these different
Tanks that are, that have been built for years,
based on that template. Now, let me return back to
our Library to take a look at these Element Templates again.
, these Element Templates they can be something that's as specific
as a template for a specific Tank from a,
a manufacturer or Reactor from a specific
manufacturer, or it could be something that's more generic in
nature. So there's no hard and fast rule of thumb
as to, you know, what the scope of your template is.
It could be something generic; it could be something specific.
It's whatever helps you to scale up
and do it consistently. So, we're going to create
these templates in this Library
Option. So, down here in the
Navigator Pane we've been mostly working
with Elements. Now we're going to shift. We're going to take a look at
Library and start working with Templates. I'll switch back over
to the database that we've been working with so far.
That was the one called OSIsoft Plant. You'll notice
that in the Navigator Pane, if we look at
that Navigator Pane, then go up to the Browser Pane, we can
see this is where we've been working so far. We're going to make
a switch. We're going to now go through the Navigator Pane.
We're going to choose Library. In the Browser
we'll see that there are no Element Templates that have been defined.
So, how do you create Element Templates?
Well, as you might guess, you select the Collection, do a right click, and choose
New Template. I believe you can also
do it from here, as well. I'll go ahead and choose New Template.
And this is where you would define that Element Template.
Now let me go ahead and cancel out of that.
I'll do a right click. I'll do New Template.
And, here's my Template.
I'll go into General and specify the Name of the Template.
So, if this is going to -- I"m just going to call this my Tank,
and I'll press Return.
I can check this in. And, what I've accomplished
here is next to nothing because I've got a template
that has no Attributes. I mean it's
like a cookie cutter that's just round. I mean, great, it'll
stamp a cookie but there's nothing unique about it, nothing
that distinguishes that from anything else. So,
, this, at this point this Element
Template's kind of useless. The next thing to do is to
add these Attribute Templates, and
it's roughly analogous to an Element has Attributes.
Well, an Element Template, Template has
Attribute Templates, and we'll got to those next.
One last point that really ought to be made,
especially for those of you who look at this and say, hold on a second.
What about that work that we just did with the Elements? Did we,
do we have no way of taking advantage of that? Well,
actually, there's some good news in that, in that regard.
If you go out to the Elements that are already defined,
like this wonderful Mixing Tank that we already defined.
It's got all these nice Attributes, it's got
calculations, it's got references to PI Tags, etc. Well,
what I can do with a right click here,
there's an Option here to say let's convert this to a Template.
I can use this as a way to convert,
or create, an Element Template based on
that Element that already exists. I'll go ahead and check that
in. If I go down to the Library --
there we go. Here's our Mixing Tank Template.
As you can see it's got all of the Attributes that we had before.
Now, the one problem that we have with this is
these have hard-coded references in them.
So, right now, you know, everything's got specific
Default Values. The Mixer's,
excuse me, these different References -- the PI Point
References -- they're pointing to specific
PI Tags, and, of course, you don't necessarily
want that when you're creating New Elements
from a template. You may want those to be either
left undefined or left blank,
or using some algorithm to specify
a PI Tag Name based on the name of the
Element or the name of the Server and the Element
together, which is all the things that we're going to discuss
later on. So there's some conventions that you can use
with these Element Templates to more or less
avoid the hard-coded Tag Names like what you see right here.
But the point I wanted to make is, as you can see, it's very,
very simple to exploit the earlier work that you've done
by just doing a right click and converting
that existing Element to an Element Template.