We
are going to explore the power of AF
templates in the OSISoft AF Builder for Microsoft Excel.
We'll use the template based transposed
attribute functionality to modify the configuration of
attributes on existing elements, and then to create some
new elements based on existing ones.
We are going to start in PI system
explorer which is familiar to many of you that have worked with PI AF as the
primary tool for configuring templates and
elements with PI AF. And here we have some
tanks, and these thanks are based on a tank
template which defined them. Some of these attributes are
PI point references. Some of them are configured
items and some of them are database lookups and calculations.
When we return to Microsoft Excel, we are
going to use that blue button that says AF database. That's actually a button even though it looks like an icon.
And we are going to use that to connect with the appropriate PI
system or AF server and then connect to the tanks
database. And we'll see that confirmation that we are connected over on the left side
of the button. Then we are going to go to the import from
AF area. Select elements, find elements.
Select our tank as a search route and
select our tank template. When we click on search, it will show
us our tank. Holding the shift key down,
we will select the tanks. And when we click OK, now it's going
to select which columns we are going to use. We are going to
clear all of the columns except the templates. That's the only thing that
we needed to find. And then we are going to click on that important
button, transposed attributes. Here we are only going to
select capacity, level and product.
Because the template defines the other ones based on calculations
or lookups. These are the only things we need to define. When we
click OK, we click OK again. And you are going to
see that the transposed attribute functionality has built a table for
us where each row is an element and each
column is a configuration
for an attribute.
Now one of the things that
we might notice is that the level has a little equal
sign in front of it, and the capacity
does not. That is because we have some syntax working for us
here. Where there is an equal sign,
we are setting the configuration string which is that little
text string below the settings button in systems explorer.
So if we'd like to change that, we can go ahead
and edit that and we'll be changing the tag configuration
of this attribute. Please note that Excel uses that equals
for a formula so you may need to put an apostrophe
in front of it. For the values, we can just change the values in the cell and
it will change the value of the attribute. Then we can click
on export, we are going to set that for create or
edit, click OK. And when we come back and look at our tanks in
system explorer and click refresh, we should see
our changes are implemented here. Here is the
A level 1 which is what we changed the PI tag
to and that has been changed. Another thing that we
can do is create new elements from old
ones. So here I've got tank A, B and C.
If I change their names to tank D, E and F and I leave the
parent as the tank farm, and then I can make appropriate
changes to the products or the
thanks, the PI tags. And when I export and
say create, now I'll create three new
tags. And we can see that when we go back to system explorer
and click on refresh, we've just generated three new tags.
Here they are and they have already
looked up all of their attributes. They already have their
PI tags and all that worked.
Now just in a few minutes here, I've been
able to edit and create a few
tags. But I don't want to assure you that using this very
simple table format, you can do 1000s of
elements in just an hour or so.
In fact, even if you only have a few elements in each
template, it can be easier to work one template
at a time with like things. And that could show you the
real power of templates in PI AF. Because if you create
new tabs for each template and just work
with the elements one template at a time, you'll be
surprised at how quickly you can accomplish
a great deal.