Suppose I have an external device (Modbus in this case) which "forgets" all its settings on power cycle.
Therefore if I have a tag "MyTag" on that device, after a device power cycle MyTag will get reset to zero by the device. What I need is that any time the value read back from the tag is not the one last set by PlantSCADA, it gets rewritten by PS to that last value.
Note that zero is valid value that might be written by PS, I can't just assume that 0 means "device reset".
I'm trying to come up with a generic solution which will work for potentially hundreds or thousands of tags.
One idea I had was to rename MyTag as "External_MyTag", and create a new internal MyTag. At the very simple level I could then have some Cicode I run every second:
IF (MyTag <> ExternalMyTag) THEN ExternalMyTag = MyTag; END
.. repeated for every tag, but I don't really want the 1s latency that this would create, and it's not exactly elegant.
I could also use TagSubscribe to subscribe to both MyTag and ExternalMyTag and do something similar on seeing either tag change. (Does the PollTime passed to TagSubscribe apply when tags are written from withing PS? If it does I still have the latency issue.) Is TagSubscribe suitable for monitoring maybe 1000+ tags?
Is there a better way to create tags which are one-way copies of other tags?