Today I'll be using our Excel
add-in PI Builder to create, edit and delete
AF objects in bulk. So I have a pretty simple
AF structure here. I have a wind farm root element
with three wind farms underneath it. But only
one of my wind farms actually has any turbines in it.
Now these turbines are based off of a template
where all of the attributes will use a PI Point reference
based on the parent name, the element name and then
the attribute name. So why don't we
use that template to populate my drafty delta and my
gusty gulch wind farm sites.
Here in Excel we'll select the PI Builder
ribbon and then make sure we are connected to
the correct asset server and database.
And indeed we are. So I will import my
elements. Clicking this retrieve elements button, I get to choose
between importing all of my elements, finding my
elements based on a search string or browsing for elements
graphically. But since my element tree is pretty simple, I'll just
import all my elements
Now at this point I've got to choose which columns will be
imported with my elements. I need to include these four
required columns but I'll also include the
template because I need to specify that I'll be creating turbines.
As well as all child elements
underneath my real element. So I'll hit OK.
And here we can see that my wind farm element
was imported as well as the three children
of my wind farm.
And then the five turbines underneath
breezy bluffs. So to create the drafty
delta turbines, I'm going to copy and paste one of my breezy
bluff turbine. And then simply fill
out down to turbine 8.
And I'll be using object type element
and template type turbine.
And instead of breezy bluffs, I'll select the root path
and hit control H. And
replace anything that says breezy
bluffs with drafty delta.
So now when we publish these
8 turbines, they will be underneath this
wind farm drafty delta parent.
So it's a similar process for my
gusty gulch turbines. I'll copy and paste
and fill out 4 turbines.
They are type element
and they are going to be template turbine. But instead of
the drafty delta, I'll hit control H
after selecting the root path for these 4 and
change breezy bluffs to gusty gulch.
Alright the last thing to do is
select the rows that I want to publish. So I'll copy
and paste this X down to these 12 turbines
that I just made. But I will
remove the X's from these rows up here.
So I don't edit them at all. And
we'll click publish and edit mode
create only after I've selected my 12 turbines
and hit OK.
Now let's go see our turbines in PI System Explorer.
So after refreshing and
expanding these two elements we can see that my
turbines were successfully created. And we can
see that their attribute name are correctly
using the template.
But as I scroll down to the end of the turbine list, I
realize that turbine 8 doesn't actually exist.
Drafty delta only has 7 turbines on this site.
So why don't we go back into
Excel and delete that turbine.
So I'll unselect all my turbines
that I don't want to change and simply select turbine 8.
Now at this point I want to
delete the turbine. But
we've grey'ed out this button as a default to make sure that you don't
delete anything by accident. You can activate the delete button
by clicking on settings and then allowing delete.
So I'll do that now.
And simply click delete
and yes.
So it looks like it has succeeded and let's go check by
refreshing our element tree. And we can see that it has gone
there. Now moving on with the inspection,
I'm noticing that my PI Point references
for gusty gulch aren't actually working properly.
And I'm realizing now that gusty gulch is a little bit
different. This site doesn't use the same
attribute name PI Point reference scheme.
What it's actually going to be is
gg.turbine4.currentoutput
So that's no problem. Instead of typing this in
in PI System Explorer, we can use
PI Builder to make those changes all at once.
So opening up a new sheet, I'm
going to import my elements again. But this time
I will browse for elements, so I can select
my gusty gulch route right here.
Now this time I won't need template but I will need
some attributes, namely the data reference and the
config string. So we'll select those two
and hit OK.
And I'm just going to use my Excel tools to
prune down this list a bit so that I only see the PI Points
that I'm going to change. So we'll just unselect everything
and only select the PI Point references.
And now I have a list of my 4 turbines
of gusty gulch.
And their 4 attributes. So in here we
can select the attribute config string, hit control H again to
find and replace. And like I said,
anywhere where there is a gusty
gulch, that's going to be replaced with gg.
And any place
there is going to be a space,
it's going to be a period.
So that's the correct attribute config string for my
gusty gulch. Let's go back into the PI Builder ribbon and publish.
This time I won't use
create mode, I'll use the edit mode because
I'm editing these attributes.
And there is my changes. Let's go see if they worked.
Going back to PI System Explorer
I'll hit refresh.
And we'll see that I've successfully changed all 16 of my attributes
all at once using this new naming scheme.
Now that I've changed the attribute config string,
this attribute won't actually change if I change the
template anymore. To reset it back to the
default, we can right click and reset the template.
After I do that all the changes to the
template will be pushed to the attribute. If you do make a
template change you want to push all of your attributes, right clicking
and resetting to template, right clicking
and resetting template, right clicking and resetting template. For each of your
attributes for each of your elements might be quite a
task. But we can do that in PI
Builder using our reset to template button.
So I'll select
all the rows
on the document and reset to template.
And publish using edit.
And at this point I'll refresh
to update the spreadsheet.
And we can see
here that if I sort by PI Point
again, my attribute config strings accurately reflect the
template again.