Skip to main content

Shared memory concept known from PLC manner implemented over uModbus framework.

Project description

Modbus Shared Memory - Simpler is Better.

Introduction

Tired of all those excelent, fully featured Modbus libraries? Just want to establish this annoying communication and start doing important stuff? Here you have it.

Modbus Shared Memory is a library that allows you to:

  • establish Modbus communication,
  • forget about Modbus communication.

Modbus Shared Memory implements well-known concept from field of PLC programming. A programmer:

  • declares memory block - variables which will be exchanged via Modbus,
  • declares an object responsive for modbus communication,
  • does something with those variables - rest of the program.
from ModbusSharedMemory.client_server import ModbusMasterTCP
from ModbusSharedMemory.memory  import MemoryStore, MemoryVariable

# declare 8 Word = 16 Bytes long memory
mem = MemoryStore(8)

# map some variables to memory addresses, name them as you wish
mem.STATE = MemoryVariable.word(address=0)      # 2 Bytes
mem.COUNTER = MemoryVariable.uint32(address=1)  # 4 Bytes

# declare master worker, will exchange memory
client = ModbusMasterTCP(mem, server_ip='localhost', default_slave_id=1)

# start exchanging
client.run()

# now play with variables - do your stuff
mem.COUNTER = 10
print(mem.STATE)
# ...

# at the end, kill client worker
client.kill()

Motivation and features

Modbus Shared Memory is a python module, written in pure python, that implements concepts known from PLC programming manner. It greatly simplifies task of using Modbus protocol as a data exchange system. The whole idea born around a concept of using cheap micro-computers (eg. raspbery pi, asus tinkerboard etc.) as a HMI device, communicating with a PLC via modbus protocol. It is widely-used pattern to incorporate Modbus as a data exchange layer between PLC and HMI. Searching for a Modbus protocol implementation for python lead us to two options: uModbus and PyModbus. Those two libraries implements Modbus protocol and expose Modbus functions for programmer use. Those are great libraries, but we noticed one disadvantage: since those two are excelent for low-level manipulation and they gives much flexibility, they lacks a really simple interface known from PLC universe: declare memory that will be exchanged and forget about modbus. Modbus Shared Memory is our attempt to recreate that interface.

Features

We can enumerate current features:

  • MSM depends on standard python modules and a uModbus, which is writen in pure python,
  • MSM is written in pure python too, it does not require any compilation steps during installation,
  • can be used in any enviorment that supports python
  • it is small and simple
  • it does the job
  • it supports abstraction layer for both: slave (PLC side) and master (HMI side)

Limitations

MSM is great, however it is still under development. Current limitations are:

  • MSM supports only ModbusTCP. ModbusRTU is under development
  • MSM server (slave) is using only memory-based Modbus functions: no. 3, 6 and 16. Rest of standard functions are under development too.
  • Modbus client (master) implements only memory register based mode. Coils and Inputs are under development.

Documentation

Modbus Shared Memory readthedocs page.

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

ModbusSharedMemory-0.1.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

ModbusSharedMemory-0.1.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file ModbusSharedMemory-0.1.1.tar.gz.

File metadata

  • Download URL: ModbusSharedMemory-0.1.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6

File hashes

Hashes for ModbusSharedMemory-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6d6d9000ad2f2fcb5efa154990721c74c6f44ef74a09e6f91cc1fbcbf803270c
MD5 eef9128a57e07ae8791dab380a83fff1
BLAKE2b-256 f8f5aadafdd3ce149e62411c58c30f91328a392a29ee3545d9b8575fc5484ed9

See more details on using hashes here.

File details

Details for the file ModbusSharedMemory-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ModbusSharedMemory-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6

File hashes

Hashes for ModbusSharedMemory-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f52985ae65cd5ed9611c3ba55ea11f97a6f65919b09bc7e2e32c4b58f76bf3b
MD5 fd780f06429ac25162ffca6488fe0da0
BLAKE2b-256 3134c9403fa846d952f210d7012d071c21e6002df59ec324fa3b6044331d558a

See more details on using hashes here.

Supported by

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