Snet.Siemens 26.75.1

dotnet add package Snet.Siemens --version 26.75.1
                    
NuGet\Install-Package Snet.Siemens -Version 26.75.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Snet.Siemens" Version="26.75.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Snet.Siemens" Version="26.75.1" />
                    
Directory.Packages.props
<PackageReference Include="Snet.Siemens" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Snet.Siemens --version 26.75.1
                    
#r "nuget: Snet.Siemens, 26.75.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Snet.Siemens@26.75.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Snet.Siemens&version=26.75.1
                    
Install as a Cake Addin
#tool nuget:?package=Snet.Siemens&version=26.75.1
                    
Install as a Cake Tool

<img src="https://api.shunnet.top/pic/nuget.png" height="32"> Snet - 工业协议与数据采集框架

License: MIT NuGet .NET

🚀 统一 · 高效 · 灵活 · 可扩展
面向工业数据采集、传输、转发、消息中间件的全栈式解决方案

✨ 框架特色

<table> <tr><td>🔄</td><td><b>同步 / 异步双模驱动</b></td><td>所有协议公共函数同时提供同步与异步 API,适配不同业务场景</td></tr> <tr><td>📐</td><td><b>统一读写参数模型</b></td><td>入参出参结构统一,协议切换零改造,降低学习与迁移成本</td></tr> <tr><td>📡</td><td><b>多点转发 & 多点解析</b></td><td>单次采集可同时转发至多个目标,并支持多级数据解析链路</td></tr> <tr><td>⚡</td><td><b>即插即用</b></td><td>NuGet 安装即用,最少 3 行代码启动一条采集链路</td></tr> <tr><td>🎭</td><td><b>虚拟点位 & 模拟库</b></td><td>内置虚拟地址与 Sim 模拟协议,无需真实设备即可开发调试</td></tr> <tr><td>🔔</td><td><b>全协议订阅模式</b></td><td>所有采集协议支持订阅式数据推送,变化驱动、实时高效</td></tr> <tr><td>🧬</td><td><b>采集 & 转发接口统一</b></td><td><code>IDaq</code> / <code>IMq</code> 统一抽象,采集与转发共享同一套 API 范式</td></tr> <tr><td>🎯</td><td><b>统一事件体系</b></td><td>同步 + 异步事件双通道,数据/信息/语言切换事件统一分发</td></tr> <tr><td>🌐</td><td><b>内置 WebAPI 控制</b></td><td>每个采集协议自带 HTTP API,远程控制开关、读写、状态查询</td></tr> <tr><td>🧩</td><td><b>极简二次开发</b></td><td>继承 <code>DaqAbstract</code> / <code>MqAbstract</code> 即可扩展新协议,开箱即用</td></tr> <tr><td>📝</td><td><b>高可定制日志</b></td><td>6 级日志(Verbose → Fatal),自定义路径、数据库输出、控制台开关</td></tr> <tr><td>🌍</td><td><b>中英文实时切换</b></td><td>全局多语言支持,运行时热切换,事件驱动自动刷新</td></tr> <tr><td>🔧</td><td><b>丰富内置能力</b></td><td>反射解析 · 脚本引擎 · 进程缓存 · 共享内存缓存 · Channel 通道</td></tr> <tr><td>📦</td><td><b>多格式序列化</b></td><td>JSON / XML / Protobuf 等一站式序列化与反序列化支持</td></tr> <tr><td>🏎️</td><td><b>高性能内核</b></td><td>无 GC.Collect 阻塞 · O(1) 字典查找 · Channel 背压控制 · 零分配热路径</td></tr> </table>

🧩 核心组件

