LECPython


NameLECPython JSON
Version 1.2.3.6 PyPI version JSON
download
home_pagehttps://github.com/xeden3/LECPython
SummaryLECPython is a Python component developed in C# that enables seamless communication between Python and PLCs...
upload_time2024-11-05 02:00:29
maintainerNone
docs_urlNone
authorxeden3
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.

# Getting Started

## Installation

Ensure you have Python installed. You can install LECPython using pip:

```bash
pip install LECPython
```

LECPython automatically installs the required `pythonnet` dependency. However, if needed, you can manually install it using:

```bash
pip install pythonnet==3.0.4
```

## .NET 8 Installation

LECPython requires .NET 8 runtime support. When you call LECPython for the first time, the component will automatically check if .NET 8 is installed on your system. If not, LECPython will automatically install the .NET 8 runtime online.

### Automatic Installation Steps

1. When you run LECPython for the first time, the component will check if .NET 8 runtime is present on your system.
2. If .NET 8 runtime is not detected, LECPython will attempt to download and install .NET 8 online.
3. The installation process will vary depending on the operating system. If the automatic installation fails, LECPython will prompt you to manually install .NET 8.

### Manual Installation

If the automatic installation fails, you can manually install .NET 8 by following these steps:

- For Windows users:
  1. Visit the official .NET website: https://dotnet.microsoft.com/download/dotnet/8.0
  2. Download and run the installer for Windows.

- For Ubuntu users:
  ```bash
  wget https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-8.0.0-linux-x64-binaries
  tar -zxf dotnet-runtime-8.0.0-linux-x64.tar.gz -C $HOME/dotnet
  export PATH=$PATH:$HOME/dotnet
  ```

- For users of other Linux distributions, please refer to the installation guide on the official .NET website.

### Supported Systems

LECPython has been tested and confirmed to automatically complete the .NET 8 installation on the following systems:
- Ubuntu 20.04, 22.04
- Windows 11 WSL2 environment
- Windows 11 PowerShell environment
- Raspbian OS environment on Raspberry Pi

## Usage Example

Here's a basic example of how to use LECPython:

```python
from LECPython import LECPython

if __name__ == "__main__":
    lecp = LECPython()
    try:
        # Establish connection to Omron FINS PLC
        result = lecp.OmronFinsNetConnection("192.168.31.64", 9600, 13, 0, "CDAB", True, 2000)
        print("Omron FINS PLC Connection called successfully:", result["ErrorCode"])
        
        # Read 10 float values from address D100
        rtval = lecp.ReadNodeValues(result["Content"], "D100", "float", 10)
        print(f"The PLC read rtval is: {rtval}")
        
        # Write a float value to address D100
        rtval = lecp.WriteNodeValues(result["Content"], "D100", "float", [88.123, 726.1223])
        print(f"The PLC write rtval is: {rtval}")
        
        # Read 10 float values from address D100 again
        rtval = lecp.ReadNodeValues(result["Content"], "D100", "float", 10)
        print(f"The PLC read rtval is: {rtval}")

        # Close connection
        lecp.ConnectClose(result["Content"])
    except AttributeError as e:
        print(e)
```


# 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.
- Built-in .NET 8 runtime automatic installation.

For more detailed API documentation, please visit: [LECPython API Documentation](http://www.lecpserver.com:3003/)

# License

This project is licensed under the MIT License. See the [LICENSE](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_format` 和 `is_string_reverse_byte_word` 来实现 PLC 的高低位读取设定。




# 使用指南

## 安装

确保你已经安装了 Python。你可以使用 pip 安装 LECPython:

```bash
pip install LECPython
```

LECPython 会自动安装所需的 `pythonnet` 依赖项。如果需要,你也可以手动安装:

```bash
pip install pythonnet==3.0.4
```
## .NET 8 安装

LECPython 需要 .NET 8 运行时支持。当你第一次调用 LECPython 时,组件会自动检查系统中是否安装了 .NET 8。如果没有安装,LECPython 将会自动在线安装 .NET 8 运行时。

### 自动安装步骤

1. 当你第一次运行 LECPython 时,组件会检测系统中是否存在 .NET 8 运行时。
2. 如果没有检测到 .NET 8 运行时,LECPython 将会尝试在线下载并安装 .NET 8。
3. 安装过程会根据操作系统的不同而有所不同。如果自动安装失败,LECPython 会提示你手动安装 .NET 8。

### 手动安装

如果自动安装失败,你可以根据以下步骤手动安装 .NET 8:

- 对于 Windows 用户:
  1. 访问 .NET 官方网站:https://dotnet.microsoft.com/download/dotnet/8.0
  2. 下载并运行适用于 Windows 的安装程序。

- 对于 Ubuntu 用户:
  ```bash
  wget https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-8.0.0-linux-x64-binaries
  tar -zxf dotnet-runtime-8.0.0-linux-x64.tar.gz -C $HOME/dotnet
  export PATH=$PATH:$HOME/dotnet
  ```

- 对于其他 Linux 发行版用户,请参考 .NET 官方网站上的安装指南。

### 支持的系统

LECPython 已在以下系统上测试并确认可以自动完成 .NET 8 的安装:
- Ubuntu 20.04, 22.04
- Windows 11 WSL2 环境
- Windows 11 PowerShell 环境
- 树莓派的 Raspbian OS 环境

## 使用示例

以下是一个如何使用 LECPython 的基本示例:

```python
from LECPython import LECPython

if __name__ == "__main__":
    lecp = LECPython()
    try:
        # 开启连接器 欧姆龙 FINS PLC
        result = lecp.OmronFinsNetConnection("192.168.31.64", 9600, 13, 0, "CDAB", True, 2000)
        print("Omron FINS PLC Connection 调用成功:", result["ErrorCode"])
        
        # 从地址 D100 读取 10 个浮点值
        rtval = lecp.ReadNodeValues(result["Content"], "D100", "float", 10)
        print(f"读取的值是: {rtval}")
        
        # 向地址 D100 写入浮点值
        rtval = lecp.WriteNodeValues(result["Content"], "D100", "float", [88.123, 726.1223])
        print(f"写入的值是: {rtval}")
        
        # 再次从地址 D100 读取 10 个浮点值
        rtval = lecp.ReadNodeValues(result["Content"], "D100", "float", 10)
        print(f"读取的值是: {rtval}")

        # 关闭连接器
        lecp.ConnectClose(result["Content"])
    except AttributeError as e:
        print(e)
```

# 特点

- 支持多种 PLC 协议,包括 Modbus、三菱、西门子、欧姆龙、罗克韦尔等。
- 提供易于使用的 API,用于连接和通信 PLC。
- 独立组件,无需额外的第三方 PLC 控件。
- 自带 .NET 8 运行时自动安装。
- 
需要了解更多的API信息,请查阅官方文档: [LECPython API Documentation](http://www.lecpserver.com:3003/)

# 许可证

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


















            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/xeden3/LECPython",
    "name": "LECPython",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "xeden3",
    "author_email": "james@sctmes.com",
    "download_url": "https://files.pythonhosted.org/packages/fa/83/0c39b98a1b01d8bd63aaa9057a70c6b69ffdd69edc08a2147d1ed9693b5f/lecpython-1.2.3.6.tar.gz",
    "platform": null,
    "description": "# LECPython\n\nLECPython 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.\n\nLECPython 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.\n\n# Introduction\n\nLECPython 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.\n\nThe 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.\n\n# Getting Started\n\n## Installation\n\nEnsure you have Python installed. You can install LECPython using pip:\n\n```bash\npip install LECPython\n```\n\nLECPython automatically installs the required `pythonnet` dependency. However, if needed, you can manually install it using:\n\n```bash\npip install pythonnet==3.0.4\n```\n\n## .NET 8 Installation\n\nLECPython requires .NET 8 runtime support. When you call LECPython for the first time, the component will automatically check if .NET 8 is installed on your system. If not, LECPython will automatically install the .NET 8 runtime online.\n\n### Automatic Installation Steps\n\n1. When you run LECPython for the first time, the component will check if .NET 8 runtime is present on your system.\n2. If .NET 8 runtime is not detected, LECPython will attempt to download and install .NET 8 online.\n3. The installation process will vary depending on the operating system. If the automatic installation fails, LECPython will prompt you to manually install .NET 8.\n\n### Manual Installation\n\nIf the automatic installation fails, you can manually install .NET 8 by following these steps:\n\n- For Windows users:\n  1. Visit the official .NET website: https://dotnet.microsoft.com/download/dotnet/8.0\n  2. Download and run the installer for Windows.\n\n- For Ubuntu users:\n  ```bash\n  wget https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-8.0.0-linux-x64-binaries\n  tar -zxf dotnet-runtime-8.0.0-linux-x64.tar.gz -C $HOME/dotnet\n  export PATH=$PATH:$HOME/dotnet\n  ```\n\n- For users of other Linux distributions, please refer to the installation guide on the official .NET website.\n\n### Supported Systems\n\nLECPython has been tested and confirmed to automatically complete the .NET 8 installation on the following systems:\n- Ubuntu 20.04, 22.04\n- Windows 11 WSL2 environment\n- Windows 11 PowerShell environment\n- Raspbian OS environment on Raspberry Pi\n\n## Usage Example\n\nHere's a basic example of how to use LECPython:\n\n```python\nfrom LECPython import LECPython\n\nif __name__ == \"__main__\":\n    lecp = LECPython()\n    try:\n        # Establish connection to Omron FINS PLC\n        result = lecp.OmronFinsNetConnection(\"192.168.31.64\", 9600, 13, 0, \"CDAB\", True, 2000)\n        print(\"Omron FINS PLC Connection called successfully:\", result[\"ErrorCode\"])\n        \n        # Read 10 float values from address D100\n        rtval = lecp.ReadNodeValues(result[\"Content\"], \"D100\", \"float\", 10)\n        print(f\"The PLC read rtval is: {rtval}\")\n        \n        # Write a float value to address D100\n        rtval = lecp.WriteNodeValues(result[\"Content\"], \"D100\", \"float\", [88.123, 726.1223])\n        print(f\"The PLC write rtval is: {rtval}\")\n        \n        # Read 10 float values from address D100 again\n        rtval = lecp.ReadNodeValues(result[\"Content\"], \"D100\", \"float\", 10)\n        print(f\"The PLC read rtval is: {rtval}\")\n\n        # Close connection\n        lecp.ConnectClose(result[\"Content\"])\n    except AttributeError as e:\n        print(e)\n```\n\n\n# Features\n\n- Supports multiple PLC protocols including Modbus, Mitsubishi, Siemens, Omron, Rockwell, and more.\n- Easy to use API for connecting and communicating with PLCs.\n- Standalone component with no need for additional third-party PLC controls.\n- Built-in .NET 8 runtime automatic installation.\n\nFor more detailed API documentation, please visit: [LECPython API Documentation](http://www.lecpserver.com:3003/)\n\n# License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n-----\n\n# LECPython \uff08\u4e2d\u6587\uff09\n\nLECPython \u662f\u4e00\u4e2a\u7528 C# \u5f00\u53d1\u7684 Python \u7ec4\u4ef6\uff0c\u80fd\u591f\u5b9e\u73b0 Python \u4e0e PLC \u4e4b\u95f4\u7684\u65e0\u7f1d\u901a\u4fe1\u3002\u5b83\u9700\u8981 .NET 8 \u8fd0\u884c\u65f6\u652f\u6301\uff0c\u5f53\u9996\u6b21\u8c03\u7528 LECPython \u65f6\uff0c\u7ec4\u4ef6\u4f1a\u81ea\u52a8\u68c0\u67e5\u662f\u5426\u5b89\u88c5\u4e86 .NET 8\uff0c\u5982\u679c\u6ca1\u6709\uff0c\u5b83\u5c06\u81ea\u52a8\u5728\u7ebf\u5b89\u88c5\u3002\n\nLECPython \u652f\u6301\u5e02\u573a\u4e0a\u5e7f\u6cdb\u7684 PLC\uff0c\u5305\u62ec\u652f\u6301 Modbus \u534f\u8bae\u7684 PLC\u3001\u4e09\u83f1\u3001\u897f\u95e8\u5b50\u3001\u6b27\u59c6\u9f99\u3001\u7f57\u514b\u97e6\u5c14\u3001\u57fa\u6069\u58eb\u3001\u53f0\u8fbe\u3001\u500d\u798f\u3001\u677e\u4e0b\u3001\u6c47\u5ddd\u3001\u5bcc\u58eb\u3001EverSensing\u3001\u65bd\u8010\u5fb7\u7b49\u3002\u8be5\u7ec4\u4ef6\u662f\u72ec\u7acb\u7684\uff0c\u4e0d\u9700\u8981\u989d\u5916\u7684\u7b2c\u4e09\u65b9 PLC \u63a7\u4ef6\u652f\u6301\u3002\n\n# \u7b80\u4ecb\n\nLECPython \u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u800c\u9ad8\u6548\u7684\u65b9\u5f0f\u6765\u8fde\u63a5\u548c\u901a\u4fe1\u5404\u79cd PLC\u3002\u65e0\u8bba\u662f\u5de5\u4e1a\u81ea\u52a8\u5316\u8fd8\u662f\u5176\u4ed6\u9700\u8981 PLC \u63a7\u5236\u7684\u5e94\u7528\uff0cLECPython \u90fd\u80fd\u63d0\u4f9b\u53ef\u9760\u7684\u89e3\u51b3\u65b9\u6848\u3002\u7531\u4e8e LECPython \u662f\u57fa\u4e8e C# \u5f00\u53d1\u7684\uff0c\u56e0\u6b64\u5176\u8fd0\u884c\u8bfb\u5199\u6548\u7387\u4f1a\u6bd4\u7eaf Python \u5feb\u3002\n\nLECPython \u7684\u8fd0\u884c\u8fc7\u7a0b\u5982\u4e0b\uff1a\u9996\u5148\u901a\u8fc7 `DeviceProfinetConnection` \u521b\u5efa\u4e00\u4e2a\u8fde\u63a5\u5668\uff0c\u4f46\u6b64\u65f6\u5e76\u4e0d\u4f1a\u4e0e PLC \u8fdb\u884c\u8fde\u63a5\u3002\u5728\u7b2c\u4e00\u6b21\u8bfb\u5199 PLC \u65f6\uff0c\u901a\u8fc7 `DeviceProfinetCommunication` \u64cd\u4f5c\uff0c\u5bf9 PLC \u8fdb\u884c\u5b9e\u9645\u7684\u8fde\u63a5\u548c\u901a\u8baf\u3002\u8fde\u63a5\u5668\u81ea\u52a8\u5b8c\u6210\u957f\u8fde\u63a5\u548c\u65ad\u7ebf\u91cd\u8fde\u7684\u673a\u5236\uff0c\u53ea\u8981 `DeviceProfinetConnection` \u5bf9\u8c61\u4e0d\u88ab\u6e05\u9664\uff0c\u8fde\u63a5\u5668\u5c31\u4e00\u76f4\u6709\u6548\u3002\u540c\u65f6\uff0c\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u8fde\u63a5\u5668\u7684 `data_format` \u548c `is_string_reverse_byte_word` \u6765\u5b9e\u73b0 PLC \u7684\u9ad8\u4f4e\u4f4d\u8bfb\u53d6\u8bbe\u5b9a\u3002\n\n\n\n\n# \u4f7f\u7528\u6307\u5357\n\n## \u5b89\u88c5\n\n\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86 Python\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528 pip \u5b89\u88c5 LECPython\uff1a\n\n```bash\npip install LECPython\n```\n\nLECPython \u4f1a\u81ea\u52a8\u5b89\u88c5\u6240\u9700\u7684 `pythonnet` \u4f9d\u8d56\u9879\u3002\u5982\u679c\u9700\u8981\uff0c\u4f60\u4e5f\u53ef\u4ee5\u624b\u52a8\u5b89\u88c5\uff1a\n\n```bash\npip install pythonnet==3.0.4\n```\n## .NET 8 \u5b89\u88c5\n\nLECPython \u9700\u8981 .NET 8 \u8fd0\u884c\u65f6\u652f\u6301\u3002\u5f53\u4f60\u7b2c\u4e00\u6b21\u8c03\u7528 LECPython \u65f6\uff0c\u7ec4\u4ef6\u4f1a\u81ea\u52a8\u68c0\u67e5\u7cfb\u7edf\u4e2d\u662f\u5426\u5b89\u88c5\u4e86 .NET 8\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0cLECPython \u5c06\u4f1a\u81ea\u52a8\u5728\u7ebf\u5b89\u88c5 .NET 8 \u8fd0\u884c\u65f6\u3002\n\n### \u81ea\u52a8\u5b89\u88c5\u6b65\u9aa4\n\n1. \u5f53\u4f60\u7b2c\u4e00\u6b21\u8fd0\u884c LECPython \u65f6\uff0c\u7ec4\u4ef6\u4f1a\u68c0\u6d4b\u7cfb\u7edf\u4e2d\u662f\u5426\u5b58\u5728 .NET 8 \u8fd0\u884c\u65f6\u3002\n2. \u5982\u679c\u6ca1\u6709\u68c0\u6d4b\u5230 .NET 8 \u8fd0\u884c\u65f6\uff0cLECPython \u5c06\u4f1a\u5c1d\u8bd5\u5728\u7ebf\u4e0b\u8f7d\u5e76\u5b89\u88c5 .NET 8\u3002\n3. \u5b89\u88c5\u8fc7\u7a0b\u4f1a\u6839\u636e\u64cd\u4f5c\u7cfb\u7edf\u7684\u4e0d\u540c\u800c\u6709\u6240\u4e0d\u540c\u3002\u5982\u679c\u81ea\u52a8\u5b89\u88c5\u5931\u8d25\uff0cLECPython \u4f1a\u63d0\u793a\u4f60\u624b\u52a8\u5b89\u88c5 .NET 8\u3002\n\n### \u624b\u52a8\u5b89\u88c5\n\n\u5982\u679c\u81ea\u52a8\u5b89\u88c5\u5931\u8d25\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u4ee5\u4e0b\u6b65\u9aa4\u624b\u52a8\u5b89\u88c5 .NET 8\uff1a\n\n- \u5bf9\u4e8e Windows \u7528\u6237\uff1a\n  1. \u8bbf\u95ee .NET \u5b98\u65b9\u7f51\u7ad9\uff1ahttps://dotnet.microsoft.com/download/dotnet/8.0\n  2. \u4e0b\u8f7d\u5e76\u8fd0\u884c\u9002\u7528\u4e8e Windows \u7684\u5b89\u88c5\u7a0b\u5e8f\u3002\n\n- \u5bf9\u4e8e Ubuntu \u7528\u6237\uff1a\n  ```bash\n  wget https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-8.0.0-linux-x64-binaries\n  tar -zxf dotnet-runtime-8.0.0-linux-x64.tar.gz -C $HOME/dotnet\n  export PATH=$PATH:$HOME/dotnet\n  ```\n\n- \u5bf9\u4e8e\u5176\u4ed6 Linux \u53d1\u884c\u7248\u7528\u6237\uff0c\u8bf7\u53c2\u8003 .NET \u5b98\u65b9\u7f51\u7ad9\u4e0a\u7684\u5b89\u88c5\u6307\u5357\u3002\n\n### \u652f\u6301\u7684\u7cfb\u7edf\n\nLECPython \u5df2\u5728\u4ee5\u4e0b\u7cfb\u7edf\u4e0a\u6d4b\u8bd5\u5e76\u786e\u8ba4\u53ef\u4ee5\u81ea\u52a8\u5b8c\u6210 .NET 8 \u7684\u5b89\u88c5\uff1a\n- Ubuntu 20.04, 22.04\n- Windows 11 WSL2 \u73af\u5883\n- Windows 11 PowerShell \u73af\u5883\n- \u6811\u8393\u6d3e\u7684 Raspbian OS \u73af\u5883\n\n## \u4f7f\u7528\u793a\u4f8b\n\n\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5982\u4f55\u4f7f\u7528 LECPython \u7684\u57fa\u672c\u793a\u4f8b\uff1a\n\n```python\nfrom LECPython import LECPython\n\nif __name__ == \"__main__\":\n    lecp = LECPython()\n    try:\n        # \u5f00\u542f\u8fde\u63a5\u5668 \u6b27\u59c6\u9f99 FINS PLC\n        result = lecp.OmronFinsNetConnection(\"192.168.31.64\", 9600, 13, 0, \"CDAB\", True, 2000)\n        print(\"Omron FINS PLC Connection \u8c03\u7528\u6210\u529f:\", result[\"ErrorCode\"])\n        \n        # \u4ece\u5730\u5740 D100 \u8bfb\u53d6 10 \u4e2a\u6d6e\u70b9\u503c\n        rtval = lecp.ReadNodeValues(result[\"Content\"], \"D100\", \"float\", 10)\n        print(f\"\u8bfb\u53d6\u7684\u503c\u662f: {rtval}\")\n        \n        # \u5411\u5730\u5740 D100 \u5199\u5165\u6d6e\u70b9\u503c\n        rtval = lecp.WriteNodeValues(result[\"Content\"], \"D100\", \"float\", [88.123, 726.1223])\n        print(f\"\u5199\u5165\u7684\u503c\u662f: {rtval}\")\n        \n        # \u518d\u6b21\u4ece\u5730\u5740 D100 \u8bfb\u53d6 10 \u4e2a\u6d6e\u70b9\u503c\n        rtval = lecp.ReadNodeValues(result[\"Content\"], \"D100\", \"float\", 10)\n        print(f\"\u8bfb\u53d6\u7684\u503c\u662f: {rtval}\")\n\n        # \u5173\u95ed\u8fde\u63a5\u5668\n        lecp.ConnectClose(result[\"Content\"])\n    except AttributeError as e:\n        print(e)\n```\n\n# \u7279\u70b9\n\n- \u652f\u6301\u591a\u79cd PLC \u534f\u8bae\uff0c\u5305\u62ec Modbus\u3001\u4e09\u83f1\u3001\u897f\u95e8\u5b50\u3001\u6b27\u59c6\u9f99\u3001\u7f57\u514b\u97e6\u5c14\u7b49\u3002\n- \u63d0\u4f9b\u6613\u4e8e\u4f7f\u7528\u7684 API\uff0c\u7528\u4e8e\u8fde\u63a5\u548c\u901a\u4fe1 PLC\u3002\n- \u72ec\u7acb\u7ec4\u4ef6\uff0c\u65e0\u9700\u989d\u5916\u7684\u7b2c\u4e09\u65b9 PLC \u63a7\u4ef6\u3002\n- \u81ea\u5e26 .NET 8 \u8fd0\u884c\u65f6\u81ea\u52a8\u5b89\u88c5\u3002\n- \n\u9700\u8981\u4e86\u89e3\u66f4\u591a\u7684API\u4fe1\u606f\uff0c\u8bf7\u67e5\u9605\u5b98\u65b9\u6587\u6863: [LECPython API Documentation](http://www.lecpserver.com:3003/)\n\n# \u8bb8\u53ef\u8bc1\n\n\u6b64\u9879\u76ee\u6839\u636e MIT \u8bb8\u53ef\u8bc1\u6388\u6743\u3002\u8be6\u60c5\u8bf7\u53c2\u9605 [LICENSE](LICENSE) \u6587\u4ef6\u3002\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "LECPython is a Python component developed in C# that enables seamless communication between Python and PLCs...",
    "version": "1.2.3.6",
    "project_urls": {
        "Bug Tracker": "https://github.com/xeden3/LECPython/issues",
        "Documentation": "http://lecpserver.com:3003/",
        "Homepage": "https://github.com/xeden3/LECPython",
        "Source": "https://github.com/xeden3/LECPython"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "27c2f330d9c0924f30320268ed05cab3ecbc5bde2d4b9db8d700a605c688d144",
                "md5": "0b08e1d40e3e9d3400f19d3540835029",
                "sha256": "f62cefbaa60928ee72659a3a40bf53eb56b572de4d2bee6adb13ca81f8f309fd"
            },
            "downloads": -1,
            "filename": "LECPython-1.2.3.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0b08e1d40e3e9d3400f19d3540835029",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 3782245,
            "upload_time": "2024-11-05T02:00:24",
            "upload_time_iso_8601": "2024-11-05T02:00:24.744424Z",
            "url": "https://files.pythonhosted.org/packages/27/c2/f330d9c0924f30320268ed05cab3ecbc5bde2d4b9db8d700a605c688d144/LECPython-1.2.3.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa830c39b98a1b01d8bd63aaa9057a70c6b69ffdd69edc08a2147d1ed9693b5f",
                "md5": "8ea83aad9e49c8c0f46919127521607c",
                "sha256": "b02f61a0a2934f5dd7995418327f3f50da68355bf00555c4a0c7aca14b7eb763"
            },
            "downloads": -1,
            "filename": "lecpython-1.2.3.6.tar.gz",
            "has_sig": false,
            "md5_digest": "8ea83aad9e49c8c0f46919127521607c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3474462,
            "upload_time": "2024-11-05T02:00:29",
            "upload_time_iso_8601": "2024-11-05T02:00:29.064671Z",
            "url": "https://files.pythonhosted.org/packages/fa/83/0c39b98a1b01d8bd63aaa9057a70c6b69ffdd69edc08a2147d1ed9693b5f/lecpython-1.2.3.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-05 02:00:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xeden3",
    "github_project": "LECPython",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "lecpython"
}
        
Elapsed time: 0.34949s