clutton - cpppo.
. () CIP-. ControlLogix/CompactLogix EtherNet/IP CIP, CIP-. , , , * Readix * Logix "Read Tag"; " Single/All", 8- . CIP REAL, INT, DINT ..
, " ". route_path = [] send_path = '' cpppo.server.enip.getattr attribute_operations ( cpppo.server.enip.client parse_operations):
from cpppo.server.enip import client
from cpppo.server.enip.getattr import attribute_operations
HOST = "192.168.1.100"
TAGS = ["@4/100/3"]
with client.connector(host=HOST) as conn:
for index, descr, op, reply, status, value in conn.synchronous(
operations=attribute_operations(
TAGS, route_path=[], send_path='' )):
print(": %20s: %s" % (descr, value))
!
cpppo, https://github.com/pjkundert/cpppo.git Git repo, , API . cpppo CIP REAL, , ...
...
Cpppo >= 3.9.0 cpppo.server.enip.get_attribute 'proxy' 'proxy_simple' CIP- (, ControlLogix, Compactlogix) - "" CIP (, MicroLogix, PowerFlex ..):
$ python
>>> from cpppo.server.enip.get_attribute import proxy_simple
>>> product_name, = proxy_simple( '10.0.1.2' ).read( [('@1/1/7','SSTRING')] )
>>> product_name
[u'1756-L61/C LOGIX5561']
, cpppo.server.enip.poll:
import logging
import sys
import time
import threading
from cpppo.server.enip import poll
from cpppo.server.enip.get_attribute import proxy_simple as device
params = [('@1/1/1','INT'),('@1/1/7','SSTRING')]
hostname = '10.0.1.2'
values = {}
poller = threading.Thread(
target=poll.poll, args=(device,), kwargs={
'address': (hostname, 44818),
'cycle': 1.0,
'timeout': 0.5,
'process': lambda par,val: values.update( { par: val } ),
'params': params,
})
poller.daemon = True
poller.start()
while True:
while values:
logging.warning( "%16s == %r", *values.popitem() )
time.sleep( .1 )
, ! dict. . cpppo/server/enip/poll_example *.py , , , , ..
3.9.5, CIP - cpppo.server.enip.get_attribute -. . Cpppo/server/enip/poll_example_many_with_write.py