CN103856375A - Single-slave end multi-master end distributed Ethernet system, construction method and communication method of single-slave end multi-master end distributed Ethernet system - Google Patents
Single-slave end multi-master end distributed Ethernet system, construction method and communication method of single-slave end multi-master end distributed Ethernet system Download PDFInfo
- Publication number
- CN103856375A CN103856375A CN201210506443.9A CN201210506443A CN103856375A CN 103856375 A CN103856375 A CN 103856375A CN 201210506443 A CN201210506443 A CN 201210506443A CN 103856375 A CN103856375 A CN 103856375A
- Authority
- CN
- China
- Prior art keywords
- slave
- master
- ethernet
- address
- port number
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000004891 communication Methods 0.000 title claims abstract description 37
- 238000000034 method Methods 0.000 title claims abstract description 31
- 238000010276 construction Methods 0.000 title abstract description 6
- ILMNSCQOSGKTNZ-UHFFFAOYSA-N 2-[1-(6-aminopurin-9-yl)-2-oxoethoxy]-3-hydroxypropanal Chemical compound NC1=NC=NC2=C1N=CN2C(OC(CO)C=O)C=O ILMNSCQOSGKTNZ-UHFFFAOYSA-N 0.000 claims description 3
- 238000013461 design Methods 0.000 abstract description 2
- 238000012545 processing Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 238000013479 data entry Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000000737 periodic effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Landscapes
- Small-Scale Networks (AREA)
Abstract
本发明公开一种可用于多种复杂工业场合的单从端多主端分布式以太网系统及其构建方法和通讯方法。包括一台上位机,连接一台以太网交换机,具有指定的IP地址和浮动的端口号;太网交换机,至少为上述一台以太网交换机,每个以太网交换机具有其固定的IP地址和端口号,通过串口/以太网转换器连接终端设备。本发明采取一个从端多个主端的反转式结构,最大优点是在实现从端对主端通讯状态完全掌握的前提下不会随着节点数目的增多而增加系统的通讯负担,大大保障了系统的稳定和安全,在从端的通讯结构设计还采用了异步多线程的方式,使从端在同一时间可同时监听所有主端的通讯状态,大大提高系统的通讯效率和稳定性。
The invention discloses a single-slave-multi-master distributed Ethernet system, a construction method and a communication method that can be used in various complicated industrial occasions. Including a host computer connected to an Ethernet switch with a specified IP address and floating port number; the Ethernet switch is at least one of the above Ethernet switches, and each Ethernet switch has its fixed IP address and port number, connect the terminal device through a serial port/Ethernet converter. The present invention adopts a reverse structure with one slave and multiple masters. The biggest advantage is that it will not increase the communication burden of the system with the increase of the number of nodes under the premise of realizing the communication status of the master from the slave, which greatly guarantees The stability and safety of the system, the communication structure design of the slave end also adopts the asynchronous multi-thread method, so that the slave end can monitor the communication status of all the master ends at the same time, greatly improving the communication efficiency and stability of the system.
Description
技术领域technical field
本发明公开一种可用于多种复杂工业场合的单从端多主端分布式以太网系统及其构建方法和通讯方法。The invention discloses a single-slave-multi-master distributed Ethernet system, a construction method and a communication method that can be used in various complicated industrial occasions.
背景技术Background technique
以太网通讯多采用单主端多从端的通讯结构构架方式,这种方式适用于通讯从端数目有限且固定的方式。随着通讯结构的复杂,通讯从端的数目不断增加,许多工况下从端数目还无法固定。这种情况下,通讯主端的负担不断加大且总量无法估计,通讯系统处于一种负担不断增加、风险不断加大的状态,给系统的稳定性带来了极大的隐患。Ethernet communication mostly adopts a single-master-multiple-slave communication structure framework, which is suitable for a limited and fixed number of communication slaves. With the complexity of the communication structure, the number of communication slaves continues to increase, and the number of slaves cannot be fixed under many working conditions. In this case, the burden on the communication master continues to increase and the total amount cannot be estimated. The communication system is in a state of increasing burden and risk, which brings great hidden dangers to the stability of the system.
发明内容Contents of the invention
针对现有技术存在的上述不足之处,本发明要解决的技术问题是提供一种可用于多种复杂工业场合的单从端多主端分布式以太网通讯方法及装置。In view of the above-mentioned deficiencies in the prior art, the technical problem to be solved by the present invention is to provide a single-slave multi-master distributed Ethernet communication method and device that can be used in various complex industrial occasions.
本发明为实现上述目的所采用的技术方案是:一种单从端多主端分布式以太网系统,包括The technical solution adopted by the present invention to achieve the above object is: a single-slave multi-master distributed Ethernet system, including
一台上位机,连接一台以太网交换机,具有指定的IP地址和浮动的端口号;A host computer, connected to an Ethernet switch, has a specified IP address and a floating port number;
太网交换机,至少为上述一台以太网交换机,每个以太网交换机具有其固定的IP地址和端口号,通过串口/以太网转换器连接终端设备。The Ethernet switch is at least one of the above Ethernet switches, each Ethernet switch has its fixed IP address and port number, and is connected to the terminal equipment through a serial port/Ethernet converter.
每个串口/以太网转换器均指定192.168.1段内的唯一的IP地址。Each serial/Ethernet converter is assigned a unique IP address within the 192.168.1 segment.
一种单从端多主端分布式以太网系统的构建方法,以一台上位机为从端,所述上位机连接的多个以太网交换机为主端,包括以下步骤:A method for constructing a single-slave multi-master distributed Ethernet system, using a host computer as a slave, and a plurality of Ethernet switches connected to the host computer as hosts, comprising the following steps:
固定每一个主端的IP地址和端口号,指定从端的IP地址而不固定端口号;Fix the IP address and port number of each master end, specify the IP address of the slave end instead of fixing the port number;
扫描的所有主端的数目,从一个号码开始编号,并以加1的方法逐渐递增端口号,使每一个主端对应一个端口号;The number of all masters scanned starts with a number, and gradually increases the port number by adding 1, so that each master corresponds to a port number;
从端通过固定的IP地址和浮动的端口号绑定主端,与不同的主端发送通讯请求;主端记录下发送通讯请求的从端IP地址和端口号,并以此IP地址和端口号与从端通讯。The slave end binds the master end through a fixed IP address and a floating port number, and sends communication requests with different master ends; the master end records the slave end IP address and port number that sent the communication request, and uses the IP address and port number Communicate with the slave.
所述从端按照主端数目,开辟同样数目的端口号。The slave end opens up the same number of port numbers according to the number of the master end.
所述一个号码为10000。The one number is 10000.
一种单从端多主端分布式以太网系统的通讯方法,以一台上位机为从端,所述上位机连接的多个以太网交换机为主端,包括以下步骤:A communication method for a single-slave multi-master distributed Ethernet system, using a host computer as a slave, and a plurality of Ethernet switches connected to the host computer as a host, comprising the following steps:
通过构造ThreadStart类型的线程构造函数在从端开启独立的“读取线程”;Start an independent "reading thread" on the slave side by constructing a thread constructor of ThreadStart type;
存放读取数据的内存区存满数据后产生触发信号,触发“读取线程”,实现异步“读取线程”,数被取走后清空内存区,继续循环挂起“读取线程”;After the memory area storing the read data is full of data, a trigger signal is generated to trigger the "read thread" to realize an asynchronous "read thread".
主端通过动态赋予参数的方法实现“委托”异步处理数据;将数据上传至从端。The master end implements "delegation" to process data asynchronously through the method of dynamically assigning parameters; upload the data to the slave end.
所述数据存储在数据库中,其存储方法为:添加数据库ADOX动态链接;添加数据库ADODB动态链接;指定数据表存储位置;指定数据表键值个数;为每一个键值命名;周期性插入数据;更新数据库并回到周期性插入数据步骤Described data is stored in the database, and its storage method is: add database ADOX dynamic link; Add database ADODB dynamic link; Specify data table storage position; Specify data table key value number; Name each key value; Periodically insert data ;Update the database and return to the step of periodically inserting data
本发明的方法和装置彻底颠覆这一传统通讯构架,采取一个从端多个主端的反转式结构,最大优点是在实现从端对主端通讯状态完全掌握的前提下不会随着节点数目的增多而增加系统的通讯负担,大大保障了系统的稳定和安全,在从端的通讯结构设计还采用了异步多线程的方式,使从端在同一时间可同时监听所有主端的通讯状态,大大提高系统的通讯效率和稳定性。具有优点如下:The method and device of the present invention completely subvert this traditional communication framework, adopting a reverse structure with one slave and multiple masters. The increase of the purpose increases the communication burden of the system, which greatly guarantees the stability and security of the system. The communication structure design of the slave end also adopts an asynchronous multi-threading method, so that the slave end can monitor the communication status of all the master ends at the same time, greatly improving System communication efficiency and stability. It has the following advantages:
1.所有终端设备均加入以太网进行数据传输,统一协议有利于扩展;1. All terminal devices are added to Ethernet for data transmission, and the unified protocol is conducive to expansion;
2.系统挂接终端设备数量可以以24倍数(总数据量小于1GB/s)的数目扩展,真正实现了分布式这一工业领域较高要求;2. The number of terminal devices connected to the system can be expanded by a multiple of 24 (the total data volume is less than 1GB/s), which truly realizes the higher requirements of the distributed industrial field;
3.采用了独特的上位机作为从站、下位机作为主站的特殊网络构架,极大的减轻了上位机的资源需求,使“可扩展”真正成为可能;3. Adopting a unique special network architecture with the upper computer as the slave station and the lower computer as the master station, which greatly reduces the resource requirements of the upper computer and makes "scalable" truly possible;
4.数据监听、读取、处理采用了独立线程和委托的方式,最大限度减轻了上位机的负担,大大提高了系统的稳定性和处理能力;4. Data monitoring, reading, and processing adopt independent threads and entrusted methods, which minimizes the burden on the host computer and greatly improves the stability and processing capacity of the system;
5.使用数据库为应用提供完整的实时的数据,为后续的数据分析和处理带来方便。5. Use the database to provide complete real-time data for the application, bringing convenience for subsequent data analysis and processing.
附图说明Description of drawings
图1本发明装置电路原理图;Fig. 1 schematic diagram of device circuit of the present invention;
图2本发明单从端多主端通讯构建方法控制程序流程图;Fig. 2 control program flow chart of the single-slave multi-master communication construction method of the present invention;
图3本发明数据库存储方法控制程序流程图。Fig. 3 is a flow chart of the control program of the database storage method of the present invention.
具体实施方式Detailed ways
下面结合附图及实施例对本发明做进一步的详细说明。The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments.
如图1-3所示,系统包括一台上位机,运行实现单从端多主端分布式以太网通讯方法的控制程序;上位机通过8芯网线连接10M/100M网络交换机;交换机通过网线连接连接RS232/以太网转换器、RS485/以太网转换器、RS422/以太网转换器、以太网视频服务器,以太网音频服务器。将每个转换器均指定192.168.1段内的唯一的IP地址;每个转换器可直接连接终端设备,包括S232设备、RS485设备、RS422设备、视频设备、音频设备;交换机通过网线连接视频解码设备和音频解码设备。As shown in Figure 1-3, the system includes a host computer that runs the control program that realizes the single-slave multi-master distributed Ethernet communication method; the host computer is connected to a 10M/100M network switch through an 8-core network cable; the switch is connected to the network through a network cable Connect RS232/Ethernet converter, RS485/Ethernet converter, RS422/Ethernet converter, Ethernet video server, Ethernet audio server. Assign each converter a unique IP address within the 192.168.1 segment; each converter can be directly connected to terminal equipment, including S232 equipment, RS485 equipment, RS422 equipment, video equipment, audio equipment; the switch is connected to video decoding through a network cable device and audio decoding device.
单从端多主端的通讯方法首先固定每一个主端的IP地址和端口号,但只指定从端的IP而不固定端口号,然后扫面入网的所有主端的数目,从10000号开始编号并以加1的方法逐渐递增端口号从而与每一个主端对应。通过固定的IP地址绑定浮动的端口号与每一个主端建立通讯,主端记录下请求通讯的从端IP和端口号,并以此IP和端口号与从端通讯。The communication method of single-slave and multi-master first fixes the IP address and port number of each master, but only specifies the IP of the slave instead of the fixed port number, and then scans the number of all masters connected to the network, numbering from 10000 and adding The method of 1 gradually increments the port number to correspond to each master. Establish communication with each master end by binding a floating port number with a fixed IP address, and the master end records the slave end IP and port number requesting communication, and communicates with the slave end using this IP and port number.
读取数据采用异步方法读取,节省系统资源,减轻了主程序负担。每一个网络设备均采用单独的线程池进行处理。数据缓存堵塞后采用委托的方式处理数据。数据库采用定时器触发方式触发,间隔固定周期存储数据。视频和音频数据均采用可读方式直接存储,为播放视频和音频带来最大方便。The read data is read by asynchronous method, which saves system resources and reduces the burden of the main program. Each network device is processed by a separate thread pool. After the data cache is blocked, the data is processed in a delegated manner. The database is triggered by a timer trigger and stores data at fixed intervals. Both video and audio data are directly stored in a readable manner, which brings maximum convenience for playing video and audio.
本发明一种具有数据库功能的单从端多主端分布式以太网通讯方法包括单从端多主端通讯构建方法和数据库存储方法,分别如下:A single-slave multi-master distributed Ethernet communication method with database function of the present invention includes a single-slave multi-master communication construction method and a database storage method, respectively as follows:
单从端多主端通讯构建方法:Single-slave multi-master communication construction method:
检测交换机状态,如果不正常则发出警报并循环检测,如果正常则继续执行;Detect the status of the switch, if it is abnormal, it will send an alarm and loop detection, if it is normal, it will continue to execute;
检测1~24号以太网服务器状态,如果;有问题则发出警报;Detect the status of Ethernet servers No. 1~24, and send an alarm if there is a problem;
固定从端IP地址;Fixed slave IP address;
扫描入网的主端数目;Scan the number of masters entering the network;
固定主端IP地址和端口号;Fixed master IP address and port number;
按照主端数目在从端开辟同样数目的端口号,并以加1的方式保证端口号没有重叠;Open up the same number of port numbers on the slave side according to the number of the master side, and add 1 to ensure that the port numbers do not overlap;
通过IP地址和不同的端口号向不同的主端发送通讯请求;Send communication requests to different masters through IP addresses and different port numbers;
主端记录下从端的IP地址和端口号并用该IP地址和端口号回传数据;The master end records the IP address and port number of the slave end and uses the IP address and port number to return data;
从端打开数去数据功能;Open the function of data removal from the terminal;
开启独立的“读取线程”;Open an independent "read thread";
异步“读取线程”,循环挂起;Asynchronous "read thread", loop hangs;
“委托”异步处理数据;"Delegate" to process data asynchronously;
将数据上传至上位机。Upload the data to the host computer.
数据库存储方法:Database storage method:
添加数据库ADOX动态链接;Add database ADOX dynamic link;
添加数据库ADODB动态链接;Add database ADODB dynamic link;
指定数据表存储位置;Specify the storage location of the data table;
指定数据表键值个数;Specify the number of key values in the data table;
为每一个键值命名;Name each key value;
周期性插入数据;Insert data periodically;
更新数据库并回到周期性出入数据步骤。Update the database and go back to the periodic data entry and exit steps.
Claims (7)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210506443.9A CN103856375A (en) | 2012-11-30 | 2012-11-30 | Single-slave end multi-master end distributed Ethernet system, construction method and communication method of single-slave end multi-master end distributed Ethernet system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210506443.9A CN103856375A (en) | 2012-11-30 | 2012-11-30 | Single-slave end multi-master end distributed Ethernet system, construction method and communication method of single-slave end multi-master end distributed Ethernet system |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN103856375A true CN103856375A (en) | 2014-06-11 |
Family
ID=50863614
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201210506443.9A Pending CN103856375A (en) | 2012-11-30 | 2012-11-30 | Single-slave end multi-master end distributed Ethernet system, construction method and communication method of single-slave end multi-master end distributed Ethernet system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN103856375A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106878482A (en) * | 2017-01-03 | 2017-06-20 | 新华三技术有限公司 | Method for network address translation and device |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101165621A (en) * | 2006-10-17 | 2008-04-23 | 江望 | Remote automation system |
| CN101226397A (en) * | 2008-02-04 | 2008-07-23 | 南京理工大学 | High-reliability distributed Ethernet measurement and control system |
| CN101483728A (en) * | 2008-12-31 | 2009-07-15 | 深圳市同洲电子股份有限公司 | Digital television receiving terminal, connecting apparatus, system and method |
| US20110267950A1 (en) * | 2005-05-06 | 2011-11-03 | Orckit Corrigent, Ltd. | Tunnel provisioning with link aggregation and hashing |
| CN102662365A (en) * | 2012-04-26 | 2012-09-12 | 中国人民解放军海军工程大学 | Method and system for monitoring state of ship power monitoring network |
| CN202998138U (en) * | 2012-11-30 | 2013-06-12 | 中国科学院沈阳自动化研究所 | A distributed Ethernet system with a single auxiliary end and multiple main ends |
-
2012
- 2012-11-30 CN CN201210506443.9A patent/CN103856375A/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20110267950A1 (en) * | 2005-05-06 | 2011-11-03 | Orckit Corrigent, Ltd. | Tunnel provisioning with link aggregation and hashing |
| CN101165621A (en) * | 2006-10-17 | 2008-04-23 | 江望 | Remote automation system |
| CN101226397A (en) * | 2008-02-04 | 2008-07-23 | 南京理工大学 | High-reliability distributed Ethernet measurement and control system |
| CN101483728A (en) * | 2008-12-31 | 2009-07-15 | 深圳市同洲电子股份有限公司 | Digital television receiving terminal, connecting apparatus, system and method |
| CN102662365A (en) * | 2012-04-26 | 2012-09-12 | 中国人民解放军海军工程大学 | Method and system for monitoring state of ship power monitoring network |
| CN202998138U (en) * | 2012-11-30 | 2013-06-12 | 中国科学院沈阳自动化研究所 | A distributed Ethernet system with a single auxiliary end and multiple main ends |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106878482A (en) * | 2017-01-03 | 2017-06-20 | 新华三技术有限公司 | Method for network address translation and device |
| CN106878482B (en) * | 2017-01-03 | 2020-01-03 | 新华三技术有限公司 | Network address translation method and device |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111163002B (en) | Container-based edge gateway system and energy data processing method | |
| CN112099948B (en) | Digital twin manufacturing unit protocol standardization and industrial big data real-time integration method | |
| CN109951538B (en) | Data processing method, device, system, electronic device and storage medium | |
| CN108123820B (en) | Network equipment information acquisition method and device | |
| CN111580995A (en) | Synchronous communication method and system of distributed cloud platform and Internet of things intelligent terminal based on MQTT asynchronous communication scene | |
| CN103747107B (en) | A kind of compatible cloud operating platform and its implementation | |
| CN103792928A (en) | Industrial field data collecting and analyzing system based on Modbus | |
| EP3575969B1 (en) | Reducing cache line collisions | |
| CN111585771A (en) | Centralized authentication system of Internet of things equipment based on U2F physical token | |
| CN103384274A (en) | Hyper text transport protocol (http)-based communication method for connection of public network with intranet computer | |
| WO2023274278A1 (en) | Resource scheduling method and device and computing node | |
| CN107291868A (en) | A kind of monitoring data processing unit and monitoring data processing method | |
| CN115118475A (en) | Method, device, equipment and medium for dispatching cryptographic equipment cluster | |
| CN102402218B (en) | Intelligent industrial network monitoring system | |
| CN105095144B (en) | The method and apparatus of multinuclear Cache consistency maintenances based on fence and lock | |
| CN102571617A (en) | Streaming data server, streaming media transmission method and data transmission system | |
| CN202998138U (en) | A distributed Ethernet system with a single auxiliary end and multiple main ends | |
| CN102831017B (en) | High-efficiency distributed parallel authentication system | |
| CN103353750B (en) | A kind of microwave metallurgical control method based on multibus | |
| CN103856375A (en) | Single-slave end multi-master end distributed Ethernet system, construction method and communication method of single-slave end multi-master end distributed Ethernet system | |
| Haikun et al. | Research and Application of the IOT Gateway Based on the Real-Time Specification for Java. | |
| CN103747439B (en) | Wireless controller device, wireless authentication processing method, system, networking | |
| CN114185616A (en) | A configuration file-based power carrier embedded device management method and system | |
| CN108121639A (en) | A kind of data center's total management system design method based on cloud platform | |
| CN107748700A (en) | A kind of MPI based on embedded OS realizes system and method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| WD01 | Invention patent application deemed withdrawn after publication | ||
| WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20140611 |