pjkundert / cpppo

Communications Protocol Python Parser and Originator -- EtherNet/IP CIP
https://hardconsulting.com/products/6-cpppo-enip-api
Other
340 stars 112 forks source link

Error reading strings from Omron PLC #83

Open TimGuiteDiamond opened 4 years ago

TimGuiteDiamond commented 4 years ago

Hi, thanks for creating this really cool module! It seems to work really well but I am having some issues reading from strings, some seem to work but not others?

I am using the proxy_simple interface for ease of use.

Some strings work:

from cpppo.server.enip.get_attribute import proxy_simple
>>> host = "###.###.###.###"
>>> x, = proxy_simple(host).read(("V1.Desc"), printing=True)
         V1.Desc == Valve-01

Others give me the following error stream:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/server/enip/get_attribute.py", line 437, in read
    for val,(sts,(att,typ,uni)) in reader:
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/server/enip/get_attribute.py", line 614, in read_details
    depth=self.depth, multiple=self.multiple, timeout=self.timeout )):
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/server/enip/client.py", line 1431, in operate
    for idx,dsc,req,rpy,sts,val in harvested:
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/server/enip/client.py", line 1296, in pipeline
    col     = next( harvester )
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/server/enip/client.py", line 1228, in harvest
    issued, self.collect( timeout=timeout )): # must be "lazy" zip!
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/server/enip/client.py", line 1154, in collect
    response,elapsed= await_response( self, timeout=timeout )
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/server/enip/client.py", line 911, in await_response
    for response in cli: # if StopIteration raised immediately, defaults to {} signalling completion
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/server/enip/client.py", line 562, in __next__
    for mch,sta in engine:
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/automata.py", line 647, in run
    source=source, machine=machine, path=path, data=data, ending=ending ):
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/automata.py", line 1228, in delegate
    for which,target in submach: # 75% of runtime is spent inside 'run'
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/automata.py", line 647, in run
    source=source, machine=machine, path=path, data=data, ending=ending ):
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/automata.py", line 1228, in delegate
    for which,target in submach: # 75% of runtime is spent inside 'run'
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/automata.py", line 647, in run
    source=source, machine=machine, path=path, data=data, ending=ending ):
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/automata.py", line 1228, in delegate
    for which,target in submach: # 75% of runtime is spent inside 'run'
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/automata.py", line 647, in run
    source=source, machine=machine, path=path, data=data, ending=ending ):
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/automata.py", line 1228, in delegate
    for which,target in submach: # 75% of runtime is spent inside 'run'
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/automata.py", line 647, in run
    source=source, machine=machine, path=path, data=data, ending=ending ):
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/automata.py", line 1228, in delegate
    for which,target in submach: # 75% of runtime is spent inside 'run'
  File "/scratch/user/pipenv/pycomm-OV4KsteT/lib/python3.7/site-packages/cpppo/automata.py", line 612, in run
    "%s detected no progress before finding acceptable symbol" % ( self )
AssertionError: ((drop)) detected no progress before finding acceptable symbol

It seems to be fairly arbitrary which strings work and which ones don't. As far as I am aware they are all set up the same way on the PLC and I can indeed read them all using a different connection through our control system.

Any advice?

Thanks!

GraninDB commented 4 years ago

Hello! Try to comment code in automata.py

            #assert crumb not in seen, \
            #    "%s detected no progress before finding acceptable symbol" % ( self )
Philippe117 commented 2 years ago

Hi there, I can attest that the fix suggested by @GraninDB is working like a charm with my NJ101-1000 controller. Thank you

GraninDB commented 2 years ago

Hi! Yes, You can.

ср, 2 мар. 2022 г. в 17:00, Philippe117 @.***>:

Hi there, I can attest that the fix suggested by @GraninDB https://github.com/GraninDB is working like a charm with my NJ101-1000 controller. Thank you

— Reply to this email directly, view it on GitHub https://github.com/pjkundert/cpppo/issues/83#issuecomment-1056962467, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQXYKMLVBYRDL5OPXPIVXDU55YAXANCNFSM4LBMVM2Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

-- С уважением, Гранин Дмитрий

GraninDB commented 2 years ago

Sorry, I misunderstood your letter. Thanks for your message. I will try to mark it in GIT

ср, 2 мар. 2022 г. в 17:00, Philippe117 @.***>:

Hi there, I can attest that the fix suggested by @GraninDB https://github.com/GraninDB is working like a charm with my NJ101-1000 controller. Thank you

— Reply to this email directly, view it on GitHub https://github.com/pjkundert/cpppo/issues/83#issuecomment-1056962467, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQXYKMLVBYRDL5OPXPIVXDU55YAXANCNFSM4LBMVM2Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

-- С уважением, Гранин Дмитрий