Movatterモバイル変換


[0]ホーム

URL:


CN114980215A - Zigbee equipment communication method and system based on beacon transmission and time slot allocation - Google Patents

Zigbee equipment communication method and system based on beacon transmission and time slot allocation
Download PDF

Info

Publication number
CN114980215A
CN114980215ACN202210569882.8ACN202210569882ACN114980215ACN 114980215 ACN114980215 ACN 114980215ACN 202210569882 ACN202210569882 ACN 202210569882ACN 114980215 ACN114980215 ACN 114980215A
Authority
CN
China
Prior art keywords
beacon
zigbee
router
time slot
node
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.)
Granted
Application number
CN202210569882.8A
Other languages
Chinese (zh)
Other versions
CN114980215B (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.)
Shanxi Newsun Technology Co ltd
Original Assignee
Shanxi Newsun 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 Shanxi Newsun Technology Co ltdfiledCriticalShanxi Newsun Technology Co ltd
Priority to CN202210569882.8ApriorityCriticalpatent/CN114980215B/en
Publication of CN114980215ApublicationCriticalpatent/CN114980215A/en
Application grantedgrantedCritical
Publication of CN114980215BpublicationCriticalpatent/CN114980215B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The invention provides a Zigbee equipment communication method and a Zigbee equipment communication system based on beacon transmission and time slot allocation, belonging to the technical field of Zigbee equipment communication; the problems of the Zigbee equipment communication method under the condition of dense uplink period, numerous terminals and high-frequency position mobile application scene are solved; the technical scheme for solving the technical problems is as follows: the method comprises the steps that a Zigbee router which is registered to be accessed into a network through a server and a Zigbee gateway initiates route discovery, the router submits path information step by step and establishes a route linked list based on a B-tree data structure, and beacons are transmitted step by step through non-recursive preorder traversal on the B-tree linked list in a determined path and a unique time slot; the router receiving the beacon synchronizes self time information and sends the time information to the next level router appointed by the route link table in the time slot appointed by the beacon; the Zigbee terminal equipment synchronizes self time information after receiving the beacon of the router and broadcasts uplink data to the router in the unique system time slot determined by the dynamic equipment ID; the invention is applied to Zigbee equipment.

Description

Translated fromChinese
基于信标传递和时隙分配的Zigbee设备通信方法和系统Zigbee device communication method and system based on beacon delivery and time slot allocation

技术领域technical field

本发明提供了一种基于信标传递和时隙分配的Zigbee设备通信方法和系统,属于Zigbee设备通信方法技术领域,尤其是涉及一种要求一定上行数据并发量和可靠性的工业领域设备Zigbee通信方法及系统。The invention provides a Zigbee device communication method and system based on beacon transmission and time slot allocation, belonging to the technical field of Zigbee device communication methods, and in particular to an industrial field device Zigbee communication that requires a certain amount of uplink data concurrency and reliability method and system.

背景技术Background technique

Zigbee是无线通信技术中非常重要的技术之一,其具有低功耗、可组网的特点被广泛应用于家庭自动化领域,其自组网技术可以适用于大多数低频次位置移动、低频次上行数据的应用场景。Zigbee is one of the most important technologies in wireless communication technology. It has the characteristics of low power consumption and networking. It is widely used in the field of home automation. Data application scenarios.

业内同行普遍具有将Zigbee无线通讯技术应用于上行周期密集、终端数量众多、设备移动频繁,且要求数据稳定性良好的工业数据采集及控制领域的需求。针对上述中的相关技术,发明人认为,业内普遍使用的Z-stack协议栈在以下诸多方面不能满足上述提及的各种应用需求:Industry peers generally have the need to apply Zigbee wireless communication technology to industrial data acquisition and control fields with dense uplink cycles, a large number of terminals, frequent device movement, and good data stability. In view of the above-mentioned related technologies, the inventor believes that the Z-stack protocol stack commonly used in the industry cannot meet the various application requirements mentioned above in the following aspects:

1. Z-stack协议栈默认提供的CSMA-CA载波检测防碰撞算法在上行周期密集、终端数量众多的应用场景下难以提供良好的数据稳定性;1. The CSMA-CA carrier detection anti-collision algorithm provided by the Z-stack protocol stack by default is difficult to provide good data stability in application scenarios with dense uplink cycles and a large number of terminals;

2. 信标模式作为Z-stack协议栈提供的一种时间同步机制,基于IEEE802.15.4协议,只有有限的用于非竞争接入的保证时隙(GTS),在竞争接入期(CAP)依然依赖于信道的随机抢占,难以满足终端数量众多的高并发量需求;2. As a time synchronization mechanism provided by the Z-stack protocol stack, the beacon mode is based on the IEEE802.15.4 protocol, and has only a limited guaranteed time slot (GTS) for non-contention access, during the contention access period (CAP) It still relies on the random preemption of the channel, and it is difficult to meet the high concurrency requirements of a large number of terminals;

3. Z-stack协议栈提供的多对一路由发现协议旨在解决多个设备向集中器方向的路由策略问题,信标的传递却是一种从集中器到多个设备的路由策略问题;3. The many-to-one route discovery protocol provided by the Z-stack protocol stack is designed to solve the routing policy problem from multiple devices to the concentrator, but the transmission of beacons is a routing policy problem from the concentrator to multiple devices;

4. Z-stack协议栈所固有的终端设备重入网机制,由于重入网阶段一定数量的网络层数据对信道的占用,难以满足设备高频次位置移动情况下上行数据的时分多址通信机制。4. The terminal device re-entry mechanism inherent in the Z-stack protocol stack is difficult to meet the time-division multiple access communication mechanism of uplink data in the case of high-frequency location movement of the device due to the occupation of a certain amount of network layer data during the re-entry phase.

发明内容SUMMARY OF THE INVENTION

本发明为了克服传统Zigbee组网通信技术中存在的不足,所要解决的技术问题为:提供一种适用于上行周期密集、终端数量众多且存在高频次位置移动应用场景下的Zigbee设备通信方法的改进。In order to overcome the deficiencies existing in the traditional Zigbee networking communication technology, the technical problem to be solved by the present invention is: to provide a Zigbee device communication method suitable for a Zigbee device communication method with dense uplink cycles, a large number of terminals and high-frequency location mobile application scenarios. Improve.

为了解决上述技术问题,本发明采用的技术方案为:基于信标传递和时隙分配的Zigbee设备通信方法,包括如下步骤:In order to solve the above-mentioned technical problems, the technical solution adopted in the present invention is: a Zigbee device communication method based on beacon transmission and time slot allocation, including the following steps:

S1:待入网路由器通过服务器的设备管理平台完成注册,Zigbee网关读取路由器的注册信息,接收路由器入网请求并完成路由器入网;S1: The router to be connected to the network completes the registration through the device management platform of the server, and the Zigbee gateway reads the router's registration information, receives the router's network access request, and completes the router's network access;

S2:Zigbee网关对所有已注册路由器逐一发起路由发现请求,每一次路由发现确定了唯一的路径,路由器按照路径逐级提交路径信息并建立基于B树数据结构的路由链表,通过对B树链表的非递归先序遍历,给B树链表的所有子树节点路由器分配信标时隙;S2: The Zigbee gateway initiates route discovery requests to all registered routers one by one. Each route discovery determines a unique path. The router submits the path information step by step according to the path and establishes a routing list based on the B-tree data structure. Non-recursive pre-order traversal, assigning beacon slots to all subtree node routers in the B-tree linked list;

S3:Zigbee网关生成信标,并在信标周期的起始时隙内发送,收到信标的子节点路由器依据信标载荷中的时间戳同步自身时间信息,并在由信标载荷确定的时隙内传递新信标给下一级子节点路由器;S3: The Zigbee gateway generates a beacon and sends it in the initial time slot of the beacon period. The sub-node router that receives the beacon synchronizes its own time information according to the time stamp in the beacon payload, and at the time determined by the beacon payload The new beacon is transmitted to the next-level child node router in the slot;

S4:Zigbee终端设备随机分布在路由器信号覆盖范围内的区域,接收Zigbee终端设备附近的路由器发送的信标,依据信标的时间戳同步自身时间信息,并依据设备ID确定上行数据的发送时隙,上行数据通过MAC层接口以时隙模式广播发送,下行数据被路由器缓存并随信标载荷一起发送,随着信标的传递到达目标Zigbee终端设备。S4: Zigbee terminal devices are randomly distributed in the area covered by the router signal, receive beacons sent by routers near Zigbee terminal devices, synchronize their own time information according to the timestamp of the beacon, and determine the transmission time slot of uplink data according to the device ID, The uplink data is broadcast and sent in the slot mode through the MAC layer interface, and the downlink data is buffered by the router and sent together with the beacon payload, and reaches the target Zigbee terminal device with the beacon delivery.

