Can someone advise if the following is valid (it appears to work). I’ve created a Transaction Group but I haven’t actually targeted any of the tags to anything in a database (and as such I’ve just put a dummy name in the database table dropdown).
In this scenario I’m using it to sync the clock on a PLC. I’ve setup various expression tags (using dateExtract) and when the group executes they get written into a set of PLC tags. There’s a PLC bit (in this example HMI_SetClock) that I then need to set on to tell the PLC to read from the tags I’ve written to and set its internal clock. I’ve set this up as the handshake (I didn’t know if otherwise I could be sure that the data values would be written before the command bit is set on).
Here’s a screengrab:
Is there anything wrong with doing this?
And also, regarding scheduling of transaction groups, I can put in say 0:00-23:00 as a range but it won’t let me put in 0:00:01-23:00:01 Is there anyway to make it run down to a certain second?
I would guess that your transaction group would throw an error since the table doesn’t exist and the group is set up to not automatically create the table.
I sync all my PLC clocks with a gateway timer script -
[code]from time import localtime, strftime
curTime = strftime("%H:%M:%S", localtime())
if curTime == “00:00:01”:
#sync PLC clocks to server’s time
I also have a button to sync the PLC clocks that gets the current time from the database -
[code]#get time from database
dbTime = system.db.runQuery("SELECT HOUR(NOW()) as hours, " +
"MINUTE(NOW()) as minutes, " +
“SECOND(NOW()) as seconds”)
tags = [“MasterClock/SCADA/Hours”, “MasterClock/SCADA/Minutes”,
values = [dbTime[“hours”], dbTime[“minutes”],
#write time to Master Clock PLC and set SyncClocks bit
Hi Pat - thanks for your example. That would have been my other way of doing it (gateway timer script). How frequently have you got that running - presumably every 1000ms?
The Group did fail the first time but that was when I’d left the table name blank.
I put in “dummy_table” and did actually create a one column table in the DB with that name.
It seems to run without errors.
I did read something about using Transaction Groups to sync data between PLCs and presumed that was without a database in the middle.
Yes the gateway timer script is running at 1000ms. I actually have all my time based events located in this script, it makes managing time based events easier.
I did read something about using Transaction Groups to sync data between PLCs and presumed that was without a database in the middle.[/quote]
Actually, yes, you can! Unlike Pat, I sync all mine with Transaction Groups!
What you have posted is very close.
At the top, where your OPC items are, the targets should be set to “Read Only”. In the Expression items, the targets should be set to the OPC tags.
Hope this helps!