Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for period in tag names #4

Closed
johanfforsberg opened this issue May 4, 2015 · 12 comments
Closed

Support for period in tag names #4

johanfforsberg opened this issue May 4, 2015 · 12 comments

Comments

@johanfforsberg
Copy link

For directly accessing tags inside "function blocks" (not sure this is the right terminology) it's necessary to use periods in the tag names, e.g. "ACC_MISC_PLC01_ALMA01.HLimit". Currently this does not seem to work.

@pjkundert
Copy link
Owner

I'll look into it today; good catch.

@pjkundert
Copy link
Owner

Fixed in branch fix-dotted-tags; try it out, if you want:

git clone --branch fix-dotted-tags git@github.com:pjkundert/cpppo.git
cd cpppo
python setup.py install

I'm doing some work on improving the multi-threaded client API unit tests, so I'll be including these improvements, too, before I push another release -- hopefully by later today.

@johanfforsberg
Copy link
Author

Thanks, that was quick! However, I get this:

[johfor@localhost ~]$ python -m cpppo.server.enip.client -a g-b080603-cab03-ctl-plc-01 -vv -p ACC_MISC_PLC01_ALMA01.HLimit
05-04 18:51:49.367        -4883a940 enip.dev DETAIL   __init__                      Logix, Class ID 0x0002, Instance ID   1 created
05-04 18:51:49.367        -4883a940 enip.dev DETAIL   lookup     Class     2/0x0002, Instance   1, Attribute  None ==> None
05-04 18:51:49.367        -4883a940 enip.dev DETAIL   lookup     Class     2/0x0002, Instance   0, Attribute  None ==> None
05-04 18:51:49.367        -4883a940 enip.dev DETAIL   lookup     Class     2/0x0002, Instance   0, Attribute  None ==> None
05-04 18:51:49.367        -4883a940 enip.dev DETAIL   lookup     Class     2/0x0002, Instance   0, Attribute  None ==> meta-Logix
05-04 18:51:49.372        -4883a940 root     DETAIL   __init__   Connect:  Success in   0.005s/  5.000s
05-04 18:51:49.372        -4883a940 enip.cli DETAIL   main       Client Register Rcvd   0.022/  5.000s
05-04 18:51:49.373        -4883a940 enip.cli DETAIL   parse_oper Tag: 'ACC_MISC_PLC01_ALMA01.HLimit' yields Operation: {'path': [{'symbolic': 'ACC_MISC_PLC01_ALMA01.HLimit'}]}
05-04 18:51:49.376        -4883a940 enip.cli DETAIL   unconnecte Client Unconnected Send: {
    "enip.CIP.send_data.CPF.item[0].type_id": 0, 
    "enip.CIP.send_data.CPF.item[1].type_id": 178, 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.path.segment[0].class": 6, 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.path.segment[1].instance": 1, 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.priority": 5, 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.request.path.segment[0].symbolic": "ACC_MISC_PLC01_ALMA01.HLimit", 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.request.read_tag.elements": 1, 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.route_path.segment[0].link": 0, 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.route_path.segment[0].port": 1, 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.service": 82, 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.status": 0, 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.timeout_ticks": 157, 
    "enip.CIP.send_data.interface": 0, 
    "enip.CIP.send_data.timeout": 0, 
    "enip.options": 0, 
    "enip.sender_context.input": "bytearray(b'0\\x00\\x00\\x00\\x00\\x00\\x00\\x00')", 
    "enip.session_handle": 5506384, 
    "enip.status": 0
}
05-04 18:51:49.377        -4883a940 root     DETAIL   format_pat Formatted     ACC_MISC_PLC01_ALMA01.HLimit from: [{'symbolic': 'ACC_MISC_PLC01_ALMA01.HLimit'}]
05-04 18:51:49.377        -4883a940 enip.cli DETAIL   issue      Sent   0.004/  5.000s: Single Read  Tag  ACC_MISC_PLC01_ALMA01.HLimit {
    "input": "bytearray(b'L\\x0f\\x91\\x1cACC_MISC_PLC01_ALMA01.HLimit\\x01\\x00')", 
    "path.segment[0].symbolic": "ACC_MISC_PLC01_ALMA01.HLimit", 
    "read_tag.elements": 1, 
    "service": 76
}
05-04 18:51:49.377        -4883a940 enip.cli DETAIL   pipeline   Issuing     0/  1; curr:   0 - last:  -1 ==   1 depth
05-04 18:51:49.395        -4883a940 enip.cli DETAIL   collect    Rcvd   0.016/  5.000s {
    "enip.CIP.send_data.CPF.count": 2, 
    "enip.CIP.send_data.CPF.item[0].length": 0, 
    "enip.CIP.send_data.CPF.item[0].type_id": 0, 
    "enip.CIP.send_data.CPF.item[1].length": 6, 
    "enip.CIP.send_data.CPF.item[1].type_id": 178, 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.request.input": "array('c', '\\xcc\\x00\\x04\\x01\\x00\\x00')", 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.request.read_tag": true, 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.request.service": 204, 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.request.status": 4, 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.request.status_ext.data": [
        0
    ], 
    "enip.CIP.send_data.CPF.item[1].unconnected_send.request.status_ext.size": 1, 
    "enip.CIP.send_data.interface": 0, 
    "enip.CIP.send_data.timeout": 0, 
    "enip.command": 111, 
    "enip.input": "array('c', '\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x00\\x00\\x00\\x00\\xb2\\x00\\x06\\x00\\xcc\\x00\\x04\\x01\\x00\\x00')", 
    "enip.length": 22, 
    "enip.options": 0, 
    "enip.sender_context.input": "array('c', '0\\x00\\x00\\x00\\x00\\x00\\x00\\x00')", 
    "enip.session_handle": 5506384, 
    "enip.status": 0
}
05-04 18:51:49.395        -4883a940 enip.cli DETAIL   pipeline   Completed   1/  1; curr:   0 - last:   0 ==   0 depth
05-04 18:51:49.395        -4883a940 enip.cli DETAIL   validate   Client Single Read  Tag  ACC_MISC_PLC01_ALMA01.HLimit Request: {
    "input": "bytearray(b'L\\x0f\\x91\\x1cACC_MISC_PLC01_ALMA01.HLimit\\x01\\x00')", 
    "path.segment[0].symbolic": "ACC_MISC_PLC01_ALMA01.HLimit", 
    "read_tag.elements": 1, 
    "service": 76
}
05-04 18:51:49.395        -4883a940 enip.cli DETAIL   validate     Yields Reply: {
    "input": "array('c', '\\xcc\\x00\\x04\\x01\\x00\\x00')", 
    "read_tag": true, 
    "service": 204, 
    "status": 4, 
    "status_ext.data": [
        0
    ], 
    "status_ext.size": 1
}
05-04 18:51:49.396        -4883a940 root     DETAIL   format_pat Formatted     ACC_MISC_PLC01_ALMA01.HLimit from: [{'symbolic': 'ACC_MISC_PLC01_ALMA01.HLimit'}]
05-04 18:51:49.396        -4883a940 enip.cli WARNING  validate   Client Single Read  Tag  ACC_MISC_PLC01_ALMA01.HLimit returned non-zero status: Status 4 [0]
05-04 18:51:49.396        -4883a940 enip.cli NORMAL   validate   ACC_MISC_PLC01_ALMA01.HLimit              == None: 'Status 4 [0]'
ACC_MISC_PLC01_ALMA01.HLimit              == None: 'Status 4 [0]'
05-04 18:51:49.396        -4883a940 enip.cli DETAIL   pipeline   Pipelined   1/  1; curr:   0 - last:   0 ==   0 depth