模块 说明 关键能力
Snet.Log 日志系统 Verbose · Debug · Info · Warning · Error · Fatal,支持文件/数据库/控制台多通道输出
Snet.Utility 公共方法集 字节处理 · 枚举 · 文件 · 字符串 · 验证 · 比对 · 转换 · 反射 · JSON · XML · FTP · System
Snet.Model 数据模型层 特性 · 数据结构 · 枚举 · 接口(IDaq / IMq / ICommunication
Snet.Core 核心引擎 抽象基类 · 通信(TCP/UDP/HTTP/WS/串口) · 订阅 · Channel · 缓存 · 反射 · 脚本 · WebAPI
Snet.Driver 底层驱动 硬件通信驱动库

📡 采集协议

支持 20+ 种工业通信协议,覆盖 PLC / 工控 / 电力 / 机器人 / DB / 标准通信 等:

三菱 / 西门子 / Modbus / 汇川 / 欧姆龙 / LSis / 基恩士 / 松下 / 罗克韦尔 / 倍福  
通用电器 / 安川 / 山武 / 永宏 / 丰炜 / 富士 / 信捷 / 麦格米特 / 横河 / 丰田 / 台达 / 维控  
电力通讯规约 / OPC (UA、DA、DAHttp) / DB (SqlServer、MySql、Oracle、SQLite)  
TEP (Tcp扩展插件) / Sim (模拟库) / 英威腾 / 西蒙 / 发那科 / 自由协议 / 图尔克 / 理化

接口定义:

/// <summary>
/// 数采接口
/// </summary>
public interface IDaq : IOn, IOff, IRead, IWrite, ISubscribe, IGetStatus, IEvent, IGetParam, ICreateInstance, ILog, IWA, IGetObject, ILanguage, IDisposable, IAsyncDisposable { }

📬 消息中间件协议

支持常见的高性能消息中间件:

中间件 能力
Kafka AdminClient · Producer · Consumer
MQTT Client (Publish/Subscribe) · Service · WSService
RabbitMQ Publish · Subscribe
Netty Client (Publish/Subscribe) · Service
NetMQ Publish · Subscribe

接口定义:

/// <summary>
/// 消息中间件接口
/// </summary>
public interface IMq : IOn, IOff, IProducer, IConsumer, IGetStatus, IEvent, IGetParam, ICreateInstance, ILog, ILanguage, IDisposable, IAsyncDisposable { }

🖥️ 协议服务端 (数据模拟)

服务端 说明
MQTT Service MQTT 服务端
MQTT WS Service MQTT WebSocket 服务端
OPC UA Service OPC UA 模拟服务端
Socket Service TCP Socket 服务端
WebSocket Service WebSocket 服务端

⚡ 实例创建方式

支持 无参、有参、单例、接口化实例 等多种方式,快速上手:

//实例创建的几种方式
//以OPCUA 采集协议为例
using Snet.Model.@interface;
using Snet.Opc.ua.client;


OpcUaClientOperate? operate = null;
IDaq? daq = null;


//无参实例
operate = new OpcUaClientOperate();
//无参实例调函数创建实例,与无参实例配合使用
operate = new OpcUaClientOperate().CreateInstance(new OpcUaClientData.Basics()).GetRData<OpcUaClientOperate>();
//有参实例
operate = new OpcUaClientOperate(new OpcUaClientData.Basics());
//有参单例
operate = OpcUaClientOperate.Instance(new OpcUaClientData.Basics());
//接口 - 无参实例
daq = new OpcUaClientOperate();
//接口 - 无参实例调函数创建实例,与无参实例配合使用
daq = new OpcUaClientOperate().CreateInstance(new OpcUaClientData.Basics()).GetRData<OpcUaClientOperate>();
//接口 - 有参实例
daq = new OpcUaClientOperate(new OpcUaClientData.Basics());
//接口 - 有参单例
daq = OpcUaClientOperate.Instance(new OpcUaClientData.Basics());


using (operate)
{
    //使用完直接释放
}


using (daq)
{
    //使用完直接释放
}

📥 采集应用示例

通过 NuGet 安装协议包,快速实现采集:

//采集协议
//以OPCUA 采集协议为例
using System.Collections.Concurrent;
using Snet.Core.script;
using Snet.Log;
using Snet.Model.data;
using Snet.Model.@enum;
using Snet.Opc.ua.client;
using Snet.Utility;

using (OpcUaClientOperate operate = new OpcUaClientOperate(new OpcUaClientData.Basics
{
    ServerUrl = "opc.tcp://127.0.0.1:6688",
    UserName = "user",
    Password = "password",
}))
{
    //点位地址
    Address address = new Address();
    address.SN = Guid.NewGuid().ToString();
    address.CreationTime = DateTime.Now.ToLocalTime();
    address.AddressArray = new List<AddressDetails>
    {
         new AddressDetails()                                        //地址详情参数介绍
        {
            SN=$"",                                                  //可以理解成唯一标识符(可以存机台号、组名、车间、厂)
            AddressAnotherName="",                                   //地址别名
            AddressDataType=DataType.String,                         //数据类型
            AddressDescribe="",                                      //地址描述
            AddressExtendParam=new object(),                         //扩展数据
            AddressName="",                                          //实际地址[ 不能为空 ]
            AddressPropertyName="",                                  //属性名称
            AddressType=AddressType.Reality,                         //地址类型
            IsEnable=true,                                           //是否启用
            AddressMqParam=new AddressMq                      		 //消息队列生产
            {
                ISns = new List<string> { "ISN1", "ISN2" },          //实例SN
                Topic = $"topic",                                    //主题
                ContentFormat="Value:{0}"                            //内容格式
            },
            AddressParseParam = new AddressParse                  //反射解析
            {
                ReflectionParam = new object[]                    //反射解析的参数
                {
                    new ReflectionData.Basics                     //反射解析基础数据
                    {
                                                                  //反射解析的基础数据
                    },
                    "SN"                                          //反射解析的SN
                }
             },
         }
    };

    #region 打开
    OperateResult result = operate.On();
    LogHelper.Info(result.ToJson(true));  //转成JSON.JSON格式化
    #endregion 打开

    #region 读取
    //读取
    result = operate.Read(address);
    LogHelper.Info(result.ToJson(true));   //转成JSON.JSON格式化
    #endregion 读取

    #region 订阅
	//事件信息结果
	operate.OnInfoEvent += delegate (object? sender, EventInfoResult e)
	{
		LogHelper.Info(e.ToJson(true));    //转成JSON.JSON格式化
	};
	//事件数据结果
    operate.OnDataEvent += delegate (object? sender, EventDataResult e)
	{
		LogHelper.Info(e.ToJson(true));    //转成JSON.JSON格式化

		//得到精简版数据 速度很快 <=2ms
		IEnumerable<AddressValueSimplify>? simplifies = e.GetSource<ConcurrentDictionary<string, AddressValue>>()?.GetSimplifyArray();
	};
    result = operate.Subscribe(address);
    LogHelper.Info(result.ToJson(true));   //转成JSON.JSON格式化
    #endregion 订阅

    #region 写入
    ConcurrentDictionary<string, object> value = new ConcurrentDictionary<string, object>
    {
        ["地址"] = "string 值",
        ["地址"] = (float)1.1f,
        ["地址"] = (double)2.2d,
        ["地址"] = (int)3,
        ["地址"] = true
    };
    result = operate.Write(value);
    LogHelper.Info(result.ToJson(true));   //转成JSON.JSON格式化
    #endregion 写入

    #region 关闭
    result = operate.Off();
    LogHelper.Info(result.ToJson(true));   //转成JSON.JSON格式化
    #endregion 关闭

    #region 获取状态
    result = operate.GetStatus();
    LogHelper.Info(result.ToJson(true));   //转成JSON.JSON格式化
    #endregion 获取状态

    #region 获取参数
    result = operate.GetParam();
    LogHelper.Info(result.GetRData<ParamStructure>().ToJson(true));   //转成JSON.JSON格式化
    #endregion 获取参数
}

🔄 MQ应用示例

//MQ协议
//以MQTT为例
using Snet.Log;
using Snet.Model.data;
using Snet.Mqtt.client;
using Snet.Utility;

using (MqttClientOperate operate = new MqttClientOperate(new MqttClientData.Basics
{
    Ip = "127.0.0.1",
    Port = 11819,
    UserName = "user",
    Password = "password"
}))
{
    #region 打开
    OperateResult result = operate.On();
    LogHelper.Info(result.ToJson(true));   //转成JSON.JSON格式化
    #endregion 打开

    #region 生产
    result = operate.Produce("主题", "内容");
    LogHelper.Info(result.ToJson(true));   //转成JSON.JSON格式化
    #endregion 生产

    #region 消费
    //事件信息结果
	operate.OnInfoEvent += delegate (object? sender, EventInfoResult e)
	{
		LogHelper.Info(e.ToJson(true));    //转成JSON.JSON格式化
	};
	//事件数据结果
    operate.OnDataEvent += delegate (object? sender, EventDataResult e)
	{
		LogHelper.Info(e.ToJson(true));    //转成JSON.JSON格式化

		//根据传进的RRT 转发响应类型来判断
		 switch (basics.RT)
		 {
			 case ResponseType.Bytes:  //字节数据

				 byte[] bytes = e.GetRData<byte[]>();

				 break;
			 case ResponseType.Content:  //字符串数据

				 string str = e.GetRData<string>();

				 break;
			 case ResponseType.ContentWithTopic: //带主题与内容的包体数据

			     ResponseModel rm = e.RData.ToJsonEntity<ResponseModel>();

				 break;
		 }
	};
    result = operate.Consume("主题");
    LogHelper.Info(result.ToJson(true));   //转成JSON.JSON格式化
    #endregion 消费

    #region 关闭
    result = operate.Off();
    LogHelper.Info(result.ToJson(true));   //转成JSON.JSON格式化
    #endregion 关闭

    #region 获取状态
    result = operate.GetStatus();
    LogHelper.Info(result.ToJson(true));   //转成JSON.JSON格式化
    #endregion 获取状态

    #region 获取参数
    result = operate.GetParam();
    LogHelper.Info(result.GetRData<ParamStructure>().ToJson(true));   //转成JSON.JSON格式化
    #endregion 获取参数
}

⚙️ 常用操作类名

类名 用途
SerialOperate 串口通信
HttpClientOperate HTTP 客户端
HttpServiceOperate HTTP 服务端
TcpClientOperate TCP 客户端
TcpServiceOperate TCP 服务端
UdpOperate UDP 通信
WsClientOperate WebSocket 客户端
WsServiceOperate WebSocket 服务端
ProcessCacheOperate 进程内存缓存
ShareCacheOperate 跨进程共享缓存
ReflectionOperate 反射操作
ChannelOperate Channel 通道操作

📦 快速开始

# 1️⃣ NuGet 安装对应协议包
dotnet add package Snet.Opc.Ua.Client   # 以 OPC UA 为例
// 2️⃣ 引入命名空间
using Snet.Opc.ua.client;

// 3️⃣ 三行代码启动采集
using var operate = new OpcUaClientOperate(new OpcUaClientData.Basics { ServerUrl = "opc.tcp://127.0.0.1:6688" });
operate.On();
var result = operate.Read(address);

🏗️ 架构总览

┌─────────────────────────────────────────────────────────┐
│                     🌐 应用层                          │
│         WebAPI · 事件订阅 · 单例管理              │
├─────────────────────────────────────────────────────────┤
│  Snet.Core   │  抽象基类 · 订阅引擎 · Channel     │
│              │  缓存 · 反射 · 脚本 · 通信层         │
├──────────────┬──────────────┬──────────────┬──────────────┤
│  Snet.Model  │  Snet.Utility  │    Snet.Log    │  Snet.Driver   │
│  接口 · 模型  │  工具 · 扩展    │  日志引擎      │  硬件驱动      │
└──────────────┴──────────────┴──────────────┴──────────────┘
        │               │                │                │
        └───────────────┴────────────────┴───────────────┘
                         ↓
            🏭 设备 → 协议 → 中间件 → 应用

设备 → 协议 → 中间件 → 应用层 全链路打通,支持快速构建工业物联网系统。

📜 许可证

本项目基于 MIT 开源。请阅读 LICENSE 获取完整条款。
⚠️ 软件按 “原样” 提供,作者不对使用后果承担责任。

🌍 查阅

👉 点击跳转

Product 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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
26.75.1 26 3/16/2026
26.59.1 91 2/28/2026
26.43.1 95 2/12/2026
26.41.1 98 2/10/2026
26.36.1 1,032 2/5/2026
26.35.1 1,034 2/4/2026
26.21.1 1,114 1/21/2026
26.15.1 1,125 1/15/2026
26.13.1 1,123 1/13/2026
25.359.1 1,288 12/25/2025
25.357.1 1,288 12/23/2025
25.331.1 1,355 11/27/2025
25.329.1 1,353 11/25/2025
25.323.1 1,578 11/19/2025
25.322.3 1,572 11/18/2025
25.322.2 1,570 11/18/2025
25.322.1 1,572 11/18/2025
25.321.1 1,483 11/17/2025
25.317.1 1,569 11/13/2025
25.307.1 1,481 11/3/2025
Loading failed