You can do simple calculations in
ProcessBook. Go to PI Demo and look at PI
Expression Data Sets. Here, a couple of examples
of very simple calculations using that
sine wave Tag. In
Green here we have the original sine wave, but then in Yellow
we have that sine wave times 2, in
Blue we have that sine wave times 3.
So, if we scroll back in time, we can see
it's that calculation over and over again.
So how have we done that? Well, we've done it through
something we're calling a, an Expression Calculation.
It's simply the Value Sinusoid times 2
or times 3, and I'll show you how to build that
in a second.
Now that's one of the two ways we can do a simple calculation,
with the Expression. Another way is to do
what we're calling Summary Data Sets. Let me show
you an example of that. Here's an example of that same
tag, Sinusoid, but now there are some
Summary Calculations that have been overlaid on top
of that. Let me zoom in and show you what I'm talking about.
I'll go ahead and click
and drag a bounding box so
we can zoom in a bit. So you can see, the Yellow
Trend here is the original tag, Sinusoid.
Now, at exact,
these are exact 10-minute Intervals. You can see this is 1
Hour. We have 1, 2, 3, 4, 5, 6 Intervals, so they're exactly
10 Minutes each. At exact 10-Minute
Intervals, what we're doing is an average
of that sine wave, so, if you look at
the, let's look at this particular one right
here. And,
I think, yeah, if we, if we look at
the Average first, if we look at that Average
that's the Average during that 10-minute
period. So, look at the Yellow Line. The Average of that
is this Red Line here. The Green Line
is the Minimum during that 10-minute period,
and the Blue Line is the Maximum, which makes sense because it
takes the Maximum and Minimum, you know, respectively.
Now, in this case, we didn't need to write
an Expression. We simply used one of our
Pre-defined Summary Calculations. The Summary
Calculations will support things like Average, Min, Max,
Standard Deviation, etc.
So let's take a look at how we would first define these.
We would define these type of calculations
by going into Tools, and within Tools
there's an option called Data Sets.
First let's look at this Twice Sinusoid.
It was on the first Trend we look at. If I edit this,
what you'll see is that we have a space
for the PI Tag Name or the
Expression. Now, when we say Expression, what we're talking
about is the Performance Equation Expression
using that Performance Equation Syntax. In this
case we're using Sinusoid times 2.
Now, if you haven't seen that before,
that Performance Equation Syntax, what we're talking about
are, err, is here,
the Syntax for writing
Mathematical Expressions that we support
all throughout PI through something we call Performance
Equation Expression Syntax. Here's an example. 3 +
the Value of Sinusoid. Now, this was the subject
of a previous video. If you go back
and take a look at the Performance Equation Section you'll learn more about this.
Also, if you're not
familiar with where to find the Help File on
this, on this Performance Equation Topic, if you go into
Program Files, PI PC Help, you'll find this right here.
PEReference. So that's where, what we're using,
this Performance Equation Syntax, and in this
case the Syntax is simply taking the Value of Sinusoid,
multiplying it by 3. Now we also
specify the Name and a Description
and you also see something called a Column Name.
It's actually the Name and the Column Name
that we're going to be using when we make reference to this
in ProcessBook. You'll see that show up as the Label.
Now, we need to specify a Calculation Interval.
As you can see there are some defaults, but you can type this
in as well, using the regular PI Time
Duration Syntax. You know, Hours, Minutes, Seconds, etc.
And also, this Interval Sync Time. So, for
example, 10 Minutes with a Sync Time of
Zero Minutes indicates we're going to see Values
calculated for at the top of the hour, 10 minutes
after, 20 minutes after, 30 minutes after, etc.
Now we also have the Refresh Interval. This
is the Interval of Time, in Minutes, in which is going to refresh
as somebody's watching this on their screen. Now,
we typically will choose to
draw this as a Stepped Plot, as a Stair-stepped Plot, as
we saw in the Demo. That's because, typically,
you don't interpolate between Values that have been calculated,
but, of course, you can turn that off, as you can see here. Now, in
our next video, we're going to take a look at how this is being used in an
actual Trend. Let's look at a 2nd
one. This is called Thrice Sinusoid.
It's simply Sinusoid times 3.
Not much different there. Now, if you recall, we also
saw a Summary Calculation that was not using
an Expression, just Summary. Let me show you that again.
This was this right here that showed me the Sinusoid
+ The Max, The Average, and The Minimum.
Now this was calculated, or this was created
using a different type of Data Set instead
of an Expression. In this case,
we simply put the Name of the Tag.
So if you notice, here you can choose to specify
either the PI Tag or
an Expression. Now the Expression is what we saw so
far, but in addition to that Expression you can simply
put a PI Tag, in which case you'll notice this actually
changes. We no longer have a Column Name listed
here. And, what we're going to be doing
is, when we make use of this
Data Set, at that point we decide whether to
use The Average, The Min, The Max. It's all kind of a multiple choice.
And let me demonstrate what I'm talking about here.
If I, if I were to change this, for example,
from Sinusoid to an actual Expression,
you'll notice as soon as we recognize that this
is an Expression,
we're going to put a brand new Field down here, this Value
Column Name, because that's one of the new Options. We
can put just the Value of this,
excuse me, the Value of this Expression.
I'll just put something in here to get that off
there. But, if this were not an Expression,
if this were simply the Value of a PI
Tag, or a Tag Name, like that, you'll notice
that Field disappears. Well, that doesn't make
sense now. Wait until we take a look at how you use this
in a Trend. You'll see that when you're
simply using a PI Tag, then
at that point you really are limited to just
things like Average, Min, Max, etc. It's more
of a sum, a set of Summary Calculations rather than an
Expression. But similar to the Expression, we also
specify the Interval, so in our Trend that
we saw, we had the similar 10-minute Intervals that we saw earlier.
And if I can demonstrate.
Now watch what happens if I change this. Instead of 10-minute
Intervals, let's go to 1-hour Intervals.
This is going to be, we're being warned, hey,
you're about to affect all these, and that's fine.
We'll go ahead and continue, and look at what
happens to our Summary Calculation now.
Quite a bit different than what we saw before because
now our Interval is 1 Hour instead of 10 Minutes.
Let me go ahead and change that back.
So I'll change this
in the Definition, change it back to 10 Minutes.
We're being
warned that, what it's going to affect, and
now we're back to that 10-minute Interval.
So, it's easy for me to say that this
is the place you start. You always go into Tools, Data Sets, and
create your data set first. In fact, what you'll notice
is that when you're actually building
ProcessBook Tags and ProcessBook Displays like this, and building
Trends, you can actually do all that from within the
Trend as well. So, as we're going to see,
if I were to create a brand new Trend right here
I could go straight in here, into PI Calculation, and
define new data sets right here. There's a
new button up here, and that's where you would go ahead and create these brand new
Data Sets. As you can see, it's the same type of
dialog box we saw earlier.