0% found this document useful (0 votes)
274 views

PI Time PDF

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
274 views

PI Time PDF

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

PI TIME

LEARNING OUTCOMES

 Understand PI time expressions


 Explain the differences between fixed and reference times
 Use time offsets
 Understand the effect of DST on the retrieval of PI point data.

When searching for data in PI you will use a timestamp since most PI data is time series data
and this data has a timestamp associated with it. We can use a special syntax, called PI time, to
specify inputs for timestamps and time intervals in the PI client applications, for example PI
Vision. PI time uses specific abbreviations and rules in building valid time expressions.

PI Time Expressions
In PI there are two ways to specify time:

Fixed Time: An expression that signifies a specific date and time. Used when you want to
save a view of your PI System data for a specific time in history.
Example: A user is creating a report that analyses an equipment failure event which
occurred on the 25th of July 2013 at 11 am, so 25-Jul-2013 11:00:00 AM
Reference Time: An expression that signifies a date and time relative to the current date
and time. Used when you want to create a dynamic view of your data, which can be used to
view data in real-time, or re-used on a periodic basis to create periodic reports.
Example: A user creates a report that summarizes weekly production totals. By using
relative time expressions, the user will be able to re-use this report every week, so define a
start date of “Monday” meaning start the report from last Monday.

Both Fixed Time and Reference Time can be used with Time Offsets; Time Offsets can be used
alone.
Fixed Time Syntax

A fixed time expression is an expression which includes a date, and optionally a time.
When the time component is omitted, Midnight is assumed. And midnight occurs at the
beginning of the day, not the end.

Expression Meaning
5-jan-92 12:34 12:34 p.m. on January 5, 1992
25-sep-12 00:00:00 (midnight) on September 25,
2012

The PI System interprets many different formats for fixed time. In the event of an ambiguous
input, the Windows Region and Language settings of the computer where the PI Visualization
Tool is installed take precedence.

Note the following:


Region and Language
Expression Meaning
Format
00:00:00 (midnight) on
1/5/2015 English (United States)
January 5th 2015
00:00:00 (midnight) on
1/5/2015 Rest of the world
May 1st 2015

Reference Time Syntax

A reference-time abbreviation represents a time relative to the current time.

Abbreviation Meaning Reference time


Now Current time
*
t today 00:00:00 (midnight) of the current day
y yesterday 00:00:00 (midnight) of the previous day
fri friday 00:00:00 (midnight) on the most recent Friday
may may 00:00:00 (midnight) on the current day in May
of the current year
apr-15 april-15 00:00:00 (midnight) on the 15th day of April in
the current year
Abbreviation Meaning Reference time
YYYY Year 00:00:00 (midnight) on the current day and
month in year YYYY
M-D or M/D USA 00:00:00 (midnight) on the Dth day of month M
Or in the current year
D-M, D/M The world
15 00:00:00 (midnight) on the 15th day of the
current month

Use the first three letters as an abbreviation for any day of the week and any month of the year.
For example:
Expression Meaning
thu 00:00:00 (midnight) on the most recent Thursday
MAR 00:00:00 (midnight) on the current day in March of the
current year

Time Offset
When specifying PI time use specific abbreviations that represent time units. These are used in
constructing Time Offsets as in the table.

Abbreviation Time Unit


s second
m minute
h hour
d day
mo month
y year
w week

Specify the abbreviation, the full time unit or the plural version of the time unit, such as s,
second, or seconds. Time offset is any of the time units with a valid value and a + or – sign
included, e.g. +8h.
Time offsets can be used alone in a time field or come with a fixed time or reference-time
abbreviation.
Time Offset Syntax

Reference Time or Fixed Time and Offset Expression


When included with a reference-time abbreviation or with a fixed time, a time offset adds or
subtracts from the specified time (indicated by either + or -) and a time unit with a value
Expression Meaning
*-1h One hour ago
t+8h 08:00:00 (8:00 a.m.) today
y-8h 16:00:00 (4:00 p.m.) the day before yesterday
mon+14.5h 14:30:00 (2:30 p.m.) last Monday
sat-1m 23:59:00 (11:59 p.m.) last Friday
1-jan-20 – 1d Midnight 31 December 2019

Time Offsets Used Alone


Entered alone in a time field, time offsets specify a time relative to an implied reference time.
The implied reference time depends on the field where you enter the expression:
 For a start time, the reference time is the current clock time.
 For an end time, the reference time is the start time.
 For a single time stamp, the reference time is the current clock time.

Time field Expression Meaning


Start time -1d One day before the current clock
time (24 hours before the current
clock time)
End time +6h Six hours after the start time
End time -30m 30 minutes before the start time
Time stamp -15s 15 seconds before the current
clock time
Rules to Remember
Rule 1: You can only include a single time offset in an expression. Including multiple
offsets can lead to unpredictable results. For example, the following time expressions
are not valid:
*+1d+4h
t-1d+12h
Rule 2: To define a time offset you must include a valid value with any time unit. Only for
seconds, minutes, or hours, you can specify a fractional value. You cannot specify
fractional values for other time units.

Rule 3: A fixed timestamp consists of the fields of Year, Month, Day and Time (hours,
minutes and seconds). If any of these fields are not specified in the PI time expression,
the following values will be assumed by default:

 If Time is not specified, then the default value would be Midnight.


 If Day is not specified, then the default value would be Current Day.
 If Month is not specified, then the default value would be Current Month.
 If Year is not specified, then the default value would be Current Year.

You might also like