I have configured the TCP driver to monitor a checkweigher which spits out a data string at 3 s intervals when running. The connection status keeps changing from Good to Not Connected.
In an attempt to debug the comms I created a DebugString tag in my UDT. I can write to this in the TCPDataString value changed event as follows:
system.tag.write("[.]DebugString", “TCP value changed! " + currentValue.value[22:30] )
system.tag.write(”[.]DebugString", “TCP value is good @ " + currentValue.value[22:30] )
if currentValue.value != system.tag.read(”[.]_FilteredDataString"):
system.tag.write("[.]DebugString", "TCP value is NOT good @ " + currentValue.value[22:30] )
Figure 1. Watch the DebugString. Every 20 s or so it reports a random number. (The animation is 20 s long and there is one occurrence of the string ‘7’.)
- Where is the ‘7’ coming from? There is nothing else writing to that tag.
- Why is my connection dropping off?
Figure 2. TCP device configuration.
Figure 3. Console report.