Code Monkey home page Code Monkey logo

Comments (1)

pjkundert avatar pjkundert commented on July 20, 2024

Most of the complexity is because client.read is a low-level API entry point, and must be usable in many different situations. Each different type of EtherNet/IP CIP device supports a different dialect of the protocol. so you must be selective. The client.read API has to support this.

Is it a ControlLogix, CompactLogix (supports Read Tag [Fragmented], and routable requests)? Then use the standard cpppo.server.enip.client APIs. Also, you can use the Multiple Service Packet request to aggregate multiple requests into a single request.

Is it a MicroLogix? Then, no Read Tag, no routable requests. Use the cpppo.server.enip.get_attribute APIs. No support for data types (eg. REAL); you have to compose the raw 8-bit SINT data into the desired data type. Or, use the cpppo.server.enip.get_attribute proxy... classes to do it for you.

Others support only Read Tag Fragmented, others only Read Tag. You just have to try them out, and see. Others just have a broken EtherNet/IP CIP implementation (eg. PowerFlex "List Identity").

So, it's not a simple answer. This is why the API is somewhat... flexible. And, therefore, somewhat confusing.

There are several higher-level abstractions that you should use, if simplicity is a goal, and if you don't have any throughput challenges (eg. high latency).

Probably the simplest API to use is the cpppo.server.enip.get_attribute proxy APIs.

  1. Try the proxy or proxy_simple class with your device, to see if it has support for "routable" requests. Try something simple, like accessing the Identity object:
from cpppo.server.enip.get_attribute import proxy, proxy_simple
via = proxy( 'hostname' ) # try proxy_simple here...
with via:
    vendor,product_name = via.read( [('@1/1/1','INT'), ('@1/1/7','SSTRING)] )
  1. If that works, and you have a Tag you want to access, try:
from cpppo.server.enip.get_attribute import proxy
value, = proxy( '10.1.2.3' ).read( 'Some_Tag' )

These examples establish a connection, read the data and then close the connection. Simple, but not efficient. However, you can use the provided examples to improve things (eg. retain the connection, handle I/O failures, adjust pipelining to improve thruput, etc.), if you need to.

Cheers,

from cpppo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.