所述步骤S1中待入网路由器的设备注册步骤如下:The device registration steps of the router to be connected to the network in the step S1 are as follows:

待入网路由器与服务器的设备管理平台建立通信,设备管理平台读取待入网路由器的64位MAC地址,并为待入网路由器指定16位网络短地址,生成设备信息表;The router to be connected to the network establishes communication with the device management platform of the server, and the device management platform reads the 64-bit MAC address of the router to be connected to the network, and specifies a 16-bit network short address for the router to be connected to the network, and generates a device information table;

设备管理平台将已注册路由器的设备信息表传输给Zigbee网关,设备信息表在Zigbee网关内部以非易失形式保存,直到设备恢复出厂设置;The device management platform transmits the device information table of the registered router to the Zigbee gateway, and the device information table is stored in the Zigbee gateway in a non-volatile form until the device is restored to factory settings;

Zigbee网关在接收到路由器设备的入网请求后,比对设备信息表中的MAC地址,过滤非注册路由器的入网请求,完成已注册路由器的网络加入过程。After receiving the network access request of the router device, the Zigbee gateway compares the MAC address in the device information table, filters the network access request of the unregistered router, and completes the network joining process of the registered router.

所述步骤S2中的构建路由链表的步骤如下:The steps of constructing the routing linked list in the step S2 are as follows:

Zigbee网关通过Z-Stack协议栈提供的路由发现功能,对所有注册的路由器逐一发起路由发现请求;Through the route discovery function provided by the Z-Stack protocol stack, the Zigbee gateway initiates route discovery requests to all registered routers one by one;

接收到路由发现请求的目标路由器提取Z-Stack协议栈中的路由发现表,进而得到上一级路由节点的网络短地址,将包含自身节点的路径信息单播发送到上一级路由节点;The target router that receives the route discovery request extracts the route discovery table in the Z-Stack protocol stack, and then obtains the network short address of the upper-level routing node, and unicasts the path information including its own node to the upper-level routing node;

上一级路由器将接收到的路径信息添加到基于B树数据结构的路由链表中,随着路由发现过程逐一进行,使路由链表逐渐完善,直至构建以每一级路由器自身节点为根节点的全部路径信息;The upper-level router adds the received path information to the routing list based on the B-tree data structure. As the route discovery process proceeds one by one, the routing list is gradually improved until it builds all routers with their own node as the root node. path information;

随着路径信息的逐级提交,Zigbee网关接收到系统中所有路由节点的路径信息,建立包含全系统路由器的路由链表。With the step-by-step submission of the path information, the Zigbee gateway receives the path information of all routing nodes in the system, and establishes a routing list including the routers of the whole system.

所述步骤S3中的信标生成和传递的步骤如下:The steps of generating and transmitting the beacon in the step S3 are as follows:

Zigbee网关通过对内部B树路由链表的非递归先序遍历,依据遍历的先后顺序给B树路由链表的所有子树节点路由器分配设备ID,设备ID唯一确定了子树节点路由器生成的新信标发送时刻的时隙;Through the non-recursive pre-order traversal of the internal B-tree routing list, the Zigbee gateway assigns device IDs to all sub-tree node routers in the B-tree routing list according to the traversal sequence. The device ID uniquely determines the new beacons generated by the sub-tree node routers. The time slot at the time of sending;

信标帧载荷中包含了Zigbee网关以及Zigbee网关子节点路由器的网络短地址和设备ID,信标帧载荷中还包含了发送时刻的时间戳;The beacon frame payload includes the network short address and device ID of the Zigbee gateway and the Zigbee gateway sub-node router, and the beacon frame payload also includes the time stamp of the sending time;

Zigbee网关生成信标后,在信标周期的起始时隙内发送第0个信标,信标被Zigbee网关的子节点路由器所接收,接收到信标的子节点路由器依次做以下操作:After the Zigbee gateway generates the beacon, it sends the 0th beacon in the initial time slot of the beacon period. The beacon is received by the child node router of the Zigbee gateway, and the child node router that receives the beacon performs the following operations in sequence:

① 依据信标载荷中的时间戳同步自身时间信息;① Synchronize its own time information according to the timestamp in the beacon payload;

② 依据自身网络短地址对应的设备ID确定新信标的发送时隙;② Determine the sending time slot of the new beacon according to the device ID corresponding to its own network short address;

③ 然后通过对内部B树路由链表的非递归先序遍历,依据遍历的先后顺序给B树路由链表的所有子树节点路由器分配信标时隙,生成新的信标;③ Then, through the non-recursive pre-order traversal of the internal B-tree routing list, according to the order of traversal, beacon time slots are allocated to all subtree node routers of the B-tree routing list, and new beacons are generated;

④ 新信标在设备ID确定的发送时隙内发送,并被下一级子节点路由器所接收;④ The new beacon is sent in the sending time slot determined by the device ID, and is received by the next-level child node router;

以此类推,信标被B树路由链表中的所有节点逐层传递,直到最末端的路由器节点。By analogy, the beacon is passed layer by layer by all nodes in the B-tree routing list, until the end router node.

一个信标周期为41943mS即65536*2个MacTimer周期,被分为32个通信周期,一个通信周期1310mS,每个通信周期又被分为256个时隙,每个时隙5.12mS即16个MacTimer周期;A beacon period is 41943mS or 65536*2 MacTimer periods, which are divided into 32 communication periods, one communication period is 1310mS, and each communication period is divided into 256 time slots, each time slot 5.12mS or 16 MacTimer cycle;

每个通信周期的前2个时隙(时隙ID = 0~1)用于信标传递,之后的2个时隙(时隙ID = 2~3)空闲备用,再之后的250个时隙(时隙ID = 4~253)用于上行数据的通信,最后的2个时隙(时隙ID = 254~255)空闲备用。The first 2 time slots (time slot ID = 0~1) of each communication cycle are used for beacon transmission, the next 2 time slots (time slot ID = 2~3) are idle, and the next 250 time slots (time slot ID = 4~253) is used for uplink data communication, and the last 2 time slots (time slot ID = 254~255) are idle for backup.

所述步骤S4中Zigbee终端设备上行数据时隙的确定步骤如下:The steps for determining the uplink data time slot of the Zigbee terminal equipment in the step S4 are as follows:

Zigbee终端设备的上行数据时隙由签到路由器给Zigbee终端设备分配的动态设备ID所确定,动态设备ID值为0~249,对应时隙ID = 4~253;The uplink data time slot of the Zigbee terminal device is determined by the dynamic device ID assigned by the sign-in router to the Zigbee terminal device. The dynamic device ID value is 0~249, and the corresponding time slot ID = 4~253;

在一个时间段内,一批Zigbee终端设备以竞争方式与签到路由器建立上行通信,发送迁入请求,动态设备ID以签到路由器接收数据包的顺序从0到249依次递增分配,被分配的设备ID处于活跃态,当所有可用设备ID均处于活跃态,新迁入的设备则被拒绝迁入;Within a period of time, a batch of Zigbee terminal devices establishes uplink communication with the sign-in router in a competitive manner, and sends a migration request. The dynamic device IDs are allocated sequentially from 0 to 249 in the order in which the sign-in routers receive packets. The assigned device ID In the active state, when all available device IDs are in the active state, the newly migrated device will be rejected;

在下一个时间段内,上一批Zigbee终端设备陆续发送迁出请求,下一批Zigbee终端设备陆续发送迁入请求,迁出设备的设备ID从活跃态转变为非活跃态,非活跃态的设备ID被动态地分配给迁入设备,由此实现上行时隙的动态分配。In the next time period, the last batch of Zigbee terminal devices send migration requests one after another, and the next batch of Zigbee terminal devices send migration requests one after another. IDs are dynamically allocated to inbound devices, thereby realizing dynamic allocation of uplink time slots.

基于信标传递和时隙分配的Zigbee设备通信系统,包括:服务器、Zigbee网关、Zigbee路由器、Zigbee签到路由器、Zigbee终端设备;Zigbee device communication system based on beacon delivery and time slot allocation, including: server, Zigbee gateway, Zigbee router, Zigbee sign-in router, Zigbee terminal equipment;

所述服务器,用于设备管理、设备数据展示和人机交互;The server is used for device management, device data display and human-computer interaction;

