Siemens S7/TIA v18: Wall clock time (again)...

Should I choose this option for the download?
Yes. Doing both at the same time really doesn't have any downsides, unless you consider stopping the PLC as part of the HW DL a downside.
 
This is what I did:
1. Went Offline and Stopped the CPU.
2. Compile > Hardware (rebuild all)
3. Compile > Software (rebuild all)
4. Download to device > Hardware Configuration.

Then I went back Online and put CPU to RUN, but still the monitored time is 1hr ahead of what it should be.


I'm clearly being thick and doing something wrong here.

should be 15-51.png
 
https://www.youtube.com/watch?v=2qB0aFzCQyY


If you set the PLC time using your local time but before fixing the time zone from UTC+1, and then the PLC system time (RD_SYS_T) was off by 1h, but you never noticed because you were on DST so the DST offset may have canceled the system time offset. When you then fixed, per @mk42's comment, the time zone to be UTC+0, you lost the offset. Or summat like that (I think I am saying the same thing that @mk42 said about six posts ago).

Anyway, if that is what happened, then the example Hegamurl experienced (or arranged for purposes of explanation) in the video above is essentially the same situation you are experiencing, and you should be able to fix it the same way he did.

Bottom line: there is one base time in the PLC, and that is the system time. RD_SYS_T reads that time with no correction for time zone or DST. RD_LOC_T is an offset from system time that uses time zone and DST. When you set the time, via either from the PLC or by manually entering a time, in the [Set Time] window of the online diagnostics ([Online Access] => [DisplayLink Network Adapter ...] => [time of day.profinet...] => [Online and Diagnostics] => [Functions] => [Set time]), I suspect the online diagnostics interpret the entered time as a local time, and use the curent time zone and DST settings in the PLC to back-calculate a system time, and then use that back-calculated value to update the PLC system time. It's all about the bookkeeping.

Sidebar/thought experiment: if we assume that last paragraph is an accurate reverse engineering of the PLC time system, then what happens if we update the time on the PLC halfway between 2am and 3am local time on the day when the clocks fall back? How would the PLC know whether it was the local 2:30am before the change or the local 2:30am after the change?
 
https://www.youtube.com/watch?v=2qB0aFzCQyY


If you set the PLC time using your local time but before fixing the time zone from UTC+1, and then the PLC system time (RD_SYS_T) was off by 1h, but you never noticed because you were on DST so the DST offset may have canceled the system time offset. When you then fixed, per @mk42's comment, the time zone to be UTC+0, you lost the offset. Or summat like that (I think I am saying the same thing that @mk42 said about six posts ago).

Anyway, if that is what happened, then the example Hegamurl experienced (or arranged for purposes of explanation) in the video above is essentially the same situation you are experiencing, and you should be able to fix it the same way he did.

Bottom line: there is one base time in the PLC, and that is the system time. RD_SYS_T reads that time with no correction for time zone or DST. RD_LOC_T is an offset from system time that uses time zone and DST. When you set the time, via either from the PLC or by manually entering a time, in the [Set Time] window of the online diagnostics ([Online Access] => [DisplayLink Network Adapter ...] => [time of day.profinet...] => [Online and Diagnostics] => [Functions] => [Set time]), I suspect the online diagnostics interpret the entered time as a local time, and use the curent time zone and DST settings in the PLC to back-calculate a system time, and then use that back-calculated value to update the PLC system time. It's all about the bookkeeping.

Sidebar/thought experiment: if we assume that last paragraph is an accurate reverse engineering of the PLC time system, then what happens if we update the time on the PLC halfway between 2am and 3am local time on the day when the clocks fall back? How would the PLC know whether it was the local 2:30am before the change or the local 2:30am after the change?
Many thanks for this, @drbitboy.

I'll be sure to watch that video. I'm already subscribed to Hegamurl on YouTube, as I find his videos really useful.
Cheers.
 
I think we're all sorted now, thanks to the video link provided.

Once I ticked the box "Take (time) from PG/PC", the PLC time matched the wall-clock time.

The HMI is now showing the correct time.

Thanks

times match now.png
 

Similar Topics

Context: PLC= S7-1212C, HMI=KTP1200 Basic. Hi again, When the "REPORT" button is pressed (on a different screen), it takes the operator to the...
Replies
7
Views
665
Context: PLC= S7-1212C, HMI=KTP1200 Basic. Hi, The operator has reported that, from time-to-time, when he presses the "Generate Report" button...
Replies
5
Views
463
General Question: The PLC and HMI that I've been working on (a laser measurement system) is soon to be transported to the site where it will be...
Replies
2
Views
699
Hi, I'm not sure how to do this... Basically, I want to restrict the user input values for this tag to be in the range 20.001 to 25.0. I...
Replies
17
Views
1,632
Can someone help me with this? I'm no good at SCL - virtually everything I've done so far has been ladder logic. The return value from the...
Replies
13
Views
1,107
Back
Top Bottom