Skip to main content

Python client library for PLC Magnet Mover using Ethernet/IP communication

Project description

Linestar Python Client Library

This is the Linestar Python client library, which provides functionality for controlling the PLC Magnet Mover. The library allows you to connect to the PLC, wake up the system, move to the home position, go to a specific position, and retrieve location and error margin information.

Installation

To use the Linestar Python client library, follow the steps below to install it using pip:

Create a new directory for your project:

mkdir my-project
cd my-project

Create a new Python virtual environment:

python3 -m venv venv
source venv/bin/activate

Create a requirements.txt file and add the following line to it:

linestar

Install the required dependencies using pip:

pip install -r requirements.txt

You're now ready to use the Linestar library!

Example Usage

Here's an example of how to use the Linestar library within a Python program:

from linestar import PLCMagnetMover

def main():

    plc = PLCMagnetMover("192.168.1.100") # Replace with your PLC IP address

    # Connect to the PLC
    plc.connect()

    # Wake up the system
    plc.wake()
    print("System woke up successfully")

    # Move to the home position
    plc.move_to_home()
    print("Moved to home position successfully")

    # Go to a specific position
    plc.go_to_position(1.0, 2.5)
    print("Moved to position (1.0, 2.5) successfully")

    # Retrieve location information
    location = plc.report_location()
    print("Current location:", location)

    # Retrieve error margin information
    error_margin = plc.report_error_margin()
    print("Error margin:", error_margin)

    # Disconnect from the PLC
    plc.disconnect()

if name == "main":

    main()

Replace the IP address "192.168.1.100" with the actual IP address of your PLC.

Updating & Distribution

Build the distribution package:

python setup.py sdist bdist_wheel

Test the distribution package by installing it in a new virtual environment:

python -m venv test_env

source test_env/bin/activate  # For Linux/macOS

test_env\Scripts\activate  # For Windows

pip install dist/linestar-0.0.2.tar.gz

Upload your package to PyPI using Twine:

pip install twine

twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linestar-0.0.3.tar.gz (2.1 kB view details)

Uploaded Source

File details

Details for the file linestar-0.0.3.tar.gz.

File metadata

  • Download URL: linestar-0.0.3.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for linestar-0.0.3.tar.gz
Algorithm Hash digest
SHA256 8cdcf5c2f1924a8871903967d8cb5880b324c09e9ce9cdaf41aa3b41ba70068e
MD5 9063a95ccb272a09a296b9b889de4f67
BLAKE2b-256 c22bfeb84f829218bfe82547132ecd7b095cc709719a4445fd9d47faf8722b12

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page