Python driver for AutomationDirect Productivity Series PLCs.
Project description
Productivity
Python ≥3.8 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
To print the tags and their values, simply call the library with the PLC IP address and the tags file.
$ productivity the-plc-ip-address path/to/tags.csv
Use --set to set values on the PLC:
$ productivity the-plc-ip-address path/to/tags.csv -s "{int_test: 4, float_test: 4.45, string_test: foo}"
The --set parameter takes YAML, a simple data format that allows you to easily set multiple tags at once.
See productivity --help
for more.
Python
This driver uses Python ≥3.5's async/await syntax to asynchronously communicate with a Productivity2000 PLC. For example (note that asyncio.run() requires Python >=3.7):
import asyncio
from productivity import ProductivityPLC
async def run():
async with ProductivityPLC('the-plc-ip-address', 'path/to/tags.csv') as plc:
print(await plc.get())
asyncio.run(run())
It is also possible to set tag values:
async def run():
async with ProductivityPLC('the-plc-ip-address', 'path/to/tags.csv') as plc:
await plc.set(start=True, setpoint=1.1)
asyncio.run(run())
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
File details
Details for the file productivity-0.13.0.tar.gz
.
File metadata
- Download URL: productivity-0.13.0.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d3cd13e8443adeb9755b2a12c64c6272d42fbe90b4bd17ccfe1fc83400dd736 |
|
MD5 | eff4fbd822cb0a46ae5efc114f90b5ac |
|
BLAKE2b-256 | 71a18adb7644ac15be350ca81b3bb277de50d85851248781992fe3e85acbde7d |
File details
Details for the file productivity-0.13.0-py3-none-any.whl
.
File metadata
- Download URL: productivity-0.13.0-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b30cf8894cdebe6c8308753e5c10972abe078b2b8c1a9acbeaa1c471e143710 |
|
MD5 | 136d1c44034fc446526289c755ffb393 |
|
BLAKE2b-256 | 9567be8d895314558ff0cdd2febd0a9a181e74c33bc06cdcd00127b0d6371e37 |