Monday, July 29, 2013

Time Sync



           Computer clocks don’t keep perfect time and tend to drift.  Since Wonderware Software products are real-time systems it is important to keep the time correct to avoid problems like data loss, incorrect data, and a variety of other problems.  Such problems can be prevented by implementing a time sync strategy.

           There is a wide range of time sync strategies ranging from enabling the domain controller’s time sync feature to relying on a feature of Historian that is on by default.  The one strategy that stands out from the crowd is using a command line program called net time.  It is the simplest to implement and works better than the rest.


             Implementing net time is as simple as creating a Windows Scheduled Task to run the command “NET TIME \\Historian /SET /YES” every hour on all control system PCs except the PC selected to be the time master.  The time master PC should sync to an atomic clock either through the Internet or an NTP time server available on the LAN.  If there is a Historian in the system it is the preferred time master.  For screenshots on implementing net time refer to Wonderware Tech Note 882.

             If you are using System Platform it would be good to consider implementing net time inside of an object.  The advantage is maintenance.  A small problem of having a Windows Scheduled Task is when replacing the PC years later the Windows Scheduled Task might be forgotten and not migrated to the new PC.  The Windows Scheduled Task isn’t remembered again until there is a problem with time synchronization and it has to be troubleshot/re-implemented.  This problem can be avoided by implement net time inside a platform object, this way it is automatically deployed to the computer.  Even the potential problem of the time master’s computer name changing could be dealt with by doing some engineering. For example, you could place an attribute on the platform called “TimeMasterName” and use that when calling net time.

             It is important to turn off other time sync tools when implementing net time.  When multiple time sync tools are on they tend to conflict.  Below is the list of commonly used time sync tools on systems.  Exactly how to disable them varies between versions, but a quick Google search can look up disabling methods.

  • ·         Windows Automatic Time Sync to Internet

  • ·         VMWare’s Time Sync

  • ·         Hyper-V’s Time Sync

  • ·         Historian’s SuiteLink Time Sync (found in the system parameters)

  • ·         The Domain Controller’s Automatic Time Sync (off by default)


Helpful Links
Wonderware Tech Note 882 on using net time.  Note that it isn't necessary to make a batch file like the tech note does, a windows scheduled task can run net time commands without a batch file: https://wdnresource.wonderware.com/support/kbcd/html/1/t002685.htm


No comments:

Post a Comment