Sometimes you're going to need to retrieve data that's
timed to match a certain array of
timestamps. For example, this tag right
here, CDT158, that's a live process variable.
That's something that's -- maybe it's a temperature transmitter or something
like that. Let's pretend that this "Value" right here,
this "Value" is some kind of a,
let's say a lab result. Let's see if we can come
up with a better one. Yeah,
here we go. This is a measure of concentration, BA
Concentration.1, and this is a
live process value. Well, concentration is measured, as
you can see, about three times a day,
and it's at even, unevenly spaced intervals from
right around noon, around 8 o'clock, around 4 o'clock.
So, these "Values" are coming in at specific
points in time, and all I'd like to do is
map my live process value, which normally
comes in in real time, to these specific times
here. Well, there's a way of doing that.
Let me go ahead and add CDT158 as
the tag name I'm going to retrieve, but now in this case,
instead of retrieving sample data or compressed
data, we're going to bring in time data using this
as the set of timestamps. I'll go ahead and demonstrate.
I'll just click here. For my tag name
I'll make reference to that. For my
timestamps, though, I'm going to make reference to an array of
timestamps. Now, in
this case, I'm going to bring in interpolated data, which
means it's going to get exact "Values" for that
point, or for those points in time.
Yeah, there we go. As you can see, these "Values" are
coming in. We don't see any timestamps on them
but they have the same timestamps as these "Values"
right here. If we click on this you can see the relationship
between the two.
Let me demonstrate another interesting use of
that. For example, I'm just going to go ahead and delete that.
Let's say that we're not interested in this "Value"
right here, these Times here. Let's say --
again, we're looking for some correlation that may be
offset in Time. Let's say we think that this is a
Leading Indicator, and there's a Lagging
Indicator here in Temperature that lags by about, oh
let's say, 30 minutes. I can go in here and create
an alternate set of timestamps. Let's say that this is equal to that
plus
and in this case we'll do -- let's go with --
that's going to be 1, which is 1
day, divided by 48, that's going to be 30 minutes.
There we go. That's,
of course, in a format that is
showing this in -- it's actually showing it in
integers counting from January 1,
1900 -- so let me copy this format over here.
That's how Excel renders timestamps.
I'll do a Paste Special.
We'll paste the format -- whether
we can see, there we go, that's a little bit better. We can see
that this is 11:53, this is 12:23,
so it's exactly 30 minutes offset, and if I copy
this down, you know, the 1953 becomes
2053, or 2023,
3:53 to 4:23. So these are all exactly half
an hour offset. Well, isn't this nice. Now I can go in and
do Time data based on this tag
but now using this alternate set of timestamps.
Time data, here's the tag name,
here are the set of timestamps, the output
cell was the default that I had selected first,
and there are my results. So now, what we're looking at
is, is correlated in
Time, but offset by 30 minutes. So it's a nice
option you can do with this "Time" data. Now one last
thing about this "Time" data -- let me bring this back up --
is we're looking at interpolated "Values." You can also
choose "Exact Time" which is simply
going to bring in a "Value", if there is a "Value,"
exactly at that timestamp. Let's see if there are any
"Values." No. In this case there are no
"Values" for this tag at exactly that timestamp, so we
just report that there are no events found.
And, again, that was at the --
that was because I had chosen "Exact Time,"
as opposed to interpolated.
I've mentioned a couple of times that it's sensible to use
cell references instead of hard-coding
things in these, you know, in these functions
instead of actually hard-coding the names, making cell reference.
I'll show you a good example of why that could be useful.
If I were to switch this around,
and for example a different tag, now we
get different results here. That's automatically
propagating forward to here, and now we're seeing
these, these "Values" here are offset from these
"Values" here.
Let's try another tag. Yeah, here's
different set of timestamps, different set of results here.
So in conclusion,
whenever you find that there's a series
of timestamps, either timestamps coming from PI
or some timestamps you've generated on your own, and
you want to retrieve a set of data just for those specific timestamps,
that's when you use this "Time Data" option.