Skip to main content

pylogix2

This project will allow you to easily read/write values from tags in Rockwell Automation Logix based PLC's over Ethernet I/P using Python. PLC models inclued CompactLogix, ControlLogix and Micro8xx. Python2 and Python3 are both supported.

Getting Started

There are currently no dependencies so you can get going quickly without having to install any other prerequiste packages.

Installing

You can clone the repo with the following:

git clone https://github.com/daniel-leicht/pylogix2.git
cd pylogix2
python setup.py install --user

Or you can install with pip:

pip install pylogix2

Verifying Installation

To verify the installation on Linux, open the terminal and use the following commands:

python
import pylogix
pylogix.__version__

Your First Script:

The cloned repository will come with many examples, I'll give one here. We'll read one simple tag and print out the value. All methods will return the Response class, which contains tag_name, value and status.

from pylogix import PLC
with comm as PLC()
    comm.IPAddress = '192.168.1.9'
    ret = comm.Read('MyTagName')
    print(ret.tag_name, ret.value, ret.status)

NOTE: If your PLC is in a slot other than zero (like can be done with ControLogix), then you can specify the slot with the following:

comm.ProcessorSlot = 2

NOTE: If you are working with a Micro8xx PLC, you must set the Micro800 flag since the path is different:

comm.Micro800 = True

If you want to query module information for modules under a nested bus / backplane:

# Uses custom CIP routing path
comm.GetModuleProperties(custom_routing_path=[(1, 0), (7, 2)])

The above code will fetch module information for slot 2 of a CompactLogix CPU CompactBus virtual backplane.

Other Features

Pylogix has features other than simply reading/writing. You can see all of them in the examples, I'll also list them here

  • Discover()
  • GetPLCTime()
  • SetPLCTime()
  • GetTagList()
  • GetModuleProperties(slot=0)

Authors

License

This project is licensed under Apache 2.0 License - see the LICENSE file for details.

Acknowledgements

  • Archie of AdvancedHMI for all kinds pointers and suggestions.
  • Thanks to ottowayi for general python and good practice advice
  • Thanks to all of the users that have tested and provided feedback.

Metadata

Release files for pylogix2 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylogix2 0.5.3
File Size Uploaded
pylogix2-0.5.3.tar.gz 34.3 kB Details

Release files / pylogix2-0.5.3.tar.gz

Download URL pylogix2-0.5.3.tar.gz
Size 34.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6662bf32b574d858a00912b289340c931685efbe7f17450586fb6909f5e1aa59
BLAKE2b-256 checksum
How to use checksums
73f956e27526df22339b7657607190eb56b5b6e42c9da85de3d011a307e93d2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

Release history Release notifications | RSS feed

This release

0.5.3 This release

1 release file

0.5.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page