• Stars
    star
    1,316
  • Rank 34,569 (Top 0.7 %)
  • Language
    C#
  • Created almost 5 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A very popular industrial Internet of Things communication plug-in. Using this dll can be very convenient, stable, and fast to obtain data from PLC equipment of multiple brands, and also supports redis, mqtt, websocket, etc., which can let your data on the network Free transmission, reducing enterprise development costs.
             ///\      ///\             /////////\              ///\
            //\\/      //\/           //\\\\\\\\//\            //\\/
           //\/       //\/          //\\/       \\/           //\/
          //\/       //\/           \//\                     //\/
         /////////////\/             \//////\               //\/
        //\\\\\\\\\//\/               \\\\\//\             //\/
       //\/       //\/                     \//\           //\/
      //\/       //\/           ///\      //\\/          //\/       //\
     ///\      ///\/            \/////////\\/           /////////////\/
     \\\/      \\\/              \\\\\\\\\/             \\\\\\\\\\\\\/             Present by Richard.Hu

HslCommunication

Build status NuGet Status NuGet Download Gitter NetFramework Visual Studio copyright status

HslCommunication.jar

Build status NetFramework version JDK status IDE status copyright status

HslCommunication.py

Build status NetFramework version download IDE status copyright status

CopyRight

(C) 2017 - 2023 Richard.Hu, All Rights Reserved

Authorization(授权)

具体可以参照 http://www.hsltechnology.cn/Home/Licence?area=HslCommunication

试用授权: 加入 技术支持VIP群 即可以获得激活码,支持长时间测试使用。企业用户可以联系微信:13516702732 申请试用的证书

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main( )
        {
            // 授权示例   调用一次即可  call only once
            if(!HslCommunication.Authorization.SetAuthorizationCode( "你的激活码" ))
            {
                MessageBox.Show( "授权失败!当前程序只能使用8小时!" );
                return;
            }


            Application.EnableVisualStyles( );
            Application.SetCompatibleTextRenderingDefault( false );
            Application.Run( new Form1( ) );
        }

商用授权(赠送源代码):

  1. 公对公签订合同。
  2. 公对公打款,开具增值税发票。
  3. 获取专用的软件,账户,来下载最新的源代码,激活码
  4. 企业专业培训额外付费,1000元人民币1小时,培训控件使用,控件开发。

Official Website

Webside: http://www.hslcommunication.cn/

API: http://api.hslcommunication.cn/

Gitter[talk with me]: https://gitter.im/HslCommunication/community

What is HSL

This is an industrial IoT based, computer communications architecture implementation, integrated with most of the basic functional implementation of industrial software development, such as Mitsubishi PLC Communications, Siemens PLC Communications, OMRON PLC Communications, Modbus Communications, All of these communications have been implemented in multiple languages, and of course, the feature integration of the main. NET Library is even more powerful, in addition to the implementation of cross-program, cross-language, cross-platform communication, so that you are no longer obsessed with the use of Windows or Linux system, the realization of log function, flow number generation function, mail sending function, Fourier transform function, and so on, will integrate more common features of industrial environment in the future.

In order not to let the industry 4.0 stay on the slogan, the high-rise flat up, and the cornerstone is HSL.

What can HSL do

HSL can connect the equipment of the industrial production site to the free transmission of data at the bottom, whether active or passive, whatever your acquisition system (usually the acquisition system is a Windows computer, or an embedded system, or a Linux-based box), can achieve the random transmission of data, convenient and fast to achieve a strong, real-time, high-response robust system, whether you are building a C/S system, or B/S system, or C-B-S-A (Integrated desktop client, browser, Android) hybrid system, is a fast and low-cost implementation,

As long as you have the primary data of the industrial field, that is, can build a powerful real-time monitoring function of the software, production reports and automated scheduling software, a variety of process parameters history tracking software, data based on the experience of machine learning software, as well as full-featured MES system and so on.

By the way, the traditional industrial model is the procurement of off-the-shelf industrial software, including the host computer software and MES system, while ignoring their own system. For some industry-standard functional software, such as ERP systems, financial software, these can be purchased directly, However, for the host computer and MES system, the actual needs of each enterprise are very different, it is difficult to have a common scene, and the current situation is to spend a lot of money to do small things, so here, give a future-oriented model to achieve: for the production enterprise, Based on HSL to develop enterprise-class MES system implementation, as the core Warehouse center of data, and business logic processing Center, for equipment suppliers, based on HSL to develop the host computer software system, fast and convenient distribution of data to the customer's MES system, work together.