所述Zigbee网关,与服务器建立有线的或无线的串口或网络连接,用于Zigbee网络的建立,以及用于路由发现功能、设备信息表的存储和管理、信标的生成和信标时隙的分配;The Zigbee gateway establishes a wired or wireless serial port or network connection with the server, is used for the establishment of a Zigbee network, and is used for routing discovery function, storage and management of device information tables, generation of beacons and allocation of beacon time slots;

所述Zigbee路由器,与服务器建立有线的或无线的串口或网络连接,用于路径信息的逐级提交、下级路由链表的管理、信标的传递、Zigbee终端设备上行数据的接收、下行数据的缓存和发送;The Zigbee router establishes a wired or wireless serial port or network connection with the server, which is used for the step-by-step submission of path information, the management of the lower-level routing list, the transmission of beacons, the reception of Zigbee terminal equipment upstream data, the cache of downstream data and send;

所述Zigbee签到路由器与上位机建立通信,不参与信标传递,用于Zigbee终端设备动态ID的生成;The Zigbee sign-in router establishes communication with the host computer, does not participate in beacon transmission, and is used for the generation of Zigbee terminal equipment dynamic ID;

Zigbee终端设备,用于设备数据的采集、缓存、上行数据的发送,信标载荷中下行数据的接收和下行命令的执行。Zigbee terminal equipment is used for data collection, buffering, transmission of uplink data, reception of downlink data in the beacon payload, and execution of downlink commands.

所述服务器采用具有RS-232、RS-485、USB、网口通信接口的单机设备或与Internet连接的网络服务器。The server adopts a stand-alone device with communication interfaces of RS-232, RS-485, USB and network port or a network server connected with the Internet.

所述Zigbee网关、Zigbee路由器分别具有RS-232、RS-485、USB、网口等通信接口中的一种或几种。The Zigbee gateway and Zigbee router respectively have one or more of communication interfaces such as RS-232, RS-485, USB, and network port.

本发明相对于现有技术具备的有益效果为:本发明提供的基于信标传递和时隙分配的Zigbee设备通信方法采用创新的信标传递算法和时隙分配策略,有效地改善了Zigbee信号带宽利用率,提高了终端设备的上行并发量,使得Zigbee网络可以适用于要求有较高数据稳定性和实时性的工业环境。Compared with the prior art, the present invention has the following beneficial effects: the Zigbee device communication method based on beacon transmission and time slot allocation provided by the present invention adopts innovative beacon transmission algorithm and time slot allocation strategy, which effectively improves the Zigbee signal bandwidth The utilization rate increases the upstream concurrency of the terminal equipment, making the Zigbee network suitable for industrial environments that require high data stability and real-time performance.

附图说明Description of drawings

下面结合附图对本发明做进一步说明:The present invention will be further described below in conjunction with the accompanying drawings:

图1是本发明通信方法的流程图;Fig. 1 is the flow chart of the communication method of the present invention;

图2是本发明待入网路由器设备注册的方法示意图;2 is a schematic diagram of a method for registering a router device to be connected to the network according to the present invention;

图3是本发明构建路由链表的方法示意图;3 is a schematic diagram of a method for constructing a routing list according to the present invention;

图4是本发明信标的生成和传递的方法示意图;4 is a schematic diagram of a method for generating and transmitting a beacon of the present invention;

图5是本发明信标周期定义的示意图;Fig. 5 is the schematic diagram of the beacon period definition of the present invention;

图6是本发明信标周期中一个通信周期内时隙定义的示意图;Fig. 6 is the schematic diagram of the time slot definition in a communication cycle in the beacon cycle of the present invention;

图7是本发明构建路由链表的实例示意图;Fig. 7 is the example schematic diagram that the present invention constructs the routing linked list;

图8是本发明路径链表的遍历和信标的传递的实例示意图;Fig. 8 is the example schematic diagram of the traversal of the path linked list of the present invention and the transmission of the beacon;

图9是本发明通信系统的结构示意图。FIG. 9 is a schematic structural diagram of the communication system of the present invention.

具体实施方式Detailed ways

如图1至图9所示,本发明为了克服传统Zigbee组网通信技术的缺陷,提出了一种基于信标传递算法和时隙分配策略的Zigbee设备通信方法,该方法包括以下步骤:As shown in Figure 1 to Figure 9, in order to overcome the defects of the traditional Zigbee networking communication technology, the present invention proposes a Zigbee device communication method based on a beacon delivery algorithm and a time slot allocation strategy, and the method includes the following steps:

待入网路由器通过设备管理平台完成注册,Zigbee网关读取注册信息,接收路由器入网请求并完成设备入网;After the router to access the network completes the registration through the device management platform, the Zigbee gateway reads the registration information, receives the router's network access request, and completes the device access to the network;

Zigbee网关对所有注册路由设备逐一发起路由发现请求,路由器逐级提交路径信息并建立基于B树数据结构的路由链表,每一级路由器通过对B树链表的非递归先序遍历给其所有子树节点路由器分配信标时隙;The Zigbee gateway initiates route discovery requests to all registered routing devices one by one. The router submits the path information step by step and establishes a routing list based on the B-tree data structure. The router at each level traverses the B-tree list to all its subtrees through non-recursive pre-order traversal. Node routers allocate beacon slots;

Zigbee网关生成信标,并在信标周期的起始时隙内发送,收到信标的子节点路由器依据信标载荷中的时间戳同步自身时间信息,并在由信标载荷确定的时隙内传递新信标给其自身的子节点路由器;The Zigbee gateway generates a beacon and sends it in the initial time slot of the beacon period. The sub-node router that receives the beacon synchronizes its own time information according to the time stamp in the beacon payload, and sends it within the time slot determined by the beacon payload. pass the new beacon to its own child node router;

Zigbee终端设备随机分布在路由器信号覆盖范围内的区域,接收其附近的路由器设备发送的信标,依据信标的时间戳同步自身时间信息,并依据其动态设备ID确定其上行数据的发送时隙,上行数据通过MAC层接口以时隙模式广播发送,下行数据被路由器缓存并随信标载荷一起发送,随着信标的传递到达目标终端设备。Zigbee terminal devices are randomly distributed in the area covered by the router signal, receive beacons sent by nearby router devices, synchronize their own time information according to the time stamp of the beacon, and determine the sending time slot of its uplink data according to its dynamic device ID, The uplink data is broadcast and sent in the slot mode through the MAC layer interface, and the downlink data is buffered by the router and sent together with the beacon payload, and reaches the target terminal device with the beacon delivery.

在一个实施例中,待入网路由器的设备注册方法,参见图2,包括:In one embodiment, the device registration method of the router to be connected to the network, referring to FIG. 2 , includes:

待入网路由器与服务器的设备管理平台建立通信,设备管理平台读取待入网路由器的64位MAC地址,并为待入网路由器指定16位网络短地址,生成设备信息表;The router to be connected to the network establishes communication with the device management platform of the server, and the device management platform reads the 64-bit MAC address of the router to be connected to the network, and specifies a 16-bit network short address for the router to be connected to the network, and generates a device information table;

设备管理平台将已注册路由器的设备信息表传输给Zigbee网关,设备信息表在网关内部以非易失形式保存,直到设备恢复出厂设置;The device management platform transmits the device information table of the registered router to the Zigbee gateway, and the device information table is stored in a non-volatile form inside the gateway until the device is restored to factory settings;

Zigbee网关在接收到路由器设备的入网请求后,比对设备信息表中的MAC地址,过滤非注册设备的入网请求,完成已注册路由设备的网络加入过程。After receiving the network access request of the router device, the Zigbee gateway compares the MAC address in the device information table, filters the network access request of the non-registered device, and completes the network joining process of the registered router device.

需要特别说明,本发明中只有路由器设备执行入网操作,路由器加入Zigbee网关组建的网络是后续路由发现过程的前提条件;It should be specially explained that in the present invention, only the router device performs the network access operation, and the router joins the network formed by the Zigbee gateway is a prerequisite for the subsequent route discovery process;

终端设备通过Z-stack协议的MAC层接口进行上行数据的通信,不执行入网操作,这样可以免去路由器在高频次位置移动情况下重入网阶段产生的网络层数据对信道的占用,保证上行数据时隙分配的确定性,严格避免本网络内的信道冲突。The terminal device communicates the uplink data through the MAC layer interface of the Z-stack protocol, and does not perform the network access operation, which can avoid the network layer data generated by the router in the re-entry phase of the high-frequency location movement on the channel and ensure the uplink. The certainty of data time slot allocation strictly avoids channel conflicts within the network.

