In this OSIsoft learning video,
we'll see how to configure the PI UFL
interface to import a simple text file like this
one into the PI system. For more
complex text files, such as ones with headers or different line
formats, we have another video that will show those steps with
the PI UFL designer. This video
is focused on the basics, a simple text file.
Let's start by opening PI interface
configuration utility, or PI ICU.
Go to
the UFL tab on the left side of PI ICU.
The first thing we'll do is create an NE
file. The NE file tells the interface where to get
the data, what the data looks like and what to do
with the data.
To create this NE file, go to the ellipses
on the right side of the configuration
box. Navigate to
your PI UFL directory
then select the NE folder.
You'll need to give
your NE file a name. I'm going to call
mine example 1.
Now that we've created our NE file, let's launch our
UFL designer. The UFL designer will help
us to configure our NE file.
When prompted, select yes to continue.
We're now prompted to
select a plugin. The UFL interface
can read data from a few different sources -
ascii files, serial ports and
POP3 mail servers. There is a plugin
to go with each of these data sources.
For this example, we'll be reading data from
ascii files, so we'll select the ascii files plugin.
You can select the other plugins from the dropdown menu.
We also need to
define a data file as a reference while we configure
our NE file. Click the ellipses
and select a data file.
Then, click okay to start your configuration.
You'll notice
that UFL designer is split into 3 different
panes. The first pane
on the left is the configuration pane. This is where
the UFL designer will walk us through the steps of
configuring the NE file.
The center pane is the data file that we selected
as reference. We'll be using this as we
step through the configuration.
On the right side is a readout of the
NE file that we're creating.
The first step in configuring the
NE file is to configure the parameters for the
ascii file's plugin. The most important of
these parameters is the input file mask.
The input file mask defines where the interface
should look for new data files and which files
in this directory are actually data files.
For this example, I want the interface to
read in any file with the
.txt extension that's in the C: data
file's directory. I can tell
the interface this with
a wild card parameter.
The wild card character is star.
So what I've just told
the interface, a file of any
name with a .txt
extension in the
C: data files directory should be read
into the interface.
There are many other parameters that can be
configured for the ascii files plugin.
I'm going to leave these at their default values for now.
I'll also take you
through the steps of configuring each of these parameters in the
advanced configuration video. Now that we've finished
the first step, we can click the blue arrow to move
on our next step in configuring our NE file.
... In this
step, we define variables. We will need a
variable for each type of information in our
data file. So, let's look at our
data file. We have
a tag name,
a time
stamp,
and a value.
We will need a variable
for each of these 3 information types.
Let's create our first variable by clicking
the green plus sign.
Our
first variable will be for our tag name, so
I'm going to call it tag name. We also need
to choose a data type for each of our variables.
In this case, our tag name
is of data type string. So, we'll select
string. Now let's create
a variable for our time stamp.
We'll click the green plus sign to add a new
variable and we'll rename our variable
to time stamp.
We now need to select a data type for
our time stamp. A time stamp is gonna be
data time date-time.
When we select the date-time data type,
the data format parameter
appears. The date format parameter
tells the interface the format of
the time stamp in our data file.
Our time stamp is actually of the
exact same data format as the default
date format. However, if your time stamp is different,
you can select from a variety of
date formats from the dropdown menu.
Now we need to
create our last variable for value.
We'll add a new
variable, name it
value, and then
select a data type for our value.
Our data type is
going to be number because
our value is a number
and it's a decimal, not an integer.
Now that we've configured all
the variables we need, we can move on to the next step by
clicking the blue arrow.
... In this
section, we'll tell the interface
the different line formats that it might expect to
see in our data files. We'll need a different
message type for each new line
format. Let's look at our data file.
Each line in
our data file has the exact same format.
Tag name comma time stamp
comma value.
Since each line has the exact same format, we'll only need
one message type.
I will go over how to create an
NE file for data files with multiple message
types in the advanced configuration video.
For now, let's go ahead and create our single message
type. We can do this by
selecting the plus sign.
I'm going to
call our message type, data.
We'll also need to define
a message filter. The message filter tells the
interface how to identify
a line of message type data.
We can do this by finding something
unique about our data line.
However, since we only have one
message type, we only need to tell the interface
any line is a data line. In order to do
this, we tell the
interface
C1. This represents the first character
in each line
is equal to
- then we use our wild
card character to say any character.
In summary, what this message filter is saying is,
look at the first character in each
line. If it's any
character, it's of message type data.
...The next parameter that we can configure is
enable point creation.
If enabled, the UFL interface
will create points on
the PI server for any tag name that doesn't
already exist. For now, I'm going to
leave enable point creation at none.
However,
if you want to enable point creation, you can define
the type of point that the interface
will create for you.
I will go over this more during the advanced
configuration video.
...Now that we've created our message type,
we can move on to the next step by clicking the blue
arrow. In this
section, we will tell the interface
which parts of our data line belong to each variable.
First, we'll
select the message that we wish to assign data
for. Since we only have one message type,
it's already selected for us. Then,
we click the green plus sign to add
an item. We're now prompted to select
the format of our line.
How are the different variables
separated? In our data file, the
variables are delimited by commas.
So we can select the delimited option.
There are also options for fixed width columns
and manually selecting.
We've selected delimited
and we'll click next.
Now we choose
what the delimiter is.
In our data file, our delimiter
is comma.
Once we select comma, the data preview
window will show us how this separates
our data.
You'll want to review the data preview to make sure that's
accurate. Let's check.
We have our
tag name.
Time stamp.
And value. These are all separated
correctly. Now that we've
confirmed, we can click next.
Here, we assign the variables the different
sections of the data line.
We'll do this by dragging our
variable. Select your variable and drag it to the
appropriate section of your data line.
The tag name we'll
assign to the tag name.
We'll assign the time stamp
to our time stamp. And
we'll assign our value to the
value. Again, I did that simply by just
clicking and dragging the variable.
We're now finished assigning
data so we can click finish.
...Now that
all our data is assigned, we can click the blue arrow
to proceed to the last step.
In this section we'll tell the interface
what to do with each variable
that we've just assigned data to.
First we'll select the message
type that we wish to create an action
for. Since we only have one message type in this example,
it's already selected for us.
We'll then click the green plus sign to add an action.
We want to store our data in
PI so we'll select the store in PI action.
Then we can click and drag
our different variables
into the store in PI function down in the
results section.
We'll select our tag name
and drag it on to the
tag section of the store in Pi function.
We'll do the same
with time
stamp and value.
Then, we'll validate our
results. Once we've got a green checkmark, we're good
to go. Let's select add to
add that action.
Then we can close the add action
pane.
We've now told our interface
where to get the data,
what the data looks like and what to do with the data. So,
we are done with our configuration file.
Let's click the save
icon.
And close UFL Designer.
Our NE file is now complete.
There are a number of other parameters that can be configured for
this interface. I will go over
these in the advanced configuration video.
...We now need to tell the interface how often
to look for data files. Switch
to the general tab in PI ICU.
We can tell the interface how often to
look for new data files by creating a scan class.
We'll create a scan class by
clicking the new scan class button in the scan class
section. I'm creating a scan
class with a scan frequency of 30 seconds.
Let's
click save to save our changes.
To start up our interface in ICU, we'll
select our interface from the dropdown menu
and then click the play arrow
to start our interface service.
We can check to see that the interface
has processed our data
file by navigating to our data file directory.
Once the interface has processed the data
file, it changes the extension of the file to
_ok.
We see that this data file has now been processed.
For a guide on configuring the interface on more
complex data files, please watch the advanced configuration
video.