CTS stability

mazeeff

Member
I have been using the CTS variable to create timers in my PLC code. The manual defines CTS as;
 
CTS Current total seconds since 1/1/2000 (based on local clock)
 
It would seem that CTS is based on the PLC using SNTP to define the current time. When the PLC is initially powered up, how long do I need to wait before CTS is accurate? I currently use a "DELAY 5000" in my initialization code, but have no idea what is required!
 
As soon as NTP gets the time, CTS will have the correct value. It is better to test clock year, because internal clock is set at time somewhere in 2010. If the time did not get update, or year is not greater than 2012 CTS will not be correct.
 
If the network is not available at power on, what will be the value of CTS? Does it simply initialize to "somewhere in 2010" minus 1/1/2000?
 
CTS keeps updating with its crystal clock running, that on my testing board read
371909092
after few seconds power on.
CYEAR will read 2011, of course if your board has been running for a long time, it could advanced to 2012 also, but that is some times later.
 
Interesting. My concern would be the impact of a system coming back up, after a power outage. The PLC comes would come up first, while my router would take quite a bit longer. Once network is restored, and CTS is updated, it would take a positive step function of over 60 million seconds (2 years x 365 x 24 x 60 x 60). I use CTS to measure timing for a couple of pumps. While, I can wait until CTS stabilizes, it would be preferable to run the PLC without the need for a network. What was the reason for tying CTS to a base time of 1/1/2000, as opposed to just being a timer that starts at zero at power on?
 
Back
Top