Daylight Savings Time RSLogix500

wlong995

Member
Join Date
May 2008
Location
Michigan
Posts
10
I searched for an example of how to adjust for daylight savings time, but I could not find one anywhere. So after considerable thought and time, I've got it figured out. I thought I would post it for anyone else who might be looking.
 
RSLogix500 Internal Clock Time Changer

Here is another version for RSLogix500 time adjustment.
 
Yours is much shorter and more simple. For a permanent line that runs continually it should be fine. Most of our machines are secondary operations that do not run 100% of the time. I specifically avoided EQUALS statements so that if the machine wasn't powered up at that given moment, it wouldn't miss a change. I tried to be sure that if the machine is powered up a week after DST, it would still realize the time change.
 
I specifically avoided EQUALS statements so that if the machine wasn't powered up at that given moment, it wouldn't miss a change.
Hmmm...this is a new concept for me - could you print your file as a PDF so that those without RSLogix500 can benefit from your wisdom?
 
Here's a pdf. I used the day of year, and week of year simply because I already had that logic. I'm sure there are various ways of finding the same date limits.
 
Thanks, I am trying to understand your program. It seems to check for certain dates, then if the DST relay is set, adds 1 hour to the Real-Time clock, and if DST = 0, subtracts 1 hour.

I cannot see how your program will know whether it has already run in the time between the DST dates and the current NOW date. It seems you need a relay (or 2) that keeps up with whether it has already made the adjustment in a previous run-time. If so, it should not call Subroutines 6 and 7 again until another DST adjustment is due.
 
It will check every scan. In the top branch of rung 9, if it is not a leap year and it is past the 66th day of the year, and past week 11, then it is automatically in DST. I created a 10 year calendar so that I had a year that started on every day of the week, and those were always true.
On the third branch, if it is March, it will do my little algorithm to figure out if it is the second Sunday.
In rung 10, it does basically the same thing to unlatch the DST bit.
After the first Sunday in November, technically, it will latch in rung 9, and unlatch in rung 10 every scan, but the result will be the same in rung 11 and 12. I did have conditions to prevent that, but I tried to minimize the logic, and the result is the same.
 
It will check every scan.
Yes, I see that, but my question is: "How do you keep your routine from adding MORE than 1 Hour (or subtracting MORE than 1 hour). It seems that each time it runs (and the DST date has rolled around) then it will think it needs to add or subtract from the real-time clock (when it may have just done that the day before).

After the first Sunday in November, technically, it will latch in rung 9, and unlatch in rung 10 every scan, but the result will be the same in rung 11 and 12.
Are you saying that the ONS one-shot instructions will prevent double-adding or double-subtracting between machine runs (when the PLC is shut down then restarted more than 1 time)? Perhaps if the PLC is shut down but the program is not reloaded upon restarting, then it will retain the latched bits and the ONS bits.
 
Last edited:
Are you saying that the ONS one-shot instructions will prevent double-adding or double-subtracting between machine runs (when the PLC is shut down then restarted more than 1 time)? Perhaps if the PLC is shut down but the program is not reloaded upon restarting, then it will retain the latched bits and the ONS bits.

Now I understand what you're asking. The latch bit is retained when the power is cycled, so it is still on when it is powered up, and it doesn't activate the ONS again.
 
I don't remember if Logix500 has a MOD instruction or not, but the easiest way of determining if a given year is a leap is

Code:
MOD RTC_Year 4 Any_Integer
EQU Any_Integer 0 OTE Leap_Year_Bit

In any case, thanks for the post. Very nice work!

Cheers,
Dustin

🍻
 
The MOD makes it very easy in Step 7, but I couldn't find a similar instruction in RSLogix500. Step 7 also has DST functions, but they each have their strengths.
 
Except that leap years don't occur in years evenly divisible by 4 while not also evenly divisble by 400. (1800, 1900, 2100, etc.).

I'm planning on sitting in the plant on 12/31/2099 as it approaches 1/1/2100 to see if the PLC knows this too. Who's with me????
 
I'm planning on sitting in the plant on 12/31/2099 as it approaches 1/1/2100 to see if the PLC knows this too. Who's with me????
Sorry, I won't be able to make it. I will be dirt long before then.
 
If you really need daylight savings time in a PLC...

Set the time from a pc that has access to a reliable network time.

Completely avoids oddball PLC code.

Completely immume to further dumb legislation that changes the start and end dates of daylight savings time. Or moving the system to another country where the rules are different.

Besides, PLC clocks are notorious for drifting over time.
 

Similar Topics

We have a client with 24/7 operations with batch reports that include queries of process values from an FT Historian. They do the reports in SQL...
Replies
2
Views
1,497
Finishing up my first project with a Do-More PLC to install tomorrow morning. I'm working on small details.... like automatically adjusting for...
Replies
5
Views
1,871
Using GSV WallClockTime and LocalDateTime, when I check the box "adjust for Daylight Savings" it advances the time by one hour. What is the...
Replies
3
Views
6,397
Hello I have four slc 505 processors on an ethernet/IP network. I would like to be able to change the time and date in only one of the processors...
Replies
4
Views
2,223
Anyway to set automatic daylight savings time in North America using codesys 2.3? I have the oscat library which is good for European DST only as...
Replies
10
Views
4,418
Back
Top Bottom