Now in the previous video we ignored this retrieval
mode briefly. And the reason we did that is
because to really explain this well, we need to go back and look at
some fundamentals on how data is stored
in PI. You see, in this "Archive Value"
retrieval we're telling PI to get a value at
"Today" at 7 o'clock in the morning. Well,
if you recall, it would be the
wildest of coincidences if we actually have a "Value"
stored at exactly 7 o'clock for any of these
"Values." And that's because what we're doing is we're
storing, in the "Archive," the peaks and valleys of
these trends. So what are we to
do when you request a specific point in time?
Well, let's go back and let's look at, let's
revisit the topic of how data's brought in
to just kind of refresh your memory on this. Remember
if we're scanning data at, say, once every five
seconds, those might represent the "Raw
Values" scanned. From those "Raw Values"
scanned, only these "Values" we see in black
are actually going to be stored in
the "Archive" because of how our data compression
settings work. See, we're really interested in
storing only the peaks and valleys, so,
you know, that's why we store "Values" here,
here, here, here, etc. We're only
storing the peaks and valleys, and so what
happens when somebody does request a "Value"
at exactly a specific point in time? Like somebody says
okay, let's get the "Value" at this
point in time right there. Well, at that point
in time we don't have a "Value." We have a "Value" here,
we have a "Value" here, so, what do we do
if that is 7 o"clock and that's what we've requested?
Well, by default, what we'll typically do is we'll interpolate
a "Value." But that's not always what we'll do.
As you can see, you get to specify what we do. We
could get the "Previous Value" or the "Next "Value."
So let's take a look, knowing that we do now about the
"Archive" and how we store the data, let's go back and look
at those options again. One of the options
was "Previous," and that's pretty straightforward. With "Previous"
that means if there is not a value at exactly
7 o'clock, we'll just go back and get the "Previous
Value." If there is a "Value" at 7 o'clock, we'll, we'll
get the 7 o'clock "Value." And "Next" works
the same way only opposite. If there is a "Value" at
7, we'll bring that. If not, we'll bring the "Next Value."
Now, compare that to "Previous
Only" and "Next Only." With "Previous Only" this specifically
means I don't care whether there's a "Value" at 7 or not,
you give me the "Value" previous to 7. So, if
there is a "Value" at 7 we will still bring in the "Previous
Value." And, same for "Next." That's only
going to bring in the "Next Value" even if there happens to be a "Value"
at exactly that timestamp.
Now, there's an interesting option called "Exact
Time." "Exact Time" basically works like
this. If you specify "Exact Time" we are only going
to bring in a "Value" if there is
exactly a "Value" at 7 o'clock.
And let me demonstrate. I'm going to go ahead and change this, so that
instead of, instead of doing the
default, we'll choose "Exact Time."
Notice what happens. It says "No Events Found." That's because for
all of these tags there is no "Value"
at exactly 7 o'clock. So let me bring this back up.
I had chosen,
instead, "Auto." So,
let's understand what "Auto" means. "Auto"
is somewhat like this
option called "Interpolated." If you choose "Interpolated,"
and what that does is it simply interpolates a 'Value"
between the "Previous" and the "Next Value."
Well, how is "Auto" any different
than that? Well, "Auto" is going to take
into account the configuration of the PI tag,
because there are certain PI tags
that we specifically, that we specify
we should not interpolate.
Let me explain. Some PI tags
have an attribute called "Step" that
is set equal to "On." As you can see "Step Equals On"
is the green trace. If "Step" is equal to "On"
then what we do is we treat at any
point when we display this, we treat this like a stair-step
function. So that, if the "Value" changes
from here and then changes
to here, and then changes to here, instead
of just connecting the dots like that, what we're
doing is we're just displaying this as a stair-step function.
Now that setting, that "Step" function is
actually, it's something that's configured
when you first configure the PI tag. So back in our
tag-builder you'll notice there's this option called "Step."
So if "Step" is turned on, if "Step" is
turned on, then that's the behavior. We treat it like a stair-step.
So how does this relate back
to our discussion of "Auto?"
Well, with "Auto", what
we're doing is we're basically saying if a "Value"
is, excuse me, if a tag
has "Step" turned "Off", then we will simply interpolate.
But, if a "Value" has "Step" turned "On", or if
a tag has 'Step" turned "On," then
we will, in fact, get the "Previous Value" because we
refuse to interpolate. Here's a nice illustration
of it. Image the "Value" we request
is at that point in time, 1300.
Well, if you have "Step" turned "Off"
then we're simply going to interpolate this "Value"
over here. We interpolate this "Value," that's the "Value"
we return. That's the, the interpolated "Value"
is a "Value" with a timestamp of 1300
and the "Value" is interpolated as 1.81.
Now, compare that to, if
"Step" were turned "On" for that tag, the green tag.
With "Step" turned "On" for the green tag,
we don't interpolate a "Value." We
simply take whatever the "Value" is and
we assign it the timestamp of
the "Previous Value." So the timestamp
we return is the timestamp of this "Previous Value"
right here. We refuse to interpolate a "Value" there.
And we see that primarily in things like,
well, if you're doing totalizations or if you're doing
lab inputs, or some kind of a quality measure
where you don't really interpolate between quality measurements,
that's when we, typically, see
"Step" turned "On" for a tag. So, in summary,
when you're retrieving using
"PI Archive Value" and you specify "Auto"
it simply means that we are going to interpolate the
"Value" if "Step" is turned "Off." If "Step" is turned
"On" we will not interpolate the value and, in fact,
the timestamp we show, if you've chosen to show the timestamp,
the timestamp we show is going to be the timestamp
of the "Previous Value."
Now, if you understood all that, there's really no point in demonstrating this
further, but I'm going to put a timestamp on here now.
So we're going to see the actual timestamp.
Yeah, take a look at this. Period Ending T
+7 hours. Well, if you notice, with,
when we, when we specify "Auto,"
as we have done here, then
for most of the tags you're seeing a timestamp
of 7 o'clock. But notice this tag,
CDM158. CDM158
is, has "Step" turned "On." So
what we're seeing here is is an inter. . .a not
interpolated timestamp. It's showing us what the "Last
Value" was before 7 o'clock.
So, now, let's compare this to -- if we set
this to "Previous" or "Previous
Only." And for "Previous" now we're seeing all
the timestamps before 7 o'clock.
Let me bring this back up.
If we choose "Next," now we're seeing all the timestamps
after 7 o'clock.
Bring this back up.
And if we were to look for, as I demonstrated earlier,
if we were to look for "Exact Time,"
well, "Exact Time"
in this case is finding nothing because there are
no, none of these tags here have exactly
a "Value" at exactly 7 o'clock.