Tip:
Highlight text to annotate it
X
Well the objective now, now that we've created an Element
Template, is to add some Attribute Templates to this Element
Template to make it useful. I mean right now
we've go an Element Template called my Tank, no Attributes.
So, why, I mean,why would we bother to do this?
Well, you know, at this point you, you can't really use
this for anything, so without Attributes
an Element Template's kind of useless. And, you're going to be asked to do this
later on in an exercise. You're going to be creating an Element Template and adding
Attributes to it. So, in, in order
to do this what you do is simply go into the Attribute Templates
Section, do a right click on it, and create
a New Attribute Template. So, the Attribute Templates are
roughly analogous to this, this Simple Attributes that we did before.
So, for example, before we had in a Tank, we had
a Diameter and so that's what I'd like to add here.
This Diameter. I'll specify what the Unit of
Measure's going to be.
This is going to be in Length. We're going to measure this
in Meters. And we can give this a Default Value
if you want or just leave it alone. And the Data Reference
is going to be -- in this case we're just going to be adding this as a
Constant, so no Data Reference there. And that becomes
now part of my, my Element
Template once I've defined that. Now,
if I were to go out and build Elements based
on this Element Template I would have a Diameter.
And let me show you the Before and After here.
I'll go back to my Plant here
with my Tanks, and let's add a brand new
Tank. We've got Mixing Tank, Storage Tank.
Let's just do Mixing Tank 2.
I'll choose a brand new element.
This time it's going to be built on a Template. This is the first time we've
done it like this, and I'm going to call it
Mixing Tank 2.
So you can see it picked up the name of the Element Template.
[typing]
But look at, look at what was produced on there.
When we look at the List of Attributes,
it's got the Attribute that we had defined in the Element Template.
I, if I
go back into this Element Template, and if I make
changes to the Template, you'll notice that is a change that will
propagate through all of the Elements that are built on that. So,
if at this point, I decide, well, I, I forgot to add
the Height -- so let's go ahead and Height to this.
We'll do a Height, we'll
say that this Height is also measured in Length,
in Meters,
and we'll have no Default Values. And once I've checked that in
watch what happens back at our Element that I just
created. Here's our Mixing Tank 2.
If I refresh my screen,
you'll notice that now that Height,
its' been added as a new Element,
or Attribute Template, to the Element Template that is
propagating forward to all the Elements built on that. So, that's something
to keep in mind. It's a nice powerful feature but it
does mean that making one change to an Element Template
may end up changing hundreds and
hundreds of Elements. So, keep that in mind as you're working with
this. Another issue
to keep in mind is to try to decide,
beforehand, which of the Attributes
you're going to specify are part of this
Element Template, and which Attributes you may want
to allow people to add on their own, individually,
after they create the Element itself. So,
if you are going to allow people to
extend the Elements that are based on an Element
Template, you do have to choose this Allow
Extensions. Allowing Extensions will allow people
to add new Attributes to an Element that's
already, that's based on that Element Template.
Just a bit of a warning. It's currently not possible
to add Child Elements
to an existing Element that's defined in
the Element Template. That's one Extension that's not
allowed, adding Child Elements to an existing
Element, or an existing Attribute,
that was created by default when you created
that Element. So, you can create
new Attributes but not new Child Attributes
of an existing Attribute in the Element Template.
So that's one restriction on allowing Extensions to
keep in mind. Okay. So, how do you go about checking,
making sure this is all working? Well, one of the things I could do,
now that I've chosen Allow Extensions and I've got
a couple of Attributes here -- again, if I just go
out back to the Elements here, and add a brand new Element --
let's go ahead and put this right
underneath here, or right at the same Level there.
I'll go ahead and choose a New Element.
If I base that on my mytank,
again, it picks up the
Name mytank and it just adds an increment to it.
If we look at the Attributes, those are the
Attributes that we had. And, then, at this point,
I can add New Attributes. I'm just going to,
I'm just going to go ahead and call this Test. Now see, that is
allowed because I did allow Extensions
on the Element Template that I, that this is based on.
So, the Element Template called mytank does allow Extensions.
That's why I was allowed to add that. So, if I
check this in, this double che...this double checks
and verifies that everything seems to be working correctly with this Element
Template. Now, one of the things that Element Template
supports is the idea of a Base
Template. So, if you go back and take a look
at the General Setting here, on this,
notice there's an Option here to create a Base Template. The Base
Template in...implements the kind of
inheritance that is required sometimes when you
have a -- let's say you've got a Base
Tank that has six Attributes, but
then you have another Type of Tank that adds an extra two
Attributes. Well, you can have the Base,
that Base Tank, be the Base Template for
the, the more specific Template that adds those
two Attributes. Let me show you an example of that.
And that, that new, that next, or the more
specific Element Template only needs to add
what's not in the Base Template. I'll show
you an example of that. If I go out to my Training Examples
here, let me take a look at our Element Templates
Collection. You'll notice we have these
two very similar Element Templates, this Power
Distribution Measurement, and
it's got these Attributes right here. We also have that With
Status. The With Status, it seems like
it only has one Attribute, but if we take a look at its
General Description here, you notice
it uses as its Base Template the Power Dist...
Mesh...Measurement. Now that indicates that anything I
build using that structure there is going
to pick up, not only that
one Value there, the Status Value, but also all of
these as well. And I can verify that by
going back and taking a look at the,
at the Elements. If I take a look at the Elements
and do a quick Search -- let me go ahead and do an Advanced Search
here. And, if
I take a look at the -- , all of
those that have the Power Dist...Measurement With
Status -- let me find those.
This looks good. Let me just go ahead and select all of them.
These are going to show up now in my Search Results. If we take a
look at these, as you can see,
the List of Attributes includes
all of those Attributes we saw before plus this one
called Status. So, that's because
it's based on this, this
Template, and that Template has a Base Template
that is, that includes these,
this large number of Attributes right here.
Now, if you'd like to double-check what those, what type
of Inheritances you've already got set up, one of
the Options you can do within PI System
Explorer is, as you're looking at your Templates Collections, you can
choose to View them by
Template Inheritance. So by viewing these by Template
Inheritance you'll see, if we drill down through this,
this Power Distribution Measurement
has -- , there we go -- it has that
list of Attributes, and then organized within that,
as a Child, you know, to this Base Template,
is this additional Status reading.
So it's, that's an example of
using a Base Template.