ruscito / pycomm

pycomm is a package that includes a collection of modules used to communicate with PLCs
MIT License
142 stars 85 forks source link

"Timed out" Issue #39

Open A-Badkoubeh opened 6 years ago

A-Badkoubeh commented 6 years ago

I am using the example for Micrologix PLC. After a few minutes, I am getting "timed out". Any ideas what potentially can cause this "timed out"?

lynnlinse commented 6 years ago

You didn't give much info, but keep in mind that if you are 'routing' to get to the PLC, for example from your desk or control room to a factory floor, then a TCP/IP socket will likely 'die' very ungracefully if it is idle for 5 minutes. This is a router/firewall thing, unrelated to CIP timeouts. So if you are polling once a minute, then this isn't the problem, but if you have been idle, then try to talk, the socket might now be broken. You'd need to enable 'TCP keepalive' on the socket.

A-Badkoubeh commented 6 years ago

How can I enable 'TCP keepalive' on the socket? Second, I need to reach 1ms speed for reading one Integer (e.g. N7:0) is it possible to reach this cycle time using Pycomm? Thank you very much.

davisjosephh commented 6 years ago

If you get those kinds of speeds let me know what you did. As is, I struggle to keep my reads under 1s.

Nsp2121 commented 6 years ago

I have the same issue with this for reading one tag it takes about 60-70 ms and i am reading 18 tags in a while loop the problem arise when i write a plc tag from another script and just after writing tag, on the first script its throws :

Traceback (most recent call last): File "experiment-initial-screen.py", line 18, in valve_class = c.read_tag('N7:2')#old N7:3 File "/home/hydro/.local/lib/python2.7/site-packages/pycomm/ab_comm/slc.py", line 271, in read_tag addr_data=self._target_cid,)): File "/home/hydro/.local/lib/python2.7/site-packages/pycomm/cip/cip_base.py", line 590, in send_unit_data self._receive() File "/home/hydro/.local/lib/python2.7/site-packages/pycomm/cip/cip_base.py", line 770, in _receive raise CommError(e) pycomm.cip.cip_base.CommError: timed out

it happens every time i do a read or write operation simultaneously any ideas? Actual visualization : Stackoverflow