python中一个功能齐全的modbus协议栈
pymodbus3的Python项目详细描述
摘要
pymodbus是一个完整的modbus协议实现,它使用twisted 异步通信核心。也可以不用第三个 如果更轻量级的项目是 需要。
功能
客户端功能
- Full read/write protocol on discrete and register
- Most of the extended protocol (diagnostic/file/pipe/setting/information)
- TCP, UDP, Serial ASCII, Serial RTU, and Serial Binary
- asynchronous(powered by twisted) and synchronous versions
- Payload builder/decoder utilities
服务器功能
- Can function as a fully implemented modbus server
- TCP, UDP, Serial ASCII, Serial RTU, and Serial Binary
- asynchronous(powered by twisted) and synchronous versions
- Full server control context (device information, counters, etc)
- A number of backing contexts (database, redis, a slave device)
用例
尽管大多数系统管理员都不需要modbus 服务器在任何现代硬件上,他们可能会发现需要查询设备 他们的网络状态(PDU、PDR、UPS等)。因为图书馆是书面的 在Python中,它允许简单的脚本和/或集成到它们的存在中。 解决。
继续,大多数监控软件都需要进行压力测试 成百上千的设备(为什么这是最初编写的),但是 接触到这么多人充其量是很难的。pymodbus3服务器将允许 用户测试其基本操作系统允许的设备数量(allow 在这种情况下,表示允许多少虚拟IP地址)。
有关详细信息,请浏览 project documentation。
示例代码
对于那些只想快速入门的人,这里是:
from pymodbus3.client.sync import ModbusTcpClient client = ModbusTcpClient('127.0.0.1') client.write_coil(1, True) result = client.read_coils(1,1) print result.bits[0] client.close()
有关更高级的示例,请查看 储存库。如果您已经创建了满足特定 需要时,请随时提交,以便其他人可以受益。
另外,如果你有问题,请在邮件列表上提问 这样其他人就能从结果中受益 追踪他们。你也可以写信给 issue tracker。
安装
可以使用pip安装,也可以通过发出以下命令轻松安装 终端窗口中的命令(确保 权限或当前正在运行的虚拟机:
easy_install -U pymodbus3 pip install -U pymodbus3
否则,您可以拔出中继源并从那里安装:
git clone https://github.com/uzumaxy/pymodbus3.git cd pymodbus3 python setup.py install
两种方法都将安装所有必需的依赖项 (在它们的适当版本)用于当前的python发行版。
如果您想安装没有twisted依赖项的pymodbus3, 在运行easy_install和comment之前,只需编辑setup.py文件 所有提到的扭曲。值得注意的是没有扭曲, 其中一个只能作为 异步版本使用twisted作为其事件循环。
当前正在进行的工作
立即任务列表:
- Fixing bugs/feature requests
- Architecture documentation
- Functional testing against any reference I can find
- The remaining edges of the protocol (that I think no one uses)
许可证信息
- PyModbus建立在源代码/源代码之上:
- 版权所有(c)2001-2005 S.W.A.C.GmbH,德国。
- 版权所有(c)2001-2005 S.W.A.C.Bohemia S.R.O.,捷克共和国。
- 海尼克·佩特拉克hynek@swac.cz>;
- 扭曲矩阵
根据BSD许可证发布