在一个实施例中,构建路由链表的方法,参见图3,包括:In one embodiment, the method for constructing a routing linked list, referring to FIG. 3 , includes:

Zigbee网关通过Z-Stack协议栈提供的路由发现功能,对所有注册路由设备逐一发起路由发现请求;Through the route discovery function provided by the Z-Stack protocol stack, the Zigbee gateway initiates route discovery requests to all registered routing devices one by one;

接收到路由发现请求的目标路由器,提取Z-Stack协议栈中的路由发现表进而得到上一级路由节点的网络短地址,将包含自身节点的路径信息单播发送到上一级路由节点;The target router that receives the route discovery request extracts the route discovery table in the Z-Stack protocol stack to obtain the network short address of the upper-level routing node, and unicasts the path information including its own node to the upper-level routing node;

上一级路由设备将接收到的路径信息添加到基于B树数据结构的路由链表中,随着路由发现过程逐一进行,路由链表逐渐完善,直至构建以其自身节点为根节点的全部路径信息;The upper-level routing device adds the received path information to the routing list based on the B-tree data structure. As the route discovery process proceeds one by one, the routing list is gradually improved until all path information with its own node as the root node is constructed;

随着路径信息的逐级提交,Zigbee网关可以接收到系统中所有路由节点的路径信息,建立包含全系统路由设备的路由链表。With the step-by-step submission of the path information, the Zigbee gateway can receive the path information of all routing nodes in the system, and establish a routing list including the routing devices of the whole system.

在此需要说明,构建路由链表是后续所述信标的生成和传递的前提条件。基于B树数据结构非递归先序遍历的信标传递算法,可以使信标以非竞争的方式在唯一时隙内传递,明显减小了终端设备接收信标的时间窗口,降低了终端设备的功耗。It should be noted here that the construction of a routing linked list is a prerequisite for the generation and delivery of the beacon described later. The beacon delivery algorithm based on the non-recursive pre-order traversal of the B-tree data structure can make the beacon delivered in a unique time slot in a non-competitive manner, which significantly reduces the time window for the terminal device to receive the beacon and reduces the power of the terminal device. consumption.

在一个实施例中,信标的生成和传递的方法,参见图4,包括:In one embodiment, a method for generating and delivering a beacon, see FIG. 4 , includes:

Zigbee网关以及其他各级路由器内部都已经构建了以其自身节点为根节点的基于B树数据结构的路由链表,通过非递归先序遍历算法,依照遍历的先后顺序给路由器设备分配设备ID,该设备ID是给每个路由器设备分配信标时隙的依据;The Zigbee gateway and other routers at all levels have built a routing list based on the B-tree data structure with its own node as the root node. Through the non-recursive pre-order traversal algorithm, the router devices are assigned device IDs in the order of traversal. The device ID is the basis for allocating beacon slots to each router device;

对于一个网关或路由器,它的邻近路由节点为其子节点,其生成的信标帧载荷中包含了它自身节点以及所有子节点的网络地址和设备ID,以及信标发送时刻的时间戳;For a gateway or router, its adjacent routing node is its child node, and the beacon frame payload generated by it contains the network address and device ID of its own node and all child nodes, as well as the time stamp of the beacon sending time;

Zigbee网关生成信标后,在信标周期的起始时隙内发送第0个信标,信标被其子节点路由器所接受;After the Zigbee gateway generates the beacon, it sends the 0th beacon in the initial time slot of the beacon period, and the beacon is accepted by its child node router;

接收到信标的子节点首先依据信标载荷中的时间戳同步自身时间信息,再以自身节点的设备ID为基础遍历其根节点下的所有子树路由器节点,依照遍历的先后顺序给路由器设备分配设备ID;The child node receiving the beacon first synchronizes its own time information according to the timestamp in the beacon payload, and then traverses all the subtree router nodes under its root node based on the device ID of its own node, and assigns router devices according to the order of traversal. device ID;

接着,上面所述的子节点在其新信标的载荷中添加自身节点其子节点的设备信息;Next, the above-mentioned child node adds the device information of its own node and its child nodes in the payload of its new beacon;

然后,上面所述的子节点依据信标载荷中自身节点的设备ID计算其新信标的发送时隙,并更新新信标的时间戳,然后在新时隙内发送新信标;Then, the above-mentioned child node calculates the transmission time slot of its new beacon according to the device ID of its own node in the beacon payload, and updates the time stamp of the new beacon, and then sends the new beacon in the new time slot;

以此类推,信标被B树路由链表中的所有节点逐层传递,直到最末端的路由器节点。By analogy, the beacon is passed layer by layer by all nodes in the B-tree routing list, until the end router node.

在一个实施例中,信标周期的定义,参见图5~6,包括:In one embodiment, the definition of the beacon period, referring to FIGS. 5-6 , includes:

一个信标周期为41943mS(65536*2个MacTimer周期),被分为32个通信周期,一个通信周期1310mS,每个通信周期又被分为256个时隙,每个时隙5.12mS(16个MacTimer周期);A beacon period is 41943mS (65536*2 MacTimer periods), which is divided into 32 communication periods, one communication period is 1310mS, and each communication period is divided into 256 time slots, each time slot 5.12mS (16 MacTimer cycle);

一个信标周期也可以包含更多的通信周期,以使系统中支持的最大路由器数量得到提升,一个通信周期也可以包含更多的时隙,以使系统中支持的同一时间段最大终端数量得到提升,但同时信标周期的加长会给路由器的实时时钟晶振的精度提出更高的要求。A beacon period can also contain more communication periods to increase the maximum number of routers supported in the system, and a communication period can also contain more time slots to increase the maximum number of terminals supported in the system in the same time period. At the same time, the lengthening of the beacon period will place higher requirements on the accuracy of the router's real-time clock crystal oscillator.

本发明可用于工业场合下基于Zigbee无线传输的传感器数据采集系统,最小采集周期1.31S。由于本发明旨在工业场合下的Zigbee系统应用,为减小Zigbee多跳模式造成的数据延时和无线信道占用的不确定性,Zigbee网关和Zigbee路由器均与服务器在硬件上保持有线或无线的Internet网络连接,终端设备的Zigbee数据通过Zigbee路由器就近上传到服务器,这是本发明系统组成的前提条件,也是本发明基本方法的前提条件。The invention can be used in a sensor data acquisition system based on Zigbee wireless transmission in industrial occasions, and the minimum acquisition period is 1.31S. Since the present invention is aimed at the application of Zigbee system in industrial occasions, in order to reduce the data delay and the uncertainty of wireless channel occupation caused by Zigbee multi-hop mode, Zigbee gateway and Zigbee router are both wired or wireless with the server in hardware. Internet network connection, the Zigbee data of the terminal device is uploaded to the server nearby through the Zigbee router, this is the precondition of the system composition of the present invention, and also the precondition of the basic method of the present invention.

Zigbee终端设备上电后不进行入网请求,经由它的数据全部通过MAC层接口发送或接收,这也是本发明基本方法的前提条件。After the Zigbee terminal device is powered on, it does not perform a network access request, and all data via it is sent or received through the MAC layer interface, which is also a precondition of the basic method of the present invention.

1.关于数据帧的传输方法1. About the transmission method of the data frame

路径信息的传输通过Z-Stack协议栈AF层或ZCL层相关程序接口发送和接收处理;The transmission of path information is sent and received through the relevant program interface of the Z-Stack protocol stack AF layer or ZCL layer;

信标帧和上行数据包的传输不经过Z-Stack的AF层或ZCL层,而是利用Z-Stack提供的MAC层数据请求接口采用时隙版本的发送函数发送,利用Z-Stack提供的MAC层事件回调接口中的 DataIndicationEvent事件提取数据帧。The transmission of beacon frames and uplink data packets does not go through the AF layer or ZCL layer of Z-Stack, but uses the MAC layer data request interface provided by Z-Stack to send using the time-slot version of the sending function, and uses the MAC layer provided by Z-Stack. The DataIndicationEvent event in the layer event callback interface extracts the data frame.

2.关于依据信标同步自身时间信息的方法2. About the method of synchronizing own time information based on beacons

信标采用时隙版本的发送函数发送,因此信标总是在macTimer计数值为0时发送。设备接收到信标后,MacTimer计数值调整为信标帧空中传输时间,时间戳调整为信标帧时间戳的值。Beacons are sent using the slotted version of the send function, so beacons are always sent when the macTimer count is zero. After the device receives the beacon, the MacTimer count value is adjusted to the air transmission time of the beacon frame, and the time stamp is adjusted to the value of the beacon frame time stamp.

