Adaptive multi-level wireless networking method and communication method for terminal equipment management system

By implementing an adaptive multi-level wireless networking method under a single gateway node and dynamically switching the role of terminal devices, the problems of network coverage limitations and high costs in traditional wireless communication architectures are solved, and flexibility and reliability are improved.

CN119697647BActive Publication Date: 2025-05-13杭州方千科技有限公司
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510212822.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-26
Publication Date
2025-05-13
Estimated Expiration
2045-02-26

AI Technical Summary

Technical Problem

In traditional wireless communication architectures, due to the limitation of wireless transmission range, it is difficult for a single gateway node to effectively manage multiple terminal devices, resulting in limited network coverage, high cost, complexity and maintenance difficulty. The relay nodes independently need external power supply, and failures may lead to network interruption.

Method used

An adaptive multi-level wireless networking method is proposed, which realizes automatic cascade of multi-level terminal devices through a single gateway node, dynamically switches master-slave mode, allowing terminal devices to select roles based on communication quality, form corresponding level equipment groups, reduces the requirements for device arrangement order, and enhances the flexibility and adaptability of the network.

Benefits of technology

The cascading of multi-level terminal devices under a single gateway node is realized, breaking through transmission distance limitations, reducing overall costs, simplifying installation and maintenance, improving network flexibility and reliability, ensuring stable communication performance can be maintained even in the event of network topology changes or failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119697647B_ABST
    Figure CN119697647B_ABST
Patent Text Reader

Abstract

The invention discloses an adaptive multi-level wireless networking method and a communication method for a terminal device management system, and relates to the field of wireless networking. A gateway in the terminal device management system first presets a terminal device as a first-level master-slave device, and sends a target networking request; the master-slave device broadcasts query information according to the request, calculates the communication quality of the answering device, selects the slave device it manages and the next-level master-slave device, the slave devices form a device group of the corresponding level, and returns the information to the gateway; the gateway then updates the request level and the target master-slave device ID number, and continues to send a networking request to the next master-slave device until the entire network is built; this adaptive mechanism ensures that stable communication performance can be maintained even when the network topology changes or fails, and significantly improves the efficiency and reliability of large-scale terminal device management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of wireless networking, and in particular to an adaptive multi-level wireless networking method and communication method for a terminal equipment management system. Background Technology

[0002] In traditional wireless communication architectures, the number of terminals and geographical coverage that a single gateway node can directly manage are limited due to the limitation of wireless transmission range. To overcome this challenge, two methods are typically employed: one is... Figure 4 As shown, network coverage is extended by deploying multiple gateway nodes, and interconnection and data synchronization between these gateways are ensured through wired or wireless networks; secondly, as... Figure 5 As shown, adding fixed routing nodes as relay stations in the network extends the signal transmission distance. However, the first approach not only increases hardware costs and dependence on stable power supplies and network connections, but also increases system complexity and maintenance requirements. While the second approach can achieve long-distance communication, the relay nodes are independent and require external power; a failure in this case may cause a communication interruption of the entire network, thus affecting the overall reliability and stability of the system. Summary of the Invention

[0003] To achieve cascading of multiple levels of terminal devices under a single gateway node, thereby overcoming transmission distance limitations, reducing overall costs, and simplifying installation and maintenance, this invention proposes an adaptive multi-level wireless networking method for a terminal device management system. The terminal device management system includes a gateway and multiple terminal devices. The adaptive multi-level wireless networking method includes the following steps:

[0004] S1: In the terminal device management system, a terminal device is preset as a first-level master-slave device;

[0005] S2: The gateway sends a target networking request to the first-level master-slave device. This request is an i-level networking request; i is a positive integer greater than or equal to 1; the target networking request includes the ID number of the target master-slave device.

[0006] S3: The primary master and slave devices determine whether the target networking request is a Level 1 networking request. If yes, proceed to the next step; otherwise, jump to step S7.

[0007] S4: The primary master and slave devices enter step S5 to execute the networking process based on the target networking request;

[0008] S5: Broadcast query information, and calculate the communication quality of each responding device based on the received response information. Use the communication quality to select the next-level master / slave device and / or the responding device to be managed by the current master / slave device, i.e., the slave device. The selected slave devices form a device group of the corresponding level, and return the formed device group and the device information of the selected next-level master / slave device to the gateway. The responding device refers to the terminal device that received the query information.

[0009] S6: After receiving the return information corresponding to the current target networking request, the gateway increments the level i of the target networking request by 1, updates the ID number of the target master-slave device in the request to the ID number of the next-level master-slave device in the return information, and returns to step S2.

[0010] S7: The first-level master-slave device forwards the target network request to the next-level master-slave device based on the ID number of the target master-slave device in the target network request; when the next-level master-slave device determines that it is not the target master-slave device in the target network request, the master-slave device continues to forward the target network request to the next-level master-slave device until the target master-slave device is reached; the target master-slave device returns to step S5 to execute the network process based on the target network request.

[0011] Furthermore, step S5 specifically includes:

[0012] Broadcast query information and determine if the number of responding devices is 0. If it is, the network is complete. If not, calculate the communication quality of each responding device based on the received response information. Based on the relationship between the communication quality of the responding device and the upper and lower limits of the preset standard range, select the next-level master / slave device and / or the responding device to be managed by the current master / slave device. The selected slave devices form a device group of the corresponding level. The formed device group and the device information of the selected next-level master / slave device are returned to the gateway.

[0013] Furthermore, the formula for calculating the communication quality is as follows:

[0014] ;

[0015] In the formula, RSSI represents the signal strength of the response information corresponding to the response device. max and RSSI min These are the maximum and minimum signal strength values ​​among all terminal devices. SNR represents the signal-to-noise ratio of the response information from the responding device. max and SNR min These represent the maximum and minimum signal-to-noise ratios among all terminal devices, respectively. and These represent the weights of signal strength and signal-to-noise ratio, respectively, while Score represents communication quality.

[0016] Furthermore, after the selected equipment forms a corresponding level of equipment group, it also includes:

[0017] The current master-slave device sends the group information of the device group to each slave device in the device group; the group information includes the level of the device group and the ID number of the corresponding master-slave device; the current master-slave device is a first-level master-slave device or a target master-slave device.

[0018] Further, in step S5, based on the relationship between the communication quality of the responding device and the upper and lower limits of the preset standard range, the next-level master / slave device and / or the responding device to be managed by the current master / slave device are selected using the communication quality; the selected slave devices form a device group of the corresponding level, and the formed device group and the device information of the selected next-level master / slave device are returned to the gateway, specifically as follows:

[0019] S51: Determine if the number of responding devices is greater than 1. If yes, proceed to the next step; otherwise, jump to step S56.

[0020] S52: Determine whether the communication quality of any responding device is within the preset standard range. If yes, proceed to the next step; otherwise, jump to step S54.

[0021] S53: Determine whether the number of responding devices within the preset standard range is greater than 1. If yes, select one of the multiple responding devices whose communication quality is the median value or the smallest difference from the median value as the next-level master-slave device, and jump to step S55. If no, set the only responding device within the preset standard range as the next-level master-slave device, and jump to step S55.

[0022] S54: Determine whether the communication quality of the responding devices is greater than the upper limit of the preset standard range. If yes, proceed to step S56; otherwise, select the responding device that is closest to the preset standard range as the next level master-slave device.

[0023] S55: Determine whether there is a response device among the remaining response devices with a communication quality greater than a preset value. If yes, set the response device with a communication quality greater than the preset value as a slave device of the corresponding master-slave device, form a device group of the corresponding level, and return the device group and the device information of the next level master-slave device to the gateway, and jump to step S6. If no, return the device information of the next level master-slave device to the gateway, and jump to step S6.

[0024] S56: Set the responding device as a slave device of the corresponding master-slave device, the set slave devices form a device group of the corresponding level, and return the device information of the device group to the gateway, and the network configuration ends.

[0025] Furthermore, the terminal device management system also includes:

[0026] A network server connected to the gateway is used to display wireless networking information; the wireless networking information includes: device information of master and slave devices at each level, and device information of slave devices included in the device groups corresponding to master and slave devices at each level.

[0027] This invention also proposes an adaptive multi-level wireless communication method for a terminal device management system, comprising the following steps:

[0028] S01: Wireless networking is achieved for terminal devices in the terminal device management system using the adaptive multi-level wireless networking method described above;

[0029] S02: The gateway sends data packets to the primary master and slave devices;

[0030] S03: After receiving the data packet, the first-level master and slave device sends the data packet to each slave device in the corresponding level device group and the next-level master and slave device, and returns the sending result to the gateway;

[0031] S04: After receiving the transmission result, the gateway generates a data packet forwarding request containing the target master / slave device ID number and sends it to the first-level master / slave device; the target master / slave device is the next-level master / slave device of the master / slave device corresponding to the currently received transmission result;

[0032] S05: After receiving a data packet forwarding request, the first-level master-slave device forwards the data packet forwarding request to the next-level master-slave device. The next-level master-slave device determines whether it is the target master-slave device in the data packet forwarding request. If it is, it proceeds to the next step. If not, it continues to forward the data packet forwarding request to the next-level master-slave device until the request is forwarded to the target master-slave device.

[0033] S06: The target master-slave device determines whether it is the last-level master-slave device. If not, it sends the data packet to each slave device in the corresponding level device group and the next-level master-slave device, and returns the sending result to the gateway, while returning to step S04. If yes, the target master-slave device determines whether it manages slave devices. If yes, it sends the data packet to each slave device in the corresponding level device group and returns the sending result to the gateway. If not, it directly returns the sending result to the gateway.

[0034] S07: The gateway terminates communication after receiving the transmission result returned by the last-level master and slave devices.

[0035] Furthermore, the adaptive multi-level wireless communication method further includes:

[0036] The fault detection process includes the following steps:

[0037] S001: The gateway sends a query request to the primary master-slave device; the query request contains the ID number of the target master-slave device; in the first query request sent by the gateway, the ID number of the target master-slave device is the ID number of the primary master-slave device;

[0038] S002: After receiving a query request, the first-level master-slave device determines whether it is the target master-slave device in the query request. If so, it returns the query result to the gateway; if not, it continues to forward the query request to the next lower-level master-slave device until the request is forwarded to the target master-slave device. After receiving the query request, the target master-slave device returns the query result to the gateway.

[0039] S003: The gateway determines whether it has received the query result corresponding to the current query request within a preset time period. If yes, it proceeds to the next step; if no, it indicates that the corresponding target master-slave device is faulty. The gateway switches the master-slave device corresponding to the query request and proceeds to the next step after the switch is completed.

[0040] S004: Determine whether the master-slave device corresponding to the current query result is the highest level master-slave device. If yes, it means that the fault detection is complete; otherwise, update the ID number in the query request to the ID number of the next level master-slave device corresponding to the current query result and return S001.

[0041] Furthermore, the switching of the master / slave device corresponding to the query request specifically involves:

[0042] The gateway selects the slave device with the best communication quality from the device group corresponding to the faulty master and slave devices based on the communication quality data calculated during network setup, and replaces the current faulty master and slave devices.

[0043] Furthermore, in step S06, returning the sending result to the gateway specifically involves the target master-slave device returning the sending result to the gateway level by level through the master-slave devices at each preceding level.

[0044] Compared with the prior art, the present invention has at least the following beneficial effects:

[0045] (1) The adaptive multi-level wireless networking method proposed in this invention aims to achieve automatic cascading of multi-level terminal devices through a single gateway node, thereby breaking through the transmission distance limitation, reducing the overall cost, and simplifying installation and maintenance. It avoids the high cost and complexity caused by adding multiple gateways or fixed relay nodes. Its core technology is to allow terminal devices to dynamically switch master-slave modes according to the actual communication quality. It can act as a regular terminal or a relay, reducing the strict requirements on the device arrangement order and enhancing the flexibility and adaptability of the network. Specifically, the gateway first presets a terminal device as a first-level master-slave device and sends a target networking request. The master-slave device broadcasts query information according to the request, calculates the communication quality of the responding device, selects the slave device it manages and the next-level master-slave device, and the slave device forms a device group of the corresponding level and returns the information to the gateway. The gateway then updates the request level and the target master-slave device ID number and continues to send networking requests to the next master-slave device until the entire network is built. This adaptive mechanism ensures that stable communication performance can be maintained even when the network topology changes or a fault occurs, which significantly improves the efficiency and reliability of large-scale terminal device management.

[0046] (2) The present invention reduces the strict requirements on the installation location and sequence of the equipment by automatically selecting the master and slave devices through a dynamic adjustment mechanism, making the installation more flexible and convenient; at the same time, once a master or slave device fails, the system can automatically select a new master or slave device to replace it, reducing the maintenance difficulty and downtime, thereby significantly reducing the overall operation and maintenance cost.

[0047] (3) In the networking process, the present invention selects the most suitable next-level master and slave devices and their managed slave devices by calculating the communication quality of the response device, thus ensuring the optimal allocation of resources; in addition, the fault detection process and master and slave device switching mechanism further optimize the efficiency of resource utilization, ensuring that the network always maintains a high-efficiency operating state.

[0048] (4) This invention is particularly suitable for scenarios such as traffic lighting, such as the large-scale deployment of tunnel lighting equipment. It can quickly complete data synchronization without sacrificing communication quality. Attached Figure Description

[0049] Figure 1 This is a flowchart of an adaptive multi-level wireless networking method for a terminal device management system according to an embodiment of the present invention;

[0050] Figure 2 This is a flowchart of an adaptive multi-level wireless communication method for a terminal device management system according to an embodiment of the present invention;

[0051] Figure 3 This is a wireless network structure diagram of the terminal device management system in an embodiment of the present invention;

[0052] Figure 4 This is a network structure diagram for extending network coverage through multiple gateway nodes in existing technologies;

[0053] Figure 5 This is a diagram illustrating the network structure used in existing technologies to extend network coverage through multiple relay nodes. Detailed Implementation

[0054] The following are specific embodiments of the present invention, which are described in conjunction with the accompanying drawings. However, the present invention is not limited to these embodiments.

[0055] Example 1

[0056] To achieve cascading of multiple levels of terminal devices under a single gateway node, thereby overcoming transmission distance limitations, while reducing overall costs and simplifying installation and maintenance, such as... Figure 1 As shown in the figure, this embodiment of the invention proposes an adaptive multi-level wireless networking method for a terminal device management system, wherein the terminal device management system includes a gateway and multiple terminal devices; the adaptive multi-level wireless networking method includes the following steps:

[0057] S1: In the terminal device management system, a terminal device is preset as a first-level master-slave device;

[0058] S2: The gateway sends a target networking request to the first-level master and slave devices. This request is a level i networking request; i is a positive integer greater than or equal to 1; the target networking request includes the ID number of the target master and slave devices; the level of the master and slave devices corresponds one-to-one with the level of the target networking request; the first target networking request sent by the gateway is a level 1 networking request.

[0059] S3: The primary master and slave devices determine whether the target networking request is a Level 1 networking request. If yes, proceed to the next step; otherwise, jump to step S7.

[0060] S4: The primary master and slave devices enter step S5 to execute the networking process based on the target networking request;

[0061] S5: Broadcast query information, and calculate the communication quality of each responding device based on the received response information. Use the communication quality to select the next-level master / slave device and / or the responding device to be managed by the current master / slave device, i.e., the slave device. The selected slave devices form a device group of the corresponding level, and return the formed device group and the device information of the selected next-level master / slave device to the gateway. The responding device refers to the terminal device that received the query information.

[0062] It should be noted that in the wireless networking scheme of this invention, the master and slave devices are actually the same type of terminal devices; the only difference between them is their logical roles. Each terminal designated as a master or slave device is not only responsible for managing a group of subordinate slave devices, but it is also managed by the master or slave device at the next higher level as a slave device itself. For example, a second-level master or slave device manages the slave devices in a second-level device group, while it itself is managed and communicates with a first-level master or slave device. The top-level first-level master or slave device directly receives management and instructions from the gateway. This hierarchical management structure allows the network to automatically cascade multiple levels of terminal devices through a single gateway node, thereby breaking through the transmission distance limitations of traditional schemes and simplifying installation and maintenance. By dynamically adjusting the master-slave mode, these devices can switch roles when necessary, acting as ordinary terminals or repeaters, enhancing the flexibility and adaptability of the network and ensuring stable communication performance even when the network topology changes or failures occur.

[0063] The S5 step is specifically as follows:

[0064] Broadcast query information and determine if the number of responding devices is 0. If it is, the network is complete. If not, calculate the communication quality of each responding device based on the received response information. Based on the relationship between the communication quality of the responding device and the upper and lower limits of the preset standard range, select the next-level master / slave device and / or the responding device to be managed by the current master / slave device. The selected slave devices form a device group of the corresponding level. The formed device group and the device information of the selected next-level master / slave device are returned to the gateway.

[0065] The formula for calculating the communication quality is:

[0066] ;

[0067] In the formula, RSSI represents the signal strength of the response information corresponding to the response device. max and RSSI min These are the maximum and minimum signal strength values ​​among all terminal devices. SNR represents the signal-to-noise ratio of the response information from the responding device. max and SNR min These represent the maximum and minimum signal-to-noise ratios among all terminal devices, respectively. and These represent the weights of signal strength and signal-to-noise ratio, respectively, while Score represents communication quality.

[0068] It's important to note that when building a wireless network, master and slave devices need to maintain a certain distance to optimize communication efficiency, but they also cannot be too far apart to ensure reliable and stable communication. However, in actual deployments, since terminal devices may not be installed in a pre-defined ID order, the master and slave devices cannot know in advance the specific ID numbers of subsequent slave devices or their relative distances. Furthermore, the propagation characteristics of radio waves mean that all devices within the receiving range will receive the transmitted message almost simultaneously, and their responses will also arrive at the sending device almost simultaneously. For example, in... Figure 3 In the scenario shown, when master device 2 broadcasts a message, the slave devices 2-1, 2-2 to 2-N under its management will receive the message at almost the same time, and their responses will be returned to master device 2 almost synchronously.

[0069] Therefore, in such an environment, the selection of suitable master / slave devices cannot be directly based on physical distance relationships. Instead, the system must rely on other indicators to determine the optimal master / slave devices and their corresponding slave devices. Specifically, this invention employs a communication quality-based selection strategy. The communication quality of each responding device is calculated by measuring signal strength index (RSSI) and signal-to-noise ratio (SNR) and combining them with weighting parameters w1 and w2. This allows the system to dynamically adjust according to the actual wireless environment without prior knowledge of the physical location or distance between devices. Ultimately, devices with higher communication quality are selected as the next-level master / slave device or as the slave device of the current master / slave device, thus ensuring good communication performance even when the network topology changes. This adaptive approach enhances network flexibility and reliability, reduces the requirements for device arrangement order, simplifies the installation process, and lowers maintenance difficulty.

[0070] It should be noted that, considering the generally negative correlation between the signal strength (RSSI) and signal-to-noise ratio (SNR) of a wireless module and communication distance—meaning these parameters typically decrease with increasing distance—this embodiment evaluates the communication quality between devices by comprehensively calculating these two parameters. Since the relationship between signal strength and SNR and distance is not strictly linear, relying solely on either parameter to calculate communication quality is inappropriate. Therefore, this solution employs a comprehensive scoring mechanism, dynamically selecting the slave device to be managed and the next master / slave device based on real-time communication quality. This method not only effectively ensures communication reliability but also reduces the stringent requirements on installation location and sequence, enhancing the system's flexibility and adaptability. It ensures that the network can automatically adjust according to actual environmental conditions after deployment, maintaining optimal performance and a stable communication link.

[0071] In step S5, based on the relationship between the communication quality of the responding device and the upper and lower limits of the preset standard range, the next-level master / slave device and / or the responding device to be managed by the current master / slave device are selected using communication quality. The selected slave devices form a device group of the corresponding level, and the formed device group and the device information of the selected next-level master / slave device are returned to the gateway. Specifically:

[0072] S51: Determine if the number of responding devices is greater than 1. If yes, proceed to the next step; otherwise, jump to step S56.

[0073] S52: Determine whether the communication quality of any responding device is within the preset standard range. If yes, proceed to the next step; otherwise, jump to step S54.

[0074] S53: Determine whether the number of responding devices within the preset standard range is greater than 1. If yes, select one of the multiple responding devices whose communication quality is the median value or the smallest difference from the median value as the next-level master-slave device, and jump to step S55. If no, set the only responding device within the preset standard range as the next-level master-slave device, and jump to step S55.

[0075] S54: Determine whether the communication quality of the responding devices is greater than the upper limit of the preset standard range. If yes, proceed to step S56; otherwise, select the responding device that is closest to the preset standard range as the next level master-slave device.

[0076] S55: Determine whether there is a response device among the remaining response devices with a communication quality greater than a preset value. If yes, set the response device with a communication quality greater than the preset value as a slave device of the corresponding master-slave device, form a device group of the corresponding level, and return the device group and the device information of the next level master-slave device to the gateway, and jump to step S6. If no, return the device information of the next level master-slave device to the gateway, and jump to step S6.

[0077] S56: Set the responding device as a slave device of the corresponding master-slave device, the set slave devices form a device group of the corresponding level, and return the device information of the device group to the gateway, and the network configuration ends.

[0078] It should be noted that the preset value is less than the lower limit of the preset standard range.

[0079] After the selected devices form the corresponding level of device group, it also includes:

[0080] The current master-slave device sends the group information of the device group to each slave device in the device group; the group information includes the level of the device group and the ID number of the corresponding master-slave device; the current master-slave device is a first-level master-slave device or a target master-slave device.

[0081] S6: After receiving the return information corresponding to the current target networking request, the gateway increments the level i of the target networking request by 1, updates the ID number of the target master-slave device in the request to the ID number of the next-level master-slave device in the return information, and returns to step S2.

[0082] S7: The first-level master-slave device forwards the target network request to the next-level master-slave device based on the ID number of the target master-slave device in the target network request; when the next-level master-slave device determines that it is not the target master-slave device in the target network request, the master-slave device continues to forward the target network request to the next-level master-slave device until the target master-slave device is reached; the target master-slave device returns to step S5 to execute the network process based on the target network request.

[0083] In actual deployments, the installation of terminal devices does not necessarily follow the order of their ID numbers. Figure 3 The identifiers such as 1-1, 1-2, and 1-N in the diagram are for illustrative purposes only (Master-Slave Device 1, Master-Slave Device 2, and Master-Slave Device 3 represent Level 1, Level 2, and Level 3 master-slave devices, respectively; Master-Slave Device 1's slave devices include Slave Device 1-1, Slave Device 1-2, and Slave Device 1-N; Master-Slave Device 2's slave devices include Slave Device 2-1, Slave Device 2-2, and Slave Device 2-N; and Master-Slave Device 3's slave device includes Slave Device 3-1), and do not represent the actual ID numbers of the devices. Therefore, when setting up a network, you cannot rely on fixed distances or intervals to select master-slave devices, nor can you pre-define which slave devices a particular master-slave device should manage. For example, Master-Slave Device 2 in the diagram is dynamically selected based on actual communication quality and can be adjusted at any time; the second group of slave devices it manages is also determined based on the on-site installation conditions, rather than being pre-specified.

[0084] At the physical layer, wireless communication uses broadcasting for message transmission. This means that when master / slave device 2 sends a message, all devices within its signal coverage area can receive this information. However, at the software layer, the destination address (ID number) contained in the message determines which devices should process the message, while other irrelevant devices will filter it out. This mechanism enables the system to implement unicast, multicast, and broadcast functions, where unicast and multicast refer to master / slave device 2 being able to multicast or unicast messages to slave devices in its corresponding level of device group.

[0085] The terminal device management system also includes:

[0086] A network server connected to the gateway is used to display wireless networking information; the wireless networking information includes: device information of master and slave devices at each level, and device information of slave devices included in the device groups corresponding to master and slave devices at each level.

[0087] The adaptive multi-level wireless networking method proposed in this invention aims to achieve automatic cascading of multi-level terminal devices through a single gateway node, thereby overcoming transmission distance limitations, reducing overall costs, and simplifying installation and maintenance. It avoids the high costs and complexity associated with adding multiple gateways or fixed relay nodes. Its core technology allows terminal devices to dynamically switch between master-slave modes based on actual communication quality, functioning as both ordinary terminals and repeaters. This reduces the strict requirements on device arrangement order and enhances network flexibility and adaptability. Specifically, the gateway first presets one terminal device as a first-level master-slave device and sends a target networking request. The master-slave device broadcasts query information based on the request, calculates the communication quality of the responding device, selects its managed slave devices and the next-level master-slave devices, forming a device group of the corresponding level, and returns the information to the gateway. The gateway then updates the request level and the target master-slave device ID, continuing to send networking requests to the next master-slave device until the entire network is constructed. This adaptive mechanism ensures stable communication performance even when the network topology changes or failures occur, significantly improving the efficiency and reliability of managing large-scale terminal devices.

[0088] Example 2

[0089] like Figure 2 As shown in the figure, this embodiment of the invention also proposes an adaptive multi-level wireless communication method for a terminal device management system, including the following steps:

[0090] S01: Wireless networking is achieved for terminal devices in the terminal device management system using the adaptive multi-level wireless networking method described above;

[0091] S02: The gateway sends data packets to the primary master and slave devices;

[0092] S03: After receiving the data packet, the first-level master and slave device sends the data packet to each slave device in the corresponding level device group and the next-level master and slave device, and returns the sending result to the gateway;

[0093] S04: After receiving the transmission result, the gateway generates a data packet forwarding request containing the target master / slave device ID number and sends it to the first-level master / slave device; the target master / slave device is the next-level master / slave device of the master / slave device corresponding to the currently received transmission result;

[0094] S05: After receiving a data packet forwarding request, the first-level master-slave device forwards the data packet forwarding request to the next-level master-slave device. The next-level master-slave device determines whether it is the target master-slave device in the data packet forwarding request. If it is, it proceeds to the next step. If not, it continues to forward the data packet forwarding request to the next-level master-slave device until the request is forwarded to the target master-slave device.

[0095] S06: The target master-slave device determines whether it is the last-level master-slave device. If not, it sends the data packet to each slave device in the corresponding level device group and the next-level master-slave device, and returns the sending result to the gateway, while returning to step S04. If yes, the target master-slave device determines whether it manages slave devices. If yes, it sends the data packet to each slave device in the corresponding level device group and returns the sending result to the gateway. If not, it directly returns the sending result to the gateway.

[0096] S07: The gateway terminates communication after receiving the transmission result returned by the last-level master and slave devices.

[0097] In step S06, returning the sending result to the gateway specifically involves the target master-slave device returning the sending result to the gateway level by level through the master-slave devices at each preceding level.

[0098] In detail, in the normal network communication process, after the gateway completes the wireless network setup according to step S01, it sends data packets to the primary master / slave device (i.e., master / slave device 1) according to step S02. Upon receiving the data packets, master / slave device 1, according to step S03, multicasts the data packets to its managed slave devices and the next master / slave device (master / slave device 2), and simultaneously sends back the reception status (transmission result) of these devices to the gateway. After receiving the transmission result returned by master / slave device 1, the gateway records this information and generates a new data packet forwarding request according to step S04, which includes the ID number of the target master / slave device (i.e., master / slave device 2), and then sends this request again to master / slave device 1. It is important to note that this forwarding request only carries instructions and does not include the actual data packets to be forwarded.

[0099] Next, in steps S05 and S06, after receiving the packet forwarding request from the gateway, master-slave device 1 forwards it to master-slave device 2. Upon receiving the request, master-slave device 2 confirms whether it is the designated target master-slave device. If so, it repeats the operation of master-slave device 1: sending the packet previously sent by master-slave device 1 to its managed slave devices and next-level master-slave devices, and sending the result back to the higher-level master-slave device 1. This process proceeds layer by layer, with each subsequent master-slave device performing the same operation until the data is passed to the last-level master-slave device. If the master-slave device does not manage any more slave devices or next-level master-slave devices, the communication is considered complete. Throughout the process, the results from each level of master-slave device are relayed back to the gateway level by level from the preceding master-slave devices. Finally, the gateway aggregates all results and uploads the data to the network server for users to view. This method ensures efficient and reliable data transmission even in complex network topologies.

[0100] The adaptive multi-level wireless communication method further includes:

[0101] The fault detection process includes the following steps:

[0102] S001: The gateway sends a query request to the primary master-slave device; the query request contains the ID number of the target master-slave device; in the first query request sent by the gateway, the ID number of the target master-slave device is the ID number of the primary master-slave device;

[0103] S002: After receiving a query request, the first-level master-slave device determines whether it is the target master-slave device in the query request. If so, it returns the query result to the gateway; if not, it continues to forward the query request to the next lower-level master-slave device until the request is forwarded to the target master-slave device. After receiving the query request, the target master-slave device returns the query result to the gateway.

[0104] S003: The gateway determines whether it has received the query result corresponding to the current query request within a preset time period. If yes, it proceeds to the next step; if no, it indicates that the corresponding target master-slave device is faulty. The gateway switches the master-slave device corresponding to the query request and proceeds to the next step after the switch is completed.

[0105] The specific steps for switching the master / slave device corresponding to the query request are as follows:

[0106] The gateway selects the slave device with the best communication quality from the device group corresponding to the faulty master and slave devices based on the communication quality data calculated during network setup, and replaces the current faulty master and slave devices.

[0107] It should be noted that when multiple slave devices have communication quality at their maximum value, any slave device with the highest communication quality is selected to replace the current faulty master / slave device. After selecting the new master / slave device, the information of the slave devices previously managed by the faulty master / slave device is sent to the newly selected master / slave device. Upon receiving this information, the new master / slave device will complete a dynamic role switch and officially take over the responsibilities of the original master / slave device. Through this intelligent and dynamic adjustment mechanism, it can be ensured that even if the master / slave device fails, network communication can still maintain a high degree of reliability and stability.

[0108] In addition, since the faulty master and slave devices may automatically resume communication or be manually repaired, there are two master and slave devices of the same level. Therefore, during the communication process, when the original faulty master and slave device also receives the request, it can confirm that there is a new master and slave device in place by matching the ID number in the request, and thus automatically switch back to the slave device mode of the device group, avoiding duplicate management and potential conflicts.

[0109] Since the master and slave devices in this embodiment are identical in hardware, the master and slave devices can be automatically switched when a failure occurs, thereby avoiding network communication failure due to problems with the master and slave devices.

[0110] S004: Determine whether the master-slave device corresponding to the current query result is the highest level master-slave device. If yes, it means that the fault detection is complete; otherwise, update the ID number in the query request to the ID number of the next level master-slave device corresponding to the current query result and return S001.

[0111] It should be noted that the solution of this invention is particularly suitable for traffic lighting scenarios, such as the deployment of tunnel lighting equipment. The distribution range of equipment within a tunnel may exceed 10 kilometers, imposing strict requirements on communication distance. Furthermore, since these devices are primarily used for lighting control, the amount of data they transmit is relatively small, and a certain degree of latency can be tolerated. Therefore, the adaptive multi-level wireless networking method and communication method proposed in this invention can well meet the functional requirements of tunnel lighting systems. This method achieves automatic cascading of multi-level terminal devices through a single gateway node, not only solving the cost and complexity problems caused by the need for multiple gateways or fixed routing nodes in traditional solutions, but also reducing the workload of installation and maintenance. Tests show that a network consisting of 3 master-slave devices and 7 slave devices within a 1-kilometer range can complete data synchronization within 5 seconds, demonstrating the efficiency and reliability of this solution in practical applications.

[0112] Considering the need for large-scale equipment upgrades, this invention also provides an optimized upgrade method to address the firmware update challenges in long-distance, large-scale equipment scenarios such as tunnel lighting. Traditional upgrade methods typically involve a one-to-one master-slave process, where the master must wait for confirmation from the slave after each data packet is sent. Upgrading a 50KB software package for 200 devices distributed over a 10km radius using this method is expected to take at least 11 hours. This invention, however, utilizes its unique communication mechanism, where the master and slave devices manage slave devices in groups, thus significantly reducing the upgrade time. Specifically:

[0113] 1. The gateway first transmits the upgrade package to the first-level master and slave devices. After receiving the complete upgrade package, the master and slave devices will read it and assign a sequential number to each data block in the upgrade package, resulting in multiple data packets with sequential numbers. They will then send these data packets in sequence to the slave devices they manage and the next-level master and slave devices via multicast.

[0114] It's important to note that a complete upgrade package typically contains multiple data packets. This is because firmware or other types of software update files are often quite large and cannot be transmitted in one go over the LoRa network. To ensure reliable transmission, each larger upgrade package is broken down into multiple smaller data packets for transmission. Each such data packet is assigned a unique sequence number (i.e., a sequence number), which helps the receiver correctly assemble and verify the received data. This ensures that even if some data packets are lost or corrupted, it is possible to identify which data needs to be retransmitted.

[0115] 2. Upon receiving a data packet, each slave device writes it to the corresponding location in its memory according to the packet's sequence number. If a data packet fails verification or has encryption / decryption errors, the slave device actively discards it, and its sequence number is recorded as a lost packet. Once the master and slave devices have completed the initial transmission of all data packets, they query each slave device under their management to understand their respective packet loss situation. For any lost data packet, the master and slave devices retransmit it one by one. However, before each retransmission, the master and slave devices check whether the number of retransmissions for that data packet exceeds the preset maximum number of retransmissions. If the number of retransmissions has not exceeded the limit, the retransmission operation is performed, and the retransmission count is incremented by 1; if the number of retransmissions has reached or exceeded the preset value, no further retransmission attempts are made, and this situation is reported to the gateway as the final retransmission result. This mechanism ensures that even under poor network conditions, all slave devices can receive complete upgrade data as much as possible, while avoiding unnecessary duplicate transmissions and improving communication efficiency.

[0116] It should be noted that due to the broadcast nature of LoRa technology, even if data packets are retransmitted in unicast form, other slave devices with the same packet loss can receive the data packets and update their own packet loss records. However, only the slave device that the master or slave device finds has packet loss (the target slave device) needs to respond and confirm. Other devices only need to update their own packet loss records when necessary without responding.

[0117] Specifically, during unicast retransmission, although only the target slave device needs to acknowledge the loss, other slave devices may receive these retransmitted data packets. If other slave devices did indeed lose data packets with the same number previously, they can take this opportunity to receive and store these packets and update their own packet loss records accordingly to reflect the latest status. Therefore, even if these devices did not initially report packet loss, they may still need to update their own packet loss records because new data packets may compensate for previous omissions.

[0118] Additionally, master and slave devices can check for packet loss by querying the status of the slave device. This is typically done by requesting the slave device to report a list of packet numbers it has successfully received. Based on this list, the master and slave devices can compare the packet numbers they sent to identify which packets were not acknowledged, thus determining which packets were lost by the slave device.

[0119] Once this process is complete, the primary master-slave device reports the upgrade result to the gateway. Subsequently, the gateway continues to request the next-level master-slave device to begin upgrading the slave devices it manages, through the primary master-slave device, until all devices have successfully received all data packets.

[0120] After testing, using this upgrade method, the upgrade time for one group of devices is about 200 seconds. Theoretically, the overall upgrade time for 200 devices can be shortened to about 1 hour, which greatly improves efficiency.

[0121] In summary, the adaptive multi-level wireless communication method provided by this invention enables long-distance communication without the need for additional hardware such as gateways. By dynamically searching ID numbers to establish logical groups, network construction is independent of the specific location of devices and the preset ID number order, simplifying the installation process and avoiding strict requirements on the arrangement order of terminal devices. Furthermore, the dynamic selection of master and slave devices ensures that even if one master or slave device fails, the entire network communication will not be interrupted, enhancing the system's stability and reliability. A practical application based on this principle—the large-scale synchronous communication and upgrade maintenance of tunnel lighting equipment—demonstrates that this solution significantly reduces operation and maintenance costs while improving communication performance, providing an effective solution for similar application scenarios.

[0122] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indication will also change accordingly.

[0123] Furthermore, in this invention, descriptions involving terms such as "first," "second," and "a" are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0124] In this invention, unless otherwise explicitly specified and limited, the terms "connection," "fixed," etc., should be interpreted broadly. For example, "fixed" can mean a fixed connection, a detachable connection, or an integral part; it can mean a mechanical connection or an electrical connection; it can mean a direct connection or an indirect connection through an intermediate medium; it can mean the internal communication of two components or the interaction between two components, unless otherwise explicitly limited. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0125] Furthermore, the technical solutions of the various embodiments of the present invention can be combined with each other, but only if they are feasible for those skilled in the art. If the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the scope of protection claimed by the present invention.

Claims

1. An adaptive multi-level wireless networking method for a terminal device management system, characterized in that: The terminal device management system includes a gateway and multiple terminal devices; the adaptive multi-level wireless networking method includes the steps of: S1: Preset a terminal device as a primary master-slave device in the terminal device management system; S2: The gateway sends a target networking request to the first-level master-slave device, where the request is an i-level networking request; i is a positive integer greater than or equal to 1; the target networking request includes the ID number of the target master-slave device; S3: The first-level master-slave device determines whether the target networking request is a first-level networking request, and if so, proceeds to the next step; if not, jumps to step S7; S4: The first-level master-slave device enters step S5 to execute the networking process based on the target networking request; S5: broadcasting query information, and calculating the communication quality of each answering device through the received answering information, and selecting the next-level master-slave device and / or the answering device to be managed by the current master-slave device, i.e., the slave device, by using the communication quality; The selected slave devices form a device group of the corresponding level, and return the formed device group and the device information of the selected next-level master and slave devices to the gateway; the answering device represents the terminal device that receives the query information; the step S5 is specifically as follows: Broadcast query information and determine whether the number of answering devices is 0. If so, it indicates that the networking is complete; if not, calculate the communication quality of each answering device through the received answering information, and based on the relationship between the communication quality of the answering device and the upper and lower limits in the preset standard range, select the next-level master-slave device and / or the answering device to be managed by the current master-slave device, i.e., the slave device, by using the communication quality; The selected slave devices form a device group of the corresponding level, and return the formed device group and the device information of the selected next-level master and slave devices to the gateway; In the step S5, based on the relationship between the communication quality of the answering device and the upper and lower limits in the preset standard range, the next-level master-slave device and / or the answering device to be managed by the current master-slave device, i.e., the slave device, is selected by using the communication quality; the selected slave devices form a device group of the corresponding level, and the formed device group and the device information of the selected next-level master-slave device are returned to the gateway, specifically: S51: Determine whether the number of answering devices is greater than 1, if so, proceed to the next step, if not, jump to step S56; S52: Determine whether the communication quality of the answering device is within the preset standard range. If so, proceed to the next step; if not, jump to step S54; S53: Determine whether the number of answering devices within the preset standard range is greater than 1. If so, select an answering device with a communication quality of the middle value or the smallest difference with the middle value from the multiple answering devices as the next-level master-slave device, and jump to step S55. If not, set the only answering device within the preset standard range as the next-level master-slave device, and jump to step S55. S54: Determine whether the communication quality of the answering devices is greater than the upper limit of the preset standard range. If so, jump to step S56; if not, select an answering device closest to the preset standard range as the next level master-slave device; S55: Determine whether there is a response device with a communication quality greater than a preset value among the remaining response devices. If so, set the response device with a communication quality greater than the preset value as a slave device corresponding to the master-slave device, and the selected slave devices form a device group of the corresponding level, and return the device information of the device group and the next-level master-slave device to the gateway, and jump to step S6 at the same time. If not, return the device information of the next-level master-slave device to the gateway, and jump to step S6 at the same time; S56: The answering device is set as a slave device corresponding to the master and slave devices, the set slave devices form a device group of corresponding levels, and the device information of the device group is returned to the gateway, and the networking is completed; S6: After receiving the return information corresponding to the current target networking request, the gateway increases the level i of the target networking request by 1, updates the ID number of the target master-slave device in the request to the ID number of the next level master-slave device in the return information, and returns to step S2; S7: The first-level master-slave device forwards the target networking request to the next-level master-slave device based on the ID number of the target master-slave device in the target networking request; when the next-level master-slave device determines that it is not the target master-slave device in the target networking request, the master-slave device continues to forward the target networking request to the next-level master-slave device until it reaches the target master-slave device; the target master-slave device returns to step S5 to execute the networking process based on the target networking request.

2. The adaptive multi-level wireless networking method for a terminal device management system according to claim 1, characterized in that: The calculation formula of the communication quality is: ; In the formula, RSSI represents the signal strength of the response information corresponding to the response device, RSSI max and RSSI min It is the maximum and minimum signal strength of all terminal devices. SNR represents the signal-to-noise ratio of the response information corresponding to the response device. max and SNR min Respectively represent the maximum and minimum values ​​of the signal-to-noise ratio among all terminal devices, and They represent the weights of signal strength and signal-to-noise ratio respectively, and Score represents the communication quality.

3. The adaptive multi-level wireless networking method for a terminal device management system according to claim 2, characterized in that: After the selected slave devices form a device group of the corresponding level, it also includes: The current master-slave device sends the group information of the device group to each slave device in the device group; the group information includes the level of the device group and the ID number of the corresponding master-slave device; the current master-slave device is a first-level master-slave device or a target master-slave device.

4. The adaptive multi-level wireless networking method for a terminal device management system according to claim 1, characterized in that: The terminal device management system further includes: The network server connected to the gateway for communication is used to display the wireless networking information; the wireless networking information includes: the device information of the master and slave devices at each level, and the device information of the slave devices included in the device groups corresponding to the master and slave devices at each level.

5. An adaptive multi-level wireless communication method for a terminal device management system, characterized in that: Includes steps: S01: Implementing wireless networking for terminal devices in a terminal device management system by using the adaptive multi-stage wireless networking method described in any one of claims 1 to 4; S02: The gateway sends a data packet to the primary master-slave device; S03: After receiving the data packet, the first-level master-slave device sends the data packet to each slave device in the corresponding level device group and the next-level master-slave device, and returns the sending result to the gateway; S04: After receiving the sending result, the gateway generates a data packet forwarding request including the ID number of the target master-slave device and sends it to the first-level master-slave device; the target master-slave device is the next-level master-slave device corresponding to the currently received sending result; S05: After receiving the data packet forwarding request, the first-level master-slave device forwards the data packet forwarding request to the next-level master-slave device; the next-level master-slave device determines whether it is the target master-slave device in the data packet forwarding request, and if so, proceeds to the next step; if not, continues to forward the data packet forwarding request to the next-level master-slave device until the request is forwarded to the target master-slave device; S06: The target master-slave device determines whether it is the last-level master-slave device. If not, the data packet is sent to each slave device in the device group of the corresponding level and the master-slave device of the next level, and the sending result is returned to the gateway, and the process returns to step S04. If so, the target master-slave device determines whether it manages slave devices. If so, the data packet is sent to each slave device in the device group of the corresponding level, and the sending result is returned to the gateway. If not, the sending result is directly returned to the gateway. S07: After receiving the sending result returned by the last-level master-slave device, the gateway ends the communication.

6. The adaptive multi-level wireless communication method for a terminal device management system according to claim 5, characterized in that: The adaptive multi-stage wireless communication method further comprises: Fault detection process, including the following steps: S001: The gateway sends a query request to a first-level master-slave device; the query request includes the ID number of the target master-slave device; in the query request sent by the gateway for the first time, the ID number of the target master-slave device is the ID number of the first-level master-slave device; S002: After receiving the query request, the first-level master-slave device determines whether it is the target master-slave device in the query request. If so, it returns the query result to the gateway; if not, it continues to forward the query request to the next-level master-slave device until the request is forwarded to the target master-slave device; after receiving the query request, the target master-slave device returns the query result to the gateway; S003: The gateway determines whether the query result corresponding to the current query request is received within a preset time period. If so, the gateway proceeds to the next step. If not, it indicates that the corresponding target master-slave device has a fault, and the master-slave device corresponding to the query request is switched, and the gateway proceeds to the next step after the switching is completed. S004: Determine whether the master-slave device corresponding to the current query result is the master-slave device of the maximum level. If so, it means that the fault detection is completed; if not, update the ID number in the query request to the ID number of the next level master-slave device corresponding to the current query result, and return to S001.

7. The adaptive multi-level wireless communication method for a terminal device management system according to claim 6, characterized in that: The switching of the master and slave devices corresponding to the query request is specifically: The gateway selects a slave device with the best communication quality from the device group corresponding to the failed master and slave devices to replace the current failed master and slave devices according to the communication quality data calculated during networking.

8. The adaptive multi-level wireless communication method for a terminal device management system according to claim 5, characterized in that: In the step S06, the sending result is returned to the gateway, specifically: the target master-slave device returns the sending result to the gateway level by level through the master-slave devices at the previous levels.

Citation Information

Patent Citations

  • Wireless networking method and device of air conditioners

    CN106288249A

  • Network addressing method, device and apparatus

    CN107948339A

  • Wireless networking method and device, terminal equipment and storage medium

    CN113133010A

  • Method and system for automatically switching wireless communication frequency points of master device and slave device

    CN116193529A