AnsweredAssumed Answered

Need isdst() function ("Is Daylight Savings Time") in AF.

Question asked by Steve.Buckley on May 23, 2017
Latest reply on Jun 6, 2017 by aseck

Trying to port a PE to an AF Analysis - the PE uses the isdst() function ("Is Daylight Savings Time"). Is there an equivalent function in AF?

 

Bigger picture: this is currently used in a pair of PE's to get the ShiftName tag populated with its digital state value as the shift changes.

1) Calculate the distance thru the 14-day rotation as:  ShiftIndex = if ISDST('*') then  ((('*' - '03-Jan-2011 05:00:00') / 86400) mod 14)  else ((('*' - '03-Jan-2011 06:00:00') / 86400) mod 14)

which returns an ShiftIndex of 0 to 13.999...

2) Calculate the shift that is on as ShiftName =  if ('ShiftIndex' >=2 and 'ShiftIndex' < 5) or ('ShiftIndex' >=7 and 'ShiftIndex' < 9 ) or 'ShiftIndex' >= 12 then (if hour('*') >=6 and hour('*') < 18 then "1A" else "3C") else (if hour('*') >=6 and hour('*') < 18 then "2B" else "4D")

 

This is has been working fine as PE's since 2011, but we want to use PI's Future Data capability, and project this schedule into the future 30 days (so, for example, we can see which shift will be working Day Shift next Friday against the Future Data scheduling data). I believe we can use '*+30d' instead of '*' as the time input based on this post: Make calculations with future values

Outcomes