Code Monkey home page Code Monkey logo

Comments (4)

pjkundert avatar pjkundert commented on July 20, 2024

Yes, you can indeed specify the backplane slot to perform I/O operations on.

The default 'route_path' is [{"port": 1, "link": 0}]. This indicates the Backplane ("port": 1), slot 0 ("link": 0). You can specify any other slot X ("link": X), or even multi-hop 'route_path', by putting multiple entries in the route_path list.

I am working on a fairly major update to Cpppo, to provide 3.7 compatiblity (ie. due to the new 'await' keyword), and to provide better support for arbitrary route_path in requests. You can access this new version (presently 4.0.1) using pip/pip2/pip3:

 pip install --upgrade git+https://github.com/pjkundert/cpppo.git@feature-multipath

To simulate something like a backplane with a CPU in slot 3, with a tag something like "This.SCADA" which is an array of 100 DINTs:

python -m cpppo.server.enip --route-path=1/3  -v 'This.SCADA=DINT[100]'

Then to read this, in another terminal on the same host, run:

python -m cpppo.server.enip.client -v --route-path=1/3 'This.SCADA[0-99]'

This actually simulates a Logix Read Tag request, with multiple symbolic name entries in its request path:

"enip.CIP.send_data.CPF.item[1].unconnected_send.request.path.segment[0].symbolic": "This",
"enip.CIP.send_data.CPF.item[1].unconnected_send.request.path.segment[1].symbolic": "SCADA",
"enip.CIP.send_data.CPF.item[1].unconnected_send.request.path.segment[2].element": 0,

Note that this is pretty much all possible right now, in the stock 3.9.7 version of Cpppo, but the route_path components must be specified in JSON, eg: '[{"port": 1, "link": 3}]', eg.:

python -m cpppo.server.enip --route-path='[{"link": 1, "port": 3 }]' -vv 'This.SCADA=DINT[100]'

from cpppo.

Kraz113 avatar Kraz113 commented on July 20, 2024

Thanks for this, the path selection works fine!
Say now that i would like to pull data every x ms and put it int my DB.
Should i make a loop in python or do we have already such libraries to pull that out?

from cpppo.

pjkundert avatar pjkundert commented on July 20, 2024

Take a look at: https://github.com/pjkundert/cpppo/blob/master/server/enip/poll_example_many.py

If you replace the import of powerflex_750_series with:

from cpppo.server.enip.get_attribute import proxy

and use and instance of that as the via, you should be able to provide tag names in the targets dict.

from cpppo.

Kraz113 avatar Kraz113 commented on July 20, 2024

Great!
Next question that comes naturally is: is there any way to get all the tags at once from a PLC?

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.