Python driver for AutomationDirect Productivity Series PLCs.
Project description
Productivity
NOTE: This is in very early stages of development.
Python ≥3.5 driver and command-line tool for AutomationDirect Productivity Series PLCs.
Installation
pip install productivity
Usage
PLC Configuration
This driver uses Modbus TCP/IP for communication. Unlike the ClickPLC, modbus addresses need to be manually configured in the Productivity PLC firmware (see manual).
To use this driver, go to Write Program → Tag Database
, scroll down to the values
you care about, and double click the Mod Start
cell of each value to assign an address.
Then, go to File → Export → Tags
to export a csv file. The file is used here so
you don't need to remember the addresses.
Command Line
$ productivity the-plc-ip-address path/to/tags.csv
See productivity --help
for more.
Python
This driver uses Python ≥3.5's async/await syntax to asynchronously communicate with a ClickPLC. For example:
import asyncio
from productivity import ProductivityPLC
async def get():
async with ProductivityPLC('the-plc-ip-address', 'path/to/tags.csv') as plc:
print(await plc.get())
asyncio.run(get())
It's possible to set coils and registers on the PLC as well using keyword arguments
async def set(**kwargs):
async with ProductivityPLC('the-plc-ip-address', 'path/to/tags.csv') as plc:
print(await plc.set(**kwargs))
asyncio.run(set(target=0, setpoint=1.1))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for productivity-0.3.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5970636d77e9235f367930ef5a3135bd646a06d783b9b420824323d23f575cb |
|
MD5 | a479b9e29bf5d17abcb50121ac88326f |
|
BLAKE2b-256 | be5e62fc988e552d488e8421cbc94432f70f3c7395972bc8edf6706c93abda9e |