Skip to main content

A simple XGT Client library for Python

Project description

XGT Client (LS Electric PLC)

This package is for communicating with LS Electric's PLC via PC.

License

MIT

Usage/Examples

from time import sleep
from pyXGTClient.client import XGTClient
import struct

#Connect
testc = XGTClient(host="192.168.1.11", auto_open=True)
testc.open()

#TestCode For ContinuousData Read Write
for i in range(0, 256):
    testc.writeContinuousData("%MB300", [i,i,i,i,i,i,i,i,i,i,i,i,i,i,i])
    output = testc.readContinuousData("%MB300", 15)
    print(output)
    sleep(0.1)

#TestCode For Single Data Read Write
for i in range(0, 255):
    data0 = struct.unpack("Q", struct.pack("d", (i+ 0.0)))[0]
    data1 = struct.unpack("Q", struct.pack("d", (i+ 0.1)))[0]
    data2 = struct.unpack("Q", struct.pack("d", (i+ 0.2)))[0]
    data3 = struct.unpack("Q", struct.pack("d", (i+ 0.3)))[0]
    data4 = struct.unpack("Q", struct.pack("d", (i+ 0.4)))[0]
    data5 = struct.unpack("Q", struct.pack("d", (i+ 0.5)))[0]
    data6 = struct.unpack("Q", struct.pack("d", (i+ 0.6)))[0]
    data7 = struct.unpack("Q", struct.pack("d", (i+ 0.7)))[0]
    data8 = struct.unpack("Q", struct.pack("d", (i+ 0.8)))[0]
    data9 = struct.unpack("Q", struct.pack("d", (i+ 0.9)))[0]
    data10 = struct.unpack("Q", struct.pack("d", (i+ 0.10)))[0]
    data11 = struct.unpack("Q", struct.pack("d", (i+ 0.11)))[0]
    data12 = struct.unpack("Q", struct.pack("d", (i+ 0.12)))[0]
    data13 = struct.unpack("Q", struct.pack("d", (i+ 0.13)))[0]
    data14 = struct.unpack("Q", struct.pack("d", (i+ 0.14)))[0]
    data15 = struct.unpack("Q", struct.pack("d", (i+ 0.15)))[0]
    
    testc.writeData(["%ML100", "%ML101", "%ML102", "%ML103", "%ML104", "%ML105", "%ML106", "%ML107", "%ML108", "%ML109", "%ML110","%ML111", "%ML112", "%ML113", "%ML114", "%ML115"], [data0, data1, data2, data3, data4, data5, data6, data7, data8, data9,data10,data11,data12,data13,data14,data15])    
    output = testc.readData(["%ML100", "%ML101", "%ML102", "%ML103", "%ML104", "%ML105", "%ML106", "%ML107", "%ML108", "%ML109", "%ML110","%ML111", "%ML112", "%ML113", "%ML114", "%ML115"])
    
    doubleoutput = [struct.unpack("d", struct.pack("Q", out))[0] for out in output]
    
    print(doubleoutput)
    sleep(0.1)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyXGTClient-0.0.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file pyXGTClient-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyXGTClient-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for pyXGTClient-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e21acb68e29e3de98089837ef2b7af88d76b920b99b577222b5cf30255ff564e
MD5 b6f2777665dc8652d43e762cd85def95
BLAKE2b-256 4536a91a9945a876871fe359119610b7bd2fb80e19d191b39612c18f25345a75

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