Self-adaptive multistage wireless networking method and communication method for terminal equipment management system

CN119697647AActive Publication Date: 2025-03-25杭州方千科技有限公司

Patent Information

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

Smart Images

  • Figure CN119697647A_ABST
    Figure CN119697647A_ABST
Patent Text Reader

Abstract

The invention discloses a self-adaptive multi-level wireless networking method and a communication method for a terminal equipment management system, and relates to the field of wireless networking, a gateway in the terminal equipment management system firstly 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 response device, selects the slave device managed by the response device, forms a device group of a corresponding level with the next-level master-slave device and the slave device, and returns the information to the gateway; the gateway then updates the request level and the ID number of the target master-slave device, and continues to send a networking request to the next master-slave device until the construction of the whole network is completed; the adaptive mechanism ensures that the stable communication performance can be maintained even if the network topology changes or fails, and the efficiency and reliability of large-scale terminal equipment management are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In traditional wireless communication architecture, due to the limitation of wireless transmission range, there are limitations on the number of terminals and geographical coverage that a single gateway node can directly manage. To overcome this challenge, two methods are usually adopted: First, Figure 4 As shown in the figure, multiple gateway nodes are deployed to expand network coverage, and the interconnection and data synchronization between these gateways are ensured through wired or wireless networks; secondly, as shown in the figure, Figure 5 As shown in the figure, fixed routing nodes are added as relay stations in the network to extend the transmission distance of the signal. However, the first solution not only increases the hardware cost and the dependence on stable power supply and network connection, but also increases the complexity and maintenance requirements of the system; although the second solution can achieve long-distance communication, the relay node is independent and requires external power supply. Once a failure occurs, it may cause the communication of the entire network to be interrupted, thus affecting the overall reliability and stability of the system. Summary of the invention

[0003] In order to realize the cascading of multi-level terminal devices under a single gateway node, thereby breaking through the limitation of transmission distance, reducing overall cost and simplifying installation and maintenance work, the present 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 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 answering device, i.e., the slave device, to be managed by the next-level master-slave device and / or the current master-slave device using the communication quality; the selected slave devices form a device group of the corresponding level, and returning the formed device group and the device information of the selected next-level master-slave device to the gateway; the answering device represents the terminal device that has received the query information; 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.

[0004] Furthermore, the step S5 is specifically as follows: Broadcast query information and determine whether the number of answering devices is 0. If so, it means 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, use the communication quality to 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; 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.

[0005] Furthermore, 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.

[0006] Furthermore, after the selected slave devices form a device group of a corresponding level, the method further 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.

[0007] Further, 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 communication quality is used to select the next-level master-slave device and / or the answering device to be managed by the current master-slave device, that is, the slave device; 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-slave device, the set slave devices form a device group of corresponding level, and the device information of the device group is returned to the gateway, and the networking is completed.

[0008] Furthermore, the terminal device management system further includes: The network server connected to the gateway 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.

[0009] The embodiment of the present invention further proposes an adaptive multi-level wireless communication method for a terminal device management system, comprising the steps of: S01: Implementing wireless networking for terminal devices in the terminal device management system by using the adaptive multi-level wireless networking method described above; 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.

[0010] Furthermore, the adaptive multi-stage wireless communication method further includes: 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.

[0011] Further, 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.

[0012] Furthermore, 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.

[0013] Compared with the prior art, the present invention has at least the following beneficial effects: (1) The adaptive multi-level wireless networking method proposed in the present invention aims to realize the automatic cascading of multi-level terminal devices through a single gateway node, thereby breaking through the transmission distance limitation and reducing the overall cost and simplifying the installation and maintenance work, avoiding the high cost and complexity caused by adding multiple gateways or fixed relay nodes. Its core technology is to allow the terminal device to dynamically switch the master-slave mode according to the actual communication quality, and can act as both a common terminal and a repeater, reducing the strict requirements on the arrangement order of devices 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 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 failures occur, significantly improving the efficiency and reliability of large-scale terminal device management. (2) The present invention reduces the strict requirements on the installation location and order of devices through a dynamic adjustment mechanism that automatically selects master and slave devices, making 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, which reduces maintenance difficulty and downtime, thereby significantly reducing the overall operation and maintenance costs. (3) In the networking process, the present invention selects the most suitable next-level master-slave device and the slave devices it manages by calculating the communication quality of the answering device, thereby ensuring the optimal allocation of resources. In addition, the fault detection process and the master-slave device switching mechanism further optimize the resource utilization efficiency, ensuring that the network always maintains an efficient operation state; (4) The present invention is particularly suitable for scenarios such as traffic lighting, such as large-scale deployment of tunnel lighting equipment. It can quickly complete data synchronization without sacrificing communication quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 It is a flow chart of an adaptive multi-level wireless networking method for a terminal device management system in an embodiment of the present invention;

[0015] Figure 2 It is a flow chart of an adaptive multi-stage wireless communication method for a terminal device management system in an embodiment of the present invention;

[0016] Figure 3 A wireless networking structure diagram of a terminal device management system in an embodiment of the present invention;

[0017] Figure 4 A network structure diagram for expanding network coverage through multiple gateway nodes in the prior art;

[0018] Figure 5 This is a network structure diagram for expanding network coverage through multiple relay nodes in the prior art. DETAILED DESCRIPTION

[0019] The following are specific embodiments of the present invention and the accompanying drawings to further describe the technical solution of the present invention, but the present invention is not limited to these embodiments.

[0020] Embodiment 1

[0021] In order to realize the cascading of multiple terminal devices under a single gateway node, so as to break through the limitation of transmission distance, reduce the overall cost and simplify the installation and maintenance work, such as Figure 1 As shown, an embodiment of the present 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 steps of:

[0022] S1: Preset a terminal device as a primary master-slave device in the terminal device management system;

[0023] S2: The gateway sends a target networking request to the first-level master-slave device, which 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; the level of the master-slave device corresponds to the level of the target networking request; the target networking request sent by the gateway for the first time is a level 1 networking request;

[0024] 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;

[0025] S4: The first-level master-slave device enters step S5 to execute the networking process based on the target networking request;

[0026] S5: broadcasting query information, and calculating the communication quality of each answering device through the received answering information, and selecting the answering device, i.e., the slave device, to be managed by the next-level master-slave device and / or the current master-slave device using the communication quality; the selected slave devices form a device group of the corresponding level, and returning the formed device group and the device information of the selected next-level master-slave device to the gateway; the answering device represents the terminal device that has received the query information; It should be noted that in the wireless networking scheme of the present invention, the master-slave device and the slave device are actually the same type of terminal devices, and the difference between them is only the difference in logical roles. Each terminal designated as a master-slave device is not only responsible for managing a group of subordinate slave devices, but also managed by the previous master-slave device as a slave device; for example, the second-level master-slave device manages the slave devices in the second-level device group, and it itself is managed and communicated by the first-level master-slave device. The top-level master-slave device directly accepts the management and instructions of the gateway. This hierarchical management structure allows the network to realize automatic cascading of multi-level terminal devices through a single gateway node, thereby breaking through the transmission distance limitation in traditional solutions 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.

[0027] The step S5 is specifically as follows: Broadcast query information and determine whether the number of answering devices is 0. If so, it means 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, use the communication quality to 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; 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.

[0028] 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.

[0029] It should be noted that when building a wireless network, a certain distance needs to be maintained between the master and slave devices to optimize communication efficiency, but at the same time they cannot be too far apart to ensure that the communication between them is reliable and stable. However, in actual deployment, since the terminal devices may not be installed in the order of the preset ID numbers, this means that the master and slave devices cannot know in advance the specific ID numbers of the subsequent slave devices and the relative distances between these devices and themselves. In addition, the propagation characteristics of radio waves make it possible for all devices within the receiving range to receive the sent message almost at the same time, and their responses will also arrive at the sending device almost at the same time. For example, in Figure 3 In the case shown, when the master-slave device 2 broadcasts a message, the slave devices 2-1, 2-2 to 2-N under its management will receive the message almost at the same time, and their responses will be returned to the master-slave device 2 almost synchronously.

[0030] Therefore, in such an environment, it is not possible to directly rely on the physical distance relationship to select the appropriate master-slave device. Instead, the system must rely on other indicators to determine the best master-slave device and the corresponding slave device. Specifically, the present invention adopts a selection strategy based on communication quality. The communication quality of each answering device is calculated by measuring the signal strength (RSSI) and the signal-to-noise ratio (SNR), and combining the weight parameters w1 and w2. This allows the system to dynamically adjust according to the actual wireless environment without the need to know the physical location or distance between devices in advance. Ultimately, the device with higher communication quality will be selected as the next-level master-slave device or the slave device of the current master-slave device, thereby ensuring that good communication performance is maintained even when the network topology changes. This adaptive method enhances the flexibility and reliability of the network, reduces the requirements for the order of device arrangement, simplifies the installation process, and reduces the difficulty of maintenance.

[0031] It should be noted that considering that the signal strength (RSSI) and signal-to-noise ratio (SNR) of the wireless module are generally negatively correlated with the communication distance, that is, as the distance increases, these parameters usually decrease, resulting in reduced communication quality. This embodiment evaluates the communication quality between devices by comprehensively calculating these two parameters. Since the relationship between signal strength and signal-to-noise ratio and distance is not strictly linear, it is not appropriate to rely on any one parameter alone to calculate the communication quality. Therefore, this solution adopts a comprehensive scoring mechanism to dynamically select the slave device to be managed and the next master-slave device based on real-time communication quality. This method not only effectively guarantees the reliability of communication, but also reduces the strict requirements on installation location and order, enhances the flexibility and adaptability of the system, and ensures that the network can automatically adjust according to actual environmental conditions after deployment to maintain optimal performance and stable communication links.

[0032] 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 communication quality is used to 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; 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:

[0033] 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;

[0034] 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;

[0035] 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.

[0036] 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;

[0037] 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;

[0038] S56: The answering device is set as a slave device corresponding to the master-slave device, the set slave devices form a device group of corresponding level, and the device information of the device group is returned to the gateway, and the networking is completed.

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

[0040] 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.

[0041] 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;

[0042] 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.

[0043] In actual deployment, the installation of terminal devices does not necessarily follow the order of ID numbers. Figure 3 The identifiers such as 1-1, 1-2, 1-N, etc. are only used for illustration (the master-slave device 1, master-slave device 2, and master-slave device 3 in the figure represent the first-level master-slave device, the second-level master-slave device, and the third-level master-slave device, respectively, where the slave devices of the master-slave device 1 include slave devices 1-1, 1-2, and 1-N, the slave devices of the master-slave device 2 include slave devices 2-1, 2-2, and 2-N; the slave devices of the master-slave device 3 include slave devices 3-1), and do not represent the real ID number of the device. Therefore, when networking, the master and slave devices cannot be selected based on fixed distances or intervals, nor can a certain master and slave device be pre-set to manage which slave devices. For example, the master-slave device 2 in the figure is dynamically selected based on the 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 situation, rather than being specified in advance.

[0044] At the physical level, wireless communication uses broadcasting to transmit messages. This means that when the master-slave device 2 sends a message, all devices within its signal coverage can receive the information. However, the software level determines which devices should process the message based on the destination address (ID number) contained in the message, while other unrelated devices will filter out the message. This mechanism enables the system to implement unicast, multicast, and broadcast functions, where unicast and multicast mean that the master-slave device 2 can direct multicast or unicast messages to the slave devices in the device group of its corresponding level.

[0045] The terminal device management system further includes: The network server connected to the gateway 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.

[0046] The adaptive multi-level wireless networking method proposed in the present invention aims to realize the automatic cascading of multi-level terminal devices through a single gateway node, thereby breaking through the transmission distance limitation and reducing the overall cost and simplifying the installation and maintenance work, avoiding the high cost and complexity caused by adding multiple gateways or fixed relay nodes. The core technology is to allow the terminal device to dynamically switch the master-slave mode according to the actual communication quality, and can be used as a common terminal or a repeater, reducing the strict requirements on the arrangement order of the devices 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 answering 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 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 failures occur, significantly improving the efficiency and reliability of large-scale terminal device management.

[0047] Embodiment 2 like Figure 2 As shown, the embodiment of the present invention also proposes an adaptive multi-level wireless communication method for a terminal device management system, comprising the steps of:

[0048] S01: Implementing wireless networking for terminal devices in the terminal device management system by using the adaptive multi-level wireless networking method described above;

[0049] S02: The gateway sends a data packet to the primary master-slave device;

[0050] 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;

[0051] 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;

[0052] 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;

[0053] 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.

[0054] S07: After receiving the sending result returned by the last-level master-slave device, the gateway ends the communication.

[0055] 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.

[0056] In detail, in the normal network communication process, the gateway first completes the wireless networking according to step S01, and then sends the data packet to the first-level master-slave device (i.e., master-slave device 1) according to step S02. After receiving the data packet, master-slave device 1 will multicast the data packet to the slave devices it manages and the next master-slave device (master-slave device 2) according to step S03, and at the same time transmit the reception status of these devices, i.e., the sending result, back to the gateway. After receiving the sending result returned by master-slave device 1, the gateway records the information and generates a new data packet forwarding request according to step S04, which contains 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 should be noted that this forwarding request only carries instructions and does not include the actual data packet to be forwarded.

[0057] Next, in steps S05 and S06, after receiving the packet forwarding request from the gateway, the master-slave device 1 will forward it to the master-slave device 2. After receiving the request, the master-slave device 2 confirms whether it is the designated target master-slave device; if so, it repeats the operation of the master-slave device 1: the data packet previously sent by the master-slave device 1 is sent to the slave device it manages and the next-level master-slave device, and the sending result is returned to the upper-level master-slave device 1. This process is progressive, and each subsequent master-slave device will perform the same operation until the data is passed to the last-level master-slave device. If the master-slave device does not manage more slave devices or the next-level master-slave devices, it means that the communication is completed. Throughout the process, the result feedback of the master-slave devices at all levels is returned to the gateway step by step through the previous master-slave devices at all levels. Finally, the gateway summarizes all the results and uploads the data to the network server for users to view. This method ensures that data transmission can be completed efficiently and reliably even in the case of complex network topology.

[0058] The adaptive multi-stage wireless communication method further comprises: Fault detection process, including the following steps:

[0059] 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;

[0060] 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;

[0061] 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. 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.

[0062] It should be noted that when there are multiple slave devices with the maximum communication quality, any slave device with the maximum communication quality is selected to replace the current faulty master-slave device. After the new master-slave device is selected, the slave device information originally managed by the faulty master-slave device is sent to the newly selected master-slave device. After receiving this information, the new master-slave device will complete the dynamic role switching and formally 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, the network communication can still maintain a high degree of reliability and stability.

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

[0064] Since the master and slave devices in this embodiment are devices with the same hardware, when a master or slave device fails, the master or slave device can be automatically switched, thereby avoiding the entire network communication failure caused by problems with the master or slave device.

[0065] 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.

[0066] It should be noted that the solution of the present invention is particularly suitable for traffic lighting scenarios, such as the deployment of tunnel lighting equipment. The distribution range of equipment in the tunnel may exceed 10 kilometers, and there are strict requirements on the communication distance. At the same time, since these devices are mainly used for lighting control, the amount of data they transmit is relatively small, and a certain delay can be tolerated. Therefore, the adaptive multi-level wireless networking method and communication method proposed in the present invention can well meet the functional requirements of the tunnel lighting system. This method realizes the automatic cascading of multi-level terminal devices through a single gateway node, which not only solves the cost and complexity problems brought about by the need for multiple gateways or fixed routing nodes in traditional solutions, but also reduces the workload of installation and maintenance. Tests show that a network consisting of 3 master-slave devices and 7 slave devices within a range of 1 kilometer can complete data synchronization within 5 seconds, proving the efficiency and reliability of the solution in practical applications.

[0067] Considering the need for large-scale equipment upgrades, the present invention also provides an optimized upgrade method to meet the challenges of firmware updates in long-distance, large-scale equipment scenarios such as tunnel lighting. The traditional upgrade method is usually a one-to-one master-slave upgrade. After each data packet is sent, the host must wait for the confirmation reply from the slave. This method is expected to take at least 11 hours to upgrade a 50KB software package for 200 devices distributed within a range of 10 kilometers. The present invention utilizes its unique communication mechanism, that is, the master and slave devices manage the slave devices in groups, thereby significantly reducing the time required for the upgrade. Specifically:

[0068] 1. The gateway first transmits the upgrade package to the first-level master-slave device. After receiving the complete upgrade package, the master-slave device will read and sequentially number each data block in the upgrade package to obtain multiple data packets with sequential numbers. It will then number them sequentially and send them to the slave devices it manages and the master-slave devices of the next level in the form of multicast.

[0069] It should be noted that a complete upgrade package usually contains multiple data packets. This is because firmware or other types of software update files are often large and cannot be transmitted through the LoRa network at one time. In order to ensure the reliability of transmission, each larger upgrade package will be divided into multiple smaller data packets for transmission. Each such data packet will be assigned a unique serial number (i.e., sequential number), which helps the receiving end to correctly assemble and verify the received data. This ensures that even if some data packets are lost or damaged, it is possible to identify which data needs to be resent.

[0070] 2. After receiving the data packet, each slave device will write it to the corresponding position of the memory according to the sequence number in the data packet. If a data packet fails to be verified or is encrypted and decrypted incorrectly, these problematic data packets will be actively discarded by the slave device, and the sequence number of the data packet will be recorded as a lost data packet. Once the master and slave devices complete the initial transmission of all data packets, they will query each slave device under their management to understand their respective packet loss situations. For any lost data packets, the master and slave devices will retransmit them one by one, but before each retransmission, the master and slave devices will check whether the number of retransmissions for the data packet exceeds the preset maximum number of retransmissions. If the number of retransmissions does not exceed the limit, the retransmission operation is performed and the number of retransmissions counted is increased by 1; if the number of retransmissions has reached or exceeded the preset value, no retransmission is attempted, but this situation is reported to the gateway as the final retransmission result. This mechanism ensures that all slave devices receive complete upgrade data as much as possible even under poor network conditions, while avoiding unnecessary repeated transmissions and improving communication efficiency.

[0071] It should be noted that due to the broadcast characteristics of LoRa technology, even if the data packet is resent in unicast form, other slave devices with the same packet loss can receive the data packet and update their own packet loss records. However, only the slave device (target slave device) that the master slave device queries for packet loss needs to respond and confirm. The other devices only update their own packet loss records when necessary without responding.

[0072] Specifically, during unicast retransmission, although only the target slave device needs to respond, other slave devices may receive these retransmitted packets. If other slave devices did lose packets with the same number before, they can also 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 report packet loss initially, they may still need to update their own packet loss records because new packets may make up for previous omissions.

[0073] In addition, the master and slave devices can check the packet loss by querying the status of the slave device. This is usually achieved by requesting the slave device to report the list of data packet numbers it has successfully received. Based on this list, the master and slave devices can compare the data packet numbers it has sent to find out which numbered data packets have not been confirmed to be received, thereby determining which data packets are lost by the slave device.

[0074] After this process is completed, the first-level master-slave device reports the upgrade result to the gateway, and then the gateway continues to request the next-level master-slave device to start upgrading the slave devices it manages through the first-level master-slave device until all devices have successfully received all data packets.

[0075] After testing, using this upgrade method, the upgrade time for a device group is about 200 seconds. Theoretically, the overall upgrade time for 200 devices can be shortened to about 1 hour, greatly improving efficiency.

[0076] In summary, the adaptive multi-level wireless communication method provided by the present invention can realize long-distance communication without the need for additional hardware facilities such as gateways. By dynamically searching for ID numbers to establish logical groups, network construction is independent of the specific location of the device and the preset ID number sequence, which simplifies the installation process and avoids strict requirements on the arrangement sequence of terminal devices. In addition, the function of dynamically selecting master and slave devices ensures that even if a master and slave device fails, the entire network communication will not be interrupted, thereby enhancing the stability and reliability of the system. The practical application based on this principle: large-scale synchronous communication and upgrade maintenance of tunnel lighting equipment shows that this solution not only improves communication performance, but also greatly reduces operation and maintenance costs, providing an effective solution for similar application scenarios.

[0077] 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 position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0078] In addition, in the present invention, descriptions such as "first", "second", "one", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0079] In the present invention, unless otherwise clearly specified and limited, the terms "connection", "fixation", etc. should be understood in a broad sense. For example, "fixation" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0080] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required 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 a terminal device that receives the query information; 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 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.

3. The adaptive multi-level wireless networking method for a terminal device management system according to claim 2, 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.

4. The adaptive multi-level wireless networking method for a terminal device management system according to claim 3, 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.

5. The adaptive multi-level wireless networking method for a terminal device management system according to claim 4, characterized in that: 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 communication quality is used to 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; 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-slave device, the set slave devices form a device group of corresponding level, and the device information of the device group is returned to the gateway, and the networking is completed.

6. 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 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.

7. An adaptive multi-level wireless communication method for a terminal device management system, characterized in that: Includes steps: S01: Implementing wireless networking of terminal devices in a terminal device management system by the adaptive multi-stage wireless networking method described in any one of claims 1 to 6; 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.

8. The adaptive multi-level wireless communication method for a terminal device management system according to claim 7, 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.

9. The adaptive multi-level wireless communication method for a terminal device management system according to claim 8, 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.

10. The adaptive multi-level wireless communication method for a terminal device management system according to claim 7, 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

  • Layered networking method based on master-slave node communication network

    CN103475524A

  • Wireless networking method and device of air conditioners

    CN106288249A

  • Networking method for electricity meter wireless data acquisition system

    CN107889185A

  • Network addressing method, device and apparatus

    CN107948339A

  • Networking method for power line communication based on asymmetric channel

    CN108964714A

Cited By

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

    WO2026179191A1