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
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 ClickPLC. For example:
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
Hashes for productivity-0.4.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2ffb85e5b5201e99959fed4448264f07981dbc9b833aeba62b7ec650dd9948a |
|
MD5 | 06b45e19db2b596bb03481c5a894d6ab |
|
BLAKE2b-256 | af03c11bf0a6c5b43ae0699e8695ae9a860acd00a15d6b7b742cbc9cde5adda4 |