[go: up one dir, main page]

CN112055059B - A method for device electing a representative - Google Patents

A method for device electing a representative Download PDF

Info

Publication number
CN112055059B
CN112055059B CN202010842348.0A CN202010842348A CN112055059B CN 112055059 B CN112055059 B CN 112055059B CN 202010842348 A CN202010842348 A CN 202010842348A CN 112055059 B CN112055059 B CN 112055059B
Authority
CN
China
Prior art keywords
layer
representative
priority value
priority
terminal equipment
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.)
Active
Application number
CN202010842348.0A
Other languages
Chinese (zh)
Other versions
CN112055059A (en
Inventor
吴宗鸿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Zhihui Huasheng Technology Co ltd
Original Assignee
Zhejiang Hongcheng Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Zhejiang Hongcheng Technology Co ltd filed Critical Zhejiang Hongcheng Technology Co ltd
Priority to CN202010842348.0A priority Critical patent/CN112055059B/en
Publication of CN112055059A publication Critical patent/CN112055059A/en
Application granted granted Critical
Publication of CN112055059B publication Critical patent/CN112055059B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16YINFORMATION AND COMMUNICATION TECHNOLOGY SPECIALLY ADAPTED FOR THE INTERNET OF THINGS [IoT]
    • G16Y40/00IoT characterised by the purpose of the information processing
    • G16Y40/10Detection; Monitoring
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/30Decision processes by autonomous network management units using voting and bidding
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to the technical field of industrial Internet of things and discloses a method for selecting representatives by equipment, which comprises the steps that terminal equipment randomly generates a priority value, and the terminal equipment broadcasts and sends notification messages comprising the priority value and identification information to a network; the terminal equipment receives the notification message sent by the rest terminal equipment, generates a priority table according to the priority value and the identification information of the terminal equipment, and arranges the priority values in the sequence from big to small; the terminal equipment judges whether more than two equal priority values exist, if so, judges whether the equal priority values are the priority values of the terminal equipment, if so, the terminal equipment returns to the first step, otherwise, the terminal equipment returns to the second step; otherwise, determining the layer where the representative device is located and the representative device of the layer where the representative device is located according to the representative device judging strategy; the method for selecting the representatives by the equipment can select the representatives of the terminal equipment in the industrial Internet of things by the representatives, and the load of the platform server and the channel is reduced by sending the heartbeat packet to the platform server by the representatives.

Description

一种设备推选代表的方法A method for device electing a representative

技术领域technical field

本发明涉及工业物联网技术领域,具体涉及一种设备推选代表的方法。The present invention relates to the technical field of industrial internet of things, in particular to a method for selecting a representative of a device.

背景技术Background technique

借助工业物联网技术或平台,企业可以对车间里的人、机、料、法、环、测等要素进行实时的连接和监控。以传统的塑编制造业为例,其生产线设备主要包括拉丝机、圆织机、印刷机、缝边机、地磅等,每台设备平均带有5-8个传感器,1-2个PLC,一家中型规模的厂家,大约要使用220台设备,为了采集设备的所有生产数据,需要配备1500个左右的物联网终端设备,物联网终端设备连接底层的传感器、PLC、地磅串型接口。With the help of industrial Internet of Things technology or platform, enterprises can connect and monitor elements such as people, machines, materials, methods, environment, and testing in the workshop in real time. Taking the traditional plastic woven manufacturing industry as an example, its production line equipment mainly includes wire drawing machines, circular looms, printing machines, hemming machines, weighbridges, etc. Each device has an average of 5-8 sensors and 1-2 PLCs. A medium-sized manufacturer needs to use about 220 devices. In order to collect all the production data of the devices, it needs to be equipped with about 1,500 IoT terminal devices. The IoT terminal devices are connected to the underlying sensors, PLC, and weighbridge serial interfaces.

这些物联网终端设备将采集到的数据通过网络发送到平台,以方便管理者进行实时查看,或为进一步深入挖掘提供基础数据。平台有监控物联网终端设备本身状态信息的义务(如设备是否在线、运行是否正常等),出于网络安全或者技术等因素,平台不会主动去询问或者收集终端设备的信息,都是由终端设备本身以心跳包的形式将一些必要的信息发送到平台。These IoT terminal devices send the collected data to the platform through the network, so that managers can view it in real time, or provide basic data for further in-depth mining. The platform has the obligation to monitor the status information of the IoT terminal device itself (such as whether the device is online, whether it is running normally, etc.), due to factors such as network security or technology, the platform will not take the initiative to inquire or collect information about the terminal device, and it is up to the terminal The device itself sends some necessary information to the platform in the form of heartbeat packets.

假设终端设备每秒发送一个心跳包,则平台每秒要接收来自一家上述中等规模厂家的1500个心跳包,如果平台所管理的区域内有100家同等规模的企业,则平台每秒需要处理150000个心跳包,以100Mb带宽、每个心跳包(UPD包,每个心跳数据单独封装成一个包)1KB计,每秒能处理约100*1000/10/1000=10000个心跳包。也就是说处理150000个终端设备的心跳包需要1.5Gb带宽。Assuming that the terminal device sends a heartbeat packet per second, the platform needs to receive 1,500 heartbeat packets per second from one of the above-mentioned medium-sized manufacturers. If there are 100 companies of the same size in the area managed by the platform, the platform needs to process 150,000 Heartbeat packets, based on 100Mb bandwidth and 1KB of each heartbeat packet (UPD packet, each heartbeat data is individually encapsulated into a packet), can process about 100*1000/10/1000=10000 heartbeat packets per second. That is to say, processing the heartbeat packets of 150,000 terminal devices requires 1.5Gb bandwidth.

如此大的数据处理量对网络带宽、服务器数量、服务器集群调度等各方面提出了相当高的要求,给系统平台、网络等部件带来了极大的负担,因此,如何降低平台的数据处理量、减轻系统平台和网络的负担,是现有技术中需要解决的问题。Such a large amount of data processing puts forward quite high requirements on network bandwidth, number of servers, server cluster scheduling, etc., and brings a great burden to the system platform, network and other components. Therefore, how to reduce the data processing amount of the platform 1. Reducing the burden on the system platform and the network is a problem to be solved in the prior art.

发明内容Contents of the invention

针对现有技术存在的不足,本发明的目的在于提供一种设备推选代表的方法,该设备推选代表的方法能够推选出工业物联网中终端设备的代表,通过代表向平台服务器发送心跳包,减少平台服务器接收、处理心跳包的数量,减轻平台服务器及信道的负担。Aiming at the deficiencies in the prior art, the purpose of the present invention is to provide a method for selecting a representative of a device, which can select a representative of a terminal device in the Industrial Internet of Things, and send a heartbeat packet to the platform server through the representative, reducing The number of heartbeat packets received and processed by the platform server to reduce the burden on the platform server and channels.

为了实现上述目的,本发明提供如下技术方案:In order to achieve the above object, the present invention provides the following technical solutions:

一种设备推选代表的方法,所述方法应用于工业物联网,包括:A method for selecting a representative of a device, the method is applied to the Industrial Internet of Things, comprising:

S1:终端设备随机生成一个优先级值,将生成的优先级值存储,标记为自身的优先级值,所述终端设备向网络中广播发送通报消息,所述通报消息中包括发送所述通报消息的终端设备的优先级值和识别信息;S1: The terminal device randomly generates a priority value, stores the generated priority value, and marks it as its own priority value, and the terminal device broadcasts a notification message to the network, and the notification message includes sending the notification message The priority value and identification information of the terminal equipment;

S2:终端设备接收除自身以外的所有终端设备发送的通报消息,根据接收的通报消息以及自身的优先级值和识别信息生成优先级表,所述优先级表中包括与各个终端设备的一一对应的优先级值和识别信息,所述优先级值在所述优先级表中按从大到小的顺序排列;S2: The terminal device receives notification messages sent by all terminal devices except itself, and generates a priority table according to the received notification messages, its own priority value and identification information, and the priority table includes one-to-one information related to each terminal device. Corresponding priority values and identification information, the priority values are arranged in descending order in the priority table;

S3:终端设备检查所述优先级表,判断所述优先级表中是否存在两个以上终端设备的优先级值相等,若是,所述终端设备执行S301,若否,所述终端设备执行S302;S3: The terminal device checks the priority table, and judges whether there are two or more terminal devices with equal priority values in the priority table, if yes, the terminal device executes S301, and if not, the terminal device executes S302;

S301:判断出现相等的情况的优先级值是否为自身的优先级值,若是,则重新执行S1,若否,则重新执行S2;S301: Determine whether the priority value in the case of equality is its own priority value, if yes, re-execute S1, if not, re-execute S2;

S302:根据代表设备判定策略确定自身所在的层、自身所在层的代表设备以及自身所在层的下一层的代表设备。S302: Determine the layer where the user is located, the representative device of the layer where the user is located, and the representative device of the layer below the layer where the user is located according to the determination strategy of the representative device.

在本发明中,优选的,所述代表设备判定策略包括:将所有的优先级值分成n个第1层优先级值段,每个第1层优先级值段中优先级值最大的设备作为第1层设备,每个第1层优先级值段中剔除第1层设备的优先级值后分成n个第2层优先级值段,每个第2层优先级值段中优先级值最大的设备作为第2层设备,每个第1层设备均为其所在的第1层优先级值段中的第2层设备的代表设备,以此类推,直到确定第m-1层代表设备,m、n均通过人为设定,定义第m-1层设备为第m层设备的上一层,每个第m-1层设备均为其所在的第m-1层优先级值段中的第m层设备的代表设备。In the present invention, preferably, the representative device determination strategy includes: dividing all priority values into n first-level priority value segments, and the device with the largest priority value in each first-level priority value segment is used as Layer 1 equipment, each layer 1 priority value segment is divided into n layer 2 priority value segments after excluding the priority value of layer 1 devices, and the priority value in each layer 2 priority value segment is the largest The device of the first layer is used as the second layer device, and each first layer device is the representative device of the second layer device in the first layer priority value segment where it is located, and so on, until the m-1th layer representative device is determined, Both m and n are manually set, defining the m-1th layer device as the upper layer of the m-th layer device, and each m-1th layer device is in the m-1th layer priority value segment where it is located The representative device of the m-th layer device.

在本发明中,优选的,还包括:In the present invention, preferably, also include:

S4:终端设备向所在层的上一层中其自身的代表设备发送通报消息,向所在层下一层中以其自身为代表设备的其他终端设备发送代表通报消息,接收所在层的上一层中其自身的代表设备发送的代表通报消息,接收所在层下一层中以其自身为代表设备的其他终端设备向其发送的通报消息,并根据接收的代表通报消息和通报消息更新自身的优先级表,所述代表通报消息包括发送所述代表通报消息的代表设备的优先级值和识别信息以及其所代表的终端设备的优先级值和识别信息。S4: The terminal device sends a notification message to its own representative device in the upper layer, sends a representative notification message to other terminal devices in the lower layer where it is the representative device, and receives the notification message from the upper layer The representative notification message sent by its own representative device, receives the notification message sent to it by other terminal devices with itself as the representative device in the lower layer, and updates its own priority according to the received representative notification message and notification message. A level table, the representative notification message includes the priority value and identification information of the representative device sending the representative notification message and the priority value and identification information of the terminal device it represents.

在本发明中,优选的,还包括:In the present invention, preferably, also include:

S5:终端设备接收不到所在层的上一层中其自身的代表设备发送的代表通报消息时,将所述代表设备定义为原代表设备,向其原代表设备所代表的其他终端设备发送通报消息,接收其原代表设备所代表的其他终端设备向其发送的通报消息,并根据接收到的通报消息更新优先级表,根据更新后的优先级表以及代表设备判定策略从原代表设备所代表的其他终端设备及自身中确定代表设备。S5: When the terminal device cannot receive the representative notification message sent by its own representative device in the upper layer of the layer where it is located, define the representative device as the original representative device, and send notifications to other terminal devices represented by the original representative device Receive notification messages sent by other terminal devices represented by the original representative device, and update the priority table according to the received notification messages, and determine the strategy from the original representative device according to the updated priority table and representative device. other terminal devices and determine the representative device among itself.

在本发明中,优选的,所述代表设备判定策略包括:将所有的优先级值分成x个第y层优先级值段,每个第y层优先级值段中优先级值最大的设备作为该第y层优先级值段在第y层的代表设备,将所有的第y层的代表设备的优先级值分成x个第y-1层优先级值段,每个第y-1层优先级值段中优先级值最大的设备作为该第y-1层优先级值段在第y-1层的代表设备,以此类推,直至确定第1层代表设备,x、y均通过人为设定,定义第y-1层设备为第y层设备的上一层,每个第y-1层设备均为其所在的第y-1层优先级值段中的第y层设备的代表设备。In the present invention, preferably, the decision strategy of the representative device includes: dividing all priority values into x y-th layer priority value segments, and the device with the largest priority value in each y-th layer priority value segment is used as The y-th layer priority value segment is the representative device at the y-th layer, and the priority values of all the y-th layer representative devices are divided into x y-1 layer priority value segments, and each y-1 layer has priority The device with the highest priority value in the level value segment is used as the representative device in the y-1th layer priority value segment at the y-1 layer, and so on until the representative device of the first layer is determined, and x and y are artificially set It is determined that the device at layer y-1 is defined as the upper layer of the device at layer y, and each device at layer y-1 is the representative device of the device at layer y in the priority value segment of layer y-1 where it is located. .

在本发明中,优选的,所述优先级值介于1至232之间。In the present invention, preferably, the priority value is between 1 and 232 .

在本发明中,优选的,所述识别信息包括终端设备的物理地址和/或网络地址。In the present invention, preferably, the identification information includes the physical address and/or network address of the terminal device.

与现有技术相比,本发明的有益效果是:Compared with prior art, the beneficial effect of the present invention is:

本发明的设备推选代表的方法通过为设备终端设置优先级值,并使终端设备互相发放优先级值及识别信息,形成优先级表,通过优先级表对终端设备进行分层、排列,从而推选出各层的代表设备,使终端设备可以仅向本层代表设备发送消息,由本层代表设备向更高层的代表设备发送消息,层层递进,最终完成向平台服务器发送心跳包的工作,由于最高层的代表设备数量较少,平台服务器需要接收和处理的心跳包数量明显减少,从而既满足了终端设备汇报自身状态的要求,又减轻了平台服务器及信道的负担,提高了工业物联网的工作效率。The method for selecting a representative of a device according to the present invention sets a priority value for a device terminal, and makes the terminal devices issue priority values and identification information to each other to form a priority table, and stratifies and arranges the terminal devices through the priority table, so as to select The representative devices of each layer are sent out, so that the terminal device can only send messages to the representative devices of this layer, and the representative devices of this layer send messages to the representative devices of higher layers, progressively, and finally complete the work of sending heartbeat packets to the platform server. The number of representative devices at the highest level is small, and the number of heartbeat packets that the platform server needs to receive and process is significantly reduced, which not only meets the requirements of the terminal device to report its own status, but also reduces the burden on the platform server and channels, and improves the industrial Internet of Things. work efficiency.

附图说明Description of drawings

图1为本发明的实施例一的流程图。FIG. 1 is a flow chart of Embodiment 1 of the present invention.

图2为本发明的实施例二的流程图。Fig. 2 is a flowchart of Embodiment 2 of the present invention.

图3为本发明的实施例三的流程图。Fig. 3 is a flow chart of Embodiment 3 of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

需要说明的是,当组件被称为“固定于”另一个组件,它可以直接在另一个组件上或者也可以存在居中的组件。当一个组件被认为是“连接”另一个组件,它可以是直接连接到另一个组件或者可能同时存在居中组件。当一个组件被认为是“设置于”另一个组件,它可以是直接设置在另一个组件上或者可能同时存在居中组件。本文所使用的术语“垂直的”、“水平的”、“左”、“右”以及类似的表述只是为了说明的目的。It should be noted that when a component is said to be "fixed" to another component, it can be directly on the other component or there can also be an intervening component. When a component is said to be "connected" to another component, it may be directly connected to the other component or there may be intervening components at the same time. When a component is said to be "set on" another component, it may be set directly on the other component or there may be an intervening component at the same time. The terms "vertical," "horizontal," "left," "right," and similar expressions are used herein for purposes of illustration only.

除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的技术领域的技术人员通常理解的含义相同。本文中在本发明的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本发明。本文所使用的术语“及/或”包括一个或多个相关的所列项目的任意的和所有的组合。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field of the invention. The terms used herein in the description of the present invention are for the purpose of describing specific embodiments only, and are not intended to limit the present invention. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.

实施例一:Embodiment one:

请参见图1,本发明一较佳实施方式提供一种设备推选代表的方法,包括:Please refer to Fig. 1, a preferred embodiment of the present invention provides a method for device representative selection, including:

S1:终端设备随机生成一个优先级值,将生成的优先级值存储,标记为自身的优先级值,终端设备向网络中广播发送通报消息,通报消息中包括发送通报消息的终端设备的优先级值和识别信息。S1: The terminal device randomly generates a priority value, stores the generated priority value, and marks it as its own priority value, and the terminal device broadcasts a notification message to the network, and the notification message includes the priority of the terminal device that sent the notification message value and identifying information.

其中,识别信息可以包括终端设备的物理地址和/或网络地址等能够准确识别终端设备身份的信息,从而可以将相关消息发送到终端设备。为存储终端设备自身以及其他终端设备的优先级值以及识别信息等数据,终端设备应当设置有数据存储单元,并且具备写入、删除等功能,以实现数据的存储和更新。Wherein, the identification information may include information such as a physical address and/or a network address of the terminal device that can accurately identify the identity of the terminal device, so that relevant messages can be sent to the terminal device. In order to store data such as the priority value and identification information of the terminal device itself and other terminal devices, the terminal device should be equipped with a data storage unit and have functions such as writing and deleting to realize data storage and update.

优先级值通过计算机程序在各终端设备开始工作前进行定义。优先级值的数量以及具体的值可以根据现实工业生产的需要来设定,例如,某工业物联网区域内有100000台终端设备,则不重复的优先级值的数量至少为100000个,并且优先级值的最大值至少为100000。优选的,优先级值可以是介于1至232之间的任意值,则优先级值可选择的值为4294967296个,能够满足工业生产的实际需要。Priority values are defined by a computer program before each terminal device starts working. The number and specific values of priority values can be set according to the needs of actual industrial production. For example, if there are 100,000 terminal devices in an industrial Internet of Things area, the number of non-repeating priority values should be at least 100,000, and priority The maximum value for level is at least 100000. Preferably, the priority value can be any value between 1 and 232 , and the number of selectable priority values is 4294967296, which can meet the actual needs of industrial production.

例如,网络中共100000台终端设备,优先级值在1至100000之间,终端设备A随机生成的优先级值为1000,终端设备A会向网络中的其他99999台设备发送通报消息,该通报消息中包含终端设备A的物理地址和/或网络地址等识别信息,其他设备通过该识别信息即可认识并找到终端设备A,该通报消息还包括终端设备A的优先级值,其他设备能够将终端设备A的优先级值为1000这一信息存储起来。For example, there are 100,000 terminal devices in the network, and the priority value is between 1 and 100,000. The priority value randomly generated by terminal device A is 1000. Terminal device A will send notification messages to other 99999 devices in the network. The notification message The notification message contains identification information such as the physical address and/or network address of the terminal device A. Other devices can recognize and find the terminal device A through the identification information. The notification message also includes the priority value of the terminal device A. Other devices can send the terminal device A Information that the priority value of device A is 1000 is stored.

S2:终端设备接收除自身以外的所有终端设备发送的通报消息,根据接收的通报消息以及自身的优先级值和识别信息生成优先级表,优先级表中包括各个终端设备的一一对应的优先级值和识别信息,优先级值按从大到小的顺序排列。S2: The terminal device receives notification messages sent by all terminal devices except itself, and generates a priority table according to the received notification messages, its own priority value and identification information, and the priority table includes the one-to-one corresponding priority of each terminal device. Priority values and identification information are arranged in descending order of priority values.

例如,终端设备A将收到的通报消息中各个终端设备的识别信息和优先级值以及自身的优先级值分离出来,汇总,并按优先级值由大到小的顺序排列,形成优先级表,在优先级表中,终端设备A与1000这一优先级值具有对应关系,其他终端设备与它们的优先级值同样具有对应关系。For example, terminal device A separates the identification information and priority value of each terminal device and its own priority value from the received notification message, summarizes them, and arranges them in descending order of priority values to form a priority table , in the priority table, terminal device A has a corresponding relationship with the priority value of 1000, and other terminal devices also have a corresponding relationship with their priority values.

S3:终端设备检查优先级表,判断优先级表中是否存在两个以上终端设备的优先级值相等,若是,终端设备则执行S301,若否,终端设备则执行S302。S3: The terminal device checks the priority table, and judges whether there are more than two terminal devices with equal priority values in the priority table, if yes, the terminal device executes S301, and if not, the terminal device executes S302.

S301:判断出现相等的情况的优先级值是否为自身的优先级值,若是,则重新执行S1和S2,若否,则重新执行S2;S301: Determine whether the priority value in the case of being equal is its own priority value, if yes, re-execute S1 and S2, if not, re-execute S2;

S302:根据代表设备判定策略确定自身所在的层、自身所在层的代表设备以及自身所在层的下一层的代表设备。S302: Determine the layer where the user is located, the representative device of the layer where the user is located, and the representative device of the layer below the layer where the user is located according to the determination strategy of the representative device.

例如,终端设备A检查优先级表中不存在两个以上相等的优先级值,说明优先级值没有重复的情况,则终端设备A根据代表设备判定策略对优先级表中的各终端设备进行分层,确定各层代表设备,并确定自身在第几层,从而确定自身所在层的代表设备以及自身所在层的下一层的代表设备。For example, terminal device A checks that there are no more than two equal priority values in the priority table, indicating that there are no duplicate priority values, then terminal device A classifies each terminal device in the priority table according to the representative device decision strategy. Layer, determine the representative equipment of each layer, and determine which layer it is in, so as to determine the representative equipment of its own layer and the representative equipment of the next layer of its own layer.

又如,终端设备A检查优先级表中存在两个以上相等的优先级值,说明存在重复的优先级值,无法进行之后的分层以及确定各层代表设备的步骤,则终端设备A进一步检查优先级表中是否存在与自身的优先级值相等的其他设备的优先级值,判断自身的优先级值是否为重复值,如果自身的优先级值确为重复的值,则终端设备A重新从S1开始执行本方法的步骤,执行完S1、S2,在S3中再次判断是否存在重复的优先级值,直到不存在重复的优先级值,则执行S302,确定自身所在的层、自身所在层的代表设备以及自身所在层的下一层的代表设备。As another example, terminal device A checks that there are two or more equal priority values in the priority table, indicating that there are duplicate priority values, and the subsequent steps of layering and determining the representative devices of each layer cannot be performed, then terminal device A further checks Whether there is a priority value of other devices equal to its own priority value in the priority table, judge whether its own priority value is a duplicate value, if its own priority value is indeed a duplicate value, then terminal device A starts from S1 starts to execute the steps of this method, after executing S1 and S2, judge whether there is a repeated priority value in S3 again, until there is no repeated priority value, then execute S302, determine the layer where the self is located, and the layer where the self is located A representative device and a representative device of the next layer of its own layer.

又如,优先级表中存在重复的优先级值,但终端设备A的优先级值经过检查判断,确定自身的优先级值不是重复的值,则只需等待优先级值重复的终端设备重新生成优先级值,更新优先级表,故需要重新执行S2、S3,直到不存在重复的优先级值,则执行S302,确定自身所在的层、自身所在层的代表设备以及自身所在层的下一层的代表设备。For another example, there are duplicate priority values in the priority table, but the priority value of terminal device A is checked and judged to determine that its own priority value is not a duplicate value, then it only needs to wait for the terminal device with duplicate priority value to be regenerated Priority value, update the priority table, so it is necessary to re-execute S2 and S3 until there is no repeated priority value, then execute S302 to determine the layer where you are, the representative device of your own layer, and the next layer of your own layer representative equipment.

在本实施例中,代表设备判定策略包括:将所有的优先级值分成n个第1层优先级值段,每个第1层优先级值段中优先级值最大的设备作为第1层设备,每个第1层优先级值段中剔除第1层设备的优先级值后分成n个第2层优先级值段,每个第2层优先级值段中优先级值最大的设备作为第2层设备,每个第1层设备均为其所在的第1层优先级值段中的第2层设备的代表设备,以此类推,直到确定第m-1层代表设备,m、n均通过人为设定,定义第m-1层设备为第m层设备的上一层,每个第m-1层设备均为其所在的第m-1层优先级值段中的第m层设备的代表设备。In this embodiment, the representative device decision strategy includes: dividing all priority values into n first-level priority value segments, and the device with the highest priority value in each first-level priority value segment is regarded as the first-level device , each layer 1 priority value segment is divided into n layer 2 priority value segments after excluding the priority value of the first layer device, and the device with the highest priority value in each layer 2 priority value segment is taken as the first For layer 2 devices, each layer 1 device is the representative device of the layer 2 device in the priority value segment of the first layer where it is located, and so on, until the representative device of layer m-1 is determined, m and n are both Through artificial setting, the m-1th layer device is defined as the upper layer of the m-th layer device, and each m-1th layer device is the m-th layer device in the m-1th layer priority value segment where it is located representative equipment.

例如,网络中的100000台终端设备被分为一百个第1层优先级值段,分为3层,第一个第1层优先级值段为1至1000,第二个第1层优先级值段为1001至2000,……第一百个第1层优先级值段为99001至100000。终端设备A优先级值为1000,位于第一个第1层优先级值段为1至1000中,并且是该第1层优先级值段中优先级值最大的设备,则终端设备A为第1层设备。优先级值为1至999的终端设备被分成一百个第2层优先级值段,第一个第2层优先级值段为1至10,第二个第2层优先级值段为11至20,……第一百个第2层优先级值段为991至999,则第二层设备包括优先级值为10、20、30……970、980、990、999的一百个终端设备,它们均以终端设备A为代表设备。那么其他既不属于第1层也不属于第2层的终端设备均为第3层设备。For example, 100,000 terminal devices in the network are divided into one hundred Layer 1 priority value segments, divided into 3 layers, the first Layer 1 priority value segment is 1 to 1000, and the second Layer 1 priority value segment is The priority value range is from 1001 to 2000, ... the hundredth layer 1 priority value range is from 99001 to 100000. The priority value of terminal device A is 1000, it is located in the first priority value range of the first layer 1 to 1000, and it is the device with the highest priority value in the priority value range of the first layer, then terminal device A is the first 1st floor equipment. End-devices with priority values 1 to 999 are divided into one hundred Layer 2 priority value segments, with the first Layer 2 priority value segment being 1 to 10 and the second Layer 2 priority value segment being 11 to 20, ... the hundredth layer 2 priority value range is 991 to 999, then the second layer equipment includes one hundred terminals with priority values 10, 20, 30... 970, 980, 990, 999 devices, all of which are represented by terminal device A. Then other terminal devices that belong to neither layer 1 nor layer 2 are layer 3 devices.

推选代表设备除采用从上层向下层推选的顺序外,还可以采用从下往上推选代表设备的策略。在本实施例中,代表设备判定策略包括:将所有的优先级值分成x个第y层优先级值段,每个第y层优先级值段中优先级值最大的设备作为该第y层优先级值段在第y层的代表设备,将所有的第y层的代表设备的优先级值分成x个第y-1层优先级值段,每个第y-1层优先级值段中优先级值最大的设备作为该第y-1层优先级值段在第y-1层的代表设备,以此类推,直至确定第1层代表设备,x、y均通过人为设定,定义第y-1层设备为第y层设备的上一层,每个第y-1层设备均为其所在的第y-1层优先级值段中的第y层设备的代表设备。In addition to the order of selecting representative devices from the upper layer to the lower layer, the strategy of selecting representative devices from the bottom to the top can also be adopted. In this embodiment, the decision strategy of the representative device includes: dividing all priority values into x y-th priority value segments, and the device with the highest priority value in each y-th layer priority value segment is used as the y-th layer The priority value segment is the representative device at the yth layer, divide the priority values of all the representative devices at the yth layer into x y-1 layer priority value segments, and each y-1 layer priority value segment The device with the highest priority value is used as the representative device in the y-1 layer priority value segment of the y-1 layer, and so on until the representative device of the 1st layer is determined. The y-1 layer device is the upper layer of the y-th layer device, and each y-1-th layer device is a representative device of the y-th layer device in the y-1 layer priority value segment where it is located.

通过上述方法,工业物联网中的终端设备能够推选出代表设备,通过代表设备向平台服务器发送心跳包,减少平台服务器接收、处理心跳包的数量,减轻平台服务器及信道的负担。Through the above method, the terminal devices in the Industrial Internet of Things can select representative devices, and send heartbeat packets to the platform server through the representative devices, reducing the number of heartbeat packets received and processed by the platform server, and reducing the burden on the platform server and channels.

实施例二:Embodiment two:

请参见图2,当网络中的终端设备增加或减少时,优先级表的信息出现不准确的情况,终端设备需要实时更新优先级表,以方便明确终端设备与代表设备之间的映射关系,为此,在本实施例中,设备推选代表的方法还包括:Please refer to Figure 2. When the number of terminal devices in the network increases or decreases, the information in the priority table is inaccurate. The terminal device needs to update the priority table in real time to facilitate the clear mapping between the terminal device and the representative device. For this reason, in this embodiment, the method for a device to elect a representative further includes:

S4:终端设备向所在层的上一层中其自身的代表设备发送通报消息,向所在层下一层中以其自身为代表设备的其他终端设备发送代表通报消息,接收所在层的上一层中其自身的代表设备发送的代表通报消息,接收所在层下一层中以其自身为代表设备的其他终端设备向其发送的通报消息,并根据接收的代表通报消息和通报消息更新自身的优先级表,代表通报消息包括发送代表通报消息的代表设备的优先级值和识别信息以及其所代表的终端设备的优先级值和识别信息。S4: The terminal device sends a notification message to its own representative device in the upper layer, sends a representative notification message to other terminal devices in the lower layer where it is the representative device, and receives the notification message from the upper layer The representative notification message sent by its own representative device, receives the notification message sent to it by other terminal devices with itself as the representative device in the lower layer, and updates its own priority according to the received representative notification message and notification message. The representative notification message includes the priority value and identification information of the representative device sending the representative notification message and the priority value and identification information of the terminal device it represents.

例如,终端设备A的代表设备为终端设备α,其所代表的设备包括终端设备B、C、D、E、F等,则终端设备A向终端设备α发送通报消息,向终端设备B、C、D、E、F等发送代表通报消息,接收终端设备α发送的代表通报消息,接收终端设备B、C、D、E、F等发送的通报消息,并根据接收的代表通报消息和通报消息更新自身的优先级表。For example, the representative device of terminal device A is terminal device α, and the devices it represents include terminal devices B, C, D, E, F, etc., then terminal device A sends a notification message to terminal device α, and sends notification messages to terminal devices B and C , D, E, F, etc. send representative notification messages, receive representative notification messages sent by terminal equipment α, receive notification messages sent by terminal equipment B, C, D, E, F, etc., and according to the received representative notification messages and notification messages Update its own priority table.

实施例三:Embodiment three:

当其中一个代表设备因其他原因不在线的时候,终端设备需要重新推选其代表设备,然后向其靠拢,保证网络的稳定,极限的情况下代表设备只表示自己一个设备,请参见图3,在本实施例中,设备推选代表的方法还包括:When one of the representative devices is offline due to other reasons, the terminal device needs to re-elect its representative device, and then move closer to it to ensure the stability of the network. In this embodiment, the method for the device to elect a representative further includes:

S5:终端设备接收不到所在层的上一层中其自身的代表设备发送的代表通报消息时,将代表设备定义为原代表设备,向其原代表设备所代表的其他终端设备发送通报消息,接收其原代表设备所代表的其他终端设备向其发送的通报消息,并根据接收到的通报消息更新优先级表,根据更新后的优先级表从原代表设备所代表的其他终端设备及自身中选出优先级值最大的终端设备,作为代表设备。S5: When the terminal device cannot receive the representative notification message sent by its own representative device in the layer above the layer where it is located, define the representative device as the original representative device, and send the notification message to other terminal devices represented by the original representative device, Receive notification messages sent to it by other terminal devices represented by its original representative device, and update the priority table according to the received notification message, and receive information from other terminal devices represented by the original representative device and itself according to the updated priority table. Select the terminal device with the highest priority value as the representative device.

例如,终端设备A不在线时,其所代表的终端设备B、C、D、E、F等将终端设备A定义为原代表设备。终端设备B、C、D、E、F等互相发送通报消息,同时接收互相发送的通报消息,并根据接收到的通报消息更新优先级表,根据更新后的优先级表选出优先级值最大的终端设备作为代表设备,假设更新后的优先级表中终端设备B的优先级值最大,则终端设备B为代表设备,代表终端设备C、D、E、F等向上一层的终端设备α发送心跳包。For example, when terminal device A is offline, terminal devices B, C, D, E, F, etc. represented by it define terminal device A as the original representative device. Terminal devices B, C, D, E, F, etc. send notification messages to each other, and at the same time receive the notification messages sent by each other, and update the priority table according to the received notification messages, and select the one with the highest priority value according to the updated priority table. As the representative device, assuming that the priority value of terminal device B in the updated priority table is the largest, then terminal device B is the representative device, representing terminal devices C, D, E, F, etc. Send a heartbeat packet.

上述说明是针对本发明较佳可行实施例的详细说明,但实施例并非用以限定本发明的专利申请范围,凡本发明所提示的技术精神下所完成的同等变化或修饰变更,均应属于本发明所涵盖专利范围。The above description is a detailed description of the preferred feasible embodiments of the present invention, but the embodiments are not used to limit the scope of the patent application of the present invention. All equivalent changes or modifications completed under the technical spirit suggested by the present invention shall belong to The scope of patents covered by the present invention.

Claims (5)

1. A method of device electing representatives, the method being applied to an industrial internet of things comprising:
s1: the terminal equipment randomly generates a priority value, stores the generated priority value, marks the priority value as the priority value of the terminal equipment, and broadcasts and sends a notification message to a network, wherein the notification message comprises the priority value and identification information of the terminal equipment sending the notification message;
s2: the terminal equipment receives notification messages sent by all terminal equipment except the terminal equipment, and generates a priority table according to the received notification messages, the priority values and the identification information of the terminal equipment, wherein the priority table comprises priority values and the identification information which are in one-to-one correspondence with the terminal equipment, and the priority values are arranged in the priority table in sequence from large to small;
s3: the terminal equipment checks the priority table, judges whether more than two terminal equipment have equal priority values in the priority table, if so, the terminal equipment executes S301, and if not, the terminal equipment executes S302;
s301: judging whether the priority value of the condition of equality is the priority value of the priority value per se, if so, re-executing the step S1, and if not, re-executing the step S2;
s302: determining a layer where the representative device is located, the representative device of the layer where the representative device is located and the representative device of the next layer of the layer where the representative device is located according to a representative device judging strategy;
the representative device determination policy includes: dividing all priority values into n 1 st layer priority value segments, wherein the device with the largest priority value in each 1 st layer priority value segment is used as 1 st layer device, removing the priority value of the 1 st layer device in each 1 st layer priority value segment and then dividing the device into n 2 nd layer priority value segments, wherein the device with the largest priority value in each 2 nd layer priority value segment is used as 2 nd layer device, each 1 st layer device is the representative device of the 2 nd layer device in the 1 st layer priority value segment, and so on until the m-1 st layer representative device is determined, m and n are defined as the upper layer of the m-1 st layer device through artificial setting, and each m-1 st layer device is the representative device of the m-1 st layer device in the m-1 st layer priority value segment;
further comprises:
s4: the terminal device sends a notification message to its own representative device in the upper layer of the layer, sends a representative notification message to other terminal devices taking itself as a representative device in the lower layer of the layer, receives the representative notification message sent by its own representative device in the upper layer of the layer, receives the notification message sent by other terminal devices taking itself as a representative device in the lower layer of the layer, and updates its own priority table according to the received representative notification message and notification message, wherein the representative notification message comprises the priority value and identification information of the representative device sending the representative notification message and the priority value and identification information of the terminal device represented by the representative notification message.
2. A method of selecting a representative device according to claim 1, further comprising:
s5: when the terminal equipment cannot receive the representative notification message sent by the representative equipment of the terminal equipment in the upper layer of the layer, the representative equipment is defined as original representative equipment, notification messages are sent to other terminal equipment represented by the original representative equipment, the notification messages sent by other terminal equipment represented by the original representative equipment are received, the priority table is updated according to the received notification messages, and the representative equipment is determined from the other terminal equipment represented by the original representative equipment and the terminal equipment according to the updated priority table and the representative equipment judging strategy.
3. The method for selecting a representative of a device according to claim 1, wherein said representative device decision strategy comprises: dividing all priority values into x y-layer priority value segments, wherein the device with the largest priority value in each y-layer priority value segment is used as the representative device of the y-layer priority value segment in the y-layer, dividing the priority values of all the representative devices of the y-layer into x y-1-layer priority value segments, using the device with the largest priority value in each y-1-layer priority value segment as the representative device of the y-1-layer priority value segment in the y-1-layer, and so on until the 1-layer representative device is determined, defining the y-1-layer device as the last layer of the y-layer device through manual setting, and each y-1-layer device is the representative device of the y-layer device in the y-1-layer priority value segment.
4. A method of selecting a representative device according to claim 1, wherein the priority value is between 1 and 2 32 Between them.
5. A method of selecting a representative of a device according to claim 1, characterized in that the identification information comprises the physical address and/or network address of the terminal device.
CN202010842348.0A 2020-08-20 2020-08-20 A method for device electing a representative Active CN112055059B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010842348.0A CN112055059B (en) 2020-08-20 2020-08-20 A method for device electing a representative

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010842348.0A CN112055059B (en) 2020-08-20 2020-08-20 A method for device electing a representative

Publications (2)

Publication Number Publication Date
CN112055059A CN112055059A (en) 2020-12-08
CN112055059B true CN112055059B (en) 2023-06-16

Family

ID=73600866

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010842348.0A Active CN112055059B (en) 2020-08-20 2020-08-20 A method for device electing a representative

Country Status (1)

Country Link
CN (1) CN112055059B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9471593B1 (en) * 2010-12-30 2016-10-18 Emc Corporation Method and apparatus for ensuring consistent ordering of writes in a distributed database storage system
WO2017039089A1 (en) * 2015-08-28 2017-03-09 한국과학기술원 Device and method for communication through random connection process
CN106664316A (en) * 2014-02-28 2017-05-10 泰科消防及安全有限公司 Constrained device and supporting operating system
CN107852192A (en) * 2015-07-03 2018-03-27 华为技术有限公司 The apparatus and method of urgency signal are sent and received using cordless communication network
CN110445824A (en) * 2018-05-04 2019-11-12 中国移动通信有限公司研究院 NB-IoT data reporting method, device, system and computer readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9510161B2 (en) * 2013-07-08 2016-11-29 Electronics & Telecoomunications Research Institute Method for public safety communication and apparatus for the same

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9471593B1 (en) * 2010-12-30 2016-10-18 Emc Corporation Method and apparatus for ensuring consistent ordering of writes in a distributed database storage system
CN106664316A (en) * 2014-02-28 2017-05-10 泰科消防及安全有限公司 Constrained device and supporting operating system
CN107852192A (en) * 2015-07-03 2018-03-27 华为技术有限公司 The apparatus and method of urgency signal are sent and received using cordless communication network
WO2017039089A1 (en) * 2015-08-28 2017-03-09 한국과학기술원 Device and method for communication through random connection process
CN110445824A (en) * 2018-05-04 2019-11-12 中国移动通信有限公司研究院 NB-IoT data reporting method, device, system and computer readable storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Min Jia.A Novel Hybrid Access Protocol Based on Traffic Priority in Space-Based Network.《IEEE》.2018,全文. *
阮冬茹 ; 谢东光 ; .基于EPA的工业以太网确定性研究.微计算机信息.2006,(07),全文. *

Also Published As

Publication number Publication date
CN112055059A (en) 2020-12-08

Similar Documents

Publication Publication Date Title
CN113010576B (en) Method, device, equipment and storage medium for evaluating capacity of cloud computing system
KR102125219B1 (en) Data processing methods, devices, systems, programs and computer readable recording media
WO2021056909A1 (en) Resource management platform-based task allocation method and system
CN106597991A (en) Numerically controlled machine tool remote monitoring method and device
CN108322548A (en) A kind of industrial process data analyzing platform based on cloud computing
CN114153580A (en) Cross-multi-cluster work scheduling method and device
CN106936925A (en) Load-balancing method and system
CN104504495A (en) Operation and maintenance abnormity processing method, device and equipment
CN105049509A (en) Cluster scheduling method, load balancer and clustering system
CN105653401A (en) Method and device for scheduling disaster recovery, operation and maintenance, monitoring and emergency start-stop of application systems
CN108762932A (en) A kind of cluster task scheduling system and processing method
CN105912740A (en) CAE distributed cooperative work method based on cloud computing
CN116048723A (en) Virtual machine scheduling method and system based on non-dominant ordering multi-target genetic algorithm
CN112055059B (en) A method for device electing a representative
CN117608257B (en) Cable production scheme generation method and electronic equipment
CN104714875A (en) Distributed automatic collecting method
CN109697117A (en) Terminal control method, device and computer readable storage medium
CN111859058A (en) Method, device, storage medium and electronic device for obtaining environmental data
KR20210123635A (en) Automatic System And Method For Image Learning Using Artificial Intelligence
CN105630634B (en) Application system calamity is for switching method and apparatus
CN111445124B (en) Order scheduling method, device and system
CN114443293A (en) A system and method for deploying a big data platform
CN114997687A (en) Resource scheduling method, device, storage medium and electronic device
CN111885159A (en) Data acquisition method and device, electronic equipment and storage medium
CN118396338B (en) Multi-intelligent system real-time task allocation and load balancing method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20241031

Address after: 308, Building 47, Dayun Software Town, No. 8288 Longgang Avenue, He'ao Community, Yuanshan Street, Longgang District, Shenzhen City, Guangdong Province, 518000

Patentee after: Shenzhen Zhihui Huasheng Technology Co.,Ltd.

Country or region after: China

Address before: Room 1009, building 2, 1780 Jiangling Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province 310000

Patentee before: Zhejiang Hongcheng Technology Co.,Ltd.

Country or region before: China