Skip to main content

Generic PLC client

Project description

Generic PLC client.

Usage

main.py

from scada_tuna import Tuna
# 用法总结:
tuna = Tuna('modbus://10.8.7.6:502?timeout=5.0&series=H5U').connect()
# tuna = Tuna('mc_3e://172.16.1.153:8100?timeout=5.0&series=L').connect()
print(tuna)
# 单次写入各种类型的数据
tuna.write('R100', 'int', 87)
tuna.write('D100', 'int', 86)
tuna.write('D200', 'long', 50054)
tuna.write('D205', 'float', [23.23, 34.56])
tuna.write('D210', 'string', 'hello world!')
print(tuna.read('R100', 'int'))
print(tuna.read('D100', 'int'))
print(tuna.read('D200', 'long'))
print(tuna.read('D205', 'float', 2))
print(tuna.read('D210', 'string', 12))
# 批量写入多种类型的数据
buffer = Buffer().append(89, 'int').append(12.23, 'float').append("hello world")
tuna.write('D500', None, buffer)
print(tuna.read('D500', 'int'))
print(tuna.read('D502', 'float'))
print(tuna.read('D504', 'string', 11))
# 批量读取多种类型的数据
buffer = tuna.read('D500', None, 20)
print(buffer.read('D500', datatype='int'))
print(buffer.read('D502', datatype='float'))
print(buffer.read('D504', datatype='string', length=11))

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

scada_tuna-0.0.3.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

scada_tuna-0.0.3-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scada_tuna-0.0.3.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for scada_tuna-0.0.3.tar.gz
Algorithm Hash digest
SHA256 43ad0f5e915d7ca716133e3840f3ca4893c1932530d0db8a132248e8958a178e
MD5 6e268d6e92245bd20a301dfdc4bed7b6
BLAKE2b-256 013c9e2600759e982a8b9408b3ddadfd14b5dbfdacae3ed870b4d0d71f14df9c

See more details on using hashes here.

File details

Details for the file scada_tuna-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: scada_tuna-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for scada_tuna-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 32065d11c8f5e8c1ec2c6b482a485fd25b9c505d44a645c4ab3ee7069e15c56c
MD5 2b0aa9012a2f4366c9c6b5fba2380d2c
BLAKE2b-256 0ac1c5b42d2722428aaf74be92035618c917fc6d5a2fbc87978c9a377e2e58a6

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