Hi,
We have a vision project running that has a couple text fields that are bidirectionally bound to the tag provider. We then have a script attached to an SFC that builds the rest of the information that the plc needs. This is based on those inputted HMI values that get loaded in after pressing a button when the operator is ready.
We had an incident where we now want to verify at the very last step that everything that has been written to the tag provider is synced up with the PLC before proceeding.
Would this be a good way of going about checking tags T801-T814? Note this is a small portion that I have cut out for my question and most of the names of things have been changed.
def VerifyTags(tag_provider):
server = "Ignition OPC UA Server"
tag_name = "ExampleTag"
path_hmi = tag_provider + "RootFolder/" + tag_name + "/"
path_plc = "ns=1;s=[Example_PLC]" + tag_name + "."
synced = True
for i in range(1,14):
trait_ID = 'T8'+str(i).zfill(2)
hmi_val = system.tag.readBlocking(path_hmi + trait_ID)[0].value
plc_val = system.opc.readValues(server, [path_plc + trait_ID])[0].getValue()
synced = (plc_val == hmi_val)
if not synced:
break
return synced
synced = VerifyTags("[Example]")
My only hang up, and reason I'm here is that I'm worried when comparing float values. In my testing, I am getting back synced values (floats too), I just don't want to be called over the weekend or at night time because this fails
Verification and correctness are the utmost important idea in this case, is there any better built in way to do this? Maybe even on the vision side?