LECPython

LECPython is a Python component developed in C# that enables seamless communication between Python and PLCs. It requires .NET 8 runtime support. When LECPython is called for the first time, the component automatically checks if .NET 8 is installed, and if not, it will perform an automatic online installation.

LECPython supports a wide range of PLCs available in the market, including those supporting the Modbus protocol, Mitsubishi, Siemens, Omron, Rockwell, Keyence PLC, Delta, Beckhoff, Panasonic, Inovance, Fuji, EverSensing, Schneider, and more. This component is standalone, requiring no additional third-party PLC controls for support.

Introduction

LECPython provides a simple and efficient way to connect and communicate with various PLCs. Whether for industrial automation or other applications requiring PLC control, LECPython offers a reliable solution. Since LECPython is developed in C#, its read and write efficiency is faster than pure Python.

The operation process of LECPython is as follows: First, a connector is created through DeviceProfinetConnection, but it does not connect to the PLC at this time. During the first read and write operation to the PLC, the actual connection and communication with the PLC are performed through DeviceProfinetCommunication. The connector automatically completes the long connection and reconnection mechanism. As long as the DeviceProfinetConnection object is not cleared, the connector remains effective. Meanwhile, users can set the connector's data_format and is_string_reverse_byte_word to achieve high and low byte read settings for the PLC.

Features

  • Supports multiple PLC protocols including Modbus, Mitsubishi, Siemens, Omron, Rockwell, and more.
  • Easy to use API for connecting and communicating with PLCs.
  • Standalone component with no need for additional third-party PLC controls.

License

This project is licensed under the MIT License. See the LICENSE file for details.


LECPython (中文)

LECPython 是一个用 C# 开发的 Python 组件,能够实现 Python 与 PLC 之间的无缝通信。它需要 .NET 8 运行时支持,当首次调用 LECPython 时,组件会自动检查是否安装了 .NET 8,如果没有,它将自动在线安装。

LECPython 支持市场上广泛的 PLC,包括支持 Modbus 协议的 PLC、三菱、西门子、欧姆龙、罗克韦尔、基恩士、台达、倍福、松下、汇川、富士、EverSensing、施耐德等。该组件是独立的,不需要额外的第三方 PLC 控件支持。

简介

LECPython 提供了一种简单而高效的方式来连接和通信各种 PLC。无论是工业自动化还是其他需要 PLC 控制的应用,LECPython 都能提供可靠的解决方案。由于 LECPython 是基于 C# 开发的,因此其运行读写效率会比纯 Python 快。

LECPython 的运行过程如下:首先通过 DeviceProfinetConnection 创建一个连接器,但此时并不会与 PLC 进行连接。在第一次读写 PLC 时,通过 DeviceProfinetCommunication 操作,对 PLC 进行实际的连接和通讯。连接器自动完成长连接和断线重连的机制,只要 DeviceProfinetConnection 对象不被清除,连接器就一直有效。同时,用户可以通过设置连接器的 data_formatis_string_reverse_byte_word 来实现 PLC 的高低位读取设定。

特点

  • 支持多种 PLC 协议,包括 Modbus、三菱、西门子、欧姆龙、罗克韦尔等。
  • 提供易于使用的 API,用于连接和通信 PLC。
  • 独立组件,无需额外的第三方 PLC 控件。

许可证

此项目根据 MIT 许可证授权。详情请参阅 LICENSE 文件。