pjkundert / cpppo

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

Server Usage #24

Closed ekw closed 7 years ago

ekw commented 7 years ago

I'm sorry I don't really have an issue, but I don't see a forum for asking questions about cpppo other than here. If there is one, please feel free to point me to more appropriate place.

I want to implement an Ethernet/IP server for a device and wondering if this is the best way to go about it with cpppo.

  1. Run enip_server with the "variables" I need: enip_server --print AAA=INT[10] BBB=SSTRING[5] CCC=FLOAT[5] Are AAA, BBB and CCC also known as "tags" in Ethernet/IP lingo?
  2. Use another process to run enip_client as needed (or periodically) to update the variables with latest values: enip_client -v -a ServerIpAddress --print AAA[0]=1 AAA[3]=6 BBB[0]="Test" CCC[3]=3.2 etc.
  3. A PLC can now access my device via its conventional Ethernet/IP interface.

Thank you for any suggestions.

pjkundert commented 7 years ago

Generally, PLCs use the EtherNet/IP CIP "Implicit" or "Connected" requests via UDP/IP for real-time communication within the factory-floor LAN. The cpppo API doesn't implement this part of the protocol. It implements the TCP/IP "Unconnected" or "Explicit" request/response part of the protocol. This is generally the one used by computers that interact with PLCs (quite often from outside the factory-floor LAN).

So, usually it is necessary to "poll" a PLC, to get updates on its values, in a Python program. We can't have the PLC spontaneously send its updated values to the Python 'cpppo' program using "Connected" messages.

Hope that helps!