The pymcprotocol-wrapper is a Python package that provides a convenient interface for interacting with PLCs using the pymcprotocol library. This wrapper allows developers to easily connect to PLCs, read and write data, and perform various operations without needing to directly interact with the underlying protocol.
- Client Class: A robust implementation that wraps the
pymcprotocollibrary for seamless PLC communication. - Mock Client: A simulated client for testing and development purposes, allowing you to work without a physical PLC connection.
- Utility Functions: Helpful functions for data conversion and validation to support the main functionality of the wrapper.
To install the pymcprotocol-wrapper, you can use pip:
pip install pymcprotocol-wrapperAlternatively, you can clone the repository and install it locally:
git clone https://github.com/yourusername/pymcprotocol-wrapper.git
cd pymcprotocol-wrapper
pip install .Here’s a simple example of how to use the pymcprotocol-wrapper:
from pymcprotocol_wrapper.client import Client
# Create a client instance
client = Client()
# Connect to the PLC
client.connect()
# Read data from the PLC
data = client.read_data('D100')
# Write data to the PLC
client.write_data('D100', 123)
# Disconnect from the PLC
client.disconnect()For more detailed usage, please refer to the examples provided in the examples directory.
To run the tests for the pymcprotocol-wrapper, you can use:
pytest tests/Make sure to have the development dependencies installed as specified in requirements-dev.txt.
This project is licensed under the MIT License. See the LICENSE file for more details.