Grid-distributed photovoltaic system based on Kademlia protocol communication
The grid-distributed photovoltaic system based on the Kademlia protocol solves the cumbersome problem of distributed photovoltaic grid connection, achieves rapid network joining and resource diffusion, and improves system efficiency and flexibility.
Patent Information
- Application Number
- CN202411535167.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-10-31
AI Technical Summary
The existing distributed photovoltaic grid-connected process is cumbersome, resulting in poor grid access flexibility and large system resource usage, affecting execution efficiency.
A grid-distributed photovoltaic system based on the Kademlia protocol is adopted. Through the modular design of the server and client, the distance judgment mechanism of the Kademlia protocol is used to ignore only the information of nodes that are far away, reduce recursive operations, and achieve fast network joining.
It improves the execution efficiency and flexibility of the system, reduces the time for nodes to join the network and the system resource usage, and ensures the convergence of the network and the rapid diffusion of resources.
Smart Images

Figure CN119383131B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of power and communication technology, and in particular to a power grid distributed photovoltaic system based on Kademlia protocol communication. Background Art
[0002] Global energy shortages and environmental pollution are becoming increasingly serious. Solar energy, a safe, clean energy source with enormous potential, is being increasingly utilized, with photovoltaic power generation being the most popular application. Under the influence of my country's strategic initiatives, distributed photovoltaics have enormous potential for development.
[0003] However, as distributed photovoltaic systems continue to expand, new ones are increasingly connected to the power grid. Only by ensuring the accurate integration of these new distributed photovoltaic systems into the grid can the safe and efficient operation of both the grid and the distributed photovoltaic systems be guaranteed. However, existing solutions require a large number of recursive operations to achieve grid connection for these new distributed photovoltaic systems. This process not only consumes significant system resources and impacts efficiency, but also is extremely cumbersome, resulting in limited flexibility in the integration of these new distributed photovoltaic systems. Summary of the Invention
[0004] In view of this, in order to address the above shortcomings, it is necessary to propose a grid-distributed photovoltaic system based on Kademlia protocol communication to improve the execution efficiency and flexibility of the system.
[0005] The present invention provides a distributed photovoltaic system for a power grid based on Kademlia protocol communication, the system comprising: a server and a plurality of clients; each client is configured at each distributed photovoltaic node in the power grid system;
[0006] The server includes: a message processing module, a first routing table processing module and a resource publishing module;
[0007] The message processing module is used to process and reply to messages sent by each client;
[0008] The first routing table processing module is used to store and process node information of each distributed photovoltaic node;
[0009] The resource publishing module is used to publish and transmit new resources;
[0010] Any of the clients includes: a second routing table processing module, a network joining module, a self-information updating module and a resource message sending module;
[0011] The second routing table processing module is used to process the node information where the current distributed photovoltaic is located;
[0012] The network joining module is used to communicate with the server based on the Kademlia protocol and implement the distributed photovoltaic network joining at the current node based on the principle that distant nodes do not reply to new node information and only add the node to the K bucket;
[0013] The self-information updating module is used to update the node information of the node where the current distributed photovoltaic is located;
[0014] The resource message sending module is used to send and download resources.
[0015] Preferably, the first routing table processing module includes 32 K buckets, and the number of nodes stored in each K bucket is unlimited.
[0016] Preferably, the second routing table processing module includes at least one K bucket, and each K bucket stores a maximum of 32 nodes.
[0017] Preferably, when executing the distributed photovoltaic network joining operation at the current A node, the network joining module is configured to perform the following operations:
[0018] The client of node A communicates with the server;
[0019] After receiving the message from node A, the server calls the first routing table processing module to calculate information of several online nodes within a first preset range from node A, and sends the information of these online nodes to node A;
[0020] After receiving the response from the server, node A sends its own information to each online node;
[0021] For any online node that receives node A's information, if the distance between the node and node A is within the second preset range, it selects from its own K bucket several nodes whose distances to node A are within the third preset range and sends the node information to node A; if the distance between the node and node A is not within the second preset range, it only replies a confirmation message to node A;
[0022] When node A no longer receives responses from other nodes, the server declares that the distributed photovoltaic of node A joins the distributed photovoltaic network of the power grid.
[0023] Preferably, when calculating the distance between nodes, if both nodes are nodes in the intranet, the gateway IP address is used to calculate the distance between the two nodes through IP XOR operation; if the IPs of the two nodes are located in different IP segments in the same region, the adjacent nodes are determined through a pre-configured adjacent node mechanism, and the distance between the two nodes is calculated based on the IP XOR operation.
[0024] Preferably, when the IP address of a node changes, the IP address is converted into a hash value through a hash algorithm, and the hash value is used as the unique identifier of the node.
[0025] Preferably, the routing tables in the K buckets in the client and the server are generated using linked lists.
[0026] Preferably, when the information of node A changes, the self-information updating module is configured to perform the following operations:
[0027] Node A sends an update message to the server and its neighbor nodes;
[0028] For any neighbor node that receives an update message from node A, if the distance between the neighbor node and node A is within the fourth preset range, the neighbor node forwards the update information of node A to several neighbor nodes in its own K bucket; if the distance between the neighbor node and node A is not within the fourth preset range, only a confirmation message is sent to node A.
[0029] Preferably, the resource publishing module is configured to actively publish the corresponding resource of the new resource when the server has new resources.<key,value> The information is published to each node so that the new resource is gradually diffused in the network; the key is generated by a hash function, and the value is a list of node information containing the new resource.
[0030] Preferably, the resource message sending module is configured to actively send the corresponding new resource to the node when the node has new resources.<key,value> The information is published to neighboring nodes so that the new resource gradually spreads in the network; wherein the key is generated by a hash function and the value is a list of node information containing the new resource; and
[0031] The resource message sending module is also configured to add the node's own information to the value list after downloading the new resource, and publish a new<key,value> information.
[0032] As can be seen from the above technical solution, the grid-distributed photovoltaic system based on Kademlia protocol communication provided by the present invention includes a server and several clients, each of which is configured at each distributed photovoltaic node in the grid system. The server specifically includes a message processing module, a first routing table processing module, and a resource publishing module. The message processing module is capable of processing and replying to messages sent by each client, the first routing table processing module is capable of storing and processing node information of each distributed photovoltaic node, and the resource publishing module is capable of publishing and transmitting new resources. The client specifically includes a second routing table processing module, a network joining module, a self-information updating module, and a resource message sending module. The second routing table processing module is capable of processing node information of the current distributed photovoltaic node. The network joining module is capable of communicating with the server based on the Kademlia protocol and, based on the principle that distant nodes do not reply to new node information but are only added to the K bucket, implements network joining of the distributed photovoltaic node at the current node. The self-information updating module is capable of updating the node information of the current distributed photovoltaic node, and the resource message sending module is capable of sending and downloading resources. It can be seen that this solution communicates with the server based on the Kademlia protocol through the network joining module, and based on the principle that nodes that are far away do not reply to new node information and only add the node to the K bucket, it can reduce the number of recursive operations, which not only shortens the time for nodes to join the network, but also reduces the occupation of system resources, facilitates the access of new distributed photovoltaic nodes to the network, and greatly improves the execution efficiency and flexibility of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 A schematic diagram of a grid-distributed photovoltaic system based on Kademlia protocol communication provided by an embodiment of the present invention.
[0034] Figure 2 A flow chart of network joining of a distributed photovoltaic node provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0036] like Figure 1 As shown, the present invention provides a grid distributed photovoltaic system based on Kademlia protocol communication, the system comprising: a server and a plurality of clients; each client is configured at each distributed photovoltaic node in the grid system;
[0037] The server includes: a message processing module, a first routing table processing module and a resource publishing module;
[0038] Message processing module, used to process and reply to messages sent by each client;
[0039] A first routing table processing module, configured to store and process node information of each distributed photovoltaic node;
[0040] Resource publishing module, used to publish and transmit new resources;
[0041] Any client includes: a second routing table processing module, a network joining module, a self-information updating module and a resource message sending module;
[0042] The second routing table processing module is used to process the node information where the current distributed photovoltaic is located;
[0043] The network joining module is used to communicate with the server based on the Kademlia protocol. Based on the principle that distant nodes do not reply to new node information and only add the node to the K bucket, it realizes the network joining of the distributed photovoltaic at the current node;
[0044] The self-information update module is used to update the node information of the current distributed photovoltaic node;
[0045] The resource message sending module is used to send and download resources.
[0046] In this embodiment, the grid-distributed photovoltaic system includes a server and a client. The server provides query services to the client. When a node uses the client to access the network, it first communicates with the server to obtain information about several nodes. The client is the main part of the system, used to build a distributed communication network and publish and download resources. Specifically, this solution communicates with the server based on the Kademlia protocol through a network joining module, and based on the principle that nodes that are farther away do not reply to new node information, but only add the node to the K bucket. For example, nodes below 24 rows do not reply to new node information. This can reduce the number of recursive operations, not only shortening the time it takes for nodes to join the network, but also reducing the occupation of system resources, facilitating the entry of new distributed photovoltaic nodes into the network, and greatly improving the execution efficiency and flexibility of the system. This can also ensure the convergence of the network, that is, the closer the nodes in the routing table, the more nodes there are, and the farther the nodes, the fewer nodes there are.
[0047] On the server side, the functional modules can be divided into a message processing module, a first routing table processing module, and a resource publishing module. The message processing module can further include UDP message processing and TCP message processing, which are used to process and reply to various messages sent by the client. The first routing table processing module is used to store and process node information. It can include 32 K buckets, and each K bucket can store an unlimited number of nodes.
[0048] The resource publishing module is used to publish and transmit new resources. For example, it can be configured to automatically send the corresponding<key,value> Information is published to each node so that the new resource can be gradually spread in the network; the key is generated by a hash function, and the value is a list of node information containing the new resource, such as IP, PORT, and ID, where PORT is the listening port for resource download.
[0049] For the client, the client's functional modules can be divided into a second routing table processing module, a network joining module, a self-information update module, and a resource message sending module. The second routing table processing module can process the node information of the current distributed photovoltaic node, which can specifically include at least one K bucket, each of which can store up to 32 nodes.
[0050] Consider improving Kademlia's K-bucket storage in the routing table processing module. Specifically, consider using a linked list instead of K-bucket splitting to generate the routing table. Because the IP XOR algorithm is used to calculate distances and IP addresses are 32 bits long, the routing table only contains 32 rows. This significantly reduces the storage space occupied by 32 rows compared to 160 rows.
[0051] The network joining module is used to execute the network joining operation of distributed photovoltaic. Figure 2 As shown, for the distributed photovoltaic network joining operation at node A, the network joining module can be configured to perform the following steps:
[0052] Step S1: The client of node A communicates with the server;
[0053] Step S2: After receiving the message from node A, the server calls the first routing table processing module to calculate information of several online nodes within a first preset range from node A, and sends the information of these online nodes to node A;
[0054] Step S3: After receiving the response from the server, node A sends its own information to each online node;
[0055] Step S4: For any online node that receives the information of node A, if the distance between the node and node A is within the second preset range, the node selects from its own K bucket several nodes whose distances to node A are within the third preset range and sends the node information to node A; if the distance between the node and node A is not within the second preset range, the node only replies with a confirmation message to node A;
[0056] Step S5: When node A no longer receives responses from other nodes, the server declares that the distributed photovoltaic of node A joins the distributed photovoltaic network of the power grid.
[0057] In this embodiment, when node A joins the network, it first communicates with the server. Upon receiving the message from node A, the server calculates and transmits the information of online nodes that are closest to node A (up to 32 nodes). Upon receiving the reply, node A continues to broadcast its own information to the replying nodes. If the receiving node finds itself relatively close to node A, it selects a number of nodes (up to 32) from its own K bucket and sends them to node A. If the node is farther away, it only responds with a confirmation message. When node A no longer receives replies from other nodes, the server declares node A to have joined the network. The determination of whether a node is relatively close or distant can be determined by setting a threshold.
[0058] When calculating the distance between nodes, you can use the node IP addresses. Specifically, if both nodes are on the intranet, the distance between the two nodes is calculated using the gateway IP address through an IP XOR operation. If the IP addresses of the two nodes are located in different IP segments in the same region, the pre-configured neighboring node mechanism is used to determine the neighboring nodes, and the distance between the two nodes is calculated based on the IP XOR operation.
[0059] In this embodiment, because node IP addresses are clearly regional, the distance calculated using the IP XOR operation is related to the actual distance. On the internet, nodes with similar IP addresses are necessarily located in the same region. For nodes within an intranet, the gateway IP address can be used for example. For nodes with different IP segments in the same region, a special mechanism can be set up to set nodes with different IP segments in the same region as adjacent nodes, allowing the distance calculation of adjacent nodes based on the IP XOR operation.
[0060] In addition, since the node IP will change, it is considered to convert the IP address into a hash value through a hash algorithm, and use the hash value as the unique identification ID of the node. In this way, when the node IP changes, the node ID can be used to publish an IP update message to ensure the consistency of the node correspondence, thereby ensuring the consistency and accuracy of data interaction.
[0061] The self-information update module is used to update the node information of the distributed photovoltaic node. For example, when the self-information of node A changes, the self-information update module can be configured to perform the following operations:
[0062] Node A sends an update message to the server and its neighbor nodes (up to 32);
[0063] For any neighbor node that receives an update message from node A, if the distance between the neighbor node and node A is within the fourth preset range, the neighbor node forwards the update information of node A to several neighbor nodes in its own K bucket; if the distance between the neighbor node and node A is not within the fourth preset range, only a confirmation message is sent to node A.
[0064] The resource message sending module is used for publishing, transmitting and downloading new resources. Specifically, it can be configured to actively send the corresponding resource to the node when there is a new resource.<key,value> Information is published to neighboring nodes to gradually spread the new resource in the network. The key is generated by a hash function, and the value is a list of node information containing the new resource. For example, the node information may include IP, PORT, and ID, where PORT is the listening port for resource downloads. In this way, when a node needs the resource, it can locate the resource download point more quickly.
[0065] The resource message sending module is also configured to add the node's own information to the value list after downloading new resources and publish new<key,value> Information to increase resource download points.
[0066] The present invention also provides a computing device including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it runs any of the above-mentioned grid-distributed photovoltaic systems based on Kademlia protocol communication.
[0067] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed in a computer, the computer is caused to run any of the above-mentioned grid-distributed photovoltaic systems based on Kademlia protocol communication.
[0068] Since the device embodiment provided by the present invention is based on the same inventive concept as the system embodiment of this specification, the specific content can be found in the description of the system embodiment of this specification and will not be repeated here.
[0069] The modules or units in the device of the embodiment of the present invention can be combined, divided, or deleted according to actual needs. The above disclosure is only a preferred embodiment of the present invention and is certainly not intended to limit the scope of the present invention. Those skilled in the art will understand that implementing all or part of the process of the above embodiment and making equivalent changes in accordance with the claims of the present invention still fall within the scope of the invention.
Claims
1. A grid-distributed photovoltaic system based on Kademlia protocol communication, characterized in that: The system includes: a server and several clients; each client is configured at each distributed photovoltaic node in the power grid system; The server includes: a message processing module, a first routing table processing module and a resource publishing module; The message processing module is used to process and reply to messages sent by each client; The first routing table processing module is used to store and process node information of each distributed photovoltaic node; The resource publishing module is used to publish and transmit new resources; Any of the clients includes: a second routing table processing module, a network joining module, a self-information updating module and a resource message sending module; The second routing table processing module is used to process the node information where the current distributed photovoltaic is located; The network joining module is used to communicate with the server based on the Kademlia protocol and implement the distributed photovoltaic network joining at the current node based on the principle that distant nodes do not reply to new node information and only add the node to the K bucket; The self-information updating module is used to update the node information of the node where the current distributed photovoltaic is located; The resource message sending module is used to send and download resources; When executing the distributed photovoltaic network joining operation at the current A node, the network joining module is configured to perform the following operations: The client of node A communicates with the server; After receiving the message from node A, the server calls the first routing table processing module to calculate information of several online nodes within a first preset range from node A, and sends the information of these online nodes to node A; After receiving the response from the server, node A sends its own information to each online node; For any online node that receives node A's information, if the distance between the node and node A is within the second preset range, it selects from its own K bucket several nodes whose distances to node A are within the third preset range and sends the node information to node A; if the distance between the node and node A is not within the second preset range, it only replies a confirmation message to node A; When node A no longer receives responses from other nodes, the server declares that the distributed photovoltaic of node A joins the distributed photovoltaic network of the power grid.
2. The grid-distributed photovoltaic system based on Kademlia protocol communication according to claim 1, characterized in that: The first routing table processing module includes 32 K buckets, and the number of nodes stored in each K bucket is unlimited.
3. The grid-distributed photovoltaic system based on Kademlia protocol communication according to claim 1, characterized in that: The second routing table processing module includes at least one K bucket, and each K bucket stores a maximum of 32 nodes.
4. The grid-distributed photovoltaic system based on Kademlia protocol communication according to claim 1, characterized in that: When calculating the distance between nodes, if both nodes are in the intranet, the gateway IP address is used to calculate the distance between the two nodes through IP XOR operation. If the IP addresses of the two nodes are located in different IP segments in the same region, the adjacent nodes are determined through the pre-configured adjacent node mechanism, and the distance between the two nodes is calculated based on the IP XOR operation.
5. The grid-distributed photovoltaic system based on Kademlia protocol communication according to claim 4, characterized in that: When the IP address of a node changes, the IP address is converted into a hash value through a hash algorithm, and the hash value is used as the unique identifier of the node.
6. The grid-distributed photovoltaic system based on Kademlia protocol communication according to claim 1, characterized in that: The routing tables in the K buckets on the client and server are generated using linked lists.
7. The grid-distributed photovoltaic system based on Kademlia protocol communication according to claim 1, characterized in that: When the information of node A changes, the self-information update module is configured to perform the following operations: Node A sends an update message to the server and its neighbor nodes; For any neighbor node that receives an update message from node A, if the distance between the neighbor node and node A is within the fourth preset range, the neighbor node forwards the update information of node A to several neighbor nodes in its own K bucket; if the distance between the neighbor node and node A is not within the fourth preset range, only a confirmation message is sent to node A.
8. The grid-distributed photovoltaic system based on Kademlia protocol communication according to claim 1, characterized in that: The resource publishing module is configured to actively publish the corresponding resource when the server has new resources.<key,value> The information is published to each node so that the new resource is gradually diffused in the network; the key is generated by a hash function, and the value is a list of node information containing the new resource.
9. The grid-distributed photovoltaic system based on Kademlia protocol communication according to claim 1, characterized in that: The resource message sending module is configured to actively send the corresponding new resource to the node when the node has new resources.<key,value> The information is published to neighboring nodes so that the new resource gradually spreads in the network; wherein the key is generated by a hash function and the value is a list of node information containing the new resource; and The resource message sending module is also configured to add the node's own information to the value list after downloading the new resource, and publish a new<key,value> information.
Citation Information
Patent Citations
Method, apparatus and system for selecting super node, searching network node or resource
CN101064649A
Method for constructing block chain fully-distributed node routing network
CN114363247A