Update: I seem to be mistaken about the UDP connection. It's TCP. Post edited.
My Ignition reading of a checkweigher is missing transmissions.
Skip to the end for the actual questions. Come back to here for the details.
The details
I have several checkweighers serving on port 9000 a weigh reading every 3 s or so, when running. The message is in the form:
"?Date=2011-05-11,TIME=9:47:31,MachineID=1234567,Product=Yum Yum Chocolate CM,SKU=YYC001,Weight=216.35,TO=228.37,Target=216.37,TU=204.37,Length=183,Speed=35.0,TradeCount=997,Total=1000,BatchNum=RUN3 30 MIN?"
I have a TCP driver setup with
- IP address:
- port 9000
- Inactivity timeout = 0
- Message delimiter type: PacketBased
- Message delimiter: [blank]
- Field count: 0
- Field delimiter: [blank]
Tag configuration:
- Data type: String
- Enabled: Yes
- Access Rights: Read only
- OPC Item Path: ns=1;s=[{OpcDevice}]9000/Message
- Source data type: Automatic
- Scan class: Default
I am able to parse the messages and assign the values to the tags in my UDT.
Maybe relevant:
- OS: Windows 10.
- Ignition 7.8.
- Checkweigher is behind a multi-NAT router connected to the same LAN as the Ignition server.
Problem
- The Tag Browser alternates between connected and not connected.
- I'm not catching all the messages. I pop them into a database with the transaction manager and I can see that the 'Total' field increments one at a time sometimes and then skips one, two or three records. I can see this in the Ignition Web OPC Client too.
- I'm monitoring the Total value in my _UdpDataString valueChanged event and it intermittently drops from the current count (e.g., 2637) to 1 and then resumes the count. (Ignore the fact that it's not UDP.)
valueChanged event code:
Check that the datastring starts and ends with '?'. If not exit.
if not currentValue.quality.isGood():
return
cv = currentValue.value
if (cv[0:1] + cv[-3:-2]) != '??':
return
cv = cv[1:-3]Create a dictionary by splitting on ',' and then on '='.
d = dict(x.split('=') for x in cv.split(','))
system.tag.write("[.]DebugString", str(d['Total']))
system.tag.write("[.]BatchNum", d['BatchNum'])
system.tag.write("[.]Length", d['Length'])
system.tag.write("[.]MachineID", d['MachineID'])
system.tag.write("[.]Product", d['Product'])
system.tag.write("[.]SKU", d['SKU'])
system.tag.write("[.]Speed", d['Speed'])
system.tag.write("[.]Target", d['Target'])
system.tag.write("[.]TradeCount", d['TradeCount'])
system.tag.write("[.]TU", d['TU'])
system.tag.write("[.]Weight", d['Weight'])Write the total last as this will trigger the Transaction Group and we want the others ready first.
system.tag.write("[.]Total", d['Total'])
Questions
- Can anyone suggest a way to prevent the 'not connected' status?
- Is my TCP setup correct for my application?
- Am I using the correct scan class or should I create a dedicated one?
- What would cause my count to drop to 1 intermittently? (I have the transaction group paused so it shouldn't be that.)
Many thanks.