Install From NuGet

Description: NuGet for stable version, Support Online upgrade, the use of components is best downloaded from NuGet, the project published here is likely to have not yet compiled the beta version, NuGet installation is as follows:

Install-Package HslCommunication

HslCommunication.dll Summary

When I started working on this project, I had an idea of how to easily and quickly read and write PLC data. Our code logic should be very simple, and it only takes one or two lines of code to implement this feature. Like this

// Pseudo code
PLC plc = new PLC("192.168.0.11", 6000);

short value = plc.ReadInt16("D100");

But after a long period of development and attempt, found that the return of PLC is likely to be abnormal, this anomaly may come from the network failure, may also come from you entered the wrong address, or the PLC itself is not allowed to operate, so in this project added a class Operateresult, So the final code becomes what it looks like (with Siemens PLC as an example)

SiemensS7Net siemens = new SiemensS7Net( SiemensPLCS.S1200, " 192.168.1.110" );
OperateResult<short> read = siemens.ReadInt16("M100");

if(read.IsSuccess)
{
	// you get the right value
	short value = read.Content;
}
else
{
	// failed , but you still can know the failed detail
	Consolo.WriteLine(read.Message);
}

Of course, you can also write very concise, because the judgment of success is ignored, so the following operation is risky.

SiemensS7Net siemens = new SiemensS7Net( SiemensPLCS.S1200, " 192.168.1.110" );
short value = siemens.ReadInt16("M100").Content;   // Look at this code, isn't it very succinct.

When use .Net4.5 or higher plateform. we can use like this

SiemensS7Net siemens = new SiemensS7Net( SiemensPLCS.S1200, " 192.168.1.110" );
short value = (await siemens.ReadInt16Async("M100")).Content;   // Look at this code, isn't it very succinct.

The above operation we have read the data, but is based on a short connection, when the reading of the data finished, automatically shut down the network, if you want to open a long connection, follow the following actions.

SiemensS7Net siemens = new SiemensS7Net( SiemensPLCS.S1200, " 192.168.1.110" );
siemens.SetPersistentConnection( );
OperateResult<short> read = siemens.ReadInt16("M100");

if(read.IsSuccess)
{
	// you get the right value
	short value = read.Content;
}
else
{
	// failed , but you still can know the failed detail
	Consolo.WriteLine(read.Message);
}

// when you don't want read data, you should call close method
siemens.ConnectClose( );

When use .Net4.5 or higher plateform. we can use like this

SiemensS7Net siemens = new SiemensS7Net( SiemensPLCS.S1200, " 192.168.1.110" );
siemens.SetPersistentConnection( );
OperateResult<short> read = await siemens.ReadInt16Async("M100");

if(read.IsSuccess)
{
	// you get the right value
	short value = read.Content;
}
else
{
	// failed , but you still can know the failed detail
	Consolo.WriteLine(read.Message);
}

// when you don't want read data, you should call close method
siemens.ConnectClose( );

So we can see that all the other modes of communication are similar to this, including Mitsubishi PLC, Siemens PLC,AB PLC, OMRON PLC, Keane plc, Panasonic Plc, redis Communications, EFT Robots, Kuka robots and so on, including its own support for the HSL protocol.

The goal is to reduce the cost of learning for developers, and usually you have to learn how to use several different libraries and learn the basics of PLC. Now, all you need to know is how the basic PLC address is represented, and you can read and write PLC data.

Called from Visual C++ project

cppProject -> Properties -> Configuration Properties -> General -> CLR Support

Add HslCommunication.dll(net35) reference

#include "pch.h"
#include <iostream>
using namespace HslCommunication;
using namespace ModBus;

int main()
{
    std::cout << "Hello World!\n";


	// This is the demo , called C# ModbusTcpNet
	System::String ^ipAddress = gcnew System::String("127.0.0.1");
	ModbusTcpNet ^modbus = gcnew ModbusTcpNet(ipAddress, 502, 1);

	System::String ^dataAddress = gcnew System::String("100");
	OperateResult<short> ^readValue = modbus->ReadInt16(dataAddress);
	if (readValue->IsSuccess) {
		short value = readValue->Content;
		printf("Read Value:%d \n", value);
	}
	else
	{
		printf("Read Failed");
	}
}

