All Projects → zhaopeiym → Iotclient

zhaopeiym / Iotclient

Licence: mit
这是一个物联网设备通讯协议实现客户端,将会包括主流PLC通信读取、ModBus协议、Bacnet协议等常用工业通讯协议。本组件终身开源免费,采用最宽松的MIT开源协议,您可以随意修改和商业使用(商业使用请做好评估和测试)。

Projects that are alternatives of or similar to Iotclient

Ohsce
PHP HI-REL SOCKET TCP/UDP/ICMP/Serial .高可靠性PHP通信&控制框架SOCKET-TCP/UDP/ICMP/硬件Serial-RS232/RS422/RS485 AND MORE!
Stars: ✭ 206 (-33.76%)
Mutual labels:  iot, tcp, socket, modbus
Iot Dc3
IOT DC3 is an open source, distributed Internet of Things (IOT) platform based on Spring Cloud. It is used for rapid development of IOT projects and management of IOT devices. It is a set of solutions for IOT system.
Stars: ✭ 195 (-37.3%)
Mutual labels:  plc, iot, tcp, socket
Modbus-STM32-HAL-FreeRTOS
Modbus TCP and RTU, Master and Slave for STM32 using Cube HAL and FreeRTOS
Stars: ✭ 272 (-12.54%)
Mutual labels:  tcp, modbus, plc
Fuxa
Web-based Process Visualization (SCADA/HMI/Dashboard) software
Stars: ✭ 262 (-15.76%)
Mutual labels:  plc, iot, modbus
Hslcommunication
An industrial IoT underlying architecture framework, focusing on the underlying technical communications and cross-platform, cross-language communication functions, to achieve a variety of mainstream PLC data reading and writing, to achieve modbus of various protocols read and write, and so on, to support the rapid construction of industrial upper computer software, configuration software, SCADA software, factory mes system, To help enterprise Industry 4.0 take-off, to achieve intelligent manufacturing, smart factory goals. The main PLC contains Siemens, Mitsubishi, Omron, Panasonic, Modbus, AB-PLC, Redis
Stars: ✭ 816 (+162.38%)
Mutual labels:  plc, iot, modbus
node-drivers
Industrial protocol drivers in node.js
Stars: ✭ 20 (-93.57%)
Mutual labels:  tcp, modbus, plc
net-Socket
A minimalist wrapper around System.Net.Sockets.Socket.
Stars: ✭ 21 (-93.25%)
Mutual labels:  socket, tcp
iot-master
物联大师是开源免费的物联网智能网关系统,集成了标准Modbus和主流PLC等多种协议,支持数据采集、公式计算、定时控制、自动控制、异常报警、流量监控、Web组态、远程调试等功能,适用于大部分物联网和工业互联网应用场景。
Stars: ✭ 119 (-61.74%)
Mutual labels:  modbus, plc
SocketIOUnity
A Wrapper for socket.io-client-csharp to work with Unity.
Stars: ✭ 69 (-77.81%)
Mutual labels:  socket, tcp
EasyFileTransfer
An easy way to transfer file with any size on network with tcp protocol.
Stars: ✭ 30 (-90.35%)
Mutual labels:  socket, tcp
socket
Dazzle Async Socket
Stars: ✭ 19 (-93.89%)
Mutual labels:  socket, tcp
Socketify
Raw TCP and UDP Sockets API on Desktop Browsers
Stars: ✭ 67 (-78.46%)
Mutual labels:  socket, tcp
Tiginx
Tiginx is a Shanzhai Nginx project , please buyao use it xian , if meet problem , I no fuze ...
Stars: ✭ 29 (-90.68%)
Mutual labels:  socket, tcp
workerman
An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols. PHP>=5.4.
Stars: ✭ 10,005 (+3117.04%)
Mutual labels:  socket, tcp
socket.engine
A robot communication engine
Stars: ✭ 34 (-89.07%)
Mutual labels:  socket, tcp
epoller
epoll implementation for connections in Linux, MacOS and Windows
Stars: ✭ 58 (-81.35%)
Mutual labels:  socket, tcp
DzSocket
Delphi Client/Server components to communicate using TCP Socket Asynchronous easily
Stars: ✭ 44 (-85.85%)
Mutual labels:  socket, tcp
DatagramTunneler
Simple C++ cross-platform client/server app forwarding UDP datagrams through a TCP connection.
Stars: ✭ 116 (-62.7%)
Mutual labels:  socket, tcp
socket-chat
This project will help you build a chat app by using the Socket IO library.
Stars: ✭ 36 (-88.42%)
Mutual labels:  socket, tcp
fire-im
分布式IM服务,参考https://github.com/crossoverJie/cim 实现
Stars: ✭ 17 (-94.53%)
Mutual labels:  socket, tcp

IoTClient

image image image

  • 这是一个物联网设备通讯协议实现客户端,将包括主流PLC通信读取、ModBus协议、Bacnet协议等常用工业通讯协议。
  • 本组件基于.NET Standard 2.0,可用于.Net的跨平台开发,如Windows、Linux甚至可运行于树莓派上。
  • 本组件终身开源免费,采用最宽松MIT协议,您也可以随意修改和商业使用(商业使用请做好评估和测试)。
  • 开发工具:Visual Studio 2019
  • QQ交流群:995475200
  • IoTClient Tool 下载1 下载2