3.关于构建路由链表的方法,以下以具体实例说明,参见图7:3. Regarding the method of constructing the routing linked list, the following will be described with a specific example, see Figure 7:

路由器的网络短地址Addr在设备注册环节中由设备管理平台分配,为方便系统调试,路由器在一个具体实施例中分批布设;The network short address Addr of the router is allocated by the device management platform in the device registration link. In order to facilitate system debugging, the routers are laid out in batches in a specific embodiment;

① 第一批布设:网关、Addr = 0x0001、Addr = 0x0003、Addr = 0x0004、Addr =0x0006;① The first batch of deployment: Gateway, Addr = 0x0001, Addr = 0x0003, Addr = 0x0004, Addr = 0x0006;

② 网关对Addr = 0x0004发起路由发现,路由发现请求被沿着Addr = 0x0000、Addr = 0x0001、Addr = 0x0004路径到达Addr = 0x0004;② The gateway initiates route discovery to Addr = 0x0004, and the route discovery request is routed along the path of Addr = 0x0000, Addr = 0x0001, Addr = 0x0004 to Addr = 0x0004;

③ 路径信息0x0004被Addr = 0x0004提交给Addr = 0x0001,Addr = 0x0001在其自身节点下添加新的子节点Addr = 0x0004;③ The path information 0x0004 is submitted by Addr = 0x0004 to Addr = 0x0001, Addr = 0x0001 adds a new child node Addr = 0x0004 under its own node;

④ 路径信息0x0001 0x0004被Addr = 0x0001提交给Addr = 0x0000,Addr =0x0000在其自身节点下添加新的子节点Addr = 0x0001,在Addr = 0x0001的节点下添加新的子节点Addr = 0x0004;④ The path information 0x0001 0x0004 is submitted by Addr = 0x0001 to Addr = 0x0000, Addr = 0x0000 adds a new child node Addr = 0x0001 under its own node, and adds a new child node Addr = 0x0004 under the node of Addr = 0x0001;

⑤ 网关对Addr = 0x0003发起路由发现,路由发现请求被沿着Addr = 0x0000、Addr = 0x0001、Addr = 0x0003路径到达Addr = 0x0003;⑤ The gateway initiates route discovery to Addr = 0x0003, and the route discovery request is routed along the path of Addr = 0x0000, Addr = 0x0001, Addr = 0x0003 to Addr = 0x0003;

⑥ 路径信息0x0003被Addr = 0x0003提交给Addr = 0x0001,Addr = 0x0001在其自身节点下添加新的子节点Addr = 0x0003;⑥ The path information 0x0003 is submitted by Addr = 0x0003 to Addr = 0x0001, Addr = 0x0001 adds a new child node Addr = 0x0003 under its own node;

⑦ 路径信息0x0001 0x0003被Addr = 0x0001提交给Addr = 0x0000,Addr =0x0000在Addr = 0x0001的节点下添加新的子节点Addr = 0x0003;⑦ Path information 0x0001 0x0003 is submitted by Addr = 0x0001 to Addr = 0x0000, Addr = 0x0000 adds a new child node Addr = 0x0003 under the node of Addr = 0x0001;

⑧ 网关对Addr = 0x0006发起路由发现,路由发现请求被沿着Addr = 0x0000、Addr = 0x0001、Addr = 0x0004、Addr = 0x0006路径到达Addr = 0x0006;⑧ The gateway initiates route discovery for Addr = 0x0006, and the route discovery request is routed along the path of Addr = 0x0000, Addr = 0x0001, Addr = 0x0004, Addr = 0x0006 to Addr = 0x0006;

⑨ 路径信息0x0006被Addr = 0x0006提交给Addr = 0x0004,Addr = 0x0004在其自身节点下添加新的子节点Addr = 0x0006;⑨ The path information 0x0006 is submitted by Addr = 0x0006 to Addr = 0x0004, Addr = 0x0004 adds a new child node Addr = 0x0006 under its own node;

⑩ 路径信息0x0004 0x0006被Addr = 0x0004提交给Addr = 0x0001,Addr =0x0001在Addr = 0x0004的节点下添加新的子节点Addr = 0x0006;⑩ The path information 0x0004 0x0006 is submitted by Addr = 0x0004 to Addr = 0x0001, Addr = 0x0001 adds a new child node Addr = 0x0006 under the node of Addr = 0x0004;

11 路径信息0x0001 0x0004 0x0006被Addr = 0x0001提交给Addr = 0x0000,Addr = 0x0000在Addr = 0x0004的节点下添加新的子节点Addr = 0x0006;11 Path information 0x0001 0x0004 0x0006 is submitted by Addr = 0x0001 to Addr = 0x0000, Addr = 0x0000 adds a new child node Addr = 0x0006 under the node of Addr = 0x0004;

以上步骤就是路由信息逐级提交,路由表逐渐完善的过程。The above steps are the process of submitting routing information step by step and gradually improving the routing table.

特别说明,如图7,在已经提交路径0x0002 0x0005 0x0007的前提下,对Addr =0x0008发起路由发现,形成了路径0x000B 0x0005 0x0008,这可能是由于路径0x00020x0005的链路成本由于环境变化突然升高有关;In particular, as shown in Figure 7, on the premise that the path 0x0002 0x0005 0x0007 has been submitted, route discovery is initiated for Addr = 0x0008, and the path 0x000B 0x0005 0x0008 is formed, which may be due to the sudden increase in the link cost of the path 0x00020x0005 due to environmental changes. ;

针对上述情况,需要对Addr = 0x0005做多次路由发现,选取出现次数最多的路径,同时更新Addr = 0x0007、Addr = 0x0008的路径信息。In view of the above situation, it is necessary to perform route discovery for Addr = 0x0005 multiple times, select the path with the most occurrences, and update the path information of Addr = 0x0007 and Addr = 0x0008 at the same time.

4.关于非递归先序遍历算法和设备ID的生成,以下以具体实例说明,参见图8:4. Regarding the non-recursive preorder traversal algorithm and the generation of the device ID, the following is a specific example to illustrate, see Figure 8:

在常规的B树节点结构体中加入记录当前节点当前搜索的孩子节点的索引,以及加入父节点指针,以此来实现搜索路径的回溯,不需要递归操作却可以实现递归操作的搜索路径;In the conventional B-tree node structure, the index of the child node that records the current node's current search is added, and the parent node pointer is added to realize the backtracking of the search path, and the search path of the recursive operation can be realized without recursive operation;

① 函数循环体进入一个父节点(设备ID=0),总是从其索引值最小的孩子节点(设备ID=1)开始搜索,当前搜索的孩子节点的索引值(Index=0)被实时保存到节点结构体中,节点的设备ID值(ID=1)随搜索路径递增;① The function loop body enters a parent node (device ID=0), and always starts the search from the child node (device ID=1) with the smallest index value, and the index value (Index=0) of the currently searched child node is saved in real time In the node structure, the device ID value (ID=1) of the node increases with the search path;

② 若当前孩子节点(设备ID=2)没有其自身的子节点,则给其设备ID赋值(ID=2)后借用节点结构体中的父节点指针回溯到该节点的父节点(设备ID=1);② If the current child node (device ID=2) does not have its own child node, assign a value to its device ID (ID=2) and then borrow the parent node pointer in the node structure to trace back to the parent node of the node (device ID= 1);

③ 函数循环体进入父节点(设备ID=1),将节点结构体中孩子节点的索引值(Index=0)加1(Index=1),搜索到下一个孩子节点(设备ID=3);③ The function loop body enters the parent node (device ID=1), adds 1 (Index=1) to the index value of the child node in the node structure (Index=0), and searches to the next child node (device ID=3);

④ 当父节点(设备ID=1)结构体中孩子节点的索引值(Index=2)达到孩子节点数量值(Count=2)时,借用节点结构体中的父节点指针回溯到该节点的父节点(设备ID=0);④ When the index value (Index=2) of the child node in the structure of the parent node (device ID=1) reaches the value of the number of child nodes (Count=2), the parent node pointer in the borrowed node structure is used to trace back to the parent of the node. node(device_id=0);

⑤ 函数循环体进入父节点(设备ID=0),将节点结构体中孩子节点的索引值(Index=0)加1(Index=1),搜索到下一个孩子节点(设备ID=7);⑤ The function loop body enters the parent node (device ID=0), adds 1 (Index=1) to the index value of the child node in the node structure (Index=0), and searches for the next child node (device ID=7);

按照此算法的遍历顺序给每一个节点的设备ID赋值,便可以给全系统的路由器所传递的信标确立信标周期内唯一的时隙。According to the traversal sequence of this algorithm, assigning the device ID of each node can establish a unique time slot in the beacon period for the beacons transmitted by the routers of the whole system.

5.关于信标的生成和传递,以下以具体实例说明,参见图8:5. The generation and delivery of beacons are described below with specific examples, referring to Figure 8:

① Zibee网关遍历B树链表,生成每个子树节点的设备ID;① The Zibee gateway traverses the B-tree linked list and generates the device ID of each sub-tree node;

② Zibee网关在[0, 0]时隙发送初始信标,信标的标识就约定为[0, 0],[0, 0]代表第0个通信周期中的第0个时隙。显然,在本发明的一个具体实例中,每个通信周期中只有第0个时隙和第1个时隙用于信标的传递;② The Zibee gateway sends the initial beacon in the [0, 0] time slot, and the beacon identifier is agreed to be [0, 0], and [0, 0] represents the 0th time slot in the 0th communication cycle. Obviously, in a specific example of the present invention, only the 0th time slot and the 1st time slot in each communication cycle are used for beacon transmission;

③ [0, 0]信标载荷中包含其自身节点以及其3个子节点路由器的设备信息,3个子节点路由器如图8分别为ID=1、ID=7、ID=14;上述3个子节点因在Zibee网关射频信号覆盖范围内,可以同时收到[0, 0]信标;同时[0, 0]信标载荷中还包含时间戳0x0000;③ [0, 0] The beacon payload contains the device information of its own node and its three sub-node routers. The three sub-node routers are ID=1, ID=7, and ID=14 respectively as shown in Figure 8; the above-mentioned three sub-nodes are due to Within the coverage of the RF signal of the Zibee gateway, the [0, 0] beacon can be received at the same time; at the same time, the [0, 0] beacon payload also contains the timestamp 0x0000;

④ ID=1的路由器接收到[0, 0]信标后,将自身时间戳同步到0x0000,遍历以其自身节点为根节点的B树链表,生成每个子树节点路由器的设备ID,并生成新的信标[0, 1];④ After the router with ID=1 receives the [0, 0] beacon, it synchronizes its own timestamp to 0x0000, traverses the B-tree linked list with its own node as the root node, generates the device ID of each subtree node router, and generates new beacon[0, 1];

⑤ ID=1的路由器在[0, 1]时隙传递新信标[0, 1],[0, 1]信标的时间戳为0x0001,它可以被其下的2个子节点路由器同时接收,如图8分别为ID=2、ID=3;⑤ The router with ID=1 transmits a new beacon [0, 1] in the [0, 1] time slot, and the timestamp of the [0, 1] beacon is 0x0001, which can be received by the two sub-node routers under it at the same time, such as Figure 8 is ID=2, ID=3 respectively;

⑥ ID=2的路由器接收到[0, 1]信标后,将自身时间戳同步到0x0001,在[1, 0]时隙传递新信标[1, 0],[1, 0]信标的时间戳0x0100,因其下没有自身节点的子节点,[1, 0]信标的MAC层数据帧可能会被其附近的路由器节点所接收,但因其载荷中不包含子节点信息则不会被处理;⑥ After the router with ID=2 receives the [0, 1] beacon, it synchronizes its own timestamp to 0x0001, and transmits a new beacon [1, 0] in the [1, 0] time slot, and the [1, 0] Timestamp 0x0100, because there is no child node of its own node, the MAC layer data frame of the [1, 0] beacon may be received by the nearby router nodes, but because the payload does not contain child node information, it will not be received. deal with;

⑦ ID=3的路由器在[1, 1]时隙传递新信标[1, 1],[1, 1]信标的时间戳为0x0101;⑦ The router with ID=3 transmits a new beacon [1, 1] in the [1, 1] time slot, and the timestamp of the [1, 1] beacon is 0x0101;

⑧ ID=7的路由器在[3, 1]时隙传递新信标[3, 1];[3, 1]信标的时间戳为0x0301;⑧ The router with ID=7 transmits a new beacon [3, 1] in the [3, 1] time slot; the timestamp of the [3, 1] beacon is 0x0301;

以此类推,直至信标传递结束,进入下一个信标周期,Zigbee网关发送[0, 0]信标,此时[0, 0]信标的时间戳为0x2000。And so on, until the end of the beacon transmission, the next beacon cycle is entered, and the Zigbee gateway sends the [0, 0] beacon, and the timestamp of the [0, 0] beacon is 0x2000 at this time.

关于本发明具体结构需要说明的是,本发明采用的各部件模块相互之间的连接关系是确定的、可实现的,除实施例中特殊说明的以外,其特定的连接关系可以带来相应的技术效果,本发明中出现的部件、模块、具体元器件的型号、连接方式除具体说明的以外,均属于本领域技术人员在申请日前可以获取到的已公开专利、已公开的期刊论文、或公知常识等现有技术,无需赘述,使得本案提供的技术方案是清楚、完整、可实现的,并能根据该技术手段重现或获得相应的实体产品。Regarding the specific structure of the present invention, it should be noted that the connection relationship between the various component modules adopted in the present invention is determined and achievable. The technical effect, the models and connection methods of the components, modules, and specific components appearing in the present invention belong to the published patents, published journal papers, or Common knowledge and other existing technologies need not be repeated, so that the technical solutions provided in this case are clear, complete and achievable, and corresponding physical products can be reproduced or obtained according to the technical means.

最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions described in the foregoing embodiments can still be modified, or some or all of the technical features thereof can be equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the embodiments of the present invention. scope.

Claims (9)

Translated fromChinese
1.基于信标传递和时隙分配的Zigbee设备通信方法,其特征在于:包括如下步骤:1. based on the Zigbee equipment communication method of beacon transmission and time slot allocation, it is characterized in that: comprise the steps:S1:待入网路由器通过服务器的设备管理平台完成注册,Zigbee网关读取路由器的注册信息,接收路由器入网请求并完成路由器入网;S1: The router to be connected to the network completes the registration through the device management platform of the server, and the Zigbee gateway reads the router's registration information, receives the router's network access request, and completes the router's network access;S2:Zigbee网关对所有已注册路由器逐一发起路由发现请求,每一次路由发现确定了唯一的路径,路由器按照路径逐级提交路径信息并建立基于B树数据结构的路由链表,通过对B树链表的非递归先序遍历,给B树链表的所有子树节点路由器分配信标时隙;S2: The Zigbee gateway initiates route discovery requests to all registered routers one by one. Each route discovery determines a unique path. The router submits the path information step by step according to the path and establishes a routing list based on the B-tree data structure. Non-recursive pre-order traversal, assigning beacon slots to all subtree node routers in the B-tree linked list;S3:Zigbee网关生成信标,并在信标周期的起始时隙内发送,收到信标的子节点路由器依据信标载荷中的时间戳同步自身时间信息,并在由信标载荷确定的时隙内传递新信标给下一级子节点路由器;S3: The Zigbee gateway generates a beacon and sends it in the initial time slot of the beacon period. The sub-node router that receives the beacon synchronizes its own time information according to the time stamp in the beacon payload, and at the time determined by the beacon payload The new beacon is transmitted to the next-level child node router in the slot;S4:Zigbee终端设备随机分布在路由器信号覆盖范围内的区域,接收Zigbee终端设备附近的路由器发送的信标,依据信标的时间戳同步自身时间信息,并依据设备ID确定上行数据的发送时隙,上行数据通过MAC层接口以时隙模式广播发送,下行数据被路由器缓存并随信标载荷一起发送,随着信标的传递到达目标Zigbee终端设备。S4: Zigbee terminal devices are randomly distributed in the area covered by the router signal, receive beacons sent by routers near Zigbee terminal devices, synchronize their own time information according to the timestamp of the beacon, and determine the transmission time slot of uplink data according to the device ID, The uplink data is broadcast and sent in the slot mode through the MAC layer interface, and the downlink data is buffered by the router and sent together with the beacon payload, and reaches the target Zigbee terminal device with the beacon delivery.2.根据权利要求1所述的基于信标传递和时隙分配的Zigbee设备通信方法,其特征在于:所述步骤S1中待入网路由器的设备注册步骤如下:2. the Zigbee device communication method based on beacon transmission and time slot allocation according to claim 1, is characterized in that: the device registration step of the router to be accessed in the described step S1 is as follows:待入网路由器与服务器的设备管理平台建立通信,设备管理平台读取待入网路由器的64位MAC地址,并为待入网路由器指定16位网络短地址,生成设备信息表;The router to be connected to the network establishes communication with the device management platform of the server, and the device management platform reads the 64-bit MAC address of the router to be connected to the network, and specifies a 16-bit network short address for the router to be connected to the network, and generates a device information table;设备管理平台将已注册路由器的设备信息表传输给Zigbee网关,设备信息表在Zigbee网关内部以非易失形式保存,直到设备恢复出厂设置;The device management platform transmits the device information table of the registered router to the Zigbee gateway, and the device information table is stored in the Zigbee gateway in a non-volatile form until the device is restored to factory settings;Zigbee网关在接收到路由器设备的入网请求后,比对设备信息表中的MAC地址,过滤非注册路由器的入网请求,完成已注册路由器的网络加入过程。After receiving the network access request of the router device, the Zigbee gateway compares the MAC address in the device information table, filters the network access request of the unregistered router, and completes the network joining process of the registered router.3.根据权利要求1所述的基于信标传递和时隙分配的Zigbee设备通信方法,其特征在于:所述步骤S2中的构建路由链表的步骤如下:3. the Zigbee device communication method based on beacon transmission and time slot allocation according to claim 1, is characterized in that: the step of constructing routing linked list in described step S2 is as follows:Zigbee网关通过Z-Stack协议栈提供的路由发现功能,对所有注册的路由器逐一发起路由发现请求;Through the route discovery function provided by the Z-Stack protocol stack, the Zigbee gateway initiates route discovery requests to all registered routers one by one;接收到路由发现请求的目标路由器提取Z-Stack协议栈中的路由发现表,进而得到上一级路由节点的网络短地址,将包含自身节点的路径信息单播发送到上一级路由节点;The target router that receives the route discovery request extracts the route discovery table in the Z-Stack protocol stack, and then obtains the network short address of the upper-level routing node, and unicasts the path information including its own node to the upper-level routing node;上一级路由器将接收到的路径信息添加到基于B树数据结构的路由链表中,随着路由发现过程逐一进行,使路由链表逐渐完善,直至构建以每一级路由器自身节点为根节点的全部路径信息;The upper-level router adds the received path information to the routing list based on the B-tree data structure. As the route discovery process proceeds one by one, the routing list is gradually improved until it builds all routers with their own node as the root node. path information;随着路径信息的逐级提交,Zigbee网关接收到系统中所有路由节点的路径信息,建立包含全系统路由器的路由链表。With the step-by-step submission of the path information, the Zigbee gateway receives the path information of all routing nodes in the system, and establishes a routing list including the routers of the whole system.4.根据权利要求1所述的基于信标传递和时隙分配的Zigbee设备通信方法,其特征在于:所述步骤S3中的信标生成和传递的步骤如下:4. the Zigbee device communication method based on beacon transmission and time slot allocation according to claim 1, is characterized in that: the step of beacon generation and transmission in described step S3 is as follows:Zigbee网关通过对内部B树路由链表的非递归先序遍历,依据遍历的先后顺序给B树路由链表的所有子树节点路由器分配设备ID,设备ID唯一确定了子树节点路由器生成的新信标发送时刻的时隙;Through the non-recursive pre-order traversal of the internal B-tree routing list, the Zigbee gateway assigns device IDs to all sub-tree node routers in the B-tree routing list according to the traversal sequence. The device ID uniquely determines the new beacons generated by the sub-tree node routers. The time slot at the time of sending;信标帧载荷中包含了Zigbee网关以及Zigbee网关子节点路由器的网络短地址和设备ID,信标帧载荷中还包含了发送时刻的时间戳;The beacon frame payload includes the network short address and device ID of the Zigbee gateway and the Zigbee gateway sub-node router, and the beacon frame payload also includes the time stamp of the sending time;Zigbee网关生成信标后,在信标周期的起始时隙内发送第0个信标,信标被Zigbee网关的子节点路由器所接收,接收到信标的子节点路由器依次做以下操作:After the Zigbee gateway generates the beacon, it sends the 0th beacon in the initial time slot of the beacon period. The beacon is received by the child node router of the Zigbee gateway, and the child node router that receives the beacon performs the following operations in sequence:① 依据信标载荷中的时间戳同步自身时间信息;① Synchronize its own time information according to the timestamp in the beacon payload;② 依据自身网络短地址对应的设备ID确定新信标的发送时隙;② Determine the sending time slot of the new beacon according to the device ID corresponding to its own network short address;③ 然后通过对内部B树路由链表的非递归先序遍历,依据遍历的先后顺序给B树路由链表的所有子树节点路由器分配信标时隙,生成新的信标;③ Then, through the non-recursive pre-order traversal of the internal B-tree routing list, according to the order of traversal, beacon time slots are allocated to all subtree node routers of the B-tree routing list, and new beacons are generated;④ 新信标在设备ID确定的发送时隙内发送,并被下一级子节点路由器所接收;④ The new beacon is sent in the sending time slot determined by the device ID, and is received by the next-level child node router;以此类推,信标被B树路由链表中的所有节点逐层传递,直到最末端的路由器节点。By analogy, the beacon is passed layer by layer by all nodes in the B-tree routing list, until the end router node.5.根据权利要求1所述的基于信标传递和时隙分配的Zigbee设备通信方法,其特征在于:5. the Zigbee device communication method based on beacon transmission and time slot allocation according to claim 1, is characterized in that:一个信标周期为41943mS即65536*2个MacTimer周期,被分为32个通信周期,一个通信周期1310mS,每个通信周期又被分为256个时隙,每个时隙5.12mS即16个MacTimer周期;A beacon period is 41943mS or 65536*2 MacTimer periods, which are divided into 32 communication periods, one communication period is 1310mS, and each communication period is divided into 256 time slots, each time slot 5.12mS or 16 MacTimer cycle;每个通信周期的前2个时隙(时隙ID = 0~1)用于信标传递,之后的2个时隙(时隙ID =2~3)空闲备用,再之后的250个时隙(时隙ID = 4~253)用于上行数据的通信,最后的2个时隙(时隙ID = 254~255)空闲备用。The first 2 time slots (time slot ID = 0~1) of each communication cycle are used for beacon transmission, the next 2 time slots (time slot ID = 2~3) are idle, and the next 250 time slots (time slot ID = 4~253) is used for uplink data communication, and the last 2 time slots (time slot ID = 254~255) are idle for backup.6.根据权利要求1所述的基于信标传递和时隙分配的Zigbee设备通信方法,其特征在于:所述步骤S4中Zigbee终端设备上行数据时隙的确定步骤如下:6. the Zigbee equipment communication method based on beacon transmission and time slot allocation according to claim 1, is characterized in that: in described step S4, the determination step of Zigbee terminal equipment uplink data time slot is as follows:Zigbee终端设备的上行数据时隙由签到路由器给Zigbee终端设备分配的动态设备ID所确定,动态设备ID值为0~249,对应时隙ID = 4~253;The uplink data time slot of the Zigbee terminal device is determined by the dynamic device ID assigned by the sign-in router to the Zigbee terminal device. The dynamic device ID value is 0~249, and the corresponding time slot ID = 4~253;在一个时间段内,一批Zigbee终端设备以竞争方式与签到路由器建立上行通信,发送迁入请求,动态设备ID以签到路由器接收数据包的顺序从0到249依次递增分配,被分配的设备ID处于活跃态,当所有可用设备ID均处于活跃态,新迁入的设备则被拒绝迁入;Within a period of time, a batch of Zigbee terminal devices establishes uplink communication with the sign-in router in a competitive manner, and sends a migration request. The dynamic device IDs are allocated sequentially from 0 to 249 in the order in which the sign-in routers receive packets. The assigned device ID In the active state, when all available device IDs are in the active state, the newly migrated device will be rejected;在下一个时间段内,上一批Zigbee终端设备陆续发送迁出请求,下一批Zigbee终端设备陆续发送迁入请求,迁出设备的设备ID从活跃态转变为非活跃态,非活跃态的设备ID被动态地分配给迁入设备,由此实现上行时隙的动态分配。In the next time period, the last batch of Zigbee terminal devices send migration requests one after another, and the next batch of Zigbee terminal devices send migration requests one after another. IDs are dynamically allocated to inbound devices, thereby realizing dynamic allocation of uplink time slots.7.基于信标传递和时隙分配的Zigbee设备通信系统,其特征在于:包括:服务器、Zigbee网关、Zigbee路由器、Zigbee签到路由器、Zigbee终端设备;7. The Zigbee equipment communication system based on beacon transmission and time slot allocation, is characterized in that: comprise: server, Zigbee gateway, Zigbee router, Zigbee sign-in router, Zigbee terminal equipment;所述服务器,用于设备管理、设备数据展示和人机交互;The server is used for device management, device data display and human-computer interaction;所述Zigbee网关,与服务器建立有线的或无线的串口或网络连接,用于Zigbee网络的建立,以及用于路由发现功能、设备信息表的存储和管理、信标的生成和信标时隙的分配;The Zigbee gateway establishes a wired or wireless serial port or network connection with the server, is used for the establishment of a Zigbee network, and is used for routing discovery function, storage and management of device information tables, generation of beacons and allocation of beacon time slots;所述Zigbee路由器,与服务器建立有线的或无线的串口或网络连接,用于路径信息的逐级提交、下级路由链表的管理、信标的传递、Zigbee终端设备上行数据的接收、下行数据的缓存和发送;The Zigbee router establishes a wired or wireless serial port or network connection with the server, which is used for the step-by-step submission of path information, the management of the lower-level routing list, the transmission of beacons, the reception of Zigbee terminal equipment upstream data, the cache of downstream data and send;所述Zigbee签到路由器与上位机建立通信,不参与信标传递,用于Zigbee终端设备动态ID的生成;The Zigbee sign-in router establishes communication with the host computer, does not participate in beacon transmission, and is used for the generation of Zigbee terminal equipment dynamic ID;Zigbee终端设备,用于设备数据的采集、缓存、上行数据的发送,信标载荷中下行数据的接收和下行命令的执行。Zigbee terminal equipment is used for data collection, buffering, transmission of uplink data, reception of downlink data in the beacon payload, and execution of downlink commands.8.根据权利要求7所述的基于信标传递和时隙分配的Zigbee设备通信系统,其特征在于:所述服务器采用具有RS-232、RS-485、USB、网口通信接口的单机设备或与Internet连接的网络服务器。8. The Zigbee device communication system based on beacon transmission and time slot allocation according to claim 7, wherein the server adopts a stand-alone device with RS-232, RS-485, USB, network port communication interface or A web server connected to the Internet.9.根据权利要求7所述的基于信标传递和时隙分配的Zigbee设备通信系统,其特征在于:所述Zigbee网关、Zigbee路由器分别具有RS-232、RS-485、USB、网口等通信接口中的一种或几种。9. The Zigbee device communication system based on beacon transmission and time slot allocation according to claim 7, is characterized in that: described Zigbee gateway, Zigbee router respectively have communication such as RS-232, RS-485, USB, network port etc. One or more of the interfaces.
CN202210569882.8A2022-05-242022-05-24 Zigbee device communication method and system based on beacon transmission and time slot allocationActiveCN114980215B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202210569882.8ACN114980215B (en)2022-05-242022-05-24 Zigbee device communication method and system based on beacon transmission and time slot allocation

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202210569882.8ACN114980215B (en)2022-05-242022-05-24 Zigbee device communication method and system based on beacon transmission and time slot allocation

Publications (2)

Publication NumberPublication Date
CN114980215Atrue CN114980215A (en)2022-08-30
CN114980215B CN114980215B (en)2025-02-07

Family

ID=82955142

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202210569882.8AActiveCN114980215B (en)2022-05-242022-05-24 Zigbee device communication method and system based on beacon transmission and time slot allocation

Country Status (1)

CountryLink
CN (1)CN114980215B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN119171257A (en)*2024-09-232024-12-20山西新太阳科技有限公司 An explosion-proof electrical box

Citations (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20070268856A1 (en)*2006-05-162007-11-22Nokia CorporationBeacon broadcaster methods and systems for wireless networks
KR20080050983A (en)*2006-12-042008-06-10한국전자통신연구원 Beacon Scheduling Method in Wireless Sensor Networks
KR20080052084A (en)*2006-12-072008-06-11한국전자통신연구원 Beacon scheduling system and method for preventing beacon collision
KR20090046426A (en)*2007-11-062009-05-11엘지이노텍 주식회사 Zigbee Network Communication Method
CN101888328A (en)*2010-03-022010-11-17北京邮电大学 Trustworthy Transformation Method of IP Routing Protocol Based on Trust Management System
CN102118849A (en)*2011-03-022011-07-06重庆邮电大学Time synchronization method applicable to wireless sensor network
CN109152065A (en)*2018-10-312019-01-04重庆邮电大学A kind of safe method of network entry of industry wireless network multinode based on IPv6
CN113055828A (en)*2021-03-162021-06-29重庆邮电大学Multi-hop time synchronization method based on beacon network
CN113507724A (en)*2021-06-302021-10-15西安理工大学 A method for detecting the network status of wireless communication nodes based on linked list

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20070268856A1 (en)*2006-05-162007-11-22Nokia CorporationBeacon broadcaster methods and systems for wireless networks
KR20080050983A (en)*2006-12-042008-06-10한국전자통신연구원 Beacon Scheduling Method in Wireless Sensor Networks
KR20080052084A (en)*2006-12-072008-06-11한국전자통신연구원 Beacon scheduling system and method for preventing beacon collision
KR20090046426A (en)*2007-11-062009-05-11엘지이노텍 주식회사 Zigbee Network Communication Method
CN101888328A (en)*2010-03-022010-11-17北京邮电大学 Trustworthy Transformation Method of IP Routing Protocol Based on Trust Management System
CN102118849A (en)*2011-03-022011-07-06重庆邮电大学Time synchronization method applicable to wireless sensor network
CN109152065A (en)*2018-10-312019-01-04重庆邮电大学A kind of safe method of network entry of industry wireless network multinode based on IPv6
CN113055828A (en)*2021-03-162021-06-29重庆邮电大学Multi-hop time synchronization method based on beacon network
CN113507724A (en)*2021-06-302021-10-15西安理工大学 A method for detecting the network status of wireless communication nodes based on linked list

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ASHI AGARWAL; BRUCE WALLACE; LAURA AULT; JULIEN LARIVIÈRE-CHARTIER; FRANK KNOEFEL; RAFIK GOUBRAN; JEFFREY KAYE; ZACHARY BEATTIE; N: "Using Zigbee Sensors for Ambient Measurement of Human Gait – Analytical Considerations", 2021 IEEE INTERNATIONAL SYMPOSIUM ON MEDICAL MEASUREMENTS AND APPLICATIONS (MEMEA), 12 July 2021 (2021-07-12)*
高井峰: "基于ZigBee的路由节点的研究", 信息科技辑, 1 June 2009 (2009-06-01)*

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN119171257A (en)*2024-09-232024-12-20山西新太阳科技有限公司 An explosion-proof electrical box

Also Published As

Publication numberPublication date
CN114980215B (en)2025-02-07

Similar Documents

PublicationPublication DateTitle
CN110401971B (en)Communication method based on 230MHz electric power special frequency band intelligent ad hoc network
CN110572187A (en) A kind of broadband power line communication network networking method
CN108322932B (en)Wireless self-organizing network node synchronization method based on CSMA-TDMA
CN115066010B (en) Multi-level synchronous networking method for multi-channel lora monitoring system
CN106060180A (en)Addressing method for IPv6 based on geographical position and application information
CN110661551A (en) A method for adaptively adjusting the number of timeslots in the beacon period
CN112565351A (en)Mobile meter reading method based on WiSUN protocol
CN113938402A (en)Power line and wireless based dual-mode test system and method
CN107404526A (en)P2P remotely-sensed data network self-adapting dissemination systems and method based on SDN
CN115955400A (en) A dual-mode fusion networking method
CN110177097A (en)Data transmission method, apparatus and system
CN114553358A (en) A distributed precise time synchronization method for the Internet of Things
CN114980215A (en)Zigbee equipment communication method and system based on beacon transmission and time slot allocation
CN114599018B (en) A Bluetooth Mesh network routing method based on automatic channel scheduling
CN108282354A (en)Shared vehicle self-organizing network framework method based on SDN
CN102307249B (en)IP address automatic configuration method based on link layer topology
CN116545569A (en)Clock synchronization method, communication network system, gateway device and communication system
CN102412956B (en)Protocol unicast manner synchronization method, devices and system
CN111294907B (en) A wireless networking method with low power consumption and high anti-interference
CN115086899A (en)Wireless network working method and system
CN104753622A (en)Low-overhead time synchronization method based on receivers under start network
Sebestyén et al.Network Mapping for TDMA Mesh Sensor Networks with Flooding Routing
CN112689255B (en) A wireless sensor information monitoring system and method based on 6TiSCH
CN114124600B (en) A power line broadband carrier system supporting home subnet and its application method
CN116390217A (en) A LoRa device ad hoc network system based on an adaptive time synchronization scheme

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp