PlcSimulator.Grpc
2.2.13
dotnet add package PlcSimulator.Grpc --version 2.2.13
NuGet\Install-Package PlcSimulator.Grpc -Version 2.2.13
<PackageReference Include="PlcSimulator.Grpc" Version="2.2.13" />
<PackageVersion Include="PlcSimulator.Grpc" Version="2.2.13" />
<PackageReference Include="PlcSimulator.Grpc" />
paket add PlcSimulator.Grpc --version 2.2.13
#r "nuget: PlcSimulator.Grpc, 2.2.13"
#:package PlcSimulator.Grpc@2.2.13
#addin nuget:?package=PlcSimulator.Grpc&version=2.2.13
#tool nuget:?package=PlcSimulator.Grpc&version=2.2.13
ZL.PlcSimulator
工业协议仿真服务器:用软件模拟真实 PLC,供上位机/驱动开发与自动化测试联调。跨平台(Windows / Linux / macOS)。
包一览
| 包 | 用途 |
|---|---|
PlcSimulator.Lite |
协议服务器实现 + 统一内存模型(netstandard2.0) |
PlcSimulator.Core |
仿真引擎、传输层、内存模型(依赖 Lite) |
PlcSimulator.Grpc |
gRPC 控制面 |
PlcSimulator.Cli |
命令行工具(plcsim,dotnet tool) |
S7Simulator.Standalone |
独立 S7 仿真器(s7sim,dotnet tool) |
安装
# 库
dotnet add package PlcSimulator.Core
# 命令行工具
dotnet tool install --global PlcSimulator.Cli
快速使用
using PlcSimulator.Lite.Memory;
var memory = new PlcMemory();
memory.Write(0x84, dbNumber: 1, address: 0, data: new byte[] { 0x12, 0x34 });
byte[] data = memory.Read(0x84, dbNumber: 1, address: 0, length: 2);
命令行:
plcsim # 交互式,输入 start 启动全部协议监听
常用协议与默认端口
| 协议 | 端口 | 地址示例 |
|---|---|---|
| 西门子 S7 | 102 | DB1.0 / M100 / I0 / Q0 |
| Modbus TCP | 502 | 00001 / 10001 / 30001 / 40001 |
| 三菱 MC 3E | 5000 | D100 / M0 |
| 欧姆龙 FINS | 9600 | D100 |
| 罗克韦尔 AB CIP | 44818 | TAGA |
| BACnet/IP | 47808 | AnalogValue:1 |
完整协议清单以代码中的 ProtocolCatalog 与 ProtocolDefaultPorts 为准。
102/502在 Linux/macOS 属特权端口。无管理员权限时用sudo,或改高位端口,例如--s7-port 1102 --modbus-port 1502。
.NET Framework 使用串口协议
PlcSimulator.Lite 是 netstandard2.0。在 .NET Framework 项目里用串口协议时,需自行显式引用:
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
不加会报 Could not load file or assembly 'System.IO.Ports'。串口在 .NET Framework 上是可用的(NuGet 会解析到 lib/net462 实现)。
内存模型
所有协议共享同一块寄存器空间:7 个固定区各 64KB(M/I/Q/T/C/AI/AQ),外加按需创建的 DB 块(每块 64KB,上限 1000 块)。协议之间数据互通。
内存按大端(ABCD)规范序存放;小端线序协议(三菱 MC、AB CIP、Beckhoff ADS 等)在各自服务器内做线序转换。
已知限制
- 报文长度校验并非所有协议都有:三菱 MC/A1E、欧姆龙 HostLink 等有 2048 点上限,BACnet 等没有。不要假定所有协议等强防护。
- macOS 上三菱 MC 的 5000 端口常被 AirPlay 占用;串口类协议需真实串口设备。
许可证
Apache-2.0。仓库:https://github.com/qwdingyu/ZL.PlcSimulator
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Google.Protobuf (>= 3.35.1)
- Grpc.Core.Api (>= 2.80.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.2.13 | 0 | 11/11/2026 |
| 2.2.12 | 86 | 11/7/2026 |
| 2.2.11 | 89 | 11/6/2026 |
| 2.2.10 | 101 | 10/26/2026 |
| 2.2.9 | 107 | 10/4/2026 |
| 2.2.8 | 104 | 10/1/2026 |
| 2.2.7 | 105 | 10/1/2026 |
| 2.2.6 | 108 | 9/30/2026 |
| 2.2.5 | 106 | 9/28/2026 |
| 2.2.4 | 100 | 9/28/2026 |
| 2.2.3 | 103 | 9/28/2026 |
| 2.2.2 | 105 | 9/28/2026 |
| 2.2.1 | 174 | 6/26/2026 |
| 1.0.3 | 135 | 6/5/2026 |
| 1.0.2 | 150 | 6/5/2026 |
| 1.0.1 | 134 | 6/4/2026 |
| 1.0.0 | 142 | 6/4/2026 |