使用说明

引用组件

Nuget安装 Install-Package IoTClient
或图形化安装
image

ModBusTcp读写操作

//1、实例化客户端 - 输入正确的IP和端口
ModBusTcpClient client = new ModBusTcpClient("127.0.0.1", 502);

//2、写操作 - 参数依次是:地址 、值 、站号 、功能码
client.Write("4", (short)33, 2, 16);
client.Write("4", (short)3344, 2, 16);

//3、读操作 - 参数依次是:地址 、站号 、功能码
var value = client.ReadInt16("4", 2, 3).Value;
var value2 = client.ReadInt32("4", 2, 3).Value;

//4、如果没有主动Open,则会每次读写操作的时候自动打开自动和关闭连接,这样会使读写效率大大减低。所以建议手动Open和Close。
client.Open();

//5、读写操作都会返回操作结果对象Result
var result = client.ReadInt16("4", 2, 3);
//5.1 读取是否成功(true或false)
var isSucceed = result.IsSucceed;
//5.2 读取失败的异常信息
var errMsg = result.Err;
//5.3 读取操作实际发送的请求报文
var requst  = result.Requst;
//5.4 读取操作服务端响应的报文
var response = result.Response;
//5.5 读取到的值
var value3 = result.Value;

//6、批量读取
var list = new List<ModBusInput>();
list.Add(new ModBusInput()
{
    Address = "2",
    DataType = DataTypeEnum.Int16,
    FunctionCode = 3,
    StationNumber = 1
});
list.Add(new ModBusInput()
{
    Address = "2",
    DataType = DataTypeEnum.Int16,
    FunctionCode = 4,
    StationNumber = 1
});
list.Add(new ModBusInput()
{
    Address = "199",
    DataType = DataTypeEnum.Int16,
    FunctionCode = 3,
    StationNumber = 1
});
var result = client.BatchRead(list);

ModBusRtu读写操作

//实例化客户端 - [COM端口名称,波特率,数据位,停止位,奇偶校验]
ModBusRtuClient client = new ModBusRtuClient("COM3", 9600, 8, StopBits.One, Parity.None);

//其他读写操作和ModBusTcpClient的读写操作一致

SiemensClient读写操作

//1、实例化客户端 - 输入正确的IP和端口
SiemensClient client = new SiemensClient(SiemensVersion.S7_200Smart, "127.0.0.1",102);

//2、写操作
client.Write("Q1.3", true);
client.Write("V2205", (short)11);
client.Write("V2209", 33);

//3、读操作
var value1 = client.ReadBoolean("Q1.3").Value;
var value2 = client.ReadInt16("V2205").Value;
var value3 = client.ReadInt32("V2209").Value;

//4、如果没有主动Open,则会每次读写操作的时候自动打开自动和关闭连接,这样会使读写效率大大减低。所以建议手动Open和Close。
client.Open();

//5、读写操作都会返回操作结果对象Result
var result = client.ReadInt16("V2205");
//5.1 读取是否成功(true或false)
var isSucceed = result.IsSucceed;
//5.2 读取失败的异常信息
var errMsg = result.Err;
//5.3 读取操作实际发送的请求报文
var requst  = result.Requst;
//5.4 读取操作服务端响应的报文
var response = result.Response;
//5.5 读取到的值
var value4 = result.Value;

//6、注意:关于西门子PLC读取地址
VB263、VW263、VD263中的B、W、D分别表示byte型、word型、doubleword型,分别对应C#中的byte、ushort(UInt16)、uint(UInt32)类型。
在本组件传入地址的时候不需要带数据类型,直接使用对应方法读取对应类型即可,如:
client.ReadByte("V263")
client.ReadUInt16("V263")
client.ReadUInt32("V263")

SiemensClient最佳实践

1、什么时候不要主动Open
西门子plc一般最多允许8个长连接。所以当连接数不够用的时候或者做测试的时候就不要主动Open,这样组件会自动Open并即时Close。

2、什么时候主动Open
当长连接数量还够用,且想要提升读写性能。

3、除了主动Open连接,还可以通过批量读写,大幅提升读写性能。
//批量读取
Dictionary<string, DataTypeEnum> addresses = new Dictionary<string, DataTypeEnum>();
addresses.Add("DB4.24", DataTypeEnum.Float);
addresses.Add("DB1.434.0", DataTypeEnum.Bool);
addresses.Add("V4109", DataTypeEnum.Byte);
...
var result = client.BatchRead(addresses);

//批量写入
Dictionary<string, object> addresses = new Dictionary<string, object>();
addresses.Add("DB4.24", (float)1);
addresses.Add("DB4.0", (float)2);
addresses.Add("DB1.434.0", true);
...
var result = client.BatchWrite(addresses);

4、【注意】写入数据的时候需要明确数据类型
client.Write("DB4.12", 9);          //写入的是int类型
client.Write("DB4.12", (float)9);   //写入的是float类型

5、SiemensClient是线程安全类
由于plc长连接有限,SiemensClient被设计成线程安全类。可以把SiemensClient设置成单例,在多个线程之间使用SiemensClient的实例读写操作plc。

其他更多详细使用请参考

IoTClient Tool效果图

image

image

image

image

image

image

image

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].