@pjkundert
Copy link
Owner

OK, the "Controller" (server) side is returning a status code "4"... Is this a real Rockwell controller, or are you (also) running a simulated Controller (eg. using something like: python -m cpppo.server.enip --print -v ACC_MISC_PLC01_ALMA01.HLimit=INT)? If so, did you remember to restart the simulated Controller? The fix was on the "Controller" side of the communications...

@johanfforsberg
Copy link
Author

It's a real Rockwell CompactLogix (I think) PLC.

@pjkundert
Copy link
Owner

Ahh. OK, there must be some other system by which those tags inside function blocks are addressed... We can support pretty much arbitrarily complex sets of EtherNet/IP CIP "path" elements, so we need to determine which ones to use. I'll take a look online to see if I can discover what they need to see.

@johanfforsberg
Copy link
Author

Thanks for looking into it. If there's any more information I can supply, just ask!

@pjkundert
Copy link
Owner

OK, I've pushed another fix to branch fix-dotted-tags. It now (correctly) handles generating multiple 'symbolic' path segments, for any Tags containing 1 (or more) '.' symbols.

@pjkundert
Copy link
Owner

Found and fixed some multi-threading issues in both Client API and Controller communications simulator. Aggressive threaded Client tests now pass reliably.

@pjkundert
Copy link
Owner

Version 3.6.0 has been pushed, fixing both multi-segment symbolic paths, and some multi-threading issues.

@pjkundert
Copy link
Owner

Version 3.6.1 pushed; fixes a problem in the client API's handling of Multiple Service Packets introduced in 3.6.0.

@johanfforsberg
Copy link
Author

Amazing, thanks!

pjkundert added a commit that referenced this issue Jan 30, 2018
# This is the 1st commit message:

Initial foray in to support for generic CIP Service Code requests

# This is the commit message #2:

No requirement for existence of .multiple segment in failed responses

# This is the commit message #3:

Correct handling of service_code operations in client connector I/O

# This is the commit message #4:

HART Requests almost working
o Cannot derive HART from Logix; service codes overlap

# This is the commit message #5:

Initial working HART I/O card request

# This is the commit message #6:

Support intermixed Tags and already parsed operation in parse_operations

# This is the commit message #7:

Test and decode the Read primary variable response, however:
o Still broken; the CIP Encapsulation path is still suppsed to be to the
  Connection Manager @0x06/1!  The 0x52 Route Path is Port 1, Address 2,
  and the message path should be to @0x035D/8.

# This is the commit message #8:

Success.  Still needs cleanup

# This is the commit message #9:

Further attempts to refine HART pass-thru.
o HART I/O card is not responding as defined in documentation

# This is the commit message #10:

Cleanups for python3, source analysis, unit tests

# This is the commit message #11:

Attempt to parse Read Dynamic Variables reply; 3 unrecognzied bytes?

# This is the commit message #12:

Update to attempt to parse real HART I/O card response
o Minimal Read Dynamic Variables status response?  Not successful
o Implement minimal simulated pass-thru Init/Query, HART commands 1,2,3
o Minor changes to client.py Send RR Data, to have timeout and ticks
  compatible with RSLogix; no difference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants