What’s the best strategy to update a lot of tags from a PLC which will then be saved to a database? The promising Strategy would appear to be a Driven Tag Group with a One Shot and Polled. However, I can’t seem to find a good way to confirm that the Tags have all updated prior to saving to the database. Using a timer delay seems inelegant and problem prone.
Thanks for the interest Kevin. I don’t want to write directly to the Sepasoft underlying database directly. I want to just run a script that uses some Sepasoft python functions to save the data. So I think that rules out using Transaction groups.
I think I want to minimize the number of tags being polled on the PLC or at least reduce the frequency of the polling to when I really need it. In doing so, I suspect that I should use the Driven Tags Group strategy. If I head down this path, I then need to know when the Tags have all been updated so that I can trigger my script to save the fresh data. I guess I am just trying to preemptively avoid a race situation.
Hmm, well, I think the only way you can be sure the tags all updated atomically is to issue an explicit read with system.opc.readValues. Anything else will be subject to timing race conditions as you already suspect.
I would create a buffer register in the PLC, then using some type of Synchronous Copy operation (In AB this would be a CPS instruction) copy the values into the buffer. Once that operation was complete, I would set a flag which would drive the script, insuring that the values were all in the buffer prior to being read with system.opc.readValues()