A method for networking lamps
Through light intensity perception and Q-learning routing decisions, the coverage and connection problems of lamp networking in poor signal environments are solved, and efficient and stable lamp network topology and data transmission are achieved.
Patent Information
- Application Number
- CN202411486334.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2044-10-23
AI Technical Summary
The existing lamp networking scheme is difficult to efficiently form a network in environments such as large-scale indoor spaces, especially basements, such as poor network signals, such as limited signal coverage, unstable network connections and difficult network maintenance.
Through light intensity perception and data preprocessing, a sequence of light intensity changes is extracted, a light intensity characteristic vector is generated, a time difference calculation of light intensity changes and multi-path effect recognition is carried out, a node relative position matrix is constructed, an initial connection relationship is established, the network topology is optimized, and a dynamic routing update is used to use Q-learning routing decisions to realize the networking of lamps.
Build an accurate lamp network topology in complex environments to improve data transmission efficiency and reliability, reduce delay and network congestion, and achieve efficient and stable lamp networking.
Smart Images

Figure CN119402988B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of wireless networks, and particularly to a method for networking lamps. Background Art
[0002] Existing lamp networking solutions mainly rely on traditional wireless communication technologies such as WiFi, Bluetooth, and Zigbee. In the face of large-scale indoor spaces, especially environments with poor network signals such as basements, it is often difficult to form a network efficiently. In scenarios with poor network signals such as large-scale indoor areas, traditional lamp networking technologies face the following challenges:
[0003] Limited signal coverage: Basements often have a vast and complex structure. The walls and metal structures severely block wireless signals, resulting in limited signal coverage of WiFi, Bluetooth, etc., and it is difficult to achieve stable connection of all lamps.
[0004] Unstable network connection: Even if weak signals can be received in some areas, they are easily interfered by the environment, resulting in intermittent network connections and affecting the normal control of lamps.
[0005] Difficult network setup and maintenance: Due to poor signal quality, lamps will frequently drop off the network, and it is necessary to reconfigure or add relay devices, increasing the difficulty of network setup and maintenance. Summary of the Invention
[0006] Based on this, it is necessary to provide a method for networking lamps to solve at least one of the above technical problems.
[0007] To achieve the above object, a method for networking lamps includes the following steps:
[0008] Step S1: Perform light intensity perception through lamps and extract a sequence of light intensity change amounts to obtain a sequence of light intensity change amounts; generate a light intensity feature vector based on the sequence of light intensity change amounts to obtain a light intensity feature vector;
[0009] Step S2: Calculate the time difference of light intensity changes based on the light intensity feature vector to obtain a time difference matrix of light intensity changes; identify multipath effects on the time difference matrix of light intensity changes and suppress the path effects to obtain multipath effect suppression data; construct a node relative position matrix based on the multipath effect suppression data to obtain a node relative position matrix;
[0010] Step S3: Establish an initial connection relationship based on the node relative position matrix to obtain initial network connection relationship data; construct a topological structure based on the initial network connection relationship data and optimize the topological structure to obtain a network topology graph;
[0011] Step S4: Calculate routing evaluation metrics based on the network topology diagram to obtain routing evaluation metric data; use the pre-trained Q-learning routing decision model and the routing evaluation metric data to perform Q-learning routing decision and dynamic routing update to obtain a dynamic routing table;
[0012] Step S5: Analyze the network status based on the dynamic routing table to obtain network status analysis result data; perform node networking control processing according to the network status analysis result data to implement the lamp networking operation.
[0013] Through light intensity perception, data preprocessing, extraction of light intensity change amount sequences, pattern analysis, and generation of feature vectors, the present invention can effectively identify the unique light change patterns of each lamp, convert them into quantifiable feature vectors, provide a reliable basis for subsequent node identification, positioning, and networking, and overcome the problem that traditional wireless communication technologies are vulnerable to environmental interference. Through feature vector broadcasting, neighbor node screening, calculation of light intensity change time difference, identification and suppression of multipath effects, calculation of initial relative position, and optimization by the least squares method, precise positioning of lamp nodes is achieved. Even in complex environments, an accurate relative position matrix of nodes can be constructed, laying a foundation for subsequent construction of a reliable network topology. Through visualization of node relative positions, triangulation, construction of a minimum spanning tree, communication range constraint, calculation of node centrality, and load balancing adjustment, an efficient, reliable, and balanced lamp network topology is constructed. This structure can adapt to the communication limitations of the actual environment and effectively balance the node load, laying a foundation for subsequent network communication and management. Through maintenance of neighbor node information, greedy forwarding, link state information exchange, multipath routing search, calculation of routing evaluation metrics, and Q-learning routing decision-making, a dynamic routing mechanism based on Q-learning is achieved. This mechanism can adaptively select the optimal routing path according to changes in the network state, improving data transmission efficiency, reliability, and network resource utilization. Through real-time collection of network performance metrics, data aggregation, parameter optimization, fuzzy logic reasoning, and issuance of control instructions, a lamp networking control mechanism based on prediction and feedback is achieved. This mechanism can dynamically adjust network parameters and routing strategies according to changes in the network state, optimize network performance, improve data transmission efficiency and reliability, and ensure the stable operation of the network. Therefore, the present invention provides a lamp and a lamp networking method to solve the problem that it is difficult to efficiently network traditional lamps in scenarios with poor network signals such as large-scale indoor areas. By introducing a high-precision light intensity sensor array and a dynamic routing decision-making mechanism based on Q-learning, the performance of lamps in large-scale indoor environments (such as areas with poor network signals like basements) is significantly improved. First, the light intensity sensor can monitor environmental light changes in real time and accurately generate light intensity feature vectors to ensure that the lamp automatically adjusts according to the actual light conditions. Second, by calculating the light intensity change time difference and suppressing multipath effects, signal interference is effectively reduced and communication stability is enhanced. In addition, the dynamic routing update mechanism adaptively adjusts the communication path according to the real-time network state, optimizes data transmission, reduces latency and network congestion, and finally achieves efficient and stable lamp networking, improving the user experience.
[0014] Preferably, step S1 includes the following steps:
[0015] Step S11: Collect light intensity data through the light intensity sensor array of the lamp to obtain the original light intensity data; perform data preprocessing on the original light intensity data to obtain the preprocessed light intensity data;
[0016] Step S12: Establish an ambient light intensity baseline based on the preprocessed light intensity data to obtain an ambient light intensity baseline value;
[0017] Step S13: Extract a light intensity change amount sequence from the preprocessed light intensity data and the ambient light intensity baseline value to obtain a light intensity change amount sequence;
[0018] Step S14: Analyze the light intensity change pattern of the light intensity change amount sequence to obtain light intensity change pattern data;
[0019] Step S15: Generate a light intensity feature vector according to the light intensity change pattern data to obtain a light intensity feature vector.
[0020] The present invention collects original light intensity data through a light intensity sensor array and performs data preprocessing, which can effectively remove the influence of high-frequency noise and environmental light fluctuations, obtain more accurate and stable light intensity data, and lay a foundation for subsequent light intensity change analysis and feature extraction. Establishing an ambient light intensity baseline can eliminate the interference of ambient light intensity changes on the light intensity changes of the lamp itself, more accurately extract the light intensity change information of the lamp itself, and improve the accuracy of light intensity change pattern recognition. Extracting the light intensity change amount sequence can convert the light intensity data into a sequence that more intuitively represents the light intensity changes of the lamp itself, making it more convenient for subsequent light intensity change pattern analysis and feature extraction. Analyzing the light intensity change pattern of the light intensity change amount sequence can identify different light intensity change patterns of the lamp, such as flashing, gradual change, periodic change, etc., and provide a basis for generating unique identification information for each lamp. Generating a light intensity feature vector according to the light intensity change pattern data can convert the light intensity change information of the lamp into a quantifiable feature vector, providing a basis for subsequent node identification, positioning, and networking.
[0021] Preferably, step S2 includes the following steps:
[0022] Step S21: Broadcast and receive the feature vector of the light intensity feature vector through the lamp to obtain the node light intensity feature vector;
[0023] Step S22: Screen potential neighbor nodes from the node light intensity feature vector to obtain potential neighbor nodes; calculate the light intensity change time difference for the potential neighbor nodes to obtain a light intensity change time difference matrix;
[0024] Step S23: Estimate the initial distance between nodes according to the light intensity change time difference matrix to obtain an initial distance value between nodes;
[0025] Step S24: Identify the multipath effect of the light intensity change time difference matrix and suppress the path effect to obtain multipath effect suppression data;
[0026] Step S25: Calculate the initial relative position based on the initial node distance value and the multipath effect suppression data to obtain the node relative position data;
[0027] Step S26: Optimize the node relative position data by the least squares method to obtain the optimized node relative position data; construct a node relative position matrix based on the optimized node relative position data to obtain the node relative position matrix.
[0028] In the present invention, through the broadcast and reception of light intensity feature vectors, each lamp can sense the presence of other lamps around it and obtain their feature vector information, providing a data basis for subsequent neighbor node screening and distance estimation. By screening potential neighbor nodes through feature vector similarity measurement, nodes that are far away or have significantly different light intensity change patterns can be effectively excluded, improving the efficiency and accuracy of subsequent distance estimation and positioning. At the same time, calculate the time difference of light intensity changes between potential neighbor nodes, providing necessary data for subsequent distance estimation and multipath effect suppression. Estimate the initial distance between nodes based on the time difference of light intensity changes and the speed of light, providing an initial reference value for subsequent node positioning and distance information for multipath effect suppression. By identifying and suppressing the multipath effect on the time difference matrix of light intensity changes, the influence of multipath propagation on the accuracy of distance estimation and positioning can be effectively reduced, improving the estimation accuracy of the relative position of nodes and laying a foundation for constructing a more accurate network topology map. According to the initial node distance value and the data after multipath effect suppression, use the trilateration algorithm to calculate the initial relative position of the nodes, providing an initial value for subsequent least squares optimization. Optimizing the initial relative position data by the least squares method can further improve the estimation accuracy of the relative position of nodes and construct a node relative position matrix, providing accurate node position information for subsequent construction of the network topology structure.
[0029] Preferably, calculating the time difference of light intensity changes for potential neighbor nodes includes the following steps:
[0030] Calculate the light intensity change rate for potential neighbor nodes to obtain a light intensity change rate sequence;
[0031] Calculate the cross-correlation function based on the light intensity change rate sequence to obtain the cross-correlation function;
[0032] Search for the maximum peak of the cross-correlation function to obtain the maximum peak;
[0033] Construct a time difference matrix based on the maximum peak to obtain the time difference matrix of light intensity changes.
[0034] By calculating the light intensity change rate, the present invention can amplify the detailed changes in the light intensity signal and improve the sensitivity of time difference calculation. Especially when the light intensity change is relatively gentle, it can more accurately capture the differences in light intensity changes. Calculating the correlation of two sequences of light intensity change rates using the cross-correlation function can effectively eliminate noise interference and extract the time delay information between the two signals. Even in the presence of certain noise, the time difference can be accurately calculated. Searching for the maximum peak in the cross-correlation function can determine the most matching time delay between the two light intensity change signals, that is, the most likely true time difference, thereby improving the accuracy of time difference calculation. Constructing a matrix of the time differences of light intensity changes between all potential neighbor nodes can facilitate subsequent operations such as distance estimation and multipath effect suppression, providing a necessary data basis for constructing the network topology structure.
[0035] Preferably, step S24 includes the following steps:
[0036] Step S241: Analyze the multipath signal characteristics of the matrix of time differences of light intensity changes to obtain the multipath signal characteristics;
[0037] Step S242: Estimate the azimuth of the time difference of the signal source based on the multipath signal characteristics to obtain the signal source azimuth data; estimate the angle of arrival of the signal based on the multipath signal characteristics to obtain the signal arrival angle data;
[0038] Step S243: Separate the multipath signals according to the signal arrival angle data and the signal source azimuth data to obtain a multipath signal set;
[0039] Step S244: Identify the line-of-sight path of the multipath signal set according to the multipath signal characteristics and classify the line-of-sight path signals to obtain the line-of-sight path signals and non-line-of-sight path signals;
[0040] Step S245: Suppress the non-line-of-sight path signals to obtain non-line-of-sight path suppression data; estimate the distance of the line-of-sight path according to the line-of-sight path signals to obtain the line-of-sight path distance data;
[0041] Step S246: Suppress the multipath effect on the line-of-sight path distance data according to the non-line-of-sight path suppression data to obtain the multipath effect suppression data.
[0042] By analyzing the multi-path signal characteristics of the optical intensity change time difference matrix, the present invention can identify node pairs that may have multi-path effects, and extract the characteristic information of the multi-path signals, such as the standard deviation of the time difference, the variation law, etc., providing a basis for subsequent multi-path effect suppression. According to the multi-path signal characteristics, the MUSIC algorithm and the TDOA technology are used to estimate the time difference azimuth of the signal source and the angle of arrival of the signal respectively, and the spatial position information of the multi-path signals can be obtained, providing a direction for subsequent multi-path signal separation. According to the angle of arrival of the signal and the azimuth of the signal source, the beamforming technology is used to separate the multi-path signals, which can effectively distinguish signals from different directions, and separate the mixed multi-path signals into multiple independent signals, providing a clearer signal for subsequent line-of-sight path identification and suppression. According to the characteristics of the multi-path signals, such as intensity, signal-to-noise ratio, time difference stability, etc., the line-of-sight path signals and non-line-of-sight path signals can be identified, and reliable signals less affected by the multi-path effect can be distinguished, providing more accurate data for subsequent distance estimation. Suppressing the non-line-of-sight path signals can reduce the influence of the multi-path effect on distance estimation, and the line-of-sight path distance can be estimated according to the line-of-sight path signals, obtaining an estimated value closer to the true distance. According to the result after non-line-of-sight path suppression, multi-path effect suppression is performed on the line-of-sight path distance data, which can further improve the accuracy of distance estimation, obtain more reliable distance information, and provide more accurate data support for subsequent node positioning and network topology construction.
[0043] Preferably, step S3 includes the following steps:
[0044] Step S31: Visualize the relative position matrix of the nodes to obtain a node distribution map; perform triangulation on the node distribution map to obtain triangulation data;
[0045] Step S32: Establish an initial connection relationship according to the triangulation data to obtain initial network connection relationship data; construct a minimum spanning tree according to the initial network connection relationship data to obtain minimum spanning tree data;
[0046] Step S33: Obtain the actual communication range data of the lamps; perform communication range constraint on the minimum spanning tree data according to the actual communication range data of the lamps to obtain node network constraint data;
[0047] Step S34: Calculate the node degree centrality of the node network constraint data to obtain node degree centrality data; calculate the node betweenness centrality of the node network constraint data to obtain node betweenness centrality data;
[0048] Step S35: Adjust the load balance according to the node degree centrality data and the node betweenness centrality data to obtain load balance adjustment data;
[0049] Step S36: Optimize the topological structure of the node network constraint data according to the load balancing adjustment data and generate a network topology graph to obtain the network topology graph.
[0050] In the present invention, by visualizing the node relative position matrix, the distribution of nodes can be intuitively understood, providing a reference for subsequent network topology construction. Triangulation divides the node distribution into multiple adjacent triangles, providing a basis for the establishment of the initial connection relationship. Establishing the initial connection relationship according to the triangulation data can quickly generate an initial network structure connecting all nodes. On this basis, constructing a minimum spanning tree can remove redundant connections, retain the shortest path connecting all nodes, improve network communication efficiency, and provide a basis for subsequent topology optimization. Constraining the minimum spanning tree according to the actual communication range of the lamps, deleting the connections beyond the communication range, ensures that the generated network topology structure is feasible in the actual environment, avoiding the situation of unreliable connections due to too long communication distance. Calculating the degree centrality and betweenness centrality of nodes can quantitatively evaluate the importance and load of each node in the network, providing a basis for subsequent load balancing adjustment. Adjusting the load balance according to the node centrality can transfer the connection relationships of some high-load nodes to low-load nodes, avoiding local congestion in the network, and improving the overall performance and stability of the network. Generating the final network topology graph according to the result of the load balance adjustment can intuitively display the connection relationship and node load of the network, facilitating users to understand the network structure, and providing a basis for subsequent routing decision-making and network management.
[0051] Preferably, step S4 includes the following steps:
[0052] Step S41: Maintain the neighbor node information according to the network topology graph to obtain a neighbor node information table; calculate the relative position of the target node according to the neighbor node information table to obtain the relative position data of the target node;
[0053] Step S42: Select greedy forwarding candidate nodes according to the relative position data of the target node and the neighbor node information table to obtain greedy forwarding candidate nodes;
[0054] Step S43: Exchange link state information according to the greedy forwarding candidate nodes to obtain link state information; search for multi-path routing according to the link state information to obtain multi-path routing data;
[0055] Step S44: Calculate the routing evaluation index for the multi-path routing data to obtain routing evaluation index data;
[0056] Step S45: Perform Q-learning routing decision using the pre-trained Q-learning routing decision model and the routing evaluation index data to obtain Q-learning routing decision data;
[0057] Step S46: Perform dynamic routing update based on the Q-learning routing decision data and the multi-path routing data to obtain a dynamic routing table.
[0058] In the present invention, by maintaining a neighbor node information table, each node can quickly obtain the location information of neighbor nodes, simplifying the process of querying the location of the target node and improving the routing efficiency. Even if the target node is not within the neighbor range, the target node can be quickly located through multi-hop query. Based on the greedy forwarding strategy, selecting the neighbor node closest to the target node as the candidate node can simplify the routing decision process, reduce the computational complexity, and to a certain extent ensure the efficiency of data transmission. By exchanging link state information with the candidate node, the sending node can obtain more comprehensive path information, including the number of nodes on the path, packet loss rate, delay, etc., providing a data basis for subsequent multi-path routing search and routing evaluation. Calculating routing evaluation metrics for multiple candidate paths, such as path length, average delay, number of hops, etc., can quantitatively evaluate the advantages and disadvantages of each path, providing a reference basis for subsequent routing decisions. Using the pre-trained Q-learning routing decision model to make routing decisions based on the routing evaluation metric data can comprehensively consider factors such as path quality and historical experience, select the optimal routing path, and improve the efficiency and reliability of data transmission. Updating the dynamic routing table according to the Q-learning decision result can dynamically adjust the routing strategy according to the changes in the network state, avoid network congestion, improve network resource utilization, and ensure the stability and efficiency of the network.
[0059] Preferably, the construction of the pre-trained Q-learning routing decision model includes the following steps:
[0060] Perform prediction and analysis of light intensity changes through the light intensity sensor array of the lamp to obtain light intensity change prediction data;
[0061] Perform prediction of path lamp nodes according to the light intensity change prediction data to obtain path lamp nodes;
[0062] Perform Q-learning state space expansion on the path lamp nodes to obtain Q-learning state space expansion data; perform path link quality assessment on the path lamp nodes to obtain path link quality data;
[0063] Design a Q-learning reward function according to the Q-learning state space expansion data and the path link quality data to obtain a Q-learning reward function;
[0064] Train and optimize the Q-learning model according to the Q-learning reward function and the light intensity change prediction data to obtain a Q-learning routing decision model.
[0065] By analyzing historical light intensity data, the present invention can predict the trend of light intensity change in a future period of time, and can predict which lamp nodes will be controlled by users, so as to more accurately predict the data transmission path. Predicting data based on the light intensity change, identifying the lamp nodes located on the data transmission path in the future, and the status information of these nodes can be obtained in advance, providing a basis for subsequent Q-learning state space expansion and link quality evaluation. Taking the path lamp nodes as the states in the Q-learning state space can more precisely describe the network state and improve the efficiency and accuracy of the Q-learning algorithm. Evaluating the quality of the link between the path lamp nodes according to the historical network performance data can provide a reference for the design of the Q-learning reward function. For example, a higher reward can be given to a high-quality link. Designing the Q-learning reward function according to the path link quality evaluation result can guide the Q-learning algorithm to select a high-quality path, avoid selecting a congested or unreliable path, and improve the efficiency and reliability of data transmission. Using the light intensity change to predict data, the path link quality evaluation result and the designed reward function to train and optimize the Q-learning model can enable the model to learn a better routing strategy and improve the performance of the model in the actual network environment.
[0066] Preferably, step S5 includes the following steps:
[0067] Step S51: Real-time collect network performance metrics through monitoring nodes deployed in the network to obtain network performance metric data;
[0068] Step S52: Aggregate the network performance metric data to the central controller node according to the dynamic routing table, perform network state analysis, and obtain network state analysis result data;
[0069] Step S53: Construct a genetic algorithm parameter optimization model according to the network state analysis result data to obtain a genetic algorithm parameter optimization model; use the genetic algorithm parameter optimization model to output the predicted value of the network performance metric to obtain the predicted value of the network performance metric;
[0070] Step S54: Perform fuzzy logic reasoning based on the predicted value of the network performance metric and the network performance metric data and output a network control instruction to obtain a network control instruction;
[0071] Step S55: The central controller node issues the network control instruction according to the dynamic routing table to obtain a node network control instruction; execute the node instruction according to the node network control instruction to implement the lamp networking operation.
[0072] By deploying monitoring nodes in the network to collect network performance metrics in real time, the operating status of the network can be grasped in a timely manner, such as node connectivity, data transmission latency, data packet loss rate, etc., providing data support for subsequent network status analysis and control. According to the dynamic routing table, the network performance metric data is aggregated to the central controller node, which can centrally manage and analyze the performance data of the entire network, forming a global network status view and providing a basis for subsequent network control decisions. Using a genetic algorithm to construct a parameter optimization model and training it based on the network status analysis result data can find the optimal network parameter configuration, such as the learning rate and discount factor in the Q-learning model, thereby optimizing network performance and improving data transmission efficiency and reliability. According to the predicted values of network performance metrics and the actually collected performance data, using a fuzzy logic inference system to judge the network status and output corresponding control instructions can achieve more flexible network control, such as dynamically adjusting the data transmission rate according to the network load. The central controller node issues network control instructions to the corresponding lamp nodes according to the dynamic routing table, and the nodes execute corresponding operations according to the instructions, such as adjusting communication module parameters, changing routing strategies, etc., ultimately realizing real-time monitoring, dynamic adjustment, and optimal control of the lamp networking, ensuring the efficient and stable operation of the network. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 It is a schematic flowchart of the steps of the lamp networking method;
[0074] Figure 2 is Figure 1 a detailed implementation step flowchart of step S3 in
[0075] Figure 3 is Figure 1 a detailed implementation step flowchart of step S4 in
[0076] The implementation, functional features, and advantages of the present invention will be further described in conjunction with embodiments with reference to the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0077] The technical method of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of them. All other embodiments obtained by those skilled in the art within the scope of the present invention without creative efforts belong to the scope of protection of the present invention.
[0078] In addition, the attached drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus repeated descriptions thereof will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. The functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor methods and / or microcontroller methods.
[0079] It should be understood that although terms such as "first" and "second" may be used herein to describe various units, these units should not be limited by these terms. These terms are only used to distinguish one unit from another. For example, without departing from the scope of the exemplary embodiments, the first unit may be referred to as the second unit, and similarly the second unit may be referred to as the first unit. The term "and / or" used herein includes any and all combinations of one or more of the listed associated items.
[0080] To achieve the above object, please refer to Figures 1 to 3 , a method for networking lamps, comprising the following steps:
[0081] Step S1: Perform light intensity perception through the lamps and extract a sequence of light intensity change amounts to obtain a sequence of light intensity change amounts; generate a light intensity feature vector according to the sequence of light intensity change amounts to obtain a light intensity feature vector;
[0082] Step S2: Calculate the time difference of light intensity change according to the light intensity feature vector to obtain a time difference matrix of light intensity change; identify the multipath effect on the time difference matrix of light intensity change and suppress the path effect to obtain multipath effect suppression data; construct a node relative position matrix according to the multipath effect suppression data to obtain a node relative position matrix;
[0083] Step S3: Establish an initial connection relationship according to the node relative position matrix to obtain initial network connection relationship data; construct a topological structure according to the initial network connection relationship data and optimize the topological structure to obtain a network topology diagram;
[0084] Step S4: Calculate a routing evaluation index according to the network topology diagram to obtain routing evaluation index data; perform Q-learning routing decision and dynamic routing update by using a pre-trained Q-learning routing decision model and the routing evaluation index data to obtain a dynamic routing table;
[0085] Step S5: Analyze the network state according to the dynamic routing table to obtain network state analysis result data; perform node networking control processing according to the network state analysis result data to implement the lamp networking operation.
[0086] In the embodiment of the present invention, with reference to Figure 1 as described, it is a schematic flowchart of the steps of the method for networking lamps of the present invention. In this example, the method for networking lamps includes the following steps:
[0087] Step S1: Perform light intensity perception through a lamp and extract a sequence of light intensity change amounts to obtain a sequence of light intensity change amounts; generate a light intensity feature vector according to the sequence of light intensity change amounts to obtain a light intensity feature vector;
[0088] In the embodiment of the present invention, the light intensity sensor array on the lamp collects ambient light intensity data at a frequency of 100 Hz. After preprocessing by moving window mean filtering and baseline correction based on polynomial fitting, a preprocessed light intensity data sequence is obtained. Subtract the ambient light intensity baseline value from the preprocessed light intensity data sequence to obtain a sequence of light intensity change amounts. Then perform a short-time Fourier transform on the sequence of light intensity change amounts, extract frequency and time features, and match them with a preset light intensity change pattern library to identify the light intensity change pattern. Finally, quantify the frequency and time features of the light intensity change pattern into numerical values to construct a light intensity feature vector.
[0089] Step S2: Calculate the light intensity change time difference according to the light intensity feature vector to obtain a light intensity change time difference matrix; identify the multipath effect on the light intensity change time difference matrix and suppress the path effect to obtain multipath effect suppression data; construct a node relative position matrix according to the multipath effect suppression data to obtain a node relative position matrix;
[0090] In the embodiment of the present invention, each lamp broadcasts its own light intensity feature vector through visible light communication and receives the broadcasts of other lamps, screens out the feature vectors whose Euclidean distance from its own feature vector is less than the threshold, and regards the lamps that send them as potential neighbor nodes. Calculate the cross-correlation function of the light intensity change amounts between itself and each potential neighbor node, find the time delay corresponding to the maximum peak, and construct a light intensity change time difference matrix. According to the light intensity change time difference matrix, estimate the initial distance between nodes using the relationship between the speed of light and the time difference. Then, analyze the time difference matrix, identify potential multipath paths, use a spatial filtering algorithm to separate the multipath signals, extract the line-of-sight path signal and suppress the non-line-of-sight path signal, and recalculate the light intensity change time difference between nodes according to the line-of-sight path signal to obtain a time difference matrix after multipath effect suppression. Finally, according to the initial distance matrix and the time difference matrix after multipath effect suppression, calculate the initial relative position of the nodes using the trilateration algorithm and optimize it by the least squares method to obtain a node relative position matrix.
[0091] Step S3: Establish the initial connection relationship according to the node relative position matrix to obtain the initial network connection relationship data; construct the topological structure based on the initial network connection relationship data and optimize the topological structure to obtain the network topology graph;
[0092] In the embodiment of the present invention, the node relative position matrix is input into the Matplotlib library of Python to visualize the node distribution, and the `Delaunay` function in the SciPy library is used for triangulation to obtain the triangulation data. According to the triangulation data, the lamp nodes forming the three vertices of each triangle are connected pairwise to generate the initial network connection relationship data, and the minimum spanning tree is constructed using the NetworkX library. The minimum spanning tree is constrained according to the actual communication range of the lamp (for example, 5 meters), and the edges beyond the communication range are deleted to obtain the node network constraint data. Then, the degree centrality and betweenness centrality of each node in the node network constraint data are calculated using the NetworkX library. According to the preset centrality threshold, the nodes with excessive load are identified, and part of the connection relationships are transferred to the neighbor nodes with lower load to achieve load balancing. Finally, according to the node network constraint data after load balancing, the final network topology graph is generated using the NetworkX library.
[0093] Step S4: Calculate the routing evaluation index according to the network topology graph to obtain the routing evaluation index data; use the pre-trained Q-learning routing decision model and the routing evaluation index data to perform Q-learning routing decision and dynamic routing update to obtain the dynamic routing table;
[0094] In the embodiment of the present invention, each lamp node maintains a neighbor node information table according to the network topology graph. When data needs to be sent to the target node, the sending node first queries the neighbor node information table maintained by itself to find whether the target node exists. If not, it broadcasts a query request to the neighbor nodes until the relative position data of the target node is found. Then, according to the relative position data of the target node, the sending node selects the neighbor node closest to the target node as the greedy forwarding candidate node. The sending node sends a link state information exchange request to the candidate node, and according to the received link state information, uses the multi-path routing algorithm to search for multiple feasible paths. Next, the sending node calculates the routing evaluation indexes of each path, such as path length, average delay, number of hops, etc. Using the pre-trained Q-learning routing decision model, routing decision is made according to the routing evaluation index data, and the path with the highest Q value is selected as the optimal path. Finally, the dynamic routing table of the sending node is updated according to the ID of the next-hop node determined by the Q-learning decision.
[0095] Step S5: Analyze the network status according to the dynamic routing table to obtain network status analysis result data; perform node networking control processing based on the network status analysis result data to implement the lamp networking operation;
[0096] In the embodiment of the present invention, several monitoring nodes are deployed in the lamp network. Each monitoring node collects network performance indicators, including node connectivity, data transmission delay, and data packet loss rate, every 1 second. The monitoring node uploads the collected network performance indicator data to the central controller node according to the dynamic routing table. The central controller node constructs a parameter optimization model based on the genetic algorithm according to the network status analysis result data, trains the model using the genetic algorithm to find the optimal model parameters. Then, the genetic algorithm parameter optimization model obtained by training is used to predict the network performance indicators for a period of time in the future. According to the preset network performance indicator threshold, combined with the predicted value of the network performance indicator, the fuzzy logic inference system is used to judge the current network status and output the corresponding network control instruction. Finally, the central controller node issues the network control instruction to the corresponding lamp node according to the dynamic routing table, and the node performs the corresponding operation according to the instruction content to realize the real-time monitoring and optimization of the lamp networking
[0097] Preferably, step S1 includes the following steps:
[0098] Step S11: Collect light intensity data through the light intensity sensor array of the lamp to obtain the original light intensity data; perform data preprocessing on the original light intensity data to obtain the preprocessed light intensity data;
[0099] Step S12: Establish the ambient light intensity baseline according to the preprocessed light intensity data to obtain the ambient light intensity baseline value;
[0100] Step S13: Extract the light intensity change amount sequence from the preprocessed light intensity data and the ambient light intensity baseline value to obtain the light intensity change amount sequence;
[0101] Step S14: Analyze the light intensity change pattern of the light intensity change amount sequence to obtain the light intensity change pattern data;
[0102] Step S15: Generate the light intensity feature vector according to the light intensity change pattern data to obtain the light intensity feature vector.
[0103] In the embodiment of the present invention, the light intensity sensor array on the lamp samples at a frequency of 100 Hz to obtain the light intensity data of the surrounding environment, and obtains an original light intensity data sequence with a length of 1000. Due to the influence of factors such as random noise and ambient light fluctuations during the light intensity data acquisition process, it is necessary to preprocess the original light intensity data. First, the sliding window mean filtering method is used to smooth the original light intensity data to remove high-frequency random noise. The sliding window size is set to 10, that is, the average value of every 10 consecutive sampling points is calculated to obtain new data points, and finally a smoothed light intensity data sequence with a length of 991 is obtained. Then, in order to eliminate the influence of ambient light fluctuations, a baseline correction method based on polynomial fitting is used to process the smoothed light intensity data. A third-order polynomial is selected to fit the smoothed light intensity data sequence to obtain the ambient light intensity change trend curve, and the smoothed light intensity data sequence is subtracted from this trend curve to obtain a preprocessed light intensity data sequence with a length of 991, effectively eliminating the influence of ambient light fluctuations. Using the preprocessed light intensity data obtained in step S11, an ambient light intensity baseline is established. First, the preprocessed light intensity data sequence is divided into a time window every 100 data points in chronological order, and a total of 10 time windows are obtained (the last time window contains 91 data points). Then, the average value of the preprocessed light intensity data within each time window is calculated to obtain 10 average values. Finally, these 10 average values are used as the ambient light intensity baseline values. Each data point in the preprocessed light intensity data sequence obtained in step S11 is subtracted from the ambient light intensity baseline value obtained in step S12 to obtain a light intensity change amount sequence with a length of 991. This sequence reflects the change amount relative to the ambient light intensity baseline at each sampling moment, eliminates the influence of ambient light intensity changes, and highlights the light intensity change information of the lamp itself. Perform an analysis of the light intensity change pattern on the light intensity change amount sequence obtained in step S13. First, the short-time Fourier transform (STFT) is used to perform time-frequency analysis on the light intensity change amount sequence to obtain the law of the energy distribution of the light intensity change amount sequence at different frequencies changing with time. The window size of the STFT is set to 20, and the step size is set to 10. Then, according to the STFT results, the frequency characteristics and time characteristics of the light intensity change amount sequence are extracted. The frequency characteristics include: main frequency, bandwidth, frequency center, etc.; the time characteristics include: rise time, fall time, duration, etc. Finally, according to the extracted frequency characteristics and time characteristics, combined with the pre-set light intensity change pattern library, pattern matching is performed on the light intensity change amount sequence to identify the light intensity change pattern data, such as: flicker, gradual change, periodic change, etc. According to the light intensity change pattern data obtained in step S14, a light intensity feature vector is constructed.For example, the frequency feature and time feature in the light intensity change pattern data are respectively quantified into values between 0 and 1, and a light intensity feature vector with a length of 10 is constructed. Among them, the first 5 elements represent the frequency feature, and the last 5 elements represent the time feature. The value of each element represents the strength of the corresponding feature, and the larger the value, the more significant the feature. Finally, each lamp will have a unique light intensity feature vector for subsequent node identification and positioning.
[0104] Preferably, step S2 includes the following steps:
[0105] Step S21: The lamp broadcasts the feature vector of the light intensity feature vector and receives the feature vector to obtain the node light intensity feature vector;
[0106] Step S22: Screen the potential neighbor nodes for the node light intensity feature vector to obtain potential neighbor nodes; calculate the time difference of light intensity change for the potential neighbor nodes to obtain the time difference matrix of light intensity change;
[0107] Step S23: Estimate the initial distance between nodes according to the time difference matrix of light intensity change to obtain the initial distance value between nodes;
[0108] Step S24: Identify the multipath effect for the time difference matrix of light intensity change and suppress the path effect to obtain the multipath effect suppression data;
[0109] Step S25: Calculate the initial relative position according to the initial distance value between nodes and the multipath effect suppression data to obtain the relative position data of nodes;
[0110] Step S26: Optimize the relative position data of nodes by the least squares method to obtain the optimized relative position data of nodes; construct the relative position matrix of nodes according to the optimized relative position data of nodes to obtain the relative position matrix of nodes.
[0111] In the embodiments of the present invention, each lamp broadcasts its own light intensity feature vector into the surrounding environment at intervals of 1 second by means of visible light communication. At the same time, each lamp also receives the light intensity feature vectors broadcast by other lamps. Each lamp maintains a list of received light intensity feature vectors, recording information such as the received feature vectors, the IDs of the transmitting lamps, and the reception timestamps. Each lamp filters out the feature vectors whose Euclidean distance from its own feature vector is less than the threshold of 0.5 from the received light intensity feature vector list, and regards the lamps that send these feature vectors as potential neighbor nodes. Then, the time difference of light intensity change between itself and each potential neighbor node is calculated. Specifically, the light intensity change data collected at the same time between itself and each potential neighbor node is selected, the cross-correlation function of the two sets of data is calculated, and the time delay corresponding to the maximum peak of the cross-correlation function is found as the time difference of light intensity change between the two nodes. Finally, the time differences of light intensity change between all potential neighbor nodes are constructed into a matrix, that is, the time difference matrix of light intensity change. According to the time difference matrix of light intensity change, the initial distance between nodes is estimated by using the relationship between the speed of light and the time difference. Assuming that the speed of light is c and the time difference of light intensity change between node i and node j is Δt ij , then the initial distance d ij between node i and node j can be estimated as: d ij = c * Δt ij / 。2Construct an initial distance matrix for all nodes, that is, the node initial distance matrix. Identify and suppress the multipath effect on the optical intensity change time difference matrix obtained in step S22. First, analyze the time difference matrix to identify node pairs that may have multipath effects. If there are multiple propagation paths between two nodes, the value of the corresponding element in the time difference matrix will be significantly greater than other elements. Then, use the spatial filtering algorithm to separate the multipath signals, extract the line-of-sight path signals, and suppress the non-line-of-sight path signals. Finally, recalculate the optical intensity change time difference between nodes according to the line-of-sight path signals to obtain the time difference matrix after suppressing the multipath effect. According to the node initial distance matrix obtained in step S23 and the time difference matrix after suppressing the multipath effect obtained in step S24, use the trilateration algorithm to calculate the initial relative positions of the nodes. Select three nodes that are close and non-collinear as reference nodes, establish a ternary quadratic equation system based on the distance and time difference information between them, and solve the coordinates of the target node. Optimize the node initial relative position data obtained in step S25 by the least squares method to obtain more accurate node relative positions. Construct an error function with node coordinates as variables to represent the difference between the distance observation values and the calculated values between all nodes. Use the least squares method to optimize the error function to find the node coordinates that minimize the error function, which are the optimized data of the node relative positions. Finally, construct a node relative position matrix according to the optimized data of the node relative positions, and each element in the matrix represents the relative distance between the corresponding two nodes.
[0112] Preferably, calculating the optical intensity change time difference for potential neighbor nodes includes the following steps:
[0113] Calculate the optical intensity change rate for potential neighbor nodes to obtain an optical intensity change rate sequence;
[0114] Calculate the cross-correlation function according to the optical intensity change rate sequence to obtain the cross-correlation function;
[0115] Search for the maximum peak of the cross-correlation function to obtain the maximum peak;
[0116] Construct a time difference matrix according to the maximum peak to obtain an optical intensity change time difference matrix.
[0117] In the embodiment of the present invention, for each potential neighbor node, use its preprocessed optical intensity data sequence to calculate the optical intensity change rate sequence. Specifically, adopt the first-order difference method to subtract the optical intensity data at two adjacent sampling times to obtain the optical intensity change rate at each sampling time. For example, for the preprocessed optical intensity data sequence P = {p1, p2,..., p n}, its optical intensity change rate sequence R = {r1, r2,..., r n-1}, where ri =p i+1 -p i 。
[0118] Obtain the sequences of light intensity change rates of the lamp itself and each potential neighbor node respectively. Taking two sequences of light intensity change rates with the same length as an example, let the sequence of light intensity change rates of the lamp itself be R1 = {r11, r12, …, r1 n}, and the sequence of light intensity change rates of the potential neighbor node be R2 = {r21, r22, …, r2 n}. Calculate the correlation between the two sequences using the cross-correlation function to obtain the cross-correlation function sequence C = {c -n+1 , c -n+2 , …, c n-1}, where c k represents the correlation coefficient between the R1 sequence and the R2 sequence after delaying k sampling points. In the calculated cross-correlation function sequence C, search for the maximum peak and its corresponding time delay. The time delay corresponding to the maximum peak reflects the time difference between the light intensity changes of the two nodes. Construct a matrix of the time differences of light intensity changes between the lamp and all potential neighbor nodes, that is, the time difference matrix of light intensity changes. The rows and columns of the matrix represent different lamp nodes, and each element in the matrix represents the time difference of light intensity changes between the corresponding two nodes. For example, the matrix element (i, j) represents the time difference of light intensity changes between node i and node j.
[0119] Preferably, step S24 includes the following steps:
[0120] Step S241: Perform multi-path signal feature analysis on the time difference matrix of light intensity changes to obtain multi-path signal features;
[0121] Step S242: Estimate the time difference azimuth of the signal source according to the multi-path signal features to obtain signal source azimuth data; estimate the angle of arrival of the signal according to the multi-path signal features to obtain angle of arrival data of the signal;
[0122] Step S243: Separate the multi-path signals according to the angle of arrival data of the signal and the signal source azimuth data to obtain a multi-path signal set;
[0123] Step S244: Identify the line-of-sight path and classify the line-of-sight path signals in the multi-path signal set according to the multi-path signal features to obtain line-of-sight path signals and non-line-of-sight path signals;
[0124] Step S245: Suppress the non-line-of-sight path signals to obtain non-line-of-sight path suppression data; estimate the line-of-sight path distance according to the line-of-sight path signals to obtain line-of-sight path distance data;
[0125] Step S246: Suppress the multipath effect on the LOS path distance data according to the NLOS path suppression data to obtain multipath effect suppression data.
[0126] In the embodiment of the present invention, the optical intensity change time difference matrix is analyzed to extract the multipath signal characteristics. First, calculate the standard deviation of each element in the time difference matrix as an index to measure the stability of the path. The larger the standard deviation, the more severely the path is affected by the multipath effect. Then, according to a preset threshold, identify the paths with standard deviation greater than the threshold as potential multipath paths. For these potential multipath paths, further analyze the variation law of their time differences, for example, whether there are periodic fluctuations, mutations, etc., and the correlation between these variations and environmental factors (such as personnel movement, object movement, etc.). Use these analysis results as multipath signal characteristics for subsequent multipath effect suppression. According to the multipath signal characteristics, estimate the time difference azimuth and signal arrival angle of the signal source. Taking nodes A and B as an example, assume that node A receives a signal from node B with multipath effect. First, judge the number of multipaths according to the standard deviation of the elements corresponding to the A-B path in the time difference matrix. Assume there are two multipaths, then the MUSIC algorithm can be used to estimate the time difference azimuth of the signal sources of the two paths to obtain two azimuth angles θ1 and θ2. At the same time, according to the time difference difference between the two paths, combined with the geometric size of node A, use the time difference of arrival (TDOA) technology to estimate the signal arrival angle to obtain two arrival angles Φ1 and Φ2. According to the signal arrival angle data and signal source azimuth data, use beamforming technology to separate the multipath signals to obtain a multipath signal set. Taking node A as the center, according to the estimated arrival angles Φ1 and Φ2, construct two beams pointing in different directions. Then, pass the received signal through these two beams respectively to obtain two separated signals, which are the two multipath signals from node B. According to the multipath signal characteristics, identify and classify the LOS path in the multipath signal set. For example, it can be judged according to characteristics such as signal strength, signal-to-noise ratio, and time difference stability. Usually, the LOS path signal has higher strength, larger signal-to-noise ratio, and more stable time difference. According to these characteristics, the multipath signal set can be divided into LOS path signals and NLOS path signals. Suppress the NLOS path signals. For example, adaptive equalization technology, blind source separation technology, etc. can be used. At the same time, according to the LOS path signal, use the distance estimation method in step S23 to calculate the LOS path distance. According to the result after NLOS path suppression, suppress the multipath effect on the LOS path distance data. For example, the suppressed NLOS path signal can be used as noise, and algorithms such as Kalman filtering can be used to filter the LOS path distance data to further reduce the influence of the multipath effect and obtain a more accurate distance estimation value, that is, multipath effect suppression data.
[0127] Preferably, step S3 includes the following steps:
[0128] Step S31: Visualize the relative position matrix of nodes to obtain a node distribution map; perform triangulation on the node distribution map to obtain triangulation data;
[0129] Step S32: Establish an initial connection relationship based on the triangulation data to obtain initial network connection relationship data; construct a minimum spanning tree based on the initial network connection relationship data to obtain minimum spanning tree data;
[0130] Step S33: Obtain the actual communication range data of the lamps; perform communication range constraint on the minimum spanning tree data according to the actual communication range data of the lamps to obtain node network constraint data;
[0131] Step S34: Calculate the node degree centrality of the node network constraint data to obtain node degree centrality data; calculate the node betweenness centrality of the node network constraint data to obtain node betweenness centrality data;
[0132] Step S35: Adjust the load balance according to the node degree centrality data and the node betweenness centrality data to obtain load balance adjustment data;
[0133] Step S36: Optimize the topological structure of the node network constraint data according to the load balance adjustment data and generate a network topology map to obtain a network topology map.
[0134] As an example of the present invention, referring to Figure 2 [[ID=2,5]]As shown, in this example, step S3 includes:
[0135] Step S31: Visualize the relative position matrix of nodes to obtain a node distribution map; perform triangulation on the node distribution map to obtain triangulation data;
[0136] In the embodiment of the present invention, the relative position matrix of nodes obtained in step S26 is input into the Matplotlib library of Python. The `scatter()` function of this library is used to draw a two-dimensional scatter plot, and the horizontal and vertical coordinates of each scatter point correspond to the X-axis and Y-axis coordinate values of the corresponding node in the relative position matrix of nodes, so as to visualize the node distribution and obtain a node distribution map. Subsequently, the `Delaunay` function in the SciPy library is called to perform triangulation on the node distribution map. The triangle object returned by the `Delaunay` function is converted into a list containing the indices of the triangle vertices and stored as triangulation data.
[0137] Step S32: Establish an initial connection relationship based on the triangulation data to obtain initial network connection relationship data; construct a minimum spanning tree based on the initial network connection relationship data to obtain minimum spanning tree data;
[0138] In the embodiment of the present invention, according to the triangulation data obtained in step S31, the list of triangle vertex indices is traversed. For each triangle, the lamp nodes constituting its three vertices are connected pairwise to generate initial network connection relationship data. These connection relationships are stored in the form of an adjacency matrix composed of 0s and 1s. The rows and columns of the matrix represent different nodes. 1 represents that there is a connection between two nodes, and 0 represents the opposite. Subsequently, based on the constructed adjacency matrix, the `minimum_spanning_tree()` function in the NetworkX library is used to select the Prim algorithm to construct a minimum spanning tree. The minimum spanning tree is stored in the NetworkX graph data structure, which contains all nodes and the shortest path information connecting these nodes.
[0139] Step S33: Obtain the actual communication range data of the lamps; perform communication range constraints on the minimum spanning tree data according to the actual communication range data of the lamps to obtain node network constraint data;
[0140] In the embodiment of the present invention, it is assumed that according to the communication chip specification of the lamp and the actual test results, its maximum communication distance is determined to be 5 meters. Traverse the minimum spanning tree data structure generated in step S32, and use the `networkx.shortest_path_length()` function to calculate the length of each edge (i.e., the Euclidean distance between the two end nodes). If the length of the edge exceeds 5 meters, the edge is deleted from the minimum spanning tree data structure. Finally, the node network constraint data that meets the communication distance constraint is obtained, and this data is still stored in the NetworkX graph data structure.
[0141] Step S34: Calculate the node degree centrality of the node network constraint data to obtain node degree centrality data; calculate the node betweenness centrality of the node network constraint data to obtain node betweenness centrality data;
[0142] In the embodiments of the present invention, based on the node network constraint data obtained in step S33, the `degree_centrality()` function provided by the NetworkX library is used to calculate the degree centrality of each node, that is, the number of nodes directly connected to this node, and the result is stored in a dictionary, where the key is the node index and the value is the corresponding degree centrality. Next, the `betweenness_centrality()` function provided by the NetworkX library is used to calculate the betweenness centrality of each node. This function calculates the number of times each node is passed through in the shortest paths between all node pairs in the network, and the result is stored in a dictionary, where the key is the node index and the value is the corresponding betweenness centrality.
[0143] Step S35: Perform load balancing adjustment according to the node degree centrality data and the node betweenness centrality data to obtain load balancing adjustment data;
[0144] In the embodiments of the present invention, degree centrality and betweenness centrality thresholds are set, for example, 0.8 and 0.6 respectively. Traverse the two centrality dictionaries calculated in step S34. If the degree centrality and betweenness centrality of a certain node both exceed the set thresholds, it is considered that the load of this node is too high. For the nodes with too high load, identify the nodes with relatively low load among their neighbor nodes, and transfer some connection relationships to these nodes to achieve load balancing. Update the adjusted connection relationships into the node network constraint data.
[0145] Step S36: Optimize the topological structure of the node network constraint data according to the load balancing adjustment data and generate a network topology graph to obtain a network topology graph;
[0146] In the embodiments of the present invention, according to the node network constraint data after load balancing adjustment in step S35, the drawing function of the NetworkX library is called again, such as the `draw()` function, to generate the final network topology graph. In the topology graph, visual elements such as different colors and line thicknesses can be used to distinguish information such as node load and connection relationship strength.
[0147] Preferably, step S4 includes the following steps:
[0148] Step S41: Maintain neighbor node information according to the network topology graph to obtain a neighbor node information table; calculate the relative position of the target node according to the neighbor node information table to obtain target node relative position data;
[0149] Step S42: Select greedy forwarding candidate nodes according to the target node relative position data and the neighbor node information table to obtain greedy forwarding candidate nodes;
[0150] Step S43: Perform link state information exchange based on the greedy forwarding candidate nodes to obtain link state information; perform multi-path routing search based on the link state information to obtain multi-path routing data;
[0151] Step S44: Calculate routing evaluation metrics for the multi-path routing data to obtain routing evaluation metric data;
[0152] Step S45: Perform Q-learning routing decision using the pre-trained Q-learning routing decision model and the routing evaluation metric data to obtain Q-learning routing decision data;
[0153] Step S46: Perform dynamic routing update based on the Q-learning routing decision data and the multi-path routing data to obtain a dynamic routing table.
[0154] As an example of the present invention, referring to Figure 3 as shown, in this example, step S4 includes:
[0155] Preferably, step S4 includes the following steps:
[0156] Step S41: Maintain neighbor node information based on the network topology graph to obtain a neighbor node information table; calculate the relative position of the target node based on the neighbor node information table to obtain target node relative position data;
[0157] In the embodiment of the present invention, each lamp node maintains a neighbor node information table according to the network topology graph generated in step S36. This table is stored in dictionary form, and the key-value pairs are the neighbor node ID and the relative position coordinates of this neighbor node. When data needs to be sent to the target node, the sending node first queries the neighbor node information table maintained by itself to find whether the target node exists. If it exists, the relative position data of the target node is directly obtained. If not, the sending node broadcasts a query request to all its neighbor nodes, and the request contains the target node ID. The neighbor nodes that receive the request also query the information table maintained by themselves and pass the query results step by step until the relative position data of the target node is found.
[0158] Step S42: Select greedy forwarding candidate nodes based on the target node relative position data and the neighbor node information table to obtain greedy forwarding candidate nodes;
[0159] In the embodiment of the present invention, the sending node selects greedy forwarding candidate nodes based on the target node relative position data obtained in step S41 and in combination with the neighbor node information table maintained by itself. Specifically, the sending node calculates the Euclidean distance between each neighbor node and the target node. Select the neighbor node closest to the target node as the greedy forwarding candidate node. If there are multiple neighbor nodes with the same distance, randomly select one of them as the candidate node.
[0160] Step S43: Perform link state information exchange based on the greedy forwarding candidate nodes to obtain link state information; perform multi-path routing search based on the link state information to obtain multi-path routing data;
[0161] In the embodiment of the present invention, the sending node sends a link state information exchange request to the greedy forwarding candidate nodes selected in step S42. This request includes information such as the sending node ID, candidate node ID, and target node ID. After receiving the request, the candidate node returns its link state information to the target node, including the number of nodes on the path, average packet loss rate, average delay, etc. The sending node uses a multi-path routing algorithm such as the Dijkstra algorithm or A* algorithm to search for multiple feasible paths from the sending node to the target node based on the received link state information, and stores the node sequence of each path as multi-path routing data.
[0162] Step S44: Calculate routing evaluation metrics for the multi-path routing data to obtain routing evaluation metric data;
[0163] In the embodiment of the present invention, the sending node calculates the routing evaluation metrics of each path according to the multi-path routing data obtained in step S43. For example, path length, average delay, number of hops, etc. The path length is defined as the sum of the distances between all adjacent nodes on the path. The average delay is calculated based on the average delay of each link in the link state information. The number of hops is defined as the number of nodes on the path. Store the routing evaluation metrics of each path in a list, and each element corresponds to the metric value of one path.
[0164] Step S45: Perform Q-learning routing decision using the pre-trained Q-learning routing decision model and the routing evaluation metric data to obtain Q-learning routing decision data;
[0165] In the embodiment of the present invention, use the pre-trained Q-learning routing decision model to perform routing decision according to the routing evaluation metric data calculated in step S44. Input the routing evaluation metric data into the Q-learning model, and the model outputs the Q value of each candidate path according to the current network state and historical experience. Select the path with the highest Q value as the optimal path, and store the routing decision data corresponding to this path (for example, the next-hop node ID).
[0166] Step S46: Perform dynamic routing update according to the Q-learning routing decision data and the multi-path routing data to obtain a dynamic routing table;
[0167] In the embodiment of the present invention, the dynamic routing table of the sending node is updated according to the Q-learning routing decision data obtained in step S45. The routing table is stored in the form of a dictionary, and the key-value pairs are the target node ID and the next-hop node ID respectively. The next-hop node ID of the Q-learning decision is updated with the routing table entry corresponding to the target node ID to achieve dynamic routing update.
[0168] Preferably, the construction of the pre-trained Q-learning routing decision model includes the following steps:
[0169] Perform prediction analysis on the light intensity change through the light intensity sensor array of the lamp to obtain the light intensity change prediction data;
[0170] Perform prediction on the path lamp nodes according to the light intensity change prediction data to obtain the path lamp nodes;
[0171] Expand the Q-learning state space for the path lamp nodes to obtain the Q-learning state space expansion data; evaluate the path link quality for the path lamp nodes to obtain the path link quality data;
[0172] Design a Q-learning reward function according to the Q-learning state space expansion data and the path link quality data to obtain the Q-learning reward function;
[0173] Train and optimize the Q-learning model according to the Q-learning reward function and the light intensity change prediction data to obtain the Q-learning routing decision model.
[0174] In the embodiments of the present invention, a time series model is constructed using historical light intensity data collected by the light intensity sensor array of the lamp. For example, an ARIMA model is used to train the historical light intensity data to learn the laws such as the periodicity and trend of light intensity changes. The trained ARIMA model is used to predict the light intensity change trend in the future for a period of time, and light intensity change prediction data is obtained, including the light intensity prediction value and the prediction confidence interval at each sampling moment. According to the network topology map generated in step S36 and the light intensity change prediction data, the lamp nodes that may be located on the data transmission path in the future are predicted. For example, according to the network topology map, the shortest path between all node pairs is calculated, and the nodes passed by each path are recorded. Combining the light intensity change prediction data, it is analyzed whether each node is in an active state in the future for a period of time (for example, a drastic change in light intensity indicates that the node may be controlled by the user). All the active nodes on the shortest path are regarded as path lamp nodes. According to the path lamp nodes, the state space of Q-learning is expanded, and each path lamp node is used as a state in the Q-learning state space. For example, assuming that there are 3 path lamp nodes on a path, these 3 nodes are respectively represented as state 1, state 2, and state 3, constituting a Q-learning state space containing 3 states. According to the historical network performance data, the quality of the links between the path lamp nodes is evaluated. For example, indicators such as the average delay and average packet loss rate of each link are statistically analyzed, and the link quality is divided into multiple levels according to a preset threshold, such as: excellent, good, medium, and poor. The quality level of each link is used as one of the input features of Q-learning. According to the path link quality evaluation result, a reward function of Q-learning is designed. For example, for a high-quality link, a higher positive reward is given; for a low-quality link, a lower positive reward or a negative penalty is given. At the same time, factors such as the path length and the number of hops are considered to adjust the reward function. For example, the shorter the path and the fewer the number of hops, the more additional positive rewards are given. Using the network topology map, light intensity change prediction data, path link quality evaluation result, and the designed reward function generated in step S36, the Q-learning model is trained and optimized. For example, the Q-learning algorithm is used to simulate the process of data transmission in the network, and the Q-table is continuously updated according to the reward function until the Q-table converges. The trained Q-learning model is used as a pre-trained Q-learning routing decision model for routing decisions in step S4.
[0175] Preferably, step S5 includes the following steps:
[0176] Step S51: Real-time collection of network performance metrics is performed through monitoring nodes deployed in the network to obtain network performance metric data;
[0177] Step S52: Aggregate the network performance metric data to the central controller node according to the dynamic routing table, perform network state analysis, and obtain the network state analysis result data;
[0178] Step S53: Construct a genetic algorithm parameter optimization model based on the network state analysis result data to obtain the genetic algorithm parameter optimization model; use the genetic algorithm parameter optimization model to output the predicted value of the network performance metric, and obtain the predicted value of the network performance metric;
[0179] Step S54: Perform fuzzy logic reasoning based on the predicted value of the network performance metric and the network performance metric data, and output a network control instruction to obtain the network control instruction;
[0180] Step S55: The central controller node issues the network control instruction according to the dynamic routing table to obtain the node network control instruction; execute the node instruction according to the node network control instruction to implement the lamp networking operation.
[0181] In the embodiment of the present invention, several monitoring nodes are deployed in the lamp network. For example, nodes with relatively high degree centrality in the network are selected as monitoring nodes. Each monitoring node collects network performance metrics once every 1 second, including:
[0182] Node connectivity: By sending heartbeat packets, detect the connection status with neighbor nodes, and record information such as connection success rate and disconnection times.
[0183] Data transmission delay: Send test data packets to specific neighbor nodes, record the time difference from sending to receiving the data packets, and calculate metrics such as average delay and maximum delay.
[0184] Data packet loss rate: Count the number of sent and received data packets, and calculate the proportion of lost data packets.
[0185] Based on the routing table dynamically updated by the monitoring node according to step S46, the network performance metric data collected is uploaded to the central controller node through multi-hop relay. After receiving the data from all monitoring nodes, the central controller node performs data cleaning and integration to obtain the network performance metric data of the entire network. The central controller node constructs a parameter optimization model based on the genetic algorithm according to the network state analysis result data. The objective function of the model is defined as the difference between the network performance metrics and the preset target values. For example, the average latency and data packet loss rate are minimized. The optimization parameters of the model include parameters such as the learning rate, discount factor, and exploration rate in the Q-learning model. The genetic algorithm is used to train the model to find the optimal model parameters, so that the network performance metrics reach the preset target. The central controller node uses the genetic algorithm parameter optimization model trained in step S53 to predict the network performance metrics for a period of time in the future, and obtains the predicted values of the network performance metrics. According to the preset network performance metric thresholds, such as the maximum acceptable latency, maximum acceptable packet loss rate, etc., combined with the predicted values of the network performance metrics, a fuzzy logic inference system is used to judge the current network state and output corresponding network control instructions. For example, if it is predicted that the network is about to become congested, an instruction to reduce the data transmission rate is output. The central controller node distributes the network control instructions generated in step S54 to the corresponding lamp nodes according to the routing table dynamically updated in step S46. After receiving the control instructions, the lamp nodes perform corresponding operations according to the instruction content. For example, after receiving the instruction to reduce the data transmission rate, the node adjusts the parameters of the communication module to reduce the data sending rate. In this way, the central controller node can dynamically adjust the network parameters according to the prediction results of the network state, realize the real-time monitoring and optimization of the lamp networking, and ensure the stability and efficiency of the network.
[0186] Therefore, from any perspective, the embodiments should be regarded as exemplary and non-restrictive. The scope of the present invention is defined by the appended claims rather than the above description. Therefore, all changes falling within the meaning and scope of the equivalent elements of the application documents are intended to be encompassed within the present invention.
[0187] The above are only the specific embodiments of the present invention, enabling those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for networking lamps, characterized in that, It includes the following steps: Step S1: Perform light intensity perception through a lamp and extract a light intensity change amount sequence to obtain a light intensity change amount sequence; generate a light intensity feature vector according to the light intensity change amount sequence to obtain a light intensity feature vector; Step S2: Calculate the light intensity change time difference according to the light intensity feature vector to obtain a light intensity change time difference matrix; identify the multipath effect on the light intensity change time difference matrix and suppress the path effect to obtain multipath effect suppression data; construct a node relative position matrix according to the multipath effect suppression data to obtain a node relative position matrix; Step S3: Establish an initial connection relationship according to the node relative position matrix to obtain initial network connection relationship data; construct a topological structure according to the initial network connection relationship data and optimize the topological structure to obtain a network topology graph; Step S4: Calculate the routing evaluation index according to the network topology graph to obtain routing evaluation index data; perform Q-learning routing decision-making and dynamic routing update by using a pre-trained Q-learning routing decision model and the routing evaluation index data to obtain a dynamic routing table; Step S5: Analyze the network state according to the dynamic routing table to obtain network state analysis result data; perform node networking control processing according to the network state analysis result data to realize the lamp networking operation.
2. The lighting network formation method according to claim 1, wherein Step S1 includes the following steps: Step S11: Collect light intensity data through the light intensity sensor array of the lamp to obtain original light intensity data; perform data preprocessing on the original light intensity data to obtain preprocessed light intensity data; Step S12: Establish an ambient light intensity baseline according to the preprocessed light intensity data to obtain an ambient light intensity baseline value; Step S13: Extract a light intensity change amount sequence from the preprocessed light intensity data and the ambient light intensity baseline value to obtain a light intensity change amount sequence; Step S14: Analyze the light intensity change pattern of the light intensity change amount sequence to obtain light intensity change pattern data; Step S15: Generate a light intensity feature vector according to the light intensity change pattern data to obtain a light intensity feature vector.
3. The lighting network formation method according to claim 1, wherein Step S2 includes the following steps: Step S21: Broadcast the feature vector of the light intensity feature vector through the lamp and receive the feature vector to obtain the node light intensity feature vector; Step S22: Screen potential neighbor nodes for the node light intensity feature vector to obtain potential neighbor nodes; calculate the light intensity change time difference for the potential neighbor nodes to obtain a light intensity change time difference matrix; Step S23: Estimate the initial distance of the nodes according to the light intensity change time difference matrix to obtain the initial distance value of the nodes; Step S24: Identify the multipath effect on the light intensity change time difference matrix and suppress the path effect to obtain multipath effect suppression data; Step S25: Calculate the initial relative position according to the initial distance value of the nodes and the multipath effect suppression data to obtain node relative position data; Step S26: Optimize the node relative position data by using the least squares method to obtain optimized node relative position data; construct a node relative position matrix according to the optimized node relative position data to obtain a node relative position matrix.
4. The lighting network formation method according to claim 3, wherein Calculating the time difference of light intensity change for potential neighbor nodes includes the following steps: Calculating the light intensity change rate for potential neighbor nodes to obtain a light intensity change rate sequence; Calculating the cross-correlation function based on the light intensity change rate sequence to obtain the cross-correlation function; Searching for the maximum peak of the cross-correlation function to obtain the maximum peak; Constructing a time difference matrix based on the maximum peak to obtain a light intensity change time difference matrix.
5. The lighting network formation method according to claim 3, wherein Step S24 includes the following steps: Step S241: Analyzing the multi-path signal characteristics of the light intensity change time difference matrix to obtain the multi-path signal characteristics; Step S242: Estimating the time difference azimuth of the signal source based on the multi-path signal characteristics to obtain the signal source azimuth data; estimating the angle of arrival of the signal based on the multi-path signal characteristics to obtain the signal arrival angle data; Step S243: Separating the multi-path signals based on the signal arrival angle data and the signal source azimuth data to obtain a multi-path signal set; Step S244: Identifying the line-of-sight path and classifying the line-of-sight path signals in the multi-path signal set based on the multi-path signal characteristics to obtain the line-of-sight path signals and non-line-of-sight path signals; Step S245: Suppressing the non-line-of-sight path signals to obtain the non-line-of-sight path suppression data; estimating the line-of-sight path distance based on the line-of-sight path signals to obtain the line-of-sight path distance data; Step S246: Suppressing the multi-path effect on the line-of-sight path distance data based on the non-line-of-sight path suppression data to obtain the multi-path effect suppression data.
6. The lighting network formation method according to claim 1, wherein Step S3 includes the following steps: Step S31: Visualizing the relative position matrix of the nodes to obtain a node distribution map; triangulating the node distribution map to obtain triangulation data; Step S32: Establishing an initial connection relationship based on the triangulation data to obtain initial network connection relationship data; constructing a minimum spanning tree based on the initial network connection relationship data to obtain minimum spanning tree data; Step S33: Obtaining the actual communication range data of the lamps; restricting the minimum spanning tree data according to the actual communication range data of the lamps to obtain node network constraint data; Step S34: Calculating the node degree centrality of the node network constraint data to obtain node degree centrality data; calculating the node betweenness centrality of the node network constraint data to obtain node betweenness centrality data; Step S35: Adjusting the load balance according to the node degree centrality data and the node betweenness centrality data to obtain load balance adjustment data; Step S36: Optimizing the topological structure of the node network constraint data according to the load balance adjustment data and generating a network topology map to obtain the network topology map.
7. The lighting network formation method according to claim 1, characterized in that, Step S4 includes the following steps: Step S41: Maintaining the neighbor node information according to the network topology map to obtain a neighbor node information table; calculating the relative position of the target node according to the neighbor node information table to obtain the relative position data of the target node; Step S42: Selecting greedy forwarding candidate nodes according to the relative position data of the target node and the neighbor node information table to obtain greedy forwarding candidate nodes; Step S43: Perform link state information exchange based on the greedy forwarding candidate nodes to obtain link state information; perform multi-path routing search based on the link state information to obtain multi-path routing data; Step S44: Calculate routing evaluation metrics for the multi-path routing data to obtain routing evaluation metric data; Step S45: Use the pre-trained Q-learning routing decision model and the routing evaluation metric data to perform Q-learning routing decision to obtain Q-learning routing decision data; Step S46: Perform dynamic routing update based on the Q-learning routing decision data and the multi-path routing data to obtain a dynamic routing table.
8. The lighting network formation method according to claim 7, wherein The construction of the pre-trained Q-learning routing decision model includes the following steps: Perform prediction analysis on the light intensity change through the light intensity sensor array of the lamp to obtain light intensity change prediction data; Perform prediction of path lamp nodes based on the light intensity change prediction data to obtain path lamp nodes; Expand the Q-learning state space for the path lamp nodes to obtain Q-learning state space expansion data; evaluate the path link quality for the path lamp nodes to obtain path link quality data; Design a Q-learning reward function based on the Q-learning state space expansion data and the path link quality data to obtain a Q-learning reward function; Train and optimize the Q-learning model based on the Q-learning reward function and the light intensity change prediction data to obtain a Q-learning routing decision model.
9. The method for networking lamps according to claim 1, characterized in that, Step S5 includes the following steps: Step S51: Real-time collect network performance metrics through the monitoring nodes deployed in the network to obtain network performance metric data; Step S52: Aggregate the network performance metric data to the central controller node according to the dynamic routing table, and perform network state analysis to obtain network state analysis result data; Step S53: Construct a genetic algorithm parameter optimization model based on the network state analysis result data to obtain a genetic algorithm parameter optimization model; use the genetic algorithm parameter optimization model to output the predicted value of the network performance metric to obtain the predicted value of the network performance metric; Step S54: Perform fuzzy logic reasoning based on the predicted value of the network performance metric and the network performance metric data and output a network control instruction to obtain a network control instruction; Step S55: The central controller node issues the network control instruction according to the dynamic routing table to obtain a node network control instruction; execute the node instruction according to the node network control instruction to implement the lamp networking operation.
Citation Information
Patent Citations
Ad hoc network method and ad hoc network system
WO2023029815A1
Illumination assembly communication
WO2023031446A1