Handling Time Zone Differences in PI Analysis for Daily and Monthly Totals

I am new to PI Analysis, and I am facing an issue with time zone differences. My data is stored in UTC, but the AF Analysis is performed in Central Time. Because of this, my daily and monthly totals are incorrect when using

'*'

 

for daily totals or

"BOM*"

for monthly totals.

Is there a way to handle this time zone mismatch by hard coding the dates or adjusting them iteratively in PI Analysis formulas? I would appreciate any guidance or suggestions on how to approach this.

Thanks in advance!

Parents
  • Hi Nash,

    The PI System stores all data in UTC. This means that any local time adjustments, including Daylight Saving Time (DST), are handled on the client side, not within the server itself12

    When writing AF Analysis formulas, you can utilize time expressions to adjust for time zones. For example, you can specify a time offset using expressions like t-6h to convert UTC to Central Time (UTC-6) or t-5h,during Daylight Saving Time (UTC-5)1.

     

    You can hard code dates in your formulas by specifying exact times adjusted for the Central Time zone. For example:

    For daily totals:text

    TotalDaily = Sum('YourTag', "t-6h", "t")

     

    This expression sums the values from the previous day at midnight Central Time.

    For monthly totals:text

     

    TotalMonthly = Sum('YourTag', "BOM-t-6h", "EOM-t-6h")

    This sums the values from the start of the month to the end of the month, adjusted for Central Time.

    If hard coding is not feasible due to variable date ranges or other factors, consider using iterative adjustments within your analysis:

    Using: TimeZoneInfo.ConvertTime()

     

    If you're programming with the AF SDK, you can convert times dynamically:

    csharp: DateTime utcTime = ...; // Your UTC time

    DateTime centralTime = TimeZoneInfo.ConvertTime(utcTime, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));

     

    The AF SDK can automatically handle time zone differences when retrieving data from the PI Data Archive, ensuring that calculations reflect the correct local time4.

     

Reply
  • Hi Nash,

    The PI System stores all data in UTC. This means that any local time adjustments, including Daylight Saving Time (DST), are handled on the client side, not within the server itself12

    When writing AF Analysis formulas, you can utilize time expressions to adjust for time zones. For example, you can specify a time offset using expressions like t-6h to convert UTC to Central Time (UTC-6) or t-5h,during Daylight Saving Time (UTC-5)1.

     

    You can hard code dates in your formulas by specifying exact times adjusted for the Central Time zone. For example:

    For daily totals:text

    TotalDaily = Sum('YourTag', "t-6h", "t")

     

    This expression sums the values from the previous day at midnight Central Time.

    For monthly totals:text

     

    TotalMonthly = Sum('YourTag', "BOM-t-6h", "EOM-t-6h")

    This sums the values from the start of the month to the end of the month, adjusted for Central Time.

    If hard coding is not feasible due to variable date ranges or other factors, consider using iterative adjustments within your analysis:

    Using: TimeZoneInfo.ConvertTime()

     

    If you're programming with the AF SDK, you can convert times dynamically:

    csharp: DateTime utcTime = ...; // Your UTC time

    DateTime centralTime = TimeZoneInfo.ConvertTime(utcTime, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));

     

    The AF SDK can automatically handle time zone differences when retrieving data from the PI Data Archive, ensuring that calculations reflect the correct local time4.

     

Children
No Data