I have a bunch of coils, each coil calls a shared script that turns the coil bools into strings and converts them to a number to bitwise compare with a magic number to see if a fault has happened. When testing the machine will set the coil that updates the tag, but the script never runs. I tried putting in a print statement in the script to chech on the server and nothing ever shows up, any thoughts? Thanks
Are you using a ValueChange event script for firing your shared script? Can you post it?
Here’s the shared script:
tag = re.sub("([).*?(])", “\g<1>\g<2>”, tag)
unit = tag[:tag.index("/")]
for fault in range(1,69):
path.append(unit + ‘/Faults/Fault’ + str(fault))
values = system.tag.readAll(path)
lfaults = map(lambda x: str(int(x.value == True)), values)
faults = ‘’.join(lfaults)
raw1 = int(faults[:31], 2)
raw2 = int(faults[32:63], 2)
raw3 = int(faults[64:67], 2)
val = False
print "jake1: ", faults[:31], faults[32:63], faults[64:67]
if raw1 & 3271557119 or raw2 & 4110413567 or raw3 & 14:
val = True
system.tag.write(unit + ‘/Faulted’, val)import re
Here’s the value changed script:
For debugging this, you’re correct in checking the Gateway since Tag Change Events occur there. Try using a logger instead of print statements though, something like this:
You can add unique messages in both the shared script and the tag event script.
So I get messages sometimes and not others, it’s very erratic.
So this thing is kicking my ass, I can’t get the valueChanged event to trigger unless I disable and reenable a tag, is this a bug, or is there something I’m missing? I have a folder with a bunch of bools in it. The bools are opc tags getting data from coils. They run a script that will update a historical memory tag on the udt that the bools are on. Thanks