Network optimization method, electronic equipment and storage medium
By calculating the communication quality and stability weight of communication devices in low-power Bluetooth networks, judging the number of devices and the ratio of stable devices, and dynamically optimizing the low-power Bluetooth network, the problem of network communication quality degradation in complex environments is solved, and efficient and stable network operation is achieved.
Patent Information
- Application Number
- CN202510118262.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-05-06
AI Technical Summary
Low-power Bluetooth networks may lead to decreased communication quality, increased latency and network stability problems in expanded scale and complex environments. Existing optimization methods are difficult to dynamically adapt to network changes and do not fully utilize available information.
By obtaining the current device identification list and the direct communication device identification, calculate the total communication quality weight and stability weight, and judge the number of stable devices. When the ratio of the number of devices and the stable device reaches the preset conditions, the low-power Bluetooth network is optimized based on the initial routing table or the current device identification list.
It realizes dynamic adjustment of optimization strategies when new communication equipment is added, avoid unnecessary optimization, reduce resource consumption, ensure the necessity and effectiveness of optimization operations, and improve the efficient operation and stability of low-power Bluetooth networks.
Smart Images

Figure CN119946593A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network optimization, and in particular to a network optimization method, electronic equipment and storage medium. Background Art
[0002] Bluetooth Low Energy is a wireless personal area network technology designed specifically for mobile communications and the Internet of Things. It aims to provide similar communication distance and functions to traditional Bluetooth with lower energy consumption. In a Bluetooth Low Energy network, the network topology usually adopts a star structure, including several communication devices, including a master device and one or more non-master devices (slave devices); the master device is responsible for initiating and managing connections with non-master devices and coordinating data transmission, and the non-master devices respond to requests from the master device to provide data or services; however, in some complex environments, such as smart homes, industrial automation, aerospace and other scenarios, there may be multiple master devices and a large number of non-master devices forming a more complex network structure. As the scale of the Bluetooth Low Energy network expands, the network topology becomes more complex, which may lead to decreased communication quality, increased latency and network stability problems. Therefore, the Bluetooth Low Energy network needs to be optimized.
[0003] Existing optimization methods for low-power Bluetooth networks include static routing selection (simplifying network configuration based on pre-set paths for data packets to be transmitted in the network), simple adjustments based on signal strength (by monitoring RSSI values, the quality of the communication link is evaluated to a certain extent, and corresponding adjustments are made accordingly) or manual configuration of network parameters (manual configuration involves directly setting the working parameters of the BLE device, such as connection interval, slave delay, MTU size), etc. However, these methods often cannot dynamically adapt to network changes and do not make full use of available information, such as the communication quality between communication devices and the overall stability of the network. Summary of the invention
[0004] In view of the above technical problems, the technical solution adopted by the present invention is:
[0005] According to a first aspect of the present invention, a network optimization method is provided, the method is applied to a communication device, and the method comprises the following steps:
[0006] S1000. If it is the master device of the low-power Bluetooth network, in response to a new communication device joining the low-power Bluetooth network, obtain a current device identification list, wherein the current device identification list includes several current device identifications, and the current device identification is the identity identification of the communication device in the current low-power Bluetooth network.
[0007] S2000: Acquire a plurality of direct communication device identifiers corresponding to each current device identifier, where the direct communication device identifier is an identity identifier of a communication device that directly communicates with the communication device corresponding to the current device identifier in a low-power Bluetooth network.
[0008] S3000. The total communication quality weight of the communication device corresponding to the current device identifier and the communication device corresponding to the direct communication device identifier is used as the first stability weight corresponding to the current device identifier. The total communication quality weight is used to measure the communication quality between the two communication devices. The smaller the total communication quality weight, the better the communication quality between the corresponding two communication devices.
[0009] S4000: Taking the minimum value of all first stability weights corresponding to the current device identifier as the second stability weight corresponding to the current device identifier.
[0010] S5000. Obtain the number of stable devices WD, where WD is the number of current device identifiers whose corresponding second stability weight is less than the preset stability weight.
[0011] S6000, if DQ ≥ YS and WD ≥ WD 0 , then when the low-power Bluetooth network has not been optimized, the low-power Bluetooth network is optimized according to the initial routing table corresponding to the low-power Bluetooth network. When the low-power Bluetooth network has been optimized, the low-power Bluetooth network is optimized based on the current device identification list, where DQ is the current number of devices, that is, the number of communication devices in the current low-power Bluetooth network. The low-power Bluetooth network includes several communication devices, and the communication devices establish and maintain communication connections based on the low-power Bluetooth protocol. YS is the preset number of devices, and WD 0 is the preset stable device ratio.
[0012] According to a second aspect of the present invention, a non-transitory computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the aforementioned method.
[0013] According to a third aspect of the present invention, there is provided an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the aforementioned method when executing the computer program.
[0014] The present invention has at least the following beneficial effects:
[0015] The present invention provides a network optimization method, an electronic device and a storage medium. The method is applied to a communication device. When responding to a new communication device joining a low-power Bluetooth network, the method obtains a first stability weight corresponding to a current device identifier according to the total weight of the communication quality between the current communication device and other devices that directly communicate with the current communication device, wherein the total weight of the communication quality is used to measure the communication quality between two communication devices. The smaller the total weight of the communication quality, the better the communication quality between the two corresponding communication devices. The minimum value of all first stability weights corresponding to the current device identifier is used as the second stability weight corresponding to the current device identifier, and the number of current device identifiers whose corresponding second stability weights are less than the preset stability weight is used as the number of stable devices. When the number of current devices is not less than the preset number of devices and the number of stable devices is not less than the preset ratio of stable devices, the low-power Bluetooth network is optimized. It can be seen that the present invention realizes optimization based on the total weight of the communication quality and the number of stable devices when responding to a new communication device joining a low-power Bluetooth network, and can dynamically adjust the optimization strategy. Only when certain conditions are met, the optimization is performed, thereby avoiding unnecessary optimization, reducing resource consumption, ensuring the necessity and effectiveness of the optimization operation, reducing the impact on existing communications, and ensuring the efficient operation and stability of the low-power Bluetooth network. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0017] Figure 1 A flowchart of a network optimization method provided by an embodiment of the present invention;
[0018] Figure 2 The initial network connection relationship diagram in step S21 provided in an embodiment of the present invention;
[0019] Figure 3 This is a new initial network connection relationship diagram in step S22 provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar tasks, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0022] An embodiment of the present invention provides a network optimization method, which is applied to a communication device and comprises the following steps: Figure 1 As shown:
[0023] S1000. If it is the master device of the low-power Bluetooth network, in response to a new communication device joining the low-power Bluetooth network, obtain a current device identification list, wherein the current device identification list includes several current device identifications, and the current device identification is the identity identification of the communication device in the current low-power Bluetooth network.
[0024] S2000: Acquire a plurality of direct communication device identifiers corresponding to each current device identifier, where the direct communication device identifier is an identity identifier of a communication device that directly communicates with the communication device corresponding to the current device identifier in a low-power Bluetooth network.
[0025] S3000: Taking the total communication quality weight of the communication device corresponding to the current device identifier and the communication device corresponding to the direct communication device identifier as the first stability weight corresponding to the current device identifier.
[0026] S4000: Taking the minimum value of all first stability weights corresponding to the current device identifier as the second stability weight corresponding to the current device identifier.
[0027] Specifically, the smaller the second stability weight corresponding to the current device identifier is, the more stable the network directly communicating with the communication device corresponding to the current device identifier is.
[0028] S5000. Obtain the number of stable devices WD, where WD is the number of current device identifiers whose corresponding second stability weight is less than the preset stability weight. Those skilled in the art know that the preset stability weight is a weight preset and set by those skilled in the art according to actual needs, and will not be described in detail here.
[0029] S6000, if DQ ≥ YS and WD ≥ WD 0, then when the low-power Bluetooth network has not been optimized, the low-power Bluetooth network is optimized according to the initial routing table corresponding to the low-power Bluetooth network. When the low-power Bluetooth network has been optimized, the low-power Bluetooth network is optimized based on the current device identification list, where DQ is the current number of devices, that is, the number of communication devices in the current low-power Bluetooth network. The low-power Bluetooth network includes several communication devices, and the communication devices establish and maintain communication connections based on the low-power Bluetooth protocol. YS is the preset number of devices, and WD 0 It is a preset stable device ratio. Those skilled in the art know that the preset number of devices is the number of devices pre-set by those skilled in the art according to actual needs, for example: 10, 20, 30, which will not be repeated here. The preset stable device ratio is set by those skilled in the art according to actual needs, which will not be repeated here.
[0030] Through the above steps, in response to a new communication device joining the low-power Bluetooth network, the first stability weight corresponding to the current device identifier is obtained according to the total weight of the communication quality between the current communication device and other devices with which it directly communicates, and the minimum value of all the first stability weights corresponding to the current device identifier is used as the second stability weight corresponding to the current device identifier, and the number of current device identifiers whose corresponding second stability weights are less than the preset stability weight is used as the number of stable devices. The current number of devices is less than the preset number of devices, indicating that the number of communication devices in the low-power Bluetooth network is small and does not need to be optimized. The number of stable devices is less than the preset ratio of stable devices, indicating that the low-power Bluetooth network is not stable enough and is not suitable for optimization. Therefore, the low-power Bluetooth network is optimized only when the current number of devices is not less than the preset number of devices and the number of stable devices is not less than the preset ratio of stable devices. The optimization strategy can be dynamically adjusted, and the optimization is performed only when certain conditions are met, thereby avoiding unnecessary optimization, reducing resource consumption, ensuring the necessity and effectiveness of the optimization operation, reducing the impact on existing communications, and ensuring the efficient operation and stability of the low-power Bluetooth network.
[0031] Specifically, the method further includes the following steps S1-S2:
[0032] S1. If the device is a master device of a low-power Bluetooth network and the low-power Bluetooth network has not been optimized, then in response to a new communication device joining the low-power Bluetooth network, DQ is obtained.
[0033] Specifically, in a low-power Bluetooth network, when a new communication device joins the low-power Bluetooth network, the new communication device maintains a communication connection relationship with all other communication devices that can establish a communication connection with it. At the same time, the maintained communication connection relationship will be stored in the initial routing table corresponding to the low-power Bluetooth network.
[0034] In a specific embodiment, the initial routing table corresponding to the low-power Bluetooth network records the communication connection relationship between each communication device in the low-power Bluetooth network and all other communication devices, and the communication connection relationship includes a connection state, and the connection state includes a maintain connection state and a disconnection state.
[0035] Furthermore, if the connection state in the communication connection relationship between two communication devices is to maintain the connection state, it indicates that the two communication devices communicate directly. Direct communication means that the two communication devices can communicate without going through other devices. For example, communication device 1 and communication device 2 communicate directly without going through other communication devices.
[0036] Furthermore, if the connection state in the communication connection relationship between two communication devices is a disconnected state, it indicates that the two communication devices are not directly connected for communication, for example, communication device 1 and communication device 2 communicate through communication device 3 .
[0037] S2. If DQ ≥ YS, the low-power Bluetooth network is optimized according to the initial routing table corresponding to the low-power Bluetooth network.
[0038] Specifically, optimizing the low-power Bluetooth network according to the initial routing table corresponding to the low-power Bluetooth network includes the following steps S21-S23:
[0039] S21, constructing an initial network connection relationship diagram corresponding to the low-power Bluetooth network according to the initial routing table corresponding to the low-power Bluetooth network, wherein, Figure 2 As shown, the initial network connection relationship diagram includes several nodes and edges. The nodes represent communication devices in the low-power Bluetooth network, and the edges represent direct communication between two communication devices corresponding to the nodes at both ends of the edge. Each edge is attached with the total communication quality weight of the two communication devices corresponding to the nodes at both ends of the edge. The total communication quality weight is used to measure the communication quality between the two communication devices.
[0040] Specifically, the smaller the total communication quality weight is, the better the communication quality between the corresponding two communication devices is.
[0041] Specifically, step S2 also includes: if DQ<YS, no processing is performed.
[0042] Specifically, step S21 includes the following steps S211-S215 to obtain the total communication quality weight of two communication devices corresponding to the nodes at both ends of the edge:
[0043] S211. Use two communication devices corresponding to the nodes at both ends of the edge as the first initial device and the second initial device respectively.
[0044] S212. Obtain a first power level, a first RSSI signal strength, a second power level, and a second RSSI strength, wherein the first power level is the power level of the first initial device, the first RSSI signal strength is the RSSI signal strength of the first initial device, the second power level is the power level of the second initial device, and the second RSSI signal strength is the RSSI signal strength of the second initial device.
[0045] S213. According to the first preset weight influence value mapping list, obtain a first electricity weight influence value corresponding to the first electricity and a second electricity weight influence value corresponding to the second electricity, wherein the first preset weight influence value mapping list includes a plurality of preset electricity intervals and first preset weight influence values corresponding to the preset electricity intervals. When the first electricity belongs to a preset electricity interval, the first preset weight influence value corresponding to the preset electricity interval to which the first electricity belongs is used as the first electricity weight influence value corresponding to the first electricity. When the second electricity belongs to a preset electricity interval, the first preset weight influence value corresponding to the preset electricity interval to which the second electricity belongs is used as the second electricity weight influence value corresponding to the second electricity. Persons skilled in the art know that the first preset weight influence value mapping list is a list pre-set by those skilled in the art according to actual needs and will not be repeated here.
[0046] Specifically, the larger the preset power interval is, the larger the corresponding first power weight influence value is. For example, the preset power intervals are [0%, 20%), [20%, 40%), [40%, 60%), [60%, 100%); the first preset weight influence value corresponding to [0%, 20%) is 0, the first preset weight influence value corresponding to [20%, 40%) is 1, the first preset weight influence value corresponding to [40%, 60%) is 2, and the first preset weight influence value corresponding to [60%, 100%) is 3.
[0047] S214. According to the second preset weight influence value mapping list, obtain the first RSSI signal strength weight influence value corresponding to the first RSSI signal strength and the second RSSI signal strength weight influence value corresponding to the second RSSI signal strength, wherein the second preset weight influence value mapping list includes several preset RSSI signal strength intervals and second preset weight influence values corresponding to the preset RSSI signal strength intervals. When the first RSSI signal strength belongs to a preset RSSI signal strength interval, the second preset weight influence value corresponding to the preset RSSI signal strength interval to which the first RSSI signal strength belongs is used as the first RSSI signal strength weight influence value corresponding to the first RSSI signal strength. When the second RSSI signal strength belongs to a preset RSSI signal strength interval, the second preset weight influence value corresponding to the preset RSSI signal strength interval to which the second RSSI signal strength belongs is used as the second RSSI signal strength weight influence value corresponding to the second RSSI signal strength. Persons skilled in the art know that the second preset weight influence value mapping list is a list pre-set by those skilled in the art according to actual needs and will not be repeated here.
[0048] Specifically, the larger the preset RSSI signal strength interval, the greater the corresponding second power weight influence value. For example, the preset power intervals are (-∞, -120), [-120, -90), [-90, -60), and [-60, 0]; the second preset weight influence value corresponding to (-∞, -120) is 0, the second preset weight influence value corresponding to [-120, -90) is 1, the second preset weight influence value corresponding to [-90, -60) is 2, and the second preset weight influence value corresponding to [-60, 0] is 3.
[0049] S215. The sum of the communication quality weight corresponding to the first initial device and the communication quality weight corresponding to the second initial device is used as the total communication quality weight representing the communication quality between the first initial device and the second initial device, wherein the communication quality weight corresponding to the first initial device is the difference between the preset communication quality weight and the first power weight influence value and the first RSSI signal strength weight influence value, and the communication quality weight corresponding to the second initial device is the difference between the preset communication quality weight and the second power weight influence value and the second RSSI signal strength weight influence value.
[0050] Specifically, the preset communication quality weight used to obtain the communication quality weight corresponding to the first initial device is the same as the preset communication quality weight used to obtain the communication quality weight corresponding to the second initial device. Those skilled in the art know that the preset communication quality weight is a weight pre-set by those skilled in the art according to actual needs and will not be repeated here.
[0051] Specifically, in step S3000, the same method as in steps S211-S215 is used to obtain the total communication quality weights of the two communication devices corresponding to the nodes at both ends of the edge, so as to obtain the total communication quality weights of the communication device corresponding to the current device identifier and the communication device corresponding to the direct communication device identifier.
[0052] Through the above steps, the total communication quality weight of the first initial device and the second initial device is obtained by quantifying the power of the first initial device and the second initial device and the RSSI signal strength. The lower the power, the worse the communication quality, and too low power may mean that the communication device is about to be powered off or the user using the communication device actively exits the low-power Bluetooth network. The smaller the RSSI signal strength, the worse the communication quality, and when the RSSI signal strength is small, the user using the communication device may also actively exit the low-power Bluetooth network, which will directly affect the communication capability of the communication device. Therefore, the total communication quality weight of the first initial device and the second initial device is obtained according to the power of the first initial device and the second initial device and the RSSI signal strength, which takes into account the key factors that actually affect the communication quality, can more accurately reflect the communication quality status between communication devices, and provides a basis for optimizing the low-power Bluetooth network.
[0053] S22, copying the initial network connection relationship graph as the historical network connection relationship graph, and using the minimum spanning tree corresponding to the initial network connection relationship graph as the new initial network connection relationship graph so as to update the initial network connection relationship graph, wherein, Figure 3 As shown, the minimum spanning tree corresponding to the initial network connection relationship graph contains all the nodes in the initial network connection relationship graph and the edges connecting these nodes, and the sum of the total communication quality weights attached to all the edges is the smallest.
[0054] S23. Generate an intermediate routing table based on the new initial network connection relationship diagram and send the intermediate routing table to all communication devices except itself in the low-power Bluetooth network, so that the communication device that receives the intermediate routing table determines whether to disconnect the communication connection between itself and other communication devices based on the communication connection relationship recorded in the intermediate routing table, so as to optimize the low-power Bluetooth network. At the same time, the intermediate routing table is used as the initial routing table corresponding to the low-power Bluetooth network, wherein the intermediate routing table records the communication connection relationship between the communication devices corresponding to each node in the initial network connection relationship diagram.
[0055] Specifically, step S1 also includes: if itself is a non-master control device of the low-power Bluetooth network, then when the intermediate routing table is received, it determines whether to disconnect the communication connection between itself and other communication devices according to the communication connection relationship between itself and other communication devices recorded in the intermediate routing table, so as to achieve the optimization of the low-power Bluetooth network, wherein, if in the low-power Bluetooth network, itself communicates directly with a certain communication device, but the communication connection relationship is not recorded in the intermediate routing table, then it is set that it needs to disconnect the communication connection with the communication device; for example: in the low-power Bluetooth network, if communication device 1 and communication device 2 communicate directly, but the communication connection relationship between communication device 1 and communication device 2 is not recorded in the intermediate routing table received by communication device 1, or the connection state in the communication connection relationship between communication device 1 and communication device 2 recorded in the intermediate routing table received by communication device 1 is a disconnected state, then communication device 1 sets itself to disconnect the communication connection with communication device 2.
[0056] Through the above steps, an initial network connection relationship graph corresponding to the low-power Bluetooth network is constructed according to the initial routing table corresponding to the low-power Bluetooth network, the minimum spanning tree corresponding to the initial network connection relationship graph is used as a new initial network connection relationship graph to update the initial network connection relationship graph, an intermediate routing table is generated according to the new initial network connection relationship graph and the intermediate routing table is sent to all communication devices except itself in the low-power Bluetooth network, so that the communication device that receives the intermediate routing table determines whether to disconnect the communication connection between itself and other communication devices according to the communication connection relationship recorded in the intermediate routing table, so as to achieve the optimization of the low-power Bluetooth network, dynamically adjust the network connection relationship and routing strategy, reduce unnecessary communication connections while maintaining communication quality, thereby reducing resource consumption, effectively improving the working efficiency and stability of the low-power Bluetooth network, and reducing the negative impact caused by the low-power Bluetooth transmission distance limitation and too many communication device connections.
[0057] In a specific embodiment, the method comprises step S10:
[0058] S10: If the device is the master device of the low-power Bluetooth network and the low-power Bluetooth network has been optimized, in response to a new communication device joining the low-power Bluetooth network, the device obtains a current device identification list and optimizes the low-power Bluetooth network based on the current device identification list.
[0059] Specifically, in step S10 or step S6000, optimizing the low-power Bluetooth network based on the current device identification list includes the following steps S11-S13:
[0060] S11. Obtain a target device identification list and a target optimization time point. The target device identification list includes several target device identifications. The target optimization time point is the time point when the low-power Bluetooth network was most recently optimized. The target device identification is the identity identification of the communication device in the low-power Bluetooth network at the target optimization time point.
[0061] S12: Taking the symmetric difference between the current device identification list and the target device identification list as an intermediate device identification list, wherein the intermediate device identification list includes a plurality of intermediate device identifications.
[0062] S13, when ZJ>YS 0 Or when A / B>C, the low-power Bluetooth network is optimized according to the initial routing table corresponding to the low-power Bluetooth network, where ZJ is the time difference between the current time point and the target optimization time point, and YS 0 is the preset time difference, A is the number of intermediate device identifiers in the intermediate device identifier list, B is the number of current device identifiers in the current device identifier list, and C is the preset device quantity change ratio. Technical personnel in this field know that the preset time difference is the time difference pre-set by technical personnel in this field according to actual needs, for example: 10 minutes, and the preset device quantity change ratio is a value pre-set by technical personnel in this field according to actual needs, for example: 0.2, which will not be repeated here.
[0063] Through the above steps, when the low-power Bluetooth has been optimized, the current device identification list is obtained, the target device identification list and the target optimization time point are obtained, and the symmetric difference set of the current device identification list and the target device identification list is used as the intermediate device identification list. When the time difference between the current time point and the target optimization time point is not less than the preset time difference, or the quotient of the number of intermediate device identifications in the intermediate device identification list divided by the number of current device identifications in the current device identification list is not less than the preset device quantity change ratio, the low-power Bluetooth network is optimized according to the initial routing table corresponding to the low-power Bluetooth network, and combined with the change ratio and time difference of communication devices in the low-power Bluetooth network (communication devices joining and exiting), it is determined whether the network needs to be re-optimized, thereby avoiding the extra calculation and communication overhead caused by frequent optimization, while maintaining the communication quality, reducing unnecessary communication connections, thereby reducing resource consumption, not only improving the optimization efficiency, but also reducing the power consumption of communication devices, and effectively improving the working efficiency and stability of the low-power Bluetooth network.
[0064] Specifically, step S13 also includes: when ZJ≤YS 0 And when A / B≤C, no processing is performed.
[0065] In a specific embodiment, the method includes the following steps S20-S70:
[0066] S20. If it is the master device of the low-power Bluetooth network and the low-power Bluetooth network has been optimized, then in response to the communication device exiting the low-power Bluetooth network, the communication device exiting the low-power Bluetooth network will be treated as a key device and the number of node connections corresponding to the key device will be obtained. The number of node connections is the number of other nodes in the initial network connection relationship diagram that are directly connected to the node corresponding to the key device through edges.
[0067] Specifically, if it is a non-master device of a low-power Bluetooth network, then when it fails to receive a heartbeat signal sent by a communication device that is communicating directly with it for D seconds, it determines that the communication device that is communicating directly with it has exited the low-power Bluetooth network. At this time, the identity identification and network exit information of the communication device that is communicating directly with it are sent to the master device of the low-power Bluetooth network, where the network exit information is information indicating that the communication device has exited the low-power Bluetooth network, wherein D is a preset heartbeat signal sending interval duration. Those skilled in the art know that the preset heartbeat signal sending interval duration is a duration pre-set by those skilled in the art based on actual needs, which will not be elaborated here.
[0068] S30. If the number of node connections corresponding to the key device is greater than 1, the nodes corresponding to the key device and the edges connecting the nodes are deleted from the historical network connection relationship graph to obtain a first key network connection relationship graph, and the nodes corresponding to the key device and the edges connecting the nodes are deleted from the initial network connection relationship graph to obtain a second key network connection relationship graph; if the number of connection nodes corresponding to the key device is equal to 1, no processing is performed.
[0069] S40, marking the edge that exists in the first key network connection relationship graph but does not exist in the second key network connection relationship graph as a candidate edge. For example: if the first key network connection relationship graph includes node 1, node 2 and node 3, node 1 and node 2 are connected by an edge, node 1 and node 3 are connected by an edge, and node 2 and node 3 are connected by an edge, and the second key network connection relationship graph includes node 1, node 2 and node 3, node 1 and node 2 are connected by an edge, and node 2 and node 3 are connected by an edge, then the edge connecting node 1 and node 3 is an edge that exists in the first key network connection relationship graph but does not exist in the second key network connection relationship graph.
[0070] S50: Mark the candidate edge corresponding to the smallest total communication quality weight among the total communication quality weights attached to all candidate edges as the target edge.
[0071] S60: Use the communication devices corresponding to the nodes at both ends of the target edge in the first key network connection relationship graph as the first intermediate device and the second intermediate device corresponding to the first intermediate device respectively.
[0072] S70. Send the second intermediate device connection information to the first intermediate device, so that the first intermediate device establishes a communication connection with the corresponding second intermediate device when receiving the second intermediate device connection information, so as to optimize the low-power Bluetooth network.
[0073] Through the above steps, if it is the master device of the low-power Bluetooth network and the low-power Bluetooth network has been optimized, then in response to the communication device exiting the low-power Bluetooth network, the communication device exiting the low-power Bluetooth network is used as a key device and the number of node connections corresponding to the key device is obtained. According to the number of node connections corresponding to the key device, when the number of node connections corresponding to the key device is greater than 1, the first key network connection relationship graph and the second key network connection relationship graph are obtained, and the edges that exist in the first key network connection relationship graph but not in the second key network connection relationship graph are marked as candidate edges, and the candidate edge corresponding to the smallest total communication quality weight among all the candidate edges is marked as the target edge, and the communication devices corresponding to the nodes at both ends of the target edge in the first key network connection relationship graph are respectively used as the first The intermediate device and the second intermediate device corresponding to the first intermediate device send the second intermediate device connection information to the first intermediate device, so that the first intermediate device establishes a communication connection with the corresponding second intermediate device when receiving the second intermediate device connection information, so as to optimize the low-power Bluetooth network and respond quickly when the communication device exits, thereby avoiding communication interruption or network instability caused by sudden disconnection of the communication device. By constructing a first key network connection relationship graph and a second key network connection relationship graph, and marking candidate edges and target edges, the first intermediate device and the second intermediate device are determined according to the target edge, so that the first intermediate device establishes a communication connection with the corresponding second intermediate device when receiving the second intermediate device connection information, and can intelligently select the optimal alternative path to ensure the continuity of the network connection and the communication quality.
[0074] In a specific embodiment, after step S30 and before step S60, the following steps S40-S50 are included:
[0075] S40. Obtain a minimum spanning tree corresponding to the first key network connection relationship graph, wherein the minimum spanning tree corresponding to the first key network connection relationship graph includes all nodes in the first key network connection relationship graph and edges connecting these nodes, and the sum of the total communication quality weights attached to all edges is the smallest.
[0076] S50. Mark the edge that exists in the minimum spanning tree corresponding to the first key network connection relationship graph but does not exist in the second key network connection relationship graph as the target edge; for example: if the minimum spanning tree corresponding to the first key network connection relationship graph includes node 1, node 2 and node 3, node 1 and node 2 are connected by an edge, node 1 and node 3 are connected by an edge, and node 2 and node 3 are connected by an edge, and the second key network connection relationship graph includes node 1, node 2 and node 3, node 1 and node 2 are connected by an edge, and node 2 and node 3 are connected by an edge, then the edge connecting node 1 and node 3 is an edge that exists in the minimum spanning tree corresponding to the first key network connection relationship graph but does not exist in the second key network connection relationship graph.
[0077] Through the above steps, the target edge is obtained through the minimum spanning tree corresponding to the first key network connection relationship graph and the second key network connection relationship graph, and the first intermediate device and the second intermediate device are determined according to the target edge, so that the first intermediate device establishes a communication connection with the corresponding second intermediate device when receiving the connection information of the second intermediate device, and can intelligently select the optimal alternative path to ensure the continuity of the network connection and the communication quality, avoiding communication interruption or network instability caused by sudden disconnection of the communication device.
[0078] Specifically, step S20 also includes: if the device itself is the master device of the low-power Bluetooth network and the low-power Bluetooth network has not been optimized, then in response to the communication device exiting the low-power Bluetooth network, no processing is performed.
[0079] In a specific embodiment, before step S1000, the following steps S001-S003 are also included:
[0080] S001. When it is the master device of a low-power Bluetooth network and responds to a new communication device joining the low-power Bluetooth network, it obtains the master device determination score corresponding to itself and the master device determination score corresponding to the new communication device and proceeds to step S002. When it is a non-master device of a low-power Bluetooth network and responds to the master device of the low-power Bluetooth network exiting the low-power Bluetooth network, it obtains the master device determination scores corresponding to all communication devices in the current low-power Bluetooth network and proceeds to step S003.
[0081] Specifically, step S001 further includes: when the device itself is a non-master device of the low-power Bluetooth network and receives the master device confirmation information, setting itself as the master device of the low-power Bluetooth network.
[0082] S002. When the master device determination score corresponding to itself is less than the master device determination score corresponding to the new communication device, set itself as a non-master device of the low-power Bluetooth network, and send master device determination information to the new communication device at the same time, so that the new communication device sets itself as the master device of the low-power Bluetooth network when receiving the master device determination information, otherwise, no processing is performed.
[0083] S003. When the master control device corresponding to itself determines the score that is the maximum value among the master control devices corresponding to all communication devices in the current low-power Bluetooth network, it sets itself as the master control device of the low-power Bluetooth network; otherwise, it sets itself as a non-master control device of the low-power Bluetooth network.
[0084] Through the above steps, the master control device determination score corresponding to the communication device is obtained based on the number of other communication devices that directly communicate with the communication device in the current low-power Bluetooth network, the power of the current communication device and the RSSI signal strength of the current communication device. When determining the master control device, the number of other communication devices that directly communicate with the communication device, the power of the communication device and the RSSI signal strength of the communication device are taken into consideration. When it is the master control device of the low-power Bluetooth network and responds to a new communication device joining the low-power Bluetooth network, by comparing the master control device determination score corresponding to itself with the master control device determination score corresponding to the new communication device, a more suitable communication device is selected as the master control device. When it is the master control device of the low-power Bluetooth network When a non-master device responds to the master device of the low-power Bluetooth network exiting the low-power Bluetooth network, the most suitable device is dynamically selected as the master device by comparing the master device determination scores of each communication device. When a new communication device joins or an existing master device exits, the communication device corresponding to the larger master device determination score is selected as the master device, ensuring that the master role is assumed by the most suitable communication device, which is beneficial to improving the overall performance and stability of the low-power Bluetooth network, and when the low-power Bluetooth network changes, it can automatically, quickly and efficiently redetermine the master device of the low-power Bluetooth network, reducing the communication interruption time caused by the lack of the master device, and improving the overall performance and resource utilization of the network.
[0085] Specifically, before step S001, the following steps S01-S02 are included:
[0086] S01. When a low-power Bluetooth network joining instruction is received, a Bluetooth signal search is performed.
[0087] S02. When no Bluetooth signal can be found, a low-power Bluetooth network is established and the device is set as the master device of the low-power Bluetooth network, while continuing to search for Bluetooth signals; when a Bluetooth signal can be found, the device joins the low-power Bluetooth network and sets itself as a non-master device of the low-power Bluetooth network.
[0088] Through the above steps, when no Bluetooth signal can be searched, a low-power Bluetooth network is established and itself is set as the master device of the low-power Bluetooth network, and the Bluetooth signal search is continued. When the Bluetooth signal can be searched, the low-power Bluetooth network is joined and itself is set as a non-master device of the low-power Bluetooth network. This enables the communication device to quickly determine whether it is the master device of the low-power Bluetooth network based on the current network environment, and avoids unnecessary creation of new networks, which is beneficial to the stability and connectivity of the low-power Bluetooth network.
[0089] In a specific embodiment, the following steps S010-S040 are included before step S001:
[0090] S010. When a low-power Bluetooth network joining instruction is received, a Bluetooth signal search is performed.
[0091] S020. When no Bluetooth signal can be found, a low-power Bluetooth network is established; when a Bluetooth signal can be found, a low-power Bluetooth network is joined.
[0092] S030, if DQ<YS, set itself as a non-master device of the low-power Bluetooth network; if DQ=YS, obtain the master device determination scores corresponding to all communication devices in the current low-power Bluetooth network.
[0093] S040. If the master control device corresponding to itself determines the score that is the maximum value among the master control device determination scores corresponding to all communication devices in the current low-power Bluetooth network, then set itself as the master control device of the low-power Bluetooth network; otherwise, set itself as a non-master control device of the low-power Bluetooth network.
[0094] Through the above steps, when the current number of devices is less than the preset number of devices, it means that the number of communication devices in the low-power Bluetooth network is small. At this time, without setting a master device, the working efficiency and stability of the low-power Bluetooth network can be guaranteed, and unnecessary resource consumption is reduced. When the current number of devices is equal to the preset number of devices, the most suitable device is dynamically selected as the master device by comparing the scores determined by the master devices of each communication device, ensuring that the master role is assumed by the most suitable communication device, which is conducive to improving the overall performance and resource utilization of the low-power Bluetooth network.
[0095] Specifically, obtaining a master control device corresponding to a communication device based on the number of other communication devices that directly communicate with the communication device in the current low-power Bluetooth network, the power of the current communication device, and the RSSI signal strength of the current communication device to determine the score includes the following steps S0011-S0014:
[0096] S0011. Obtain the current device connection quantity E corresponding to the communication device, where E is the quantity of other communication devices that directly communicate with the communication device in the current low-power Bluetooth network.
[0097] S0012. According to the preset power score mapping list F, obtain the current power score G corresponding to the communication device, where F = {F 1 , F 2 , ..., F i , ..., F m}, F i =(F i1 , F i2 ), F i is the i-th preset power score mapping combination, i ranges from 1 to m, m is the number of preset power score mapping combinations, F i1 F i The preset power interval in F i2 F i1 The corresponding preset power score, when F i11 ≤H≤F i12 When F i1 As G, where F i11 F i1 The minimum value, F i12 F i1 The maximum value of H is the current power of the communication device; in a specific embodiment, the preset power score mapping list is a list pre-set by technicians in this field according to actual needs, which will not be repeated here.
[0098] Specifically, F i12 <F (i+1)11 , F i2 =F (i+1)2 -1, F (i+1)11 F (i+1)1 The minimum value, F (i+1)1 F i+1 The preset power interval in F i+1 is the i+1th preset power score mapping combination, F (i+1)2 F (i+1)1 The corresponding preset power score.
[0099] S0013. According to the preset RSSI signal strength score mapping list R, obtain the current RSSI signal strength score J corresponding to the communication device, where R = {R 1 , R 2 , ..., R j , ..., R n}, R j =(R j1 , R j2 ), Rj is the jth preset RSSI signal strength score mapping combination, where j ranges from 1 to n, and n is the number of preset RSSI signal strength score mapping combinations. j1 For R j The preset RSSI signal strength interval, R j2 For R j1 The corresponding preset RSSI signal strength score, when R j11 <K≤R j12 When R j2 As J, where R j11 For R j1 The minimum value, R j12 For R j1 The maximum value of K is the current RSSI signal strength of the communication device. In a specific embodiment, the preset RSSI signal strength score mapping list is a list preset by those skilled in the art according to actual needs, which will not be repeated here.
[0100] Specifically, R j12 <R (j+1)11 , R j2 =R (j+1)2 -1, R (j+1)11 For R (j+1)1 The minimum value, R (j+1)1 For R j+1 The preset RSSI signal strength interval, R j+1 is the j+1th preset RSSI signal strength score mapping combination, R (j+1)2 For R (j+1)1 The corresponding preset RSSI signal strength score.
[0101] S0014. Obtain the master control device corresponding to the communication device based on E, G and J to determine the score FZ, which meets the following conditions:
[0102] FZ=E+G+J.
[0103] Specifically, F m2 =R n2 = ZD, ZD is the maximum number of valid communication connections that the communication device can maintain simultaneously, F m2 F m1 The corresponding preset power score, F m1 F m The preset power interval in F m is the mth preset power score mapping combination, R n2 For R n1 The corresponding preset RSSI signal strength score, R n1 For R n The preset RSSI signal strength interval, Rn It is the nth preset RSSI signal strength score mapping combination.
[0104] Specifically, F 12 =R 12 =0, F 12 F 11 The corresponding preset power score, F 11 F 1 The preset power interval in F 1 is the first preset power score mapping combination, R 12 For R 11 The corresponding preset RSSI signal strength score, R 11 For R 1 The preset RSSI signal strength interval, R 1 It is the first preset RSSI signal strength score mapping combination.
[0105] Specifically, the greater the master device determination score corresponding to the communication device is, the greater the possibility that the communication device is the master device of the low-power Bluetooth network.
[0106] Through the above steps, the master device determination score corresponding to the communication device is obtained according to the current number of device connections, the current power score and the current RSSI signal strength score of the communication device, providing a more comprehensive evaluation standard to ensure that the selection of the master device is not only based on a single factor, but takes multiple factors into consideration, providing a more accurate basis for selecting the master device, and selecting the communication device corresponding to the largest master device determination score as the master device, which can be understood as: selecting a communication device with a larger power supply, a larger RSSI signal strength and a larger number of other communication devices that directly communicate with the communication device as the master device; which is conducive to improving the connectivity and stability of the low-power Bluetooth network.
[0107] In a specific embodiment, the method further comprises the following steps to obtain F 11 , F 21 , ..., F i1 , ..., F m1 :
[0108] Get the preset power usage time mapping list L = {L 1 , L 2 , ..., L e , ..., L f}, L e =(L e1 , L e2 ), where L e is the e-th preset power usage duration mapping combination, where the value of e ranges from 1 to f, and f is the number of preset power usage duration mapping combinations. e1is the e-th preset power, L e2 The power of the communication equipment is L e1 The estimated length of time that the communication equipment can continue to be used.
[0109] Specifically, L e <L e+1 , L e+1 This is the e+1th preset power level.
[0110] When L (e-1)2 <M<L e2 When F m11 =L e1 , let F m12 =100, where L (e-1)2 The power of the communication equipment is L (e-1)1 The estimated time that the communication equipment can continue to be used, L (e-1)1 is the e-1th preset power, F m11 F m1 The minimum value, F m12 F m1 The maximum value of M is the duration between the current time point and the end time point of the low-power Bluetooth network use. In a specific application scenario, the end time point of the low-power Bluetooth network use can be understood as the end time point of the voyage, and M can be understood as the remaining time of the voyage; for example: if there are still 120 minutes before the end of the low-power Bluetooth network use, then the value of M is 120; if there are still 120 minutes left in the voyage, then the value of M is 120.
[0111] The closed interval [0, F m11 -1] is divided into F m2 -1 closed interval as F 11 , F 21 , ..., F i1 , ..., F (m-1)1 , wherein those skilled in the art know that any method of dividing a closed interval into a plurality of closed intervals in the prior art, for example: average division, falls within the protection scope of the present invention, and will not be described in detail here.
[0112] Through the above steps, the preset power range in the preset power score mapping combination is determined according to the preset power, the estimated length of time the communication device can continue to be used, and the length of time between the current time point and the end time point of the use of the low-power Bluetooth network. The preset power range can be flexibly determined according to actual conditions, which is conducive to improving the accuracy of determining the preset power range.
[0113] In a specific embodiment, the method includes the following steps S100-S600:
[0114] S100, if the device is a master control device of the low-power Bluetooth network and the low-power Bluetooth network has been optimized, in response to a new communication device joining the low-power Bluetooth network, obtaining a DQ;
[0115] S200, when Q>ZK, obtain Q cluster core devices, when Q≤ZK, do not perform any processing, where Q is the device multiple value, ZK is the number of master control devices in the current low-power Bluetooth network, and Q meets the following conditions:
[0116] Q = floor (DQ / YS), floor () is a floor rounding function;
[0117] S300. The identity identifiers corresponding to the Q clustering core devices are respectively used as the Q cluster centers in the k-means clustering algorithm, and the total communication quality weight between the communication device in the low-power Bluetooth network and the clustering core devices corresponding to the cluster centers is used as the distance between the identity identifier of the communication device and the cluster center, and the identity identifiers of all communication devices in the current low-power Bluetooth network are clustered based on the k-means clustering algorithm to obtain Q clusters, each cluster including several clustering identity identifiers.
[0118] Specifically, in step S300, several discrete identity tags are obtained while obtaining Q clusters.
[0119] Specifically, a discrete identity can be understood as an identity that is not clustered among the identities of all communication devices in the Bluetooth low energy network.
[0120] S400: Using a network formed by communication devices corresponding to all clustering identities in a single cluster as a single low-power Bluetooth sub-network to obtain Q low-power Bluetooth sub-networks.
[0121] Specifically, the method also includes: sending full connection information to the communication device corresponding to the discrete identity identifier, so that when the communication device corresponding to the discrete identity identifier receives the full connection information, it maintains a communication connection relationship with all other communication devices in the low-power Bluetooth network that can establish a communication connection with it.
[0122] S500. When it is a cluster core device, it sets itself as the master device of the low-power Bluetooth sub-network where it is located, and sends master device confirmation information to other cluster core devices, so that when other cluster core devices receive the master device confirmation information, they set themselves as the master device of the low-power Bluetooth network and also set themselves as the master device of the low-power Bluetooth sub-network where they are located; when it is not a cluster core device, it sets itself as a non-master device of the low-power Bluetooth network, and sends master device confirmation information to all cluster core devices, so that when other cluster core devices receive the master device confirmation information, they set themselves as the master device of the low-power Bluetooth network and also set themselves as the master device of the low-power Bluetooth sub-network where they are located.
[0123] S600. When it is the master control device of the low-power Bluetooth sub-network, the low-power Bluetooth sub-network is optimized according to the initial routing table corresponding to the low-power Bluetooth sub-network, wherein the initial routing table corresponding to the low-power Bluetooth sub-network records the communication connection relationship between each communication device in the low-power Bluetooth sub-network and all other communication devices, wherein the low-power Bluetooth sub-network is optimized according to the initial routing table corresponding to the low-power Bluetooth sub-network in the same manner as that of optimizing the low-power Bluetooth network according to the initial routing table corresponding to the low-power Bluetooth sub-network in steps S21-S23.
[0124] Through the above steps, if it is the master device of the low-power Bluetooth network and the low-power Bluetooth network has been optimized, then in response to a new communication device joining the low-power Bluetooth network, the current number of devices is obtained, and the device multiplier value is obtained according to the current number of devices. When the device multiplier value is greater than the number of master devices in the current low-power Bluetooth network, the clustering core device is determined, and the identity identifiers of all communication devices in the low-power Bluetooth network are clustered based on the k-means algorithm to obtain the cluster corresponding to each clustering core device. The network composed of the communication devices corresponding to all clustering identities in a single cluster is used as a single low-power Bluetooth sub-network, and the clustering core device is set as the master device of the low-power Bluetooth network and the low-power Bluetooth sub-network. When When it is the master device of a low-power Bluetooth sub-network, it optimizes the low-power Bluetooth sub-network according to the initial routing table corresponding to the low-power Bluetooth sub-network. It optimizes only when a new communication device is added and the device multiplier value is greater than the number of master devices in the current low-power Bluetooth network, thus avoiding the waste of resources caused by frequent optimization. When optimizing the low-power Bluetooth network, it uses the k-means algorithm to dynamically divide the network according to the communication quality weights between communication devices to obtain several low-power Bluetooth sub-networks. It can flexibly respond to changes in network topology and can optimize the low-power Bluetooth sub-networks at the same time, so it can quickly complete the optimization of the low-power Bluetooth network, which is beneficial to improving the performance and optimization efficiency of the low-power Bluetooth network.
[0125] Specifically, step S200 also includes the following steps S210-S270 to obtain Q cluster core devices:
[0126] S210. Obtain a master control device determination score corresponding to each communication device in the current low-power Bluetooth network, wherein the master control device determination score corresponding to the communication device is obtained based on the number of other communication devices that directly communicate with the communication device in the current low-power Bluetooth network, the power of the current communication device, and the RSSI signal strength of the current communication device.
[0127] S220, select Q from all communication devices in the current low-power Bluetooth network in descending order of the scores determined by the master control device. 0 A communication device is selected as the first candidate device, Q 0 Determine the number of devices to be selected, Q 0 Meet the following conditions: Q 0 =2×Q.
[0128] S230, obtain a second list of device identification combinations to be selected T = {T 1 , T 2 , ..., T g , ..., T h}, T g is the gth second device identification combination to be selected, the value of g ranges from 1 to h, h is the number of second device identification combinations to be selected, T g The second device identifier to be selected includes Q second device identifiers, where the second device identifier to be selected is the identity identifier of the second device to be selected, wherein Q 0 Q first to-be-selected devices are randomly selected from the first to-be-selected devices as second to-be-selected devices corresponding to the Q second to-be-selected device identifiers in a second to-be-selected device identifier combination.
[0129] S240, from T g Select any two second candidate device identifiers as T g The two third candidate device identifiers in a corresponding third candidate device identifier combination are used to obtain T g The corresponding third candidate device identification combination list U g = {U g1 , U g2 , ..., U gr , ..., U gs}, where U gr T g The corresponding rth third candidate device identification combination, r is from 1 to s, s is T g The corresponding third device identification combination to be selected, the third device identification to be selected is the identity identification of the third device to be selected.
[0130] S250, Get U gr The total communication quality weight W between the third candidate devices corresponding to the two third candidate device identifiers in gr .
[0131] S260, according to W gr Get T g The corresponding second intermediate weight N g , N g Meet the following conditions:
[0132] N g =∑ s r=1 W gr .
[0133] S270, N 1 , N 2 , ..., N g , ..., N h The second to-be-selected devices corresponding to the Q second to-be-selected device identifiers in the second to-be-selected device identifier combination list corresponding to the largest second intermediate weight are used as Q clustering core devices.
[0134] Through the above steps, the master control device determination score corresponding to each communication device in the current low-power Bluetooth network is obtained, the first candidate device is determined according to the master control device determination score, and the second candidate device identification combination list is obtained based on the first candidate device. Further, the third candidate device identification combination corresponding to the second candidate device identification combination is obtained, and the total communication quality weight between the third candidate devices corresponding to the two third candidate device identifications in the third candidate device identification combination is obtained. Further, the second intermediate weight corresponding to the second candidate device identification combination is obtained, and the second candidate device corresponding to the second candidate device identification in the second candidate device identification combination list corresponding to the largest second intermediate weight among all second candidate device identification combinations is used as the clustering core device, thereby ensuring that the clustering core device finally selected not only has a higher master control device determination score, but also has the best communication quality.
[0135] Specifically, step S250 includes the following steps S251-S254:
[0136] S251, if U gr The two third candidate devices corresponding to the two third candidate device identifiers in the two third candidate devices communicate directly, and the total weight of the communication quality of the two third candidate devices is taken as W gr , wherein the total communication quality weights of the two third candidate devices are obtained in the same manner as that of obtaining the total communication quality weights of the two communication devices corresponding to the nodes at both ends of the edge in steps S211-S215.
[0137] S252, if U gr The two third to-be-selected devices corresponding to the two third to-be-selected device identifiers in the indirect communication are used as U gr A fourth candidate device identifier in a corresponding fourth candidate device identifier list is used to obtain U gr The corresponding fourth candidate device identification list set V gr = {V gr1 , V gr2 , ..., V grx , ..., V grp},V grx = {V grx1 , V grx2 , ..., V grxy , ..., V grxq},V grx For U gr The corresponding xth fourth candidate device identification list, x ranges from 1 to p, p is U gr The number of the corresponding fourth candidate device identification list, V grxy V grx The yth fourth device to be selected identifier in the fourth device to be selected identifier list, where y ranges from 1 to q, and q is the number of fourth device to be selected identifiers in the fourth device to be selected identifier list.
[0138] Specifically, indirect communication means that two communication devices need to communicate through one or more other communication devices that act as relays; for example: if communication device 1 and communication device 2 communicate through communication device 3, communication device 4 and communication device 5, then communication device 1 and communication device 2 communicate indirectly, and communication device 3, communication device 4 and communication device 5 act as relays in the indirect communication process.
[0139] Specifically, V grxy The corresponding fourth candidate device and V grx(y+1) The corresponding fourth candidate device directly communicates, V grx(y+1) V grx The y+1th fourth device identifier to be selected.
[0140] S253, Get V grx The corresponding first intermediate weight V 0 grx , V 0 grx Meet the following conditions:
[0141] V 0 grx =∑ q-1 y=1 V 1grxy , V 1 grxy V grxy The corresponding fourth candidate device and V grx(y+1) The total communication quality weight of the fourth candidate device corresponding to the node at both ends of the edge is obtained in the same manner as in steps S211-S215 to obtain the total communication quality weight of the two communication devices corresponding to the nodes at both ends of the edge, to obtain V grxy The corresponding fourth candidate device and V grx(y+1) The corresponding total weight of the communication quality of the fourth candidate device.
[0142] S254, V 0 grx1 , V 0 grx2 , ..., V 0 grxy , ..., V 0 grxq The smallest first intermediate weight is W gr .
[0143] Through the above steps, if the two third to be selected devices corresponding to the two third to be selected device identifiers in the third to be selected device identifier combination communicate directly, the total communication quality weight of the two third to be selected devices is used as the total communication quality weight between the two third to be selected devices; if the two third to be selected devices corresponding to the two third to be selected device identifiers in the third to be selected device identifier combination communicate indirectly, a fourth to be selected device identifier list set corresponding to the third to be selected device identifier combination is obtained, and the first intermediate weight corresponding to the fourth to be selected device identifier list is obtained according to the total communication quality weight of the fourth to be selected devices corresponding to two adjacent fourth to be selected device identifiers in the fourth to be selected device identifier list, and the minimum value of the first intermediate weights corresponding to all the fourth to be selected device identifier lists is used as the total communication quality weight of the two third to be selected devices as the total communication quality weight between the two third to be selected devices, and the communication quality of each communication path is accurately quantified, providing a basis for selecting the optimal clustering core device.
[0144] In a specific embodiment, after step S600, the following steps S110-S160 are also included:
[0145] S110: When the device is the master control device of the low-power Bluetooth sub-network and the low-power Bluetooth sub-network has been optimized, the low-power Bluetooth sub-network in which the device is located is used as the first sub-network, and other low-power Bluetooth sub-networks except the first sub-network are used as the second sub-network.
[0146] S120, obtain the first designated device identification list X corresponding to the first sub-network = {X 1 , X 2, ..., X a , ..., X c} and the second designated device identification list set Y corresponding to X={Y 1 , Y 2 , ..., Y a , ..., Y c},Y a = {Y a1 , Y a2 , ..., Y ab , ..., Y ad}, where X a is the ath first designated device identifier corresponding to the first sub-network, a is a value from 1 to c, c is the number of first designated device identifiers corresponding to the first sub-network, wherein the first designated device identifier is the identity identifier of the first designated device, and the first designated device is a communication device in the first sub-network that directly communicates with the communication device in the second sub-network, and Y a For X a The corresponding second specified device identification list, Y ab For X a The corresponding b-th second designated device identifier, b is from 1 to d, d is X a The number of corresponding second designated device identifiers, the second designated device identifier is the identity identifier of the second designated device, and the second designated device is a communication device in the second sub-network that directly communicates with the first designated device.
[0147] S130, X a The corresponding first specified device and Y ab The total communication quality weight of the corresponding second designated device is taken as Y ab The corresponding first specified weight is obtained by adopting the same method as that of obtaining the total communication quality weight of the two communication devices corresponding to the nodes at both ends of the edge in steps S211-S215 to obtain X a The corresponding first specified device and Y ab The corresponding communication quality weight of the second designated device.
[0148] S140: Send disconnection information to all first designated devices, so that the first designated device disconnects the communication connection with the second designated device corresponding to itself when receiving the disconnection information.
[0149] S150. The second designated device corresponding to the second designated device identifier corresponding to the minimum first designated weight is used as the third designated device, and the first designated device corresponding to the first designated device identifier corresponding to the minimum first designated weight is used as the fourth designated device corresponding to the third designated device, wherein the minimum first designated weight is the minimum value of the first designated weights corresponding to all second designated device identifiers in the list of all second designated device identifiers.
[0150] S160: Send the third designated device connection information to the fourth designated device, so that the fourth designated device establishes a communication connection with the corresponding third designated device when receiving the third designated device connection information.
[0151] Through the above steps, the first sub-network and the second sub-network are determined, and the third designated device and the fourth designated device are determined according to the first designated device in the first sub-network and the second designated device corresponding to the first designated device in the second sub-network, and a disconnection message is sent to all the first designated devices, so that the first designated device disconnects the communication connection with the second designated device corresponding to itself when receiving the disconnection message, and the third designated device connection information is sent to the fourth designated device, so that the fourth designated device establishes a communication connection with the third designated device corresponding to it when receiving the third designated device connection information, so that all communication devices in the first sub-network and all communication devices in the second sub-network can communicate indirectly only through the third designated device and the fourth designated device, thereby reducing unnecessary communication connections, thereby reducing resource consumption, and effectively improving the working efficiency and stability of the low-power Bluetooth network.
[0152] An embodiment of the present invention also provides a non-transitory computer-readable storage medium, which can be set in an electronic device to store a computer program related to a method in a method embodiment, and the computer program is loaded and executed by the processor to implement the method provided in the above embodiment.
[0153] An embodiment of the present invention further provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method provided in the above embodiment when executing the computer program.
[0154] An embodiment of the present invention further provides a computer program product, which includes program code. When the program product is run on an electronic device, the program code is used to enable the electronic device to execute the steps of the method according to various exemplary embodiments of the present invention described above in this specification.
[0155] The present invention provides a network optimization method, an electronic device and a storage medium. The method is applied to a communication device. When responding to a new communication device joining a low-power Bluetooth network, the method obtains a first stability weight corresponding to a current device identifier according to the total weight of the communication quality between the current communication device and other devices that directly communicate with the current communication device, wherein the total weight of the communication quality is used to measure the communication quality between two communication devices. The smaller the total weight of the communication quality, the better the communication quality between the two corresponding communication devices. The minimum value of all first stability weights corresponding to the current device identifier is used as the second stability weight corresponding to the current device identifier, and the number of current device identifiers whose corresponding second stability weights are less than the preset stability weight is used as the number of stable devices. When the number of current devices is not less than the preset number of devices and the number of stable devices is not less than the preset ratio of stable devices, the low-power Bluetooth network is optimized. It can be seen that the present invention realizes optimization based on the total weight of the communication quality and the number of stable devices when responding to a new communication device joining a low-power Bluetooth network, and can dynamically adjust the optimization strategy. Only when certain conditions are met, the optimization is performed, thereby avoiding unnecessary optimization, reducing resource consumption, ensuring the necessity and effectiveness of the optimization operation, reducing the impact on existing communications, and ensuring the efficient operation and stability of the low-power Bluetooth network.
[0156] Although some specific embodiments of the present invention have been described in detail by way of example, it should be understood by those skilled in the art that the above examples are only for illustration, not for limiting the scope of the present invention. It should also be understood by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention.
Claims
1. A network optimization method, characterized in that: The method is applied to a communication device, and the method comprises the following steps: S1000: If the device is a master device of a low-power Bluetooth network, in response to a new communication device joining the low-power Bluetooth network, obtain a current device identification list, wherein the current device identification list includes a plurality of current device identifications, and the current device identification is an identity identification of a communication device in the current low-power Bluetooth network; S2000, obtaining a plurality of direct communication device identifiers corresponding to each current device identifier, where the direct communication device identifier is an identity identifier of a communication device that directly communicates with the communication device corresponding to the current device identifier in the low-power Bluetooth network; S3000, taking the total communication quality weight of the communication device corresponding to the current device identifier and the communication device corresponding to the direct communication device identifier as the first stability weight corresponding to the current device identifier, the total communication quality weight is used to measure the communication quality between the two communication devices, the smaller the total communication quality weight, the better the communication quality between the corresponding two communication devices; S4000: taking the minimum value among all first stability weights corresponding to the current device identifier as the second stability weight corresponding to the current device identifier; S5000, obtaining the number of stable devices WD, where WD is the number of current device identifiers whose corresponding second stability weight is less than the preset stability weight; S6000, if DQ ≥ YS and WD ≥ WD 0 , then when the low-power Bluetooth network has not been optimized, the low-power Bluetooth network is optimized according to the initial routing table corresponding to the low-power Bluetooth network. When the low-power Bluetooth network has been optimized, the low-power Bluetooth network is optimized based on the current device identification list, where DQ is the current number of devices, that is, the number of communication devices in the current low-power Bluetooth network. The low-power Bluetooth network includes several communication devices, and the communication devices establish and maintain communication connections based on the low-power Bluetooth protocol. YS is the preset number of devices, and WD 0 is the preset stable device ratio.
2. The network optimization method according to claim 1, characterized in that: Optimizing the low-power Bluetooth network according to the initial routing table corresponding to the low-power Bluetooth network includes the following steps S21-S23: S21. Construct an initial network connection relationship graph corresponding to the low-power Bluetooth network according to the initial routing table corresponding to the low-power Bluetooth network, wherein the initial network connection relationship graph includes a plurality of nodes and edges, wherein the nodes represent communication devices in the low-power Bluetooth network, and the edges represent direct communication between two communication devices corresponding to the nodes at both ends of the edge, and each edge is attached with a total communication quality weight of the two communication devices corresponding to the nodes at both ends of the edge; S22, copying the initial network connection relationship graph as the historical network connection relationship graph, and using the minimum spanning tree corresponding to the initial network connection relationship graph as the new initial network connection relationship graph so as to update the initial network connection relationship graph, wherein the minimum spanning tree corresponding to the initial network connection relationship graph contains all nodes in the initial network connection relationship graph and edges connecting these nodes, and the sum of the total communication quality weights attached to all edges is the smallest; S23. Generate an intermediate routing table based on the new initial network connection relationship diagram and send the intermediate routing table to all communication devices except itself in the low-power Bluetooth network, so that the communication device that receives the intermediate routing table determines whether to disconnect the communication connection between itself and other communication devices based on the communication connection relationship recorded in the intermediate routing table, so as to optimize the low-power Bluetooth network. At the same time, the intermediate routing table is used as the initial routing table corresponding to the low-power Bluetooth network, wherein the intermediate routing table records the communication connection relationship between the communication devices corresponding to each node in the initial network connection relationship diagram.
3. The network optimization method according to claim 2, characterized in that: Step S21 includes the following steps S211-S215 to obtain the total weight of the communication quality of the two communication devices corresponding to the nodes at both ends of the edge: S211, using two communication devices corresponding to the nodes at both ends of the edge as the first initial device and the second initial device respectively; S212, obtaining a first power level, a first RSSI signal strength, a second power level, and a second RSSI strength, wherein the first power level is the power level of the first initial device, the first RSSI signal strength is the RSSI signal strength of the first initial device, the second power level is the power level of the second initial device, and the second RSSI signal strength is the RSSI signal strength of the second initial device; S213. According to the first preset weight influence value mapping list, obtain a first power weight influence value corresponding to the first power and a second power weight influence value corresponding to the second power, wherein the first preset weight influence value mapping list includes a plurality of preset power intervals and first preset weight influence values corresponding to the preset power intervals, and when the first power belongs to a preset power interval, the first preset weight influence value corresponding to the preset power interval to which the first power belongs is used as the first power weight influence value corresponding to the first power, and when the second power belongs to a preset power interval, the first preset weight influence value corresponding to the preset power interval to which the second power belongs is used as the second power weight influence value corresponding to the second power; S214. According to the second preset weight influence value mapping list, obtain a first RSSI signal strength weight influence value corresponding to the first RSSI signal strength and a second RSSI signal strength weight influence value corresponding to the second RSSI signal strength, wherein the second preset weight influence value mapping list includes a plurality of preset RSSI signal strength intervals and second preset weight influence values corresponding to the preset RSSI signal strength intervals; when the first RSSI signal strength belongs to a preset RSSI signal strength interval, the second preset weight influence value corresponding to the preset RSSI signal strength interval to which the first RSSI signal strength belongs is used as the first RSSI signal strength weight influence value corresponding to the first RSSI signal strength; when the second RSSI signal strength belongs to a preset RSSI signal strength interval, the second preset weight influence value corresponding to the preset RSSI signal strength interval to which the second RSSI signal strength belongs is used as the second RSSI signal strength weight influence value corresponding to the second RSSI signal strength; S215. The sum of the communication quality weight corresponding to the first initial device and the communication quality weight corresponding to the second initial device is used as the total communication quality weight representing the communication quality between the first initial device and the second initial device, wherein the communication quality weight corresponding to the first initial device is the difference between the preset communication quality weight and the first power weight influence value and the first RSSI signal strength weight influence value, and the communication quality weight corresponding to the second initial device is the difference between the preset communication quality weight and the second power weight influence value and the second RSSI signal strength weight influence value.
4. The network optimization method according to claim 3, characterized in that: The preset communication quality weight used to obtain the communication quality weight corresponding to the first initial device is the same as the preset communication quality weight used to obtain the communication quality weight corresponding to the second initial device.
5. The network optimization method according to claim 3, characterized in that: In step S3000, the total communication quality weight of the communication device corresponding to the current device identifier and the communication device corresponding to the direct communication device identifier are obtained in the same manner as in steps S211-S215.
6. The network optimization method according to claim 1, characterized in that: In step S6000, optimizing the low-power Bluetooth network based on the current device identification list includes the following steps S11-S13: S11, obtaining a target device identification list and a target optimization time point, wherein the target device identification list includes a plurality of target device identifications, the target optimization time point is the time point when the low-power Bluetooth network was most recently optimized, and the target device identification is the identity identification of the communication device in the low-power Bluetooth network at the target optimization time point; S12, taking a symmetric difference set of the current device identification list and the target device identification list as an intermediate device identification list, wherein the intermediate device identification list includes a plurality of intermediate device identifications; S13, when ZJ>YS 0 Or when A / B>C, the low-power Bluetooth network is optimized according to the initial routing table corresponding to the low-power Bluetooth network, where ZJ is the time difference between the current time point and the target optimization time point, and YS 0 is the preset time difference, A is the number of intermediate device identifiers in the intermediate device identifier list, B is the number of current device identifiers in the current device identifier list, and C is the preset device quantity change ratio.
7. The network optimization method according to claim 1, characterized in that: In a low-power Bluetooth network, when a new communication device joins the low-power Bluetooth network, the new communication device maintains a communication connection relationship with all other communication devices that can establish a communication connection with it.
8. The network optimization method according to claim 7, characterized in that: The maintained communication connection relationship will be stored in the initial routing table corresponding to the low-power Bluetooth network.
9. A non-transitory computer-readable storage medium, characterized in that: The storage medium stores a computer program, which is loaded and executed by a processor to implement the network optimization method according to any one of claims 1 to 8.
10. An electronic device comprising: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the network optimization method according to any one of claims 1 to 8 when executing the computer program.