Support Forums
Sync'ing PLC clock to VTScada

Sync'ing the clock on a PLC with the VTSCada computer time comes up fairly often. Depending on the requirements of the PLC, there are a number of ways to do this. The easiest way for all of them require using a trigger tag in the VTScada application that will trigger at a known time. For now, call this TriggerTimeSync and set an On schedule for 01:01 am and off 2 seconds later with no off schedule.

Method 1 - Set a digital control tag that uses the trigger tag as a data source. Flip a bit on in the PLC. Use that bit to set the time in the PLC directly. You know the bit is going to go high every day at 01:01:00 so you can set the PLC time and turn the bit off.

Method 2 - If you actually have to send the time to the PLC, set up three analog control tags writing out to the PLC addresses. As a data source in the control tags, use the following expressions -

[TriggerTimeSync ] ? "01": invalid {hour tag}
[TriggerTimeSync ] ? "01" : invalid {minute tag}
[TriggerTimeSync ] ? "00" : invalid {seconds tag}

This works because we know when the trigger tag is going off.

Method 3 - If you have the trigger tag set to go off at multiple times through the day, use the following expressions -

[TriggerTimeSync ] ? Time(Now(1),"hh") : invalid {hour tag}
[TriggerTimeSync ] ? Time(Now(1),"mm") : invalid {minute tag}
[TriggerTimeSync ] ? Time(Now(1),"ss") : invalid {seconds tag}

Additionally, the month or day could use -

[TriggerTimeSync ] ? Date(Today(),"MM") : invalid {month tag}

[TriggerTimeSync ] ? Date(Today(),"dd") : invalid {day tag}
Sync'ing the clock on a PLC with the VTSCada computer time comes up fairly often. Depending on the requirements of the PLC, there are a number of ways to do this. The easiest way for all of them require using a trigger tag in the VTScada application that will trigger at a known time. For now, call this TriggerTimeSync and set an On schedule for 01:01 am and off 2 seconds later with no off schedule. Method 1 - Set a digital control tag that uses the trigger tag as a data source. Flip a bit on in the PLC. Use that bit to set the time in the PLC directly. You know the bit is going to go high every day at 01:01:00 so you can set the PLC time and turn the bit off. Method 2 - If you actually have to send the time to the PLC, set up three analog control tags writing out to the PLC addresses. As a data source in the control tags, use the following expressions - ```` [TriggerTimeSync ] ? "01": invalid {hour tag} [TriggerTimeSync ] ? "01" : invalid {minute tag} [TriggerTimeSync ] ? "00" : invalid {seconds tag} ```` This works because we know when the trigger tag is going off. Method 3 - If you have the trigger tag set to go off at multiple times through the day, use the following expressions - ```` [TriggerTimeSync ] ? Time(Now(1),"hh") : invalid {hour tag} [TriggerTimeSync ] ? Time(Now(1),"mm") : invalid {minute tag} [TriggerTimeSync ] ? Time(Now(1),"ss") : invalid {seconds tag} ```` Additionally, the month or day could use - ```` [TriggerTimeSync ] ? Date(Today(),"MM") : invalid {month tag} [TriggerTimeSync ] ? Date(Today(),"dd") : invalid {day tag} ````

Doug Spurrell

edited Jul 6 '17 at 8:51 pm
278
0
1
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft