Adjusting for daylight saving time (DST) in Do-More PLC.
When does daylight savings time (DST) start and end?
Canada Daylight Saving Time begins at 2:00 am local time on the second Sunday in March. On the first Sunday in November areas on Daylight Saving Time return to Standard Time at 2:00 am local time. When Daylight Saving Time begins, turn your clocks ahead one hour. This is what happens in most parts of Canada.
There are several methods in the Do-More PLC to account for Daylight Savings Time. You can use the internet time clock, manual adjustment, or use an internal bit to set daylight savings time. Since websites for internet time may not always be reliable and we do not want to wake up at 2 am in the morning to set the real-time clock, we will use the internal bit method.
ST768 $SummerTime Configuration
Set this bit ON to add one hour to LocalTime to account for Daylight Savings Time.
The first line of code will check for the 3rd month (March). Then ensure that the day is between 8 and 14 so that we are viewing the second week. Next, make sure the day of the week is 0 (Sunday). Finally, it will check to make sure the hour is 2 (2 am). The ST768 $SummerTime will then be turned on to add one hour to the real-time clock in the PLC.
The second line of code will check for the 11th month (November). Then ensure that the day is less than 8 the first week. Next, make sure the day of the week is 0 (Sunday). Finally, it will check to make sure the hour is 2 (2 am). The ST768 $SummerTime will then be turned off to subtract one hour to the real-time clock in the PLC.
Adding this code to your existing logging information in the PLC can be helpful when determining the correct time.
In the Community Automation Direct Forum, a question was asked about automatically adjusting for daylight savings. Especially when the PLC is not powered up all of the time.
The following formula is used to automatically adjust the summertime bit (DST) in the Do-More PLC.
Formula to turn on DST $SummerTime Bit:
((SDT0.Month > 3) && (SDT0.Month < 11))|| ((SDT0.Month == 3) && (SDT0.Day >= IF(((SDT0.Day – SDT0.DayOfWeek) % 7) <= 0, ((SDT0.Day – SDT0.DayOfWeek) % 7) + 14, ((SDT0.Day – SDT0.DayOfWeek) % 7) + 7)))|| ((SDT0.Month == 11) && (SDT0.Day < IF(((SDT0.Day – SDT0.DayOfWeek) % 7) == 0, 7, ABS((SDT0.Day – SDT0.DayOfWeek) % 7))))
The video below will use Net Time to adjust the PLC real-time clock and show you a couple of ways to adjust for DST.
Download the Do-More PLC Daylight Savings Sample Program here.
Watch on YouTube: Adjusting Daylight Savings Time in Do-More PLC If you have any questions or need further information please contact me.
If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.
To get this free article, subscribe to my free email newsletter.
Use the information to inform other people how numbering systems work. Sign up now.
The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.