I am adjusting for daylight saving time (DST) in Do-More PLC.
When does daylight savings time (DST) start and end?
On the first Sunday in November, areas on Daylight Saving Time return to Standard Time at 2:00 am local time. Canada Daylight Saving Time begins at 2:00 am local time on the second Sunday in March. When Daylight Saving Time begins, turn your clocks ahead for 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 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 to assign 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 ensure 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 eight the first week. Next, make sure the day of the week is 0 (Sunday). Finally, it will ensure the hour is 2 (2 am). The ST768 $SummerTime will then be turned off to subtract one hour from 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.
The Community Automation Direct Forum asked a question about automatically adjusting for daylight savings, especially when the PLC is not always powered up.
The following formula automatically adjusts 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 how 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 get in touch with me.
Thank you,
Garry
If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLCs are not challenging to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimals, Hexadecimal, ASCII, and Floating Points.
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.
Thank you Garry!
Thanks Andrew,
Let me know if you have any questions.
Regards,
Garry