Remote datalogging

Nathan,

Point taken about keeping things as clear as possible - maintaining other people’s code is hard at the best of times.

As a digression, time synchronisation is something we had a look at. If a customer only requires events to be related to other events on the same machine, the time only needs to be loosely synchronised between PC and PLC. However, this would really have to be done when the local cache was empty as you point out or the order of events could get mixed up. If the customer wants inter-machine synchronisation of events, things get complicated. You have to use either specialist devices such as Allen Bradley’s synch modules for ControlLogix, or you need Ethernet switches with GPS modules which allow accurate time synchronisation using SNTP - Westermo makes switches which can achieve an accuracy of 1µS - sounds impressive, although I’ve not used them.

I loved your solution of adding the number of seconds to your base time in the SQL INSERT query. In true VB fashion I was thinking about huge expressions to calculate the number of days, hours etc. and build a date/time string before writing it out. I’ve read posts where you and Carl have been keen to stress the use of built-in tools and functions to create simpler, more elegant (and more understandable) code. Good advice :slight_smile: