Network optimization method and apparatus, and device and storage medium
By constructing a network topology map and determining the target connection path, the problem of relay devices being unable to perceive the rationality of the network topology was solved, a stable connection between the relay devices and the server was achieved, communication reliability was improved, reliable remote control of the control valve was ensured, and the risk of environmental pollution was reduced.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- GUANGZHOU XAIRCRAFT TECH CO LTD
- Filing Date
- 2025-06-27
- Publication Date
- 2026-05-21
AI Technical Summary
During the connection process, relay devices cannot detect whether the network topology is reasonable, leading to weak network cascading and loss of connection with downstream devices, resulting in poor communication reliability. Especially in farm scenarios, this may cause control valves to fail to close in time, causing environmental pollution.
By constructing a network topology map, the target connection path between the relay device and the server is determined, and the upstream device is identified based on this path. Connection optimization commands are then sent to achieve automatic optimization of the network topology, ensuring that the relay device can stably connect to the server.
It achieves a stable connection between relay equipment and server, improves communication reliability, avoids the problems of weak network cascading and loss of connection of downstream equipment, ensures reliable remote control of control valves, and reduces the risk of environmental pollution.
Smart Images

Figure CN2025104512_21052026_PF_FP_ABST
Abstract
Description
Network optimization methods, apparatus, equipment and storage media
[0001] Cross-references to related applications
[0002] This application claims priority to Chinese patent application filed on November 14, 2024, with application number 202411621255X and entitled "Network Optimization Method, Apparatus, Device and Storage Medium", the entire contents of which are incorporated herein by reference. Technical Field
[0003] This application relates to the field of network communication technology, and in particular to a network optimization method, apparatus, device and storage medium. Background Technology
[0004] A relay device is an instrument that amplifies and forwards transmitted signals. It is positioned between a server and terminal devices to facilitate data forwarding between them. When the communication connection between the relay device and the server is unstable, other relay devices can be used to connect to the server; that is, data forwarding between the server and terminal devices can be achieved through multiple relay devices. The network topology constructed by multiple relay devices and servers is called a relay network.
[0005] Currently, after setting up a relay network, relay devices rely on reconnection functionality to maintain network connectivity. This means that when a relay device detects a lack of internet access, it will reconnect to another relay device or server with a stronger signal. However, when connecting to other relay devices or servers, relay devices cannot detect whether the network topology is optimal, potentially leading to weak network cascading issues (i.e., the newly connected upstream device also has a weak network connection). Furthermore, inefficient network topology connections and configurations cannot be automatically optimized, causing downstream devices to easily lose connection. Therefore, the current network connection method cannot guarantee a stable connection between servers and terminal devices, resulting in poor communication reliability.
[0006] In a farm setting, the control valves of the irrigation and fertilization system are connected to a server via a relay device to access the internet. If the relay device's network is not working properly, the control valves will not be able to be controlled remotely. One possible scenario is that the control valves during irrigation cannot be closed in time, resulting in excessive pesticides being applied to the farmland and causing environmental pollution. Summary of the Invention
[0007] This application provides a network optimization method, apparatus, device, and storage medium to determine the target connection path between the relay devices and the server through a network topology diagram between the server and each relay device, and to determine the upstream device of the relay device based on the target connection path, so that the relay device can stably connect to the server through the upstream device, thereby realizing automatic optimization of the network topology. This can solve the problems of weak network cascading and downstream device disconnection that are prone to occur when connecting networks in related technologies, ensure a stable connection between the server and terminal devices, and improve communication reliability.
[0008] In a first aspect, this application provides a network optimization method, comprising: constructing a network topology map based on first scan results of multiple relay devices, wherein the first scan results include the signal strength of relay devices or servers scanned by the corresponding relay devices; determining a target connection path between each relay device and the server based on the network topology map; determining an upstream device of the corresponding relay device based on the target connection path; and sending a connection optimization instruction to the corresponding relay device according to the upstream device of the relay device, so that the relay device connects to the corresponding upstream device based on the connection optimization instruction.
[0009] Secondly, this application provides a network optimization apparatus, comprising: a topology map construction module configured to construct a network topology map based on a first scan result of multiple relay devices, wherein the first scan result includes the signal strength of the relay devices or servers scanned by the corresponding relay devices; an upstream device determination module configured to determine a target connection path between each relay device and the server based on the network topology map, and to determine the upstream device of the corresponding relay device based on the target connection path; and a connection optimization module configured to send a connection optimization instruction to the corresponding relay device based on the upstream device of the relay device, so that the relay device connects to the corresponding upstream device based on the connection optimization instruction.
[0010] Thirdly, this application provides a network optimization device, comprising: one or more processors; and a storage device storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the network optimization method as described in any embodiment of the first aspect.
[0011] Fourthly, this application provides a storage medium containing computer-executable instructions that, when executed by a computer processor, implement the network optimization method as described in any embodiment of the first aspect.
[0012] In this application, a network topology map is constructed by scanning the signal strength of multiple relay devices or servers. This network topology map characterizes the available connections and reliability between the server and each relay device. The target connection path from the relay device to the server is determined using the network topology map. This target connection path can be considered a stable and reliable network connection structure when the relay device connects to the server. Based on the target connection path, the upstream device to be connected by the relay device can be determined. A connection optimization command is sent to the relay device to enable it to connect to the corresponding upstream device. After each relay device connects to its corresponding upstream device, the optimal network topology formed between the relay devices and the server achieves automatic and reasonable optimization of the network topology, ensuring a stable and reliable network connection between each relay device and the server, avoiding weak network cascading and downstream device disconnection problems, and improving the communication reliability between the server and terminal devices.
[0013] In a farm setting, the network optimization method provided in this application can improve the communication reliability between the control valve and the server in the irrigation and fertilization system, thereby reducing the risk of the control valve being unable to be remotely controlled due to network connectivity issues, which could lead to the control valve failing to close in time and causing environmental pollution due to over-irrigation. Attached Figure Description
[0014] Figure 1 is a flowchart of a network optimization method provided in an embodiment of this application;
[0015] Figure 2 is a schematic diagram of the network structure of the server and relay device before optimization provided in the embodiment of this application;
[0016] Figure 3 is a flowchart of constructing a network topology diagram provided in an embodiment of this application;
[0017] Figure 4 is one of the schematic diagrams of the network topology provided in the embodiments of this application;
[0018] Figure 5 is a schematic diagram of the mapping relationship between signal strength and attenuation ratio coefficient provided in the application embodiment;
[0019] Figure 6 is a second schematic diagram of the network topology provided in the embodiments of this application;
[0020] Figure 7 is a flowchart of determining the target connection path provided in an embodiment of this application;
[0021] Figure 8 is a schematic diagram of the optimized network structure of the server and relay device provided in an embodiment of this application;
[0022] Figure 9 is a flowchart of the channel of the optimized relay device provided in an embodiment of this application;
[0023] Figure 10 is a flowchart of determining the optimal channel for each relay device according to an embodiment of this application;
[0024] Figure 11 is a schematic diagram of the structure of a network optimization device provided in an embodiment of this application;
[0025] Figure 12 is a schematic diagram of the structure of a network optimization device provided in one embodiment of this application. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. It should also be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. A process can be terminated when its operation is completed, but it may also have additional steps not included in the drawings. A process can correspond to a method, function, procedure, subroutine, subroutine, etc.
[0027] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0028] In existing implementations, after establishing a relay network, relay devices rely on reconnection functionality to maintain network connectivity. This means that when a relay device detects a lack of internet access, it reconnects to another relay device or server with a stronger signal. However, when connecting to other relay devices or servers, relay devices cannot detect whether the network topology is optimal, potentially leading to weak network cascading issues. Furthermore, inefficient network topology connections and configurations cannot be automatically optimized, making downstream devices prone to disconnection. In addition, the channels used by relay devices and servers are randomly configured, leading to situations where nearby relay devices use the same channel for data transmission. This can cause signal interference, affecting data transmission stability. Therefore, existing network connection methods cannot guarantee stable network connections and data transmission between servers and terminal devices, resulting in poor communication reliability.
[0029] To address the problems existing in the above-mentioned implementation methods, this application provides a network optimization method. This method determines the target connection path between the relay devices and the server based on the network topology diagram between the server and each relay device. Based on the target connection path, it determines the upstream device of the relay device, enabling the relay device to stably connect to the server through the upstream device. This achieves automatic optimization of the network topology, avoiding weak network cascading and downstream device disconnection problems, ensuring the stability of the network connection between the server and terminal devices, and improving communication reliability. By determining the optimal channel for each relay device, it avoids relay devices that are close to each other using channels that interfere with each other, ensuring the stability of data transmission between the server and terminal devices, and further improving communication reliability.
[0030] The network optimization method provided in this application embodiment can be executed by a network optimization device, which can be implemented by software and / or hardware. The network optimization device can consist of two or more physical entities, or it can consist of a single physical entity. For example, the network optimization device can be a server, or it can be the server's processor. Alternatively, the network optimization device can also be a network system composed of a server and multiple relay devices, where the network system implements the network optimization method through the cooperation of the server and relay devices. The network system can also include terminal devices, which establish a network connection with the server through relay devices.
[0031] The network optimization device is equipped with at least one type of operating system. Based on this operating system, the device can install at least one application. This application can be a built-in application of the operating system or an application downloaded from a third-party device or server. In this embodiment, the network optimization device has at least one application capable of executing network optimization methods.
[0032] For ease of understanding, this application describes the embodiment using a server as the main body for executing the network optimization method.
[0033] Figure 1 is a flowchart of a network optimization method provided in one embodiment of this application. Referring to Figure 1, the network optimization method specifically includes:
[0034] In step S110, a network topology map is constructed based on the first scan results of multiple relay devices. The first scan results include the signal strength of the relay devices or servers scanned by the corresponding relay devices.
[0035] For example, the first scan result is generated when the corresponding relay device scans for wireless signals broadcast by surrounding relay devices or servers. For example, a server and multiple relay devices broadcast wireless signals to the surrounding area. Relay devices or servers within the broadcast range of the wireless signals can search for the wireless signals, thereby obtaining the signal strength of the wireless signals and the device information broadcasting the wireless signals. The first scan result is generated based on the signal strength of the scanned wireless signals and the device information broadcasting the wireless signals.
[0036] For example, the wireless signal can be a hotspot signal. A relay device can scan for hotspot signals broadcast by surrounding relay devices or servers, determine the signal strength of the hotspot signal and the relay device or server broadcasting it based on the scanned hotspot signal, and thus generate a first scan result. For example, a relay device in site mode actively scans for hotspot signals, while other relay devices and servers in wireless access point mode broadcast hotspot signals. When a relay device in site mode scans a hotspot signal, it determines the signal strength and parses the device information carried by the hotspot signal. The device information and signal strength are associated and stored in the first scan result. The device information may include the device identifier of the relay device or server broadcasting the corresponding hotspot signal. This device identifier can be an SSID (Service Set Identifier) and / or a BSSID (Basic Service Set Identifier). The device information may also include information such as the channel and network security type used by the relay device or server.
[0037] After generating the first scan result, the relay device transmits the first scan result to the server. The server generates a network topology map based on the first scan results transmitted by each relay device, and automatically optimizes the network structure between the relay devices and the server based on the network topology map.
[0038] For example, network structure optimization can affect communication connections between the server and terminal devices; therefore, network structure optimization is not performed while the server and terminal devices are communicating. To address this, the server optimizes the network structure at specific times. For instance, the server may optimize the network structure between multiple relay devices and the server during initialization or before data transmission with the terminal devices. This network structure optimization is based on the first scan results transmitted by the relay devices. The relay devices may scan for wireless signals broadcast by surrounding relay devices or the server at pre-set specific times to generate the first scan result, which is then transmitted to the server so that the server can optimize the network structure based on this result.
[0039] Since the server optimizes the network structure at unpredictable times, the implementation method of relay devices scanning surrounding devices based on preset time nodes has low applicability. Therefore, the server can send scanning commands to the relay devices to control them in generating a first scan result. Specifically, the process involves sending scanning commands to multiple relay devices, each scanning the wireless signals of surrounding relay devices or the server, generating a first scan result based on the signal strength of the scanned wireless signals and the device information they carry, and sending this result to the server; and receiving the first scan results from each relay device. For example, each relay device is currently connected to the server via a network connection, either directly or indirectly. The server sends scanning commands to each relay device through this network connection. Upon receiving the scanning command, the relay device scans the wireless signals broadcast by surrounding relay devices or the server, and associates and stores the signal strength of the scanned wireless signals and the device information they carry in the first scan result. The relay device then sends the first scan result to the server through its network connection, and the server receives the first scan result generated by the relay device.
[0040] For example, before the server performs network structure optimization, the server maintains network connections with each relay device. However, the current network structure is not optimal. Therefore, the server needs to optimize the current network structure based on the first scan results generated by each relay device to ensure a stable and reliable network connection between the server and the terminal device through each relay device. For example, Figure 2 is a schematic diagram of the network structure of the server and relay devices before optimization provided in an embodiment of this application. As shown in Figure 2, relay devices A, B, and C are directly connected to the server; relay devices D and E are connected to the server through relay device A; relay device F is connected to the server through relay device C; and relay device G is connected to the server through relay devices F and C. When a relay device connects to the server through other relay devices, the scan command issued by the server will be sent to the corresponding relay device through other intermediate relay devices. For example, the scan command sent by the server to relay device G is forwarded by relay devices C and F. Similarly, the first scan result uploaded by the relay device will be sent to the server through other intermediate relay devices. For example, the first scan result sent to the server by relay device E will be forwarded by relay device A.
[0041] Furthermore, when the server and relay devices connect via a Wi-Fi hotspot, the relay devices cannot simultaneously operate in both wireless access point mode (scanning hotspot signals) and site mode (broadcasting hotspot signals). To address this, the server can send a scan command to one relay device and a broadcast command to other relay devices, causing the receiving relay device to switch to wireless access point mode and the receiving relay device to switch to site mode. A relay device in wireless access point mode can scan for hotspot signals broadcast by nearby relay devices in site mode or by the server, generating a first scan result based on the signal strength and device information of the scanned hotspot signal, and sending this first scan result to the server. After receiving the first scan result from one relay device, the server continues to send scan commands to the next relay device and broadcast commands to other relay devices, thus collecting the first scan results from those relay devices. After receiving the first scan results from all relay devices, the server stops sending scan commands and instead optimizes the network structure based on the first scan results. For example, referring to Figure 2, when the server sends a scan command to relay device A, it also sends a broadcast command to the other relay devices. Upon receiving the scan command, relay device A switches to wireless access point mode to scan for hotspot signals, while the other relay devices switch to site mode to broadcast hotspot signals. Assuming a relay device scans for hotspot signals from the server, relay device B, relay device D, and relay device E, it generates a first scan result containing the signal strength of the hotspot signals from these devices and the device information carried by those signals. This first scan result is then uploaded to the server. After receiving the first scan result from relay device A, the server sends a scan command to relay device B and broadcast commands to the other relay devices. It can then receive the first scan result from relay device B. This process continues, allowing the server to obtain the first scan results from all relay devices connected to the network.
[0042] For example, the server can detect whether preset optimization conditions are met at the current moment; if the preset optimization conditions are met at the current moment, it sends scanning instructions to multiple relay devices. Here, optimization conditions can be understood as the conditions that the server must meet to perform network optimization. As can be seen from the above, the network structure optimization process can affect the communication transmission between the terminal device and the server. Therefore, before performing network structure optimization, the server determines whether the preset optimization conditions are met at the current moment. If the optimization conditions are met at the current moment, it sends scanning instructions to multiple relay devices to perform the network structure optimization process based on the first scan results generated by the multiple relay devices. If the optimization conditions are not met at the current moment, it does not send scanning instructions to the multiple relay devices, that is, it does not perform the network structure optimization process. This embodiment avoids the optimization process affecting the communication transmission between the terminal device and the server by sending scanning instructions to the relay devices only when the optimization conditions are met.
[0043] For example, the optimization conditions include the terminal device connected to the server being in an unused network state, and / or the current time not being within a preset device wake-up time period. Here, the terminal device refers to an Internet of Things (IoT) device that does not amplify and forward transmitted signals; for example, in a farm scenario, the terminal device could be a control valve of an irrigation and fertilization system. An unused network state can be considered as the terminal device not communicating with the server. The device wake-up time period can be considered as the time period during which the terminal device communicates with the server. It can be understood that when the terminal device is in a used network state and / or the current time is within the preset device wake-up time period, it indicates that the terminal device is currently communicating with the server. To avoid the optimization process affecting the communication between the terminal device and the server, the current time is determined not to meet the optimization conditions. When the terminal device is in an unused network state and / or the current time is not within the preset device wake-up time period, it indicates that the terminal device is not communicating with the server. Therefore, the server's optimization process does not affect the normal use of the terminal device, and the current time is determined to meet the optimization conditions.
[0044] For example, when a terminal device is in a network-using state, it will exchange data with the server or maintain a network connection with the server. Therefore, the server can determine whether the terminal device is in a network-unusing state or a network-using state based on the connection relationship or data transmission relationship with the terminal device.
[0045] Furthermore, if the preset optimization conditions are not met at the current time, the server can re-determine whether the preset optimization conditions are met at the corresponding time after a preset interval, so as to send scanning instructions to each relay device when the preset optimization conditions are met.
[0046] In some cases, not all relay devices possess the capability for automatic network optimization. This means some relay devices may be unable to respond to scan commands and generate and send initial scan results. For these relay devices, the server can withhold scan commands to save command transmission time and improve network optimization efficiency. Specifically, the automatic network optimization function of relay devices is implemented through firmware OTA (Over-The-Air). Before sending scan commands, the server can send a firmware OTA information query request to each relay device to check whether its firmware OTA version has been upgraded to support automatic network optimization. If a relay device's firmware OTA does not support automatic network optimization, a scan command will not be sent to that device; if it does support automatic network optimization, then a scan command will be sent to that device.
[0047] After sending scan commands to each relay device, the server receives the first scan results from each relay device. The server can then parse the associated signal strength and device information from these results. Based on the device information, it can determine which relay device or server is responsible for the corresponding signal strength. For example, referring to Figure 2, the server parses the device identifier B associated with signal strength B from the first scan result A returned by relay device A. Since device identifier B is the device identifier of relay device B, the server determines that signal strength B is the signal strength of the wireless signal broadcast by device identifier B, which relay device A has scanned. When relay device A detects the wireless signal of relay device B, it indicates that a wireless communication connection can be established between relay device A and relay device B. The signal strength of the wireless signal characterizes the reliability of the connection between relay device A and relay device B; that is, the higher the signal strength, the more reliable the connection between relay device A and relay device B. In response, the server can construct a network topology map based on the signal strength of the wireless signals transmitted between each relay device and the server. This network topology map can characterize the available connections and connection reliability between the server and each relay device, thereby optimizing the network structure between the server and each relay device.
[0048] For example, Figure 3 is a flowchart of constructing a network topology diagram according to an embodiment of this application. As shown in Figure 3, the steps of constructing the network topology diagram specifically include steps S1101-S1102:
[0049] In step S1101, the server and multiple relay devices are configured as nodes in the network topology diagram.
[0050] For example, the server configures itself and multiple correspondingly connected relay devices as nodes in the network topology diagram, that is, the server corresponds to one node, and each relay device corresponds to one node. Referring to Figure 2, when the server corresponds to relay devices A, B, C, D, E, F, and G, eight nodes can be generated. For example, Figure 4 is a schematic diagram of a network topology diagram provided in an embodiment of this application. As shown in Figure 4, relay devices A, B, C, D, E, F, and G correspond to nodes A, B, C, D, E, F, and G, respectively, and the server corresponds to node O.
[0051] In step S1102, a connection line is established between the corresponding node and the node of the scanned relay device or server based on the first scan result of the relay device, and the value of the corresponding connection line is determined based on the signal strength.
[0052] Referring to Figure 4, when relay device A scans for wireless signals broadcast by server, relay device B, and relay device D, relay device A can record the signal strength of the corresponding wireless signals broadcast by server, relay device B, and relay device D, as well as the device identifiers of server, relay device B, and relay device D, in the first scan result. After obtaining the device identifiers of server, relay device B, and relay device D from the first scan result of relay device A, the server can establish connections between node A and nodes B, O, and D respectively. Then, the signal strengths associated with the device identifiers of server, relay device B, and relay device D in the first scan result are used as the values for the connection lines between the corresponding nodes. For example, if the signal strengths associated with the device identifiers of server, relay device B, and relay device D in the first scan result of relay device A are -58, -56, and -57 respectively, then -58 is used as the value for the connection line between node O and node A, -56 is used as the value for the connection line between node A and node B, and -57 is used as the value for the connection line between node D and node A. Similarly, the server can establish a connection between the corresponding relay device and the scanned relay device or server based on the first scan result transmitted by each relay device, and determine the value of the connection.
[0053] For example, two relay devices can scan each other. After the server establishes a connection between the two relay devices based on the first scan result of one of the relay devices and determines the connection value, when subsequently establishing a connection based on the first scan result of the other relay device, the step of establishing a connection between the two relay devices can be omitted, avoiding the need to repeatedly establish a connection between the two nodes. Moreover, the signal strengths of the wireless signals scanned by the two mutually scanned relay devices are roughly the same, and the average of one or both can be taken as the connection value.
[0054] For example, signal strength sometimes fails to reflect actual communication performance. In the -40°C range, signal strength has little impact on communication effectiveness, while in the range below -70°C, the correlation between signal strength and communication effectiveness is stronger. To measure actual communication effectiveness, signal strength can be converted into an attenuation ratio coefficient. This coefficient can then be used as the value of the connection line between two nodes, accurately characterizing the communication performance of the two nodes in practical applications and providing a more reliable basis for network optimization. The specific implementation process is as follows: Based on a preset mapping relationship, the signal strength between the relay device and the corresponding scanned relay device or server is converted into an attenuation ratio coefficient; this coefficient is then determined as the value of the connection line between the relay device and the corresponding scanned relay device or server, and the attenuation ratio coefficient is greater than zero and less than one.
[0055] For example, Figure 5 is a schematic diagram of the mapping relationship between signal strength and attenuation ratio coefficient provided in the application embodiment. As shown in Figure 5, the mapping relationship between signal strength and attenuation ratio coefficient is a piecewise linear function relationship, that is, different linear functions correspond to signal strength ranges of 0 to -20, -20 to -40, -40 to -60, -60 to -80, and -80 to -100. Among them, the actual communication effect of the signal strength range of -60 to -80 is the best, so the slope of the linear function corresponding to this signal strength range is the largest. The mapping relationship between signal strength and attenuation ratio coefficient can be obtained in advance through communication testing. When the server converts the signal strength into the attenuation ratio coefficient, it can obtain the corresponding linear function based on the signal strength range in which the signal strength is located, and substitute the signal strength into the linear function to obtain the attenuation ratio coefficient. Referring to Figure 5, the attenuation ratio coefficient ranges from 0 to 1. The attenuation ratio coefficient for the signal strength range of -60 to -80 is approximately between 0.3 and 0.9, while the attenuation ratio coefficient for the signal strength range of -40 to -60 is approximately between 0.18 and 0.3. Therefore, the signal strength difference between these two signal strength ranges is not significant, but converting it to an attenuation ratio coefficient will amplify the difference between the two signal strength ranges to better reflect the actual communication effect of the two signal strength ranges, ensuring that the constructed network topology diagram more intuitively reflects the stability of the actual communication between each node.
[0056] The mapping diagram shown in Figure 5 roughly determines the linear function corresponding to the signal strength range of -60 to -80 as y = 0.03*x - 1.5, and the linear function corresponding to the signal strength range of -40 to -60 as y = 0.006*x - 0.06, where y and x are the attenuation ratio coefficient and the signal strength, respectively. The signal strengths between the nodes shown in Figure 4 fall within these two signal strength ranges. The corresponding attenuation ratio coefficient can be calculated by substituting the signal strength between each node into the corresponding linear function of the range, and this attenuation ratio coefficient can be used as the value of the connection line between the corresponding nodes. Finally, the network topology diagram shown in Figure 4 can be converted into the network topology diagram shown in Figure 6. Figure 6 is a schematic diagram of the network topology diagram provided in the embodiments of this application. As shown in Figure 6, the values on the connection lines between the nodes in the network topology diagram are the attenuation ratio coefficients converted from the signal strength, which allows for a more intuitive confirmation of the stability of actual communication between the nodes. This embodiment converts signal strength into attenuation ratio coefficients through a pre-determined mapping relationship. These attenuation ratio coefficients are then used as the values of the connection lines between corresponding nodes in the network topology diagram. This allows the network topology diagram to more accurately represent the communication quality between each relay device and the server, providing a more reliable basis for accurately determining the target connection path between the relay device and the server.
[0057] In step S120, the target connection path between each relay device and the server is determined according to the network topology diagram, and the upstream device of the corresponding relay device is determined according to the target connection path.
[0058] For example, the target connection path can be viewed as a stable and reliable network connection structure when a relay device connects to a server, with the upstream device being the device located at the node above the relay device in the target connection path. It is understood that when a relay device connects to a server through the target connection path, it can maintain a relatively stable and reliable network connection with the server, allowing the next-level terminal device to reliably transmit data to the server through the relay device, thus achieving a stable connection between the server and the end terminal devices. Since the connection paths from the nodes in the target connection path to the server are all target connection paths for their respective nodes, a relay device only needs to connect to the device located at the node above it in the target connection path—that is, connect to the upstream device—to establish a stable and reliable network connection structure between itself and the server.
[0059] For example, the optimal connection path for relay devices can be searched in the network topology graph using a shortest path algorithm, and this optimal connection path can be used as the target connection path for the relay devices. The optimal connection path can be considered as the most stable and reliable network connection structure when the relay devices connect to the server. Referring to Figure 4 or Figure 6, the network topology graph visually shows the available connections and connection reliability between the server and each relay device. Based on the connection lines between nodes in the network topology graph and the values of these connection lines, the server can determine the shortest connection path from the relay devices to the server as the target connection path. For example, relay device A can connect to a server, relay device B, and relay device D. The network connection between relay device A and the server can be a direct connection to the server, a connection through relay device B, or a connection through both relay device D and relay device B. Since the connection path is shortest when relay device A directly connects to the server, this connection path can be determined as the target connection path. Therefore, the device located at the node above relay device A in the target connection path is taken as its superior device, i.e., the server is taken as the superior device of relay device A, so that relay device A can directly connect to the server in the future.
[0060] For example, the total number of connection routes between the relay device and the server can also be calculated using a network topology diagram, and the target connection path of the relay device can be determined based on the total number. Figure 7 is a flowchart of determining the target connection path provided in an embodiment of this application. As shown in Figure 7, the steps for determining the target connection path specifically include steps S1201-S1202:
[0061] In step S1201, at least one connection path between the relay device and the server is determined based on the network topology diagram.
[0062] For example, based on the node corresponding to the relay device in the network topology diagram, all connection paths between that node and the corresponding node of the server are determined. To avoid invalid delays in the length of connection paths, connection paths will not repeatedly pass through the same node. Since the more nodes a connection path passes through, the more unstable the communication connection between the server and the relay device becomes, the number of nodes passed through each connection path can be determined, and a minimum number of nodes included in a connection path can be determined. When the difference between the number of nodes in a connection path and the minimum number of nodes exceeds a preset threshold, it indicates that the connection path passes through too many nodes, and the communication connection is unstable, thus the connection path is eliminated. Afterwards, the server can determine the target connection path for the relay device from the remaining connection paths.
[0063] For example, referring to Figure 6, the connection paths between relay device A and the server include: Relay device A - Server, Relay device A - Relay device B - Server, Relay device A - Relay device D - Relay device B - Server, Relay device A - Relay device D - Relay device B - Relay device C - Server, etc. The minimum number of nodes for the connection path corresponding to Relay device A - Server is two. Assuming a preset threshold of 2, if the connection path from Relay device A to the server passes through more than five nodes, that connection path is deleted, and only the following connection paths are retained: Relay device A - Server, Relay device A - Relay device B - Server, and Relay device A - Relay device D - Relay device B - Server.
[0064] In step S1202, the total value of the corresponding connection path is calculated based on the value of the connection line on the connection path, and the target connection path of the relay device is determined based on the total value of the connection path.
[0065] For example, the server accumulates the values of the connection lines on the connection path to obtain the total value of the connection path. The smaller the total value, the shorter the connection path, which means the network connection between the server and the relay device is more stable and reliable. Therefore, the connection path with the smallest total value or a relatively small total value can be determined as the target connection path of the relay device. For example, referring to Figure 6, the connection path from relay device D to the server includes relay device D-relay device A-server and relay device D-relay device B-server. The total values of these two connection paths are calculated to be 0.57 and 1.02 respectively. Since 1.02 > 0.57, the connection path of relay device D-relay device A-server is determined as the target connection path of relay device D.
[0066] This embodiment calculates the total value of each connection path between the relay device and the server to accurately determine the stable and reliable connection path between the relay device and the server. This enables precise determination of the target connection path for the relay device, allowing the relay device to achieve a stable connection with the server through the target connection path. This ensures that the downstream terminal devices of the relay device can maintain stable and reliable data communication with the server through the relay device and the target connection path.
[0067] After determining the target connection path of the relay devices, the server designates the relay device located at the next node in the target connection path as the superior device. For example, if the target connection path of relay device D is relay device D-relay device A-server, then relay device A is designated as the superior device of relay device D, allowing relay device D to indirectly connect to the server via relay device A.
[0068] In step S130, a connection optimization command is sent from the upstream device of the relay device to the corresponding relay device, so that the relay device can connect to the corresponding upstream device based on the connection optimization command.
[0069] For example, when the upstream device of relay device D is relay device A, the server can generate a connection optimization command based on the device identifier of relay device B and send the connection optimization command to relay device D, so that relay device D can establish a wireless communication connection with relay device A based on the device identifier in the connection optimization command. Referring to Figure 2, before relay device D is connected to the upstream device, it establishes a wireless communication connection through relay device B. The server sends the connection optimization command to relay device D through relay device B. Based on the connection optimization command, relay device D switches the corresponding connected relay device from relay device B to relay device A, thereby optimizing the network connection structure between relay device D and the server.
[0070] For example, Figure 8 is a schematic diagram of the optimized network structure of the server and relay devices provided in the embodiments of this application. As shown in the network topology diagram in Figure 6, the upstream device of relay device G is relay device E, the upstream device of relay device E is relay device B, the upstream device of relay device F is relay device B, the upstream device of relay device D is relay device A, and the upstream devices of relay devices A, B, and C are servers. After the relay devices are connected to their corresponding upstream devices, the network structure shown in Figure 8 is obtained. At this time, the network structure shown in Figure 8 is the current optimal network structure.
[0071] For example, when generating the first scan result, the relay device can add the device identifier of the currently connected relay device or server to the first scan result. After determining the upstream device of the relay device, the server can compare the device identifier of the relay device or server currently connected to the relay device in the first scan result with the device identifier of the upstream device. If the device identifiers are the same, it is determined that the relay device is currently connected to the upstream device, that is, the relay device currently maintains the optimal network connection structure with the server, and no connection optimization command is sent to the relay device. If the device identifiers are different, it is determined that the relay device is not connected to the upstream device, that is, the relay device currently does not maintain the optimal network connection structure with the server, and a connection optimization command is sent to the relay device to optimize the network connection structure between the relay device and the server. For example, if the server determines that the upstream device of relay device E is relay device B, and relay device E is currently connected to relay device B, no connection optimization command is sent to relay device E.
[0072] The relay device establishes a wireless communication connection with the corresponding upstream device based on the connection optimization command. If the connection fails midway, it can reconnect to the upstream device after a certain period of time. If the connection fails again, it connects to the previous relay device and sends the connection failure result back to the server through the previously connected relay device, so that the server can re-determine the upstream device of the relay device or determine whether there is an abnormal problem with the upstream device.
[0073] In one embodiment, the server can also optimize the optimal channel for each relay device, enabling relay devices that are close to each other to transmit data using channels with minimal mutual interference, thereby improving the reliability of data transmission. For example, Figure 9 is a flowchart of optimizing the channel of relay devices according to an embodiment of this application. As shown in Figure 9, the steps for optimizing the channel of relay devices specifically include S210-S220:
[0074] In step S210, the optimal channel for each relay device is determined.
[0075] For example, after obtaining the first scan result of the relay device, the server can determine the relay devices that are close to the relay device based on the first scan result, and allocate two channels with minimal mutual interference to the two close relay devices. The greater the signal strength between the two relay devices, the smaller the distance between them; thus, it can be determined that the relay device with the strongest signal strength in the first scan result is close to the relay device.
[0076] For example, in order to allocate the optimal channel for each relay device in an orderly manner, the corresponding relay devices can be allocated sequentially according to the order of proximity between each relay device and the server. For example, Figure 10 is a flowchart of determining the optimal channel for each relay device according to an embodiment of this application. As shown in Figure 10, the step of determining the optimal channel for each relay device specifically includes steps S2101-S2102:
[0077] In step S2101, the signal strength between the server and each relay device is determined based on the second scan result of the server or the first scan result of each relay device. The second scan result includes the signal strength of the relay devices scanned by the server.
[0078] For example, when the server determines that the preset optimization conditions are met at the current moment, it sends a broadcast command to each relay device to enable each relay device to broadcast a wireless signal. After scanning the wireless signal, the server obtains the device information carried by the wireless signal, associates the signal strength of the wireless signal with the corresponding device information, and saves the association to generate a second scan result. Then, it sequentially sends scan commands to each relay device to obtain the first scan result from each relay device.
[0079] The server can obtain the signal strength between itself and each relay device based on the second scan result. When the server scans a relay device, the relay device can also scan the server. In this case, the first scan result of the relay device records the signal strength between itself and the server. The server can obtain the signal strength between itself and the corresponding relay device from the first scan results of each relay device.
[0080] In step S2102, the optimal channel for each relay device is determined sequentially based on the order of signal strength between each relay device and the server from largest to smallest.
[0081] Referring to Figure 4, assuming the signal strength between the multiple relay devices and the server shown in Figure 4, from strongest to weakest, is relay device A, relay device B, relay device C, relay device D, relay device E, relay device F, and relay device G, then the optimal channels are assigned to relay devices A, B, C, D, E, F, and G in that order. When assigning the optimal channel, first, relay device A is assigned the channel with the least interference corresponding to the server. Next, among relay device A and the server, the device closest to relay device B is determined, and relay device B is assigned the channel with the least interference corresponding to that closest device. In other words, each relay device will determine the closest device among the devices already assigned a channel and assign the corresponding relay device the channel with the least interference corresponding to that closest device, until the optimal channel for each relay device is determined. This embodiment can allocate the optimal channel to each relay device in descending order of signal strength between each relay device and the server, thereby achieving orderly channel allocation. This avoids assigning the same channel or channels with significant mutual interference to relay devices that are close to each other during the allocation process, improving channel allocation efficiency while ensuring the optimization effect of channel configuration.
[0082] For example, when the server and various relay devices communicate via 2.4G Wi-Fi, the 2.4G Wi-Fi is configured with 11 channels. Three channels with minimal mutual interference can be selected from these 11 channels. These three channels with minimal mutual interference are then allocated to each relay device and the server to minimize channel interference between them. The specific implementation steps include steps S21021-S21022:
[0083] In step S21021, the relay devices are sorted and a relay device list is generated based on the order of signal strength between each relay device and the server from largest to smallest.
[0084] For example, assuming that the signal strength between the multiple relay devices and the server shown in Figure 4 is in descending order as relay device A, relay device B, relay device C, relay device D, relay device E, relay device F, and relay device G, the server will sort relay devices A, B, C, D, E, F, and G from top to bottom to obtain a relay device list.
[0085] In step S21022, three target channels are acquired from multiple preset channels, and the mutual interference between the three target channels is minimized.
[0086] For example, the channels corresponding to 2.4G WIFI include channels 1 to 11. Among them, the closer the channel number is, the greater the interference between them. Therefore, the mutual interference between channels 1, 6 and 11 is the least, and channels 1, 6 and 11 can be selected as target channels.
[0087] In step S21023, the relay device list is traversed, and the optimal channel for each relay device is determined among the three target channels.
[0088] For example, the optimal channel for each relay device is determined sequentially from top to bottom according to the order of the relay device list. When determining the optimal channel for each relay device, the optimal channel for the relay device is determined from channels 1, 6, and 11.
[0089] For example, any one of the three target channels is determined as the optimal channel of the server, and the remaining two are determined as the optimal channels of the two top-ranked relay devices in the relay device list; the relay device that ranks first in the relay device list and has not been assigned a channel is determined as the target relay device, which is the relay device currently waiting to be assigned a channel; two neighboring devices of the target relay device are determined from the first device, which is either the server or the relay device that has been assigned a channel; the target channel that is not included in the optimal channel of the two neighboring devices is determined as the optimal channel of the target relay device.
[0090] This embodiment describes the process using relay devices A, B, C, D, E, F, and G from a list of relay devices, ordered from top to bottom. Channel 1, 6, and 11 are determined as the optimal channel for the server. Alternatively, if the server's current channel is one of these channels, it remains the optimal channel. If channel 1 is the optimal channel for the server, then channels 6 and 11 are determined as the optimal channels for relay devices A and B, respectively. Next, relay device C is designated as the target relay device, and the server, relay device A, and relay device B are identified as the first devices corresponding to relay device C. Among the server, relay device A, and relay device B, the two devices closest to relay device C are identified as its neighboring devices. The stronger the signal strength between the relay device and the first device, the closer the relay device is to the first device. Based on the first scan result of the target relay device, two first devices that are closer to the target relay device can be identified from among the multiple first devices corresponding to the target relay device. As shown in Figure 4, relay device B and the server are closer to relay device C. Therefore, the server and relay device B are determined to be neighboring devices of relay device C. The optimal channel for the server is channel 1, and the optimal channel for relay device B is channel 11. Thus, the optimal channel for relay device C is determined to be channel 6.
[0091] Then, relay device D is selected as the target relay device, and the server, relay devices A, B, and C are identified as the first devices corresponding to relay device D. The neighboring devices of relay device D are then determined from among these first devices. As shown in Figure 4, the neighboring devices of relay device D are relay devices A and B. Therefore, the optimal channel for relay device D is determined to be channel 1. Similarly, the optimal channels for relay devices E, F, and G can be determined one by one.
[0092] For example, although Figure 4 shows that the closest devices to relay device D are relay devices A and E, relay device E cannot be the first device of relay device D because it has not yet been assigned an optimal channel. Therefore, relay device B is determined to be one of the neighboring devices of relay device D. Even so, relay device D and its correspondingly closest relay device E will not be assigned the same target channel because relay device E will subsequently determine relay device D as one of its neighboring devices. Therefore, even if the neighboring device corresponding to the target relay device is not actually the closest device, the target relay device will still use a different target channel than the closest device, ensuring that neighboring relay devices use the channel with minimal mutual interference. This embodiment determines two relatively close neighboring devices among the first devices corresponding to the target relay device, thereby assigning the target relay device a different target channel than its neighboring devices. This avoids mutual interference between the target relay device and the target channels used by neighboring devices when transmitting on the target channel, improving the data transmission reliability of each relay device.
[0093] For example, when determining two neighboring devices of a target relay device, each first device can be sorted based on its signal strength relative to the target relay device, and the two first devices ranked higher can be designated as second devices. If the optimal channels of the two second devices are different, the two second devices are designated as neighboring devices of the target relay device. If the optimal channels of the two second devices are the same, the second device with the larger signal strength is designated as the first neighboring device of the target relay device, and among the remaining first devices, the first device ranked higher and whose optimal channel is different from that of the first neighboring device is designated as the second neighboring device of the target relay device.
[0094] For example, when relay device E is the target relay device, the server, relay device A, relay device B, relay device C, and relay device D are identified as first devices. Based on the first scan result of relay device E, the signal strength of relay device E and these first devices, from strongest to weakest, is confirmed as: relay device B, relay device D, relay device C, relay device A, and server. Since relay device E did not scan relay device A and the server, they are listed last. Relay devices B and D are designated as second devices. The optimal channels for relay devices B and D are channel 11 and channel 1, respectively. Therefore, the optimal channel for relay device E is determined to be channel 6. If relay devices D and C are used as the second devices, since the optimal channel for both relay devices D and C is channel 1, and the signal strength between relay device D and relay device E is higher than the signal strength between relay device E and relay device C, relay device D can be identified as the first neighboring device of relay device E. Among the remaining first devices, the relay device with the larger signal strength and whose optimal channel is not channel 1 is identified as the second neighboring device of relay device E. If relay device B, whose optimal channel is channel 11, is identified as the second neighboring device of relay device E, then the optimal channel of relay device E can be identified as channel 6.
[0095] This embodiment determines two adjacent second devices based on the signal strength between the target relay device and the corresponding multiple first devices. When the optimal channels of the two second devices are different, they can be determined as neighboring devices of the target relay device, thereby allocating a target channel to the target relay device that is different from that of the adjacent second devices. When the optimal channels of the two second devices are the same, the one that is closer can be determined as the first neighboring device, and among the remaining first devices, a first device that is closer and whose optimal channel is different from that of the first neighboring device is re-determined as the second neighboring device, thereby allocating a target channel to the target relay device that is different from that of the two neighboring devices. This ensures that the relay device and the corresponding adjacent relay devices use target channels with less mutual interference, thereby improving the data transmission reliability of the relay device.
[0096] In step S220, a channel optimization command is sent to the corresponding relay device based on the optimal channel of the relay device, so that the relay device configures the corresponding channel based on the channel optimization command.
[0097] For example, the server can send a channel optimization command to the relay device based on the optimal channel allocated to the relay device. The relay device then configures its own channel as the optimal channel in the channel optimization command. The relay device has a pre-configured channel; if the pre-configured channel matches the optimal channel in the channel optimization command, the channel is not reconfigured; otherwise, it is reconfigured.
[0098] For example, when generating the first scan result, the relay device may add the currently configured channel to the first scan result. After determining the optimal channel for the relay device, the server may compare the optimal channel with the currently configured channel of the relay device in the first scan result. If they are different, the server sends a channel optimization command to the relay device based on the optimal channel to make the relay device reconfigure the channel. If they are the same, the server does not send a channel optimization command to the relay device so that the relay device maintains the channel configuration.
[0099] This embodiment optimizes the network structure between the server and each relay device, while also optimizing the channels of each relay device. This reduces channel interference between relay devices that are close to each other, improves the data transmission stability of the relay devices, and thus enhances the communication reliability between the server and the terminal devices.
[0100] According to the network optimization method provided in the above embodiments, a network topology map is constructed by scanning the signal strength of multiple relay devices or servers. The network topology map can represent the available connections and connection reliability between the server and each relay device. The target connection path from the relay device to the server is determined through the network topology map. The target connection path can be regarded as a stable and reliable network connection structure when the relay device connects to the server. Based on the target connection path, the upstream device to be connected by the relay device can be determined. A connection optimization command is sent to the relay device to enable it to connect to the corresponding upstream device. After each relay device is connected to its corresponding upstream device, the optimal network topology formed between each relay device and the server achieves automatic and reasonable optimization of the network topology, ensuring a stable and reliable network connection between each relay device and the server, avoiding weak network cascading and downstream device disconnection problems, and improving the communication reliability between the server and terminal devices.
[0101] Based on the above embodiments, Figure 11 is a schematic diagram of the structure of a network optimization device provided in an embodiment of this application. Referring to Figure 11, the network optimization device provided in this embodiment specifically includes: a topology map construction module 31, a superior device determination module 32, and a connection optimization module 33.
[0102] The topology construction module 31 is configured to construct a network topology map based on the first scan results of multiple relay devices, wherein the first scan results include the signal strength of the relay devices or servers scanned by the corresponding relay devices.
[0103] The upstream device determination module 32 is configured to determine the target connection path between each relay device and the server based on the network topology diagram, and determine the upstream device of the corresponding relay device based on the target connection path;
[0104] The connection optimization module 33 is configured to send a connection optimization command to the corresponding relay device according to the upstream device of the relay device, so that the relay device can connect to the corresponding upstream device based on the connection optimization command.
[0105] Based on the above embodiments, the topology graph construction module 31 includes: a node configuration submodule, configured to configure the server and multiple relay devices as nodes in the network topology graph; and a connection line establishment submodule, configured to establish connection lines between the corresponding node and the nodes of the scanned relay device or server based on the first scan result of the relay device, and determine the value of the corresponding connection line based on the signal strength.
[0106] Based on the above embodiments, the connection line establishment submodule includes: a signal strength conversion unit, configured to convert the signal strength between the relay device and the corresponding scanned relay device or server into an attenuation ratio coefficient according to a preset mapping relationship; and a connection line value determination unit, configured to determine the attenuation ratio coefficient as the value of the connection line between the relay device and the corresponding scanned relay device or server, wherein the attenuation ratio coefficient is greater than zero and less than one.
[0107] Based on the above embodiments, the upper-level device determination module 32 includes: a connection path determination submodule, configured to determine at least one connection path between the relay device and the server according to the network topology diagram; and an optimal path determination submodule, configured to calculate the total value of the corresponding connection path based on the value of the connection lines on the connection path, and determine the target connection path of the relay device based on the total value of the connection path.
[0108] Based on the above embodiments, the network optimization device further includes: an optimal channel determination module, configured to determine the optimal channel for each relay device; and a channel optimization module, configured to send a channel optimization command to the corresponding relay device based on the optimal channel of the relay device, so that the relay device configures the corresponding channel based on the channel optimization command.
[0109] Based on the above embodiments, the optimal channel determination module includes: a signal strength determination submodule, configured to determine the signal strength between the server and each relay device according to the second scan result of the server or the first scan result of each relay device, wherein the second scan result includes the signal strength of the relay devices scanned by the server; and an optimal channel determination submodule, configured to determine the optimal channel of each relay device in descending order of the signal strength between each relay device and the server.
[0110] Based on the above embodiments, the optimal channel determination submodule includes: a list generation unit, configured to sort each relay device and generate a relay device list based on the signal strength between each relay device and the server from largest to smallest; a target channel acquisition unit, configured to acquire three target channels from multiple preset channels, with the mutual interference between the three target channels being minimal; and an optimal channel determination unit, configured to traverse the relay device list and determine the optimal channel for each relay device among the three target channels.
[0111] Based on the above embodiments, the optimal channel determination unit includes: a first optimal channel determination subunit, configured to determine any one of the three target channels as the optimal channel of the server, and the remaining two as the optimal channels of the two relay devices ranked first in the relay device list; a target relay device determination subunit, configured to determine the relay device ranked first in the relay device list and not assigned a channel as the target relay device, the target relay device being the relay device currently awaiting channel allocation; a neighboring device determination subunit, configured to determine two neighboring devices of the target relay device from the first device, the first device being a server or relay device that has been assigned a channel; and a second optimal channel determination subunit, configured to determine the target channel that is not included in the optimal channels of the two neighboring devices as the optimal channel of the target relay device.
[0112] Based on the above embodiments, the neighboring device determination subunit is specifically configured as follows: sorting each first device according to its signal strength with the target relay device, and designating the two first devices with higher ranking as second devices; if the optimal channels of the two second devices are different, determining the two second devices as neighboring devices of the target relay device; if the optimal channels of the two second devices are the same, determining the second device with the larger signal strength as the first neighboring device of the target relay device, and determining the first device with higher ranking and an optimal channel different from the first neighboring device as the second neighboring device of the target relay device among the remaining first devices.
[0113] Based on the above embodiments, the network optimization device further includes: a scanning instruction sending module, configured to send scanning instructions to multiple relay devices before constructing a network topology map based on the first scanning results of multiple relay devices, so that each relay device scans the wireless signals broadcast by surrounding relay devices or servers based on the scanning instructions, and generates a first scanning result based on the signal strength of the scanned wireless signals and the device information carried, and sends it to the server; and a scanning result acquisition module, configured to receive the first scanning results sent by each relay device.
[0114] Based on the above embodiments, the scan command sending module includes: a condition detection submodule, configured to detect whether the current time meets the preset optimization conditions; and a scan command sending submodule, configured to send scan commands to multiple relay devices if the preset optimization conditions are met at the current time.
[0115] Based on the above embodiments, the optimization conditions include that the terminal device connected to the server is in an unused network state, and / or that the current time is not within the preset device wake-up time period.
[0116] According to the network optimization device provided in the above embodiments, a network topology map is constructed by scanning the signal strength of multiple relay devices or servers. The network topology map can represent the available connections and connection reliability between the server and each relay device. The target connection path from the relay device to the server is determined through the network topology map. The target connection path can be regarded as a stable and reliable network connection structure when the relay device connects to the server. Based on the target connection path, the upstream device to be connected by the relay device can be determined, and a connection optimization command is sent to the relay device to enable it to connect to the corresponding upstream device. After each relay device is connected to its corresponding upstream device, the optimal network topology formed between each relay device and the server achieves automatic and reasonable optimization of the network topology, ensuring a stable and reliable network connection between each relay device and the server, avoiding weak network cascading and downstream device disconnection problems, and improving the communication reliability between the server and terminal devices.
[0117] The network optimization apparatus provided in this application embodiment can be used to execute the network optimization method provided in the above embodiment, and has corresponding functions and beneficial effects.
[0118] Figure 12 is a schematic diagram of a network optimization device according to an embodiment of this application. Referring to Figure 12, the network optimization device includes a processor 41, a memory 42, a communication device 43, an input device 44, and an output device 45. The number of processors 41 and the number of memories 42 in the network optimization device can be one or more. The processor 41, memory 42, communication device 43, input device 44, and output device 45 of the network optimization device can be connected via a bus or other means.
[0119] The memory 42, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as program instructions / modules corresponding to the network optimization method in any embodiment of this application (e.g., the topology map construction module 31, the upper-level device determination module 32, and the connection optimization module 33 in the network optimization device). The memory 42 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created based on the use of the device, etc. Furthermore, the memory 42 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0120] The communication device 43 is used for data transmission.
[0121] The processor 41 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory 42, thereby implementing the network optimization method provided in any of the above embodiments.
[0122] Input device 44 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the device. Output device 45 may include display devices such as a display screen.
[0123] The network optimization device provided above can be used to execute the network optimization method provided in the above embodiments, and has corresponding functions and beneficial effects.
[0124] This application also provides a storage medium containing computer-executable instructions. When executed by a computer processor, the computer-executable instructions implement the network optimization method provided in any of the above embodiments. The network optimization method includes: constructing a network topology map based on first scan results of multiple relay devices, the first scan results including the signal strength of the relay devices or servers scanned by the corresponding relay devices; determining a target connection path between each relay device and a server based on the network topology map; determining the upstream device of the corresponding relay device based on the target connection path; and sending a connection optimization instruction to the corresponding relay device based on the upstream device of the relay device, so that the relay device connects to the corresponding upstream device based on the connection optimization instruction.
[0125] Storage medium refers to various types of memory devices or storage equipment. The term "storage medium" is intended to include: mounting media, such as CD-ROMs, floppy disks, or magnetic tape devices; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (e.g., hard disks or optical storage); registers or other similar types of memory elements, etc. Storage medium may also include other types of memory or combinations thereof. Furthermore, storage medium may reside in a first computer system in which a program is executed, or it may reside in a different second computer system connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media residing in different locations (e.g., in different computer systems connected via a network). Storage medium may store program instructions (e.g., specifically implemented as a computer program) executable by one or more processors.
[0126] Of course, the computer-executable instructions provided in the embodiments of this application are not limited to the network optimization method described above, but can also perform related operations in the network optimization method provided in any embodiment of this application.
[0127] The network optimization apparatus, storage medium, and network optimization device provided in the above embodiments can execute the network optimization method provided in any embodiment of this application. For technical details not described in detail in the above embodiments, please refer to the network optimization method provided in any embodiment of this application.
[0128] The above description is merely a preferred embodiment and the technical principles employed in this application. This application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions that can be made by those skilled in the art will not depart from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of this application. The scope of this application is determined by the scope of the claims.
Claims
1. A network optimization method, comprising: A network topology map is constructed based on the first scan results of multiple relay devices, wherein the first scan results include the signal strength of the relay devices or servers scanned by the corresponding relay devices; The target connection path between each relay device and the server is determined based on the network topology diagram, and the upstream device of the corresponding relay device is determined based on the target connection path. The relay device sends a connection optimization command to the corresponding relay device from its upstream device, so that the relay device can connect to the corresponding upstream device based on the connection optimization command.
2. The network optimization method according to claim 1, wherein constructing a network topology map based on the first scan results of multiple relay devices includes: Configure the server and the plurality of relay devices as nodes in the network topology diagram; Based on the first scan result of the relay device, a connection line is established between the corresponding node and the node of the scanned relay device or server, and the value of the corresponding connection line is determined based on the signal strength.
3. The network optimization method of claim 2, wherein, Determining the value of the corresponding connection line based on the signal strength includes: The signal strength between the relay device and the corresponding scanned relay device or server is converted into an attenuation ratio coefficient according to a preset mapping relationship. The attenuation ratio coefficient is determined as the value of the connection line between the relay device and the corresponding scanned relay device or server, wherein the attenuation ratio coefficient is greater than zero and less than one.
4. The network optimization method of any one of claims 1-3, wherein, Determining the target connection path between each relay device and the server based on the network topology map includes: Determine at least one connection path between the relay device and the server based on the network topology diagram; The total value of the corresponding connection path is calculated based on the value of the connecting lines on the connection path, and the target connection path of the relay device is determined based on the total value of the connection path.
5. The network optimization method of any one of claims 1-4, wherein, The method further includes: Determine the optimal channel for each relay device; Based on the optimal channel of the relay device, a channel optimization command is sent to the corresponding relay device, so that the relay device configures the corresponding channel based on the channel optimization command.
6. The network optimization method of claim 5, wherein, Determining the optimal channel for each relay device includes: The signal strength between the server and each of the relay devices is determined based on the second scan result of the server or the first scan result of each relay device, wherein the second scan result includes the signal strength of the relay devices scanned by the server; Based on the order of signal strength between each relay device and the server from largest to smallest, the optimal channel for each relay device is determined sequentially.
7. The network optimization method of claim 6, wherein, The step of determining the optimal channel for each relay device based on the signal strength between each relay device and the server in descending order includes: Based on the order of signal strength between each relay device and the server from largest to smallest, a relay device list is generated by sorting each relay device. Three target channels are acquired from multiple preset channels, and the mutual interference between the three target channels is minimized. The optimal channel for each relay device is determined by traversing the list of relay devices among the three target channels.
8. The network optimization method of claim 7, wherein, The step of traversing the list of relay devices and determining the optimal channel for each relay device among the three target channels includes: One of the three target channels is determined as the optimal channel of the server, and the remaining two are determined as the optimal channels of the two relay devices ranked first in the relay device list. The relay device that ranks first in the relay device list and has not been assigned a channel is identified as the target relay device, which is the relay device currently awaiting channel allocation. In the first device, two neighboring devices of the target relay device are identified, wherein the first device is a server or relay device with an allocated channel; The target channel that is not included in the optimal channel of the two neighboring devices is determined as the optimal channel of the target relay device.
9. The network optimization method of claim 8, wherein, The step of determining two neighboring devices of the target relay device in the first device includes: The first devices are sorted based on their signal strength with the target relay device, and the two first devices with the highest ranking are designated as the second devices. If the optimal channels of the two second devices are different, the two second devices are identified as neighboring devices of the target relay device; If the optimal channels of the two second devices are the same, the second device with the larger signal strength is determined as the first neighboring device of the target relay device, and among the remaining first devices, the first device that is ranked higher and whose optimal channel is different from that of the first neighboring device is determined as the second neighboring device of the target relay device.
10. The network optimization method of any one of claims 1-9, wherein, Before constructing the network topology map based on the first scan results of multiple relay devices, the method further includes: A scanning command is sent to multiple relay devices, so that each relay device scans the wireless signals broadcast by surrounding relay devices or servers based on the scanning command, and generates a first scanning result based on the signal strength of the scanned wireless signals and the device information they carry, and sends it to the server. Receive the first scan results sent by each of the relay devices.
11. The network optimization method of claim 10, wherein, Sending scanning commands to multiple relay devices includes: Check whether the preset optimization conditions are met at the current moment; If the preset optimization conditions are met at the current moment, scan commands are sent to multiple relay devices.
12. The network optimization method of claim 11, wherein, The optimization conditions include that the terminal device connected to the server is in an unused network state, and / or that the current time is not within a preset device wake-up time period.
13. A network optimization device, comprising: The topology map construction module is configured to construct a network topology map based on the first scan results of multiple relay devices, wherein the first scan results include the signal strength of the relay devices or servers scanned by the corresponding relay devices; The upstream device determination module is configured to determine the target connection path between each relay device and the server based on the network topology diagram, and to determine the upstream device of the corresponding relay device based on the target connection path; The connection optimization module is configured to send a connection optimization instruction to the corresponding relay device according to the upstream device of the relay device, so that the relay device can connect to the corresponding upstream device based on the connection optimization instruction.
14. A network optimization device, comprising: one or more processors; a storage device storing one or more programs, when the one or more programs are executed by the one or more processors, cause the one or more processors to implement the network optimization method according to any one of claims 1-12.
15. A storage medium containing computer-executable instructions for performing the network optimization method according to any one of claims 1-12 when executed by a computer processor.