
akbeer (Customer) asked a question.
I have a few Click Plus PLCs that maintain standard time. A couple of them generate log files, but it has been easy enough to take DST time into account when looking at those, just like a lot of my other building related equipment. I had a need recently to display the current time on one of our HMIs though and so took the opportunity to write some code for the Click PLCs to update their RTC for ST/DST. The code will work regardless of if the PLC is powered at the time of a ST/DST changeover.
See the attached Excel spreadsheet and Click code file. It was easier/quicker to develop/check the logic in Excel, and you can see the years that I tested and/or do your own testing.
Regarding rungs 4, 5 and 6... Your implementation of how you actually change the RTC may vary from mine. This PLC, while not powered 100% of the time, is network connected when it is. It is thus configured to use NTP to keep the clock synced to UTC with an offset applied for standard time. In my case, if the current date/time mandates DST, the code sets the internal system control relay SC121 which tells the Click to add an hour anytime it updates the RTC via NTP, anytime SC55 transitions from OFF to ON, and anytime SC121 itself transitions from OFF to ON. Clearing SC121 however, does not subtract an hour from the RTC. Thus, the NTP request in rung 6. If your PLC is isolated, you'll need to populate SD34 with an hour less than current, SD35 with the current minute, and then assert SC55. Technically, even with network connectivity, I suppose the later approach might be considered more robust w/o proper error checking on the NTP update.
The project file has a 'Data View' named DST that you can use for your own testing, though in order to test falling back/out of DST, you'll need to change the assertion of SC120 to something else if the real current date/time would otherwise suggest DST. ;-)
I have tested this code by repeatedly forcing times/dates, It has also gone through both a real life shift to DST and a return back to ST. Seems to work great.
Cheers!