If you want to communication in your mobile phone application, you also can use C# code by xamarin, you can download HslAppDemo to test HslAppDemo.apk

Another feature of this project is support for cross-language communication support. You can build a C # background server that supports Windows desktop application and Web background, and Android phone-side, Python programs, Java programs to communicate. server side code:

class Program
{
    static void Main(string[] args)
    {
		NetSimplifyServer simplifyServer;
		try
		{
			simplifyServer = new NetSimplifyServer( );
			simplifyServer.ReceiveStringEvent += SimplifyServer_ReceiveStringEvent;
			simplifyServer.ServerStart( 12345 );
		}
		catch(Exception ex )
		{
			Console.WriteLine( "Create failed: " + ex.Message );
			Return;
		}

		Console.ReadLine();
	}

	private static void SimplifyServer_ReceiveStringEvent( AppSession session, NetHandle handle, string value )
	{
		if (handle == 1)
		{
			// Message to operate when a signal from the client is received 1
			simplifyServer.SendMessage( session, handle, "This is test single:" + value );
		}
		else
		{
			simplifyServer.SendMessage( session, handle, "not supported msg" );
		}
	
		// Show out, who sent it, what did it send?
		Console.WriteLine($"{session} [{handle}] {value}");
	}
}

C# Client Side (Also asp.net mvc, asp.net core mvc)

NetSimplifyClient simplifyClient = new NetSimplifyClient( "127.0.0.1", 12345 );
string value = simplifyClient.ReadFromServer( 1, "test" ).Content;

Java Client Side

NetSimplifyClient simplifyClient = new NetSimplifyClient( "127.0.0.1", 12345 );
string value = simplifyClient.ReadFromServer( 1, "test" ).Content;

Python Client Side

netSimplifyClient = NetSimplifyClient("127.0.0.1",12345)
value = netSimplifyClient.ReadFromServer(1,'123').Content

Note: In the source code, still contains a lot of Chinese annotation, in the future for a short period of time, will be used in English and Chinese double annotation, thank you for your understanding.

HslCommunicationDemo The features supported by this project can be roughly clear through the demo interface below: Picture

HslCommunication.jar Summary

This component provides the Java version, for the. NET version of the castration version, removed all the server function code, retained part of the client function code, convenient and plc, device data interaction, and C # program data interaction, this jar component is suitable for the development of Android, easy to build a. NET Server + Windows Client + asp.net client + J2EE client + Java Client + Android client. Picture

HslCommunication.py Summary

This component provides a Python version, a castration version of the. NET version, removes all server function codes, retains some of the client function code, facilitates data interaction with PLC, devices, and data interaction with C # programs for cross-platform operation Picture

Xamarin.Android Demo

Picture

Where is the Source code?

Not free open source. you can refer to webside: http://www.hslcommunication.cn/Cooperation

How to sponsor author?

PayPal

Alipay

Thank you for your understanding

More Repositories

1

ClientServerProject

一个C-S模版,该模版由三部分的程序组成,一个服务端运行的程序,一个客户端运行的程序,还有一个公共的组件,实现了基础的账户管理功能,版本控制,软件升级,公告管理,消息群发,共享文件上传下载,批量文件传送功能。具体的操作方法见演示就行。本项目的一个目标是:提供一个基础的中小型系统的C-S框架,客户端有三种模式,无缝集成访问,winform版本,wpf版本,asp.net mvc版本,方便企业进行中小型系统的二次开发和个人学习。同时网络组件方便的支持读写三菱和西门子PLC的数据,详细见Readme
C#
1,226
star
2

OpcUaHelper

一个通用的opc ua客户端类库,基于.net 4.6.1创建,基于官方opc ua基金会跨平台库创建,封装了节点读写,批量节点读写,引用读取,特性读取,历史数据读取,方法调用,节点订阅,批量订阅等操作。还提供了一个节点浏览器工具。
C#
710
star
3

HslControlsDemo

HslControls控件库的使用demo,HslControls是一个工业物联网的控件库,基于C#开发,配套HslCommunication组件可以实现工业上位机软件的快速开发,支持常用的工业图形化控件,快速的集成界面开发。 主要包含了按钮,开关,进度条,信号灯,数码管,时钟,曲线显示控件,仪表盘控件,管道控件,瓶子控件,饼图控件,传送带控件,温度计控件,鼓风机控件,阀门控件,电池控件等等。
C#
595
star
4

SharpNodeSettings

一个设备及节点配置类库,基于HslCommunication.dll创建,方便的实现PLC根据配置文件动态创建,并支持自动写入相应的服务器对象。
C#
233
star
5

RemoteMonitor

本项目是一个利用HslCommunication组件读取PLC的示例项目,演示了后台从PLC循环读取到前台显示,并推送给在线客户端,客户端同步显示并画实时曲线图。支持web端同步的数据显示,支持web端远程操作PLC,安卓端数据显示,远程操作PLC
JavaScript
211
star
6

ModBusTcpTools

一个Modbus的C#开发示例,运用HslCommunication.dll组件库实现,包含了一个服务端的演示和一个客户端演示,客户端可用于进行Modbus测试,详细见ReadMe.md。
C#
66
star
7

HslCommunicationJavaDemo

HslCommunication的Java版本的项目
Java
63
star
8

HslCommunicationPython

HslCommunication的python版本
Python
43
star
9

OpcUaHelperOld

一个OPC UA客户端二次封装类,使用本组件提供的类库,可以简单便捷的读写OPC-UA服务器上的数据,引用,方法等等操作。本版本为旧版,新版请参照:https://github.com/dathlin/OpcUaHelper
C#
31
star
10

NetChatRoom

一个基于HslCommunication实现的局域网实时聊天的项目,采用C-S架构实现,除了实现基本的消息发送,还包括了在线信息的管理,系统消息的查看。
C#
23
star
11

FileManagment

一个使用HslCommunication组件实现了文件管理引擎,在客户端块演示了文件的上传,下载,删除,文件集获取操作。
C#
22
star
12

WebSpiderLearnAndTest

A simple C# web spider application , It catches all the hotels of hangzhou from xiecheng 【一个简单的爬虫程序,提供了一个基础的框架,实现了对AJAX页面爬虫,并测试学习几个例子,详细见README。】
C#
22
star
13

HslRedisDesktop

Redis Winform Desktop
C#
18
star
14

HSLSharp

采集框架第一个版本,如有bug,希望大家发起pull request
C#
17
star
15

ClassicGame

some simple games base on C# ,such as Tetris. [一个简单的C#游戏,以俄罗斯方块为基础,提炼一个简单的游戏框架,方便学习算法,GDI+,C#]
C#
13
star
16

ThriftDemo

一个Thrift的学习测试项目,服务器端实现从PLC进行采集数据,推送到Thrift,以接口的形式对外公开数据,方便客户端获取到服务器的不同数据,并且支持从客户端进行远程操控PLC
C#
8
star
17

HslMRpcLearn

基于HslCommunication的远程读写PLC,JAVA,Python远程读写PLC的示例代码。
C#
7
star
18

OpcUaStudy

A project for personal learning opc ua technology, opc part of the code from the opc Foundation, where only for learning and testing.
C#
7
star
19

Gobang-

a simple computer game, you can play with computer , we designed a simple computer AI , we need you to improve the AI level , to build a more smart AI , and also helps improve our program skills [一个简单的五子棋游戏,实现了初级算法,需要大家一起来努力创建一个更加聪明的电脑AI,也用来方便新手学习。]
C#
6
star
20

MyNuGet

一个基于本地的NuGet服务器,用于本地或是公司的.net的包管理器。
ASP
4
star
21

RoboDKHelper

RoboDK通讯用的C#组件
C#
4
star
22

GameHelper3366

this is a game help tool, help user to play hige score on 3366.com
C#
2
star
23

HslWebApplication

一个用于ASP.NET MVC和ASP.NET CORE学习的项目
CSS
1
star
24

WebApplicationLearn

一个用于自身学习ASP.NET的项目,不具有生产条件,仅用于学习,测试技术
JavaScript
1
star
25

Static

Static Resources For test
C#
1
star