Now up to this point in the class, we've been talking about
this very broad topic that we call AF. We've been talking
about the fundamental underpinnings of AF,
creating Elements, creating Element Templates, etc.,
etc. And now, actually we're going to get into something
a lot less fundamental. Now, we're going to start
talking about the Substitution Parameter.
It's probably one of the more obscure things,
something you may not use for, for a while. So, it's
important, fundamental...it's important stuff, but I wouldn't call it
the fundamentals. We've just covered those.
So, we'll start by taking a look at this
Option of using the Substitution Parameter. We use
it when we configure a Library Elements
like Element Templates and Attribute
Templates. Substitution Parameters
work like this. When you're configuring
the settings for these Attribute Templates,
in some of these fields instead of specifying
hard-coded text, you can specify these,
this Substitution Text. And the Substitution
Indicator we have is the percent symbol.
So, by specifying something like this, the percent symbol
and then these reserved words --
let's go with Element
and also I'll put in a period after that
and then we'll do Percent Attribute. What this means is
instead of putting the word Element
Attribute, it's simply going to substitute whatever the current
Element is, and the current Attribute,
such that when we, you know, when,
when I create a New Element
Attribute that looks like this in the actual
Elements Collection -- remember, this is the Template here.
When I actually create this Element, it's going to create an Element
that has a Tag Reference to a Tag
that has that name. And that can be very
convenient if you, you know, if you end up happening to have
PI Tags that have those Names. In
fact, that's how you can design your System. If your PI System
has Names like this, or has been configured
with Names like this, then when you create these
AF Elements and the Attributes that are
pointing to Data References in PI, it'll
automatically find those Tags. Let me give you an
example. Now, that, that's the Default we're looking at right
here, this Element Attribute. You'll see that if you,
if you to choose to create a,
a PI Point Data Reference without entering a Tag Name.
I'm just going to use, let's just use
the word Element here, and I'll just demonstrate
how this works. So this means at Run Time, when I create
this, a, a, an Element based on this
Template, it's going to have a Reference to a Tag
that is the same name as the Element.
Now this is not going to affect any of our
existing Tags or
any of our existing Elements. The existing Elements are going to
be left alone by this. I'll go ahead and check this in.
And this is the Mixing Tank Template.
So let me go ahead and
exploit what I just created. I'm going to go into my Elements
Collection here, and I think I'll just go under the
Equipment Maintenance Section here.
And, I'm going to add a New Mixing Tank, so
underneath here I'll do a New Child Element.
That Child Element will be built on that Mixing Tank
Template, and once I create that --
let me give it a good Name here.
Let's take a look at what Attribute got
created here. So, it's called Mixing Tank 3. Here's
that Attribute whose Configuration
I just modified. And, as you can see,
it's, if we take a look at it's Settings,
you can see it's specifying that it needs to
retrieve an Element based on that Name.
Well, right now,
the Name is called Mixing Tank 3,
and so it's looking for a Tag called Mixing Tank 3.
And, of course, it doesn't find one. If I refresh my screen,
you'll notice it doesn't find one, a PI Tag
called Mixing Tank 3. And we say, we see this
message saying it cannot retrieve it. Watch what happens, though, if I
change this to a Tag Name that does exist.
Oh, for example, I know a Tag called CDT158.
I'll go ahead
and check this in. We take a look
at our Attributes now. See, now it's
actually looking for a Tag called CDT158.
And, when I refresh my screen, because,
in fact, there does exist a Tag called CDT158,
this Substitution has its -- whoops,
wrong Attribute. This Substitution
has its desired effect.
It's substituting the Name of the Element.
The Name of the Element happens to be the Name of a Tag,
so I can create as many of these as I want, and, as long as I
give them Names that are
the same as PI Tag Names, and base them off of this Template,
here -- I'll go ahead and create another
one. Let's go with -- how about ba:conc.1.
I know there's a Tag, a Sample Tag, that exists
like that. I'll go ahead and check that in.
Let's take a look.
It's looking right now for ba:conc.1. Let me refresh
my screen,
and, as you can see, that's working just fine.
Now that's, that's an example that's rather, you know, kind of
a silly example because it's very, it would be
very odd for you to create a bunch of Tanks that are named after
PI Tags. I just wanted to demonstrate what's happening.
Later on, I'll show
you how, in just a few minutes, we'll, we'll take a look at how you might
use this in a more practical way. Now, that
Substitution Identifier, the Percent, can be used in a variety
of places. It can be used when you create a Table Reference.
Let me show you an example.
I'm going to take a look at this Storage Tank.
And, in this Storage Tank,
you see this Production, Daily Goal, or Production
Goal Daily. It's actually doing a Table Lookup.
It's doing a Table Lookup
in which we're specifying
that we would like to have the
Lookup match a -- this is
going to be a Column in a Table -- with the current
Name of the Parent Element. As you can see, there's our
Substitution. Let's look at it his way.
What we're saying is we've got a, a,
a Table that we're looking
up something in. This is actually going to be a Production Goal
for the different Production Lines, and
what we're saying is if the Line is Equal To
the Name of the Element, the Parent Element,
then bring in one Production Goal.
So, for example, Production Line 1 is going to have one goal;
Production Line 2 will have a second goal. So, let
me show you what needs to be in place for this to work.
Oh, and by the way, as we look at this, watch how
it changes. If I change Storage Tank
from Production Line 1 to Production Line 2,
watch the Production Goal change.
And, the Production Line 1 has a Daily
Goal of 45,000; 2 has 62,000 as
its Goal. Well, how did we do that? We did it through a
Table Reference, so let's take a look at the Table.
This is a Table I created just to demonstrate this
example..
Here's the Table. It's very straightforward. It has
two Columns, Line and Goal.
We're saying Production Line 1 has 45,000,
Production Line 2, 62,000. And, again, if I were to make
changes here -- let's say we were going to go with 62 5,
when I make
those changes, everything that
is based off of this, all the Table Lookups are going to get that Update.
So, let's take a look at the Table
Reference that we're making here. We're going to do this in that
Production, or excuse me,
the Storage Tank Template. In the Storage Tank Template
I added a brand new Attribute called Production Goal.
And, that Attribute is defined like
this. It is a Table Lookup, and what we're saying is
when the Line is Equal to the
Name of the Parent Element, then,
you know, that's the, that's the Result we're going to be bringing
back. A Result Column is going to be the Goal.
So, that's going to be either 45,000 or 62 5.
That was what was in that Column. , this
Column right here in that Table is what we're trying to map
to. And as, if you recall, there were two Columns
in there. There was the Production
Line 1 and Production Line 2. So,
if we now take a look at our Elements
themselves, the Elements themselves,
they're -- you know this Mix...or excuse me, this Storage Tank
right here, it's Parents storage, it's
Parent Element is called Production Line 1, and so
as a result, when we take a look at this
Production Goal, we find that the Name of the Parent Element
is Production Line 1, so we retrieve 45,000.
For Storage Tank 2,
which is in Production Line 2, we retrieve
62,500. And,
that's -- what we're doing essentially, is making use of this
Substitution. Now, that's, you know,
that's pretty obscure. I don't know when you're going to be making use
of that, you know, in, in your initial roll-out, but
it could be something that really saves the day. It gives you a mechanism
to actually reach in to the Configuration
and then bring out data, conditionally,
based on what your Configuration is, based on what your Architecture
is. So, anything that I add under Production
Line 2 is going to come up with that Production Goal, daily,
of 62 5. So, that's
an example of using that Substitution here. We're
using that Percent Element.
Now you'll find in your documentation the, just, you know more
information about the different syntax, and you'll also see
there's drop-downs available for doing this. So, when
I actually configured this --
here, let me show you When I actually
configured this in my Template
this
was something I did not have to type in by hand,
because, if you look
at this Attribute or Value Field, when I
went to choose the Attribute, or Value,
some of the Options I had were these different
Substitutions. And, I just chose this one. This is the
dot dot slash Element. That's going to be the Name of
the Element of the the Parent Attribute.
[typing]