Microgrid transaction consensus method and system based on Q method and power grid detection and evaluation

By applying the Q-learning algorithm and KKT conditions on the blockchain, combined with the grid voltage detection and evaluation, the problem of difficulty in dealing with the complexity of multi-microgrid transactions in traditional scheduling is solved, and the efficient and environmental consensus mechanism of the microgrid market is realized, and the improvement of the Transaction efficiency and grid safety.

CN115334106BActive Publication Date: 2024-11-01DEZHOU POWER SUPPLY COMPANY OF STATE GRID SHANDONG ELECTRIC POWER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210890727.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-27
Publication Date
2024-11-01
Estimated Expiration
2042-07-27

AI Technical Summary

Technical Problem

Traditional centralized power market scheduling is difficult to take into account the complexity and efficiency of multi-microgrid transactions, and the traditional consensus mechanism does not consider grid voltage detection and evaluation, resulting in insufficient distributed grid connection and inefficiency.

Method used

A blockchain consensus mechanism based on the Q-learning algorithm is adopted, combined with KKT conditions, a market transaction model is established, grid voltage detection and evaluation and profit distribution are carried out, and the Nash equilibrium solution and consensus judgment of microgrid transactions are realized through the blockchain platform.

Benefits of technology

It improves the efficiency and fairness of microgrid market transactions, avoids the grid voltage exceeding the limit, reduces energy waste, and ensures the safety and fairness of power grid operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115334106B_ABST
    Figure CN115334106B_ABST
Patent Text Reader

Abstract

The present invention proposes a microgrid transaction consensus method and system based on the Q method and power grid detection and evaluation, which belongs to the field of transaction consensus technology. Based on the blockchain power market information in which the microgrid participates, a market transaction model based on the power grid detection and evaluation technology is established; the KKT condition is combined with the Q-learning algorithm to solve the Nash equilibrium of the market transaction model to obtain the block that reaches the Nash equilibrium; the block that reaches the Nash equilibrium is judged by consensus, and the block that meets the conditions is used as the main node to package and manage the blockchain market information; in the power market scenario in which multiple microgrids participate, the present invention discloses a market architecture suitable for transactions on the microgrid blockchain, and on the basis of the market architecture, the KKT condition is used to improve the Q-learning algorithm so that it can handle complex power market constraints, help maintain the fairness and justice of blockchain market transactions, and ensure the safety of power grid operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of transaction consensus, and in particular to a microgrid transaction consensus method and system based on the Q method and power grid detection and evaluation. Background Art

[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.

[0003] As the power industry's requirements for environmental protection continue to increase, the proportion of various new energy sources in the power market continues to increase. Distributed is one of the most important clean energy generation methods and has broad development prospects. Surveys show that distributed is expected to become one of the most important new energy generation methods in the future. The participation of microgrids composed of distributed energy in the power market competition has made the power market participants more diverse and the power market information more complex, which has brought huge challenges to the traditional market optimization transaction system. The traditional power market dispatch adopts a centralized dispatching method. First of all, it is difficult to deal with the massive transaction information of multi-microgrid transactions and the changeable decision-making behavior of market entities. In addition, the centralized traditional optimization dispatching method is difficult to take into account the benefits of each market entity, resulting in insufficient distributed grid connection; traditional centralized dispatching also has problems in efficiency and decision-making cost control. Therefore, in order to fully consider the market behavior of all market entities and improve the benefits and efficiency of each entity, it is necessary to transform the original centralized center dispatching into decentralized transactions. In this context, blockchain technology is an important means to solve the above problems. Blockchain technology has the advantages of decentralization, reliable data, and high information transparency. Its decentralized advantages are consistent with the characteristics of distributed dispersion, and it is very suitable for multi-microgrid market transactions. In addition, the traditional consensus mechanism does not consider the detection and evaluation of the grid voltage, and the voltage is easy to exceed the limit, causing damage to the grid. In this regard, the present invention discloses a microgrid blockchain transaction consensus mechanism based on the detection and evaluation of the grid voltage, uses Q-learning to improve the blockchain market mechanism used in microgrid market transactions, combines the consensus mechanism with the actual needs of the microgrid, and establishes an efficient and environmentally friendly consensus mechanism, which can lay a technical foundation for promoting the use of blockchain in the microgrid market and promote the transformation of the microgrid market.

[0004] The blockchain consensus mechanism is one of the most important and basic technologies of the blockchain. The blockchain has the characteristics of decentralization and power. Each node has considerable power and can tamper with the entire blockchain transaction information data at will without constraints. How to make these subjects with the same power reach a consistent decision is a complex problem that the blockchain needs to solve, that is, the consensus mechanism. The traditional consensus mechanism adopts methods such as the proof of work mechanism. First of all, it wastes a lot of energy and is contrary to the theme of microgrid development and environmental protection. In addition, the consensus efficiency is low and the error rate is high, which is not suitable for power market transactions. The essence of the power market competition game is to solve the market equilibrium, that is, any change in the current state will develop in an unfavorable direction, which is consistent with the consensus mechanism. Therefore, the algorithm for solving the market equilibrium can be combined with the consensus mechanism to establish a new blockchain microgrid transaction consensus method.

[0005] Reinforcement learning technology is to give weights and evaluations to the learning process. The subject constantly tests the consequences of various behaviors. When a behavior is close to the ideal result, it will be "rewarded", otherwise it will be punished. The advantage of reinforcement learning is that it uses a fixed operation mode, and the amount of calculation for each step is not large; you only need to know the evaluation criteria, but not the optimization method and the entire process. This makes reinforcement learning have a fast solution speed, and it can obtain relatively ideal results without obtaining particularly complete information. In recent years, reinforcement learning has been widely used in the field of power systems, playing an important role in the fields of power market optimization and scheduling, digital twin technology, fault monitoring, etc.

[0006] However, there are few studies on blockchain consensus mechanisms suitable for microgrid market transactions, and the feasibility is not strong. There is a lack of research on applying reinforcement learning with fast running speed and strong ability to use incomplete information to solve consensus problems.

[0007] This research direction is indispensable to the future development of the electricity market, especially the use of blockchain for the sale of electric energy resources, which plays a basic supporting role in the in-depth application of blockchain technology in the electricity market. Summary of the invention

[0008] In order to overcome the deficiencies of the above-mentioned prior art, the present invention provides a microgrid transaction consensus method and system based on the Q method and power grid detection and evaluation, which are used to simplify the complex consensus problems of power market transactions involving microgrids; in the power market scenario involving multiple microgrids, blockchain is used as the transaction platform, and each market entity is used as a participating node of the blockchain. First, a market architecture suitable for transactions on the microgrid blockchain is disclosed, which takes into account the detection and evaluation of the power grid voltage to avoid the voltage exceeding the rated limit and ensure the safety of network operation; then, on the basis of the market architecture, a blockchain consensus mechanism based on the Q-learning algorithm is disclosed, and the KKT condition is used to improve the Q-learning algorithm so that it can handle complex power market constraints, help maintain the fairness and justice of blockchain market transactions, and ensure the safety of power grid operation.

[0009] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions:

[0010] The first aspect of the present invention provides a microgrid transaction consensus method based on the Q method and power grid detection and evaluation;

[0011] Microgrid transaction consensus method based on Q method and power grid detection and evaluation, including:

[0012] Based on the blockchain power market information of microgrid participation, a market transaction model based on power grid detection and evaluation technology is established;

[0013] Combining the KKT condition with the Q-learning algorithm, the Nash equilibrium of the market transaction model is solved to obtain the block that reaches the Nash equilibrium;

[0014] Consensus judgment is made on the blocks that have reached Nash equilibrium, and qualified blocks serve as master nodes to package and manage blockchain market information.

[0015] Furthermore, the market transaction model includes a market revenue function, a detection and evaluation of grid voltage, constraints, and a profit distribution function for grid participants.

[0016] Furthermore, the market revenue function is the difference between the revenue from selling electricity in the market and the cost of producing electricity, and the market clearing objective is to maximize the market revenue;

[0017] The cost of producing electricity includes credit cost, traditional unit cost and energy storage cost.

[0018] Furthermore, the constraints include power balance constraints, power generation capacity constraints and energy storage capacity constraints.

[0019] Furthermore, the profit distribution function of the grid participants applies the Shapley value method to distribute the revenue according to the marginal contribution of the microgrid to the market revenue and calculate the profit of the grid participants.

[0020] Furthermore, the Nash equilibrium solution for the market transaction model is performed in the following specific steps:

[0021] Initialize Q table;

[0022] Update microgrid power market parameters;

[0023] The KKT condition is used to improve the Q-learning algorithm;

[0024] Exploration using known microgrid market information;

[0025] Calculate new Q values ​​and update the Q table based on market calculation results;

[0026] Determine whether there is a block that has reached Nash equilibrium. If not, continue exploring.

[0027] Furthermore, a verification and sorting mechanism is used to make consensus judgments on blocks that have reached Nash equilibrium.

[0028] A second aspect of the present invention provides a microgrid transaction consensus system based on the Q method and power grid detection and evaluation.

[0029] A microgrid transaction consensus system based on the Q method and power grid detection and evaluation, including a model building module, a Nash equilibrium module, and a consensus judgment module;

[0030] The model building module is configured to: establish a market transaction model based on power grid detection and evaluation technology based on the blockchain power market information in which the microgrid participates;

[0031] The Nash equilibrium module is configured to: combine the KKT condition with the Q-learning algorithm to solve the Nash equilibrium of the market transaction model and obtain the block that reaches the Nash equilibrium;

[0032] The consensus judgment module is configured to: make consensus judgments on blocks that have reached Nash equilibrium, and use qualified blocks as master nodes to package and manage blockchain market information.

[0033] The third aspect of the present invention provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps in the microgrid transaction consensus method based on the Q method and power grid detection and evaluation as described in the first aspect of the present invention.

[0034] The fourth aspect of the present invention provides an electronic device, including a memory, a processor, and a program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps in the microgrid transaction consensus method based on the Q method and power grid detection and evaluation as described in the first aspect of the present invention are implemented.

[0035] One or more of the above technical solutions have the following beneficial effects:

[0036] In the electricity market scenario involving multiple microgrids, the present invention adopts blockchain as a transaction platform, and each market entity serves as a participating node of the blockchain. A market architecture suitable for transactions on the microgrid blockchain is disclosed. The architecture takes into account the detection and evaluation of the grid voltage to avoid the voltage exceeding the rated limit. Compared with the traditional consensus mechanism, this method runs fast and does not require too much computing power. At the same time, it takes into account the detection and evaluation of the grid voltage to ensure the safe operation of the grid.

[0037] The present invention proposes a mathematical clearing model suitable for transactions on microgrid blockchain. The model discloses a reputation cost calculation method, which can better reflect the reputation of microgrids participating in blockchain power market transactions and punish behaviors that violate good faith transactions, which can help maintain fairness and justice in blockchain market transactions. At the same time, the model fully considers the actual market situation and establishes an energy storage model and a profit distribution model.

[0038] The present invention discloses a method for solving the consensus of transactions on a microgrid blockchain using a Q-learning algorithm, which transforms the original complex consensus mechanism problem into a Nash equilibrium problem for solving a market game, and applies the advantages of a deep learning Q-learning algorithm such as fast running speed and strong ability to process uncertain market information to the consensus mechanism of the microgrid market; introduces KKT conditions into the Q-learning algorithm, so that the algorithm can process complex constraints in the power market; the method abandons the traditional proof-of-work mechanism, and the microgrid operator who has achieved Nash equilibrium in the game has obtained the most appropriate benefits, so there is no reason to break the existing balance, and can serve as the main node selected by the consensus mechanism to process and package and upload power market information for management.

[0039] The present invention discloses a verification and sorting mechanism, which ensures the reliability of the consensus mechanism through multiple tests; compared with the traditional proof-of-work mechanism, this method is more efficient and does not require invalid workload.

[0040] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0042] Figure 1 This is a flow chart of the method of the first embodiment.

[0043] Figure 2 This is a flowchart of solving the Nash equilibrium solution of the first embodiment.

[0044] Figure 3 It is a system structure diagram of the second embodiment. DETAILED DESCRIPTION

[0045] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present disclosure. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present disclosure belongs.

[0046] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present disclosure. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0047] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

[0048] The application of blockchain in electricity market transactions, as a platform and architecture for market transactions, is a research focus of the economic operation of the electricity market. The consensus mechanism is one of the most important components of the blockchain. However, the existing research consensus mechanism is not applicable to microgrid electricity market transactions.

[0049] The present invention provides a microgrid blockchain transaction consensus method based on the Q method and power grid detection and evaluation technology, which fully considers the power grid voltage detection constraints, and transforms the power market consensus of the microgrid into the problem of solving the market Nash equilibrium solution through the Q-learning algorithm. The present invention first discloses a market model for transactions on the microgrid blockchain, which proposes a reputation cost calculation method for judging the reputation of market entities; the present invention proposes a new consensus mechanism for the blockchain used in microgrid market transactions, which considers the power grid voltage detection and evaluation, and applies the advantages of the deep learning Q-learning algorithm such as fast running speed and strong ability to process uncertain market information to the consensus mechanism of the microgrid market, and solves the problem that the Q-learning algorithm is difficult to handle complex constraints by embedding the KKT condition into the Q-learning algorithm; the present invention can effectively improve the efficiency of the consensus process of microgrids participating in blockchain market transactions and reduce energy waste caused by consensus.

[0050] Embodiment 1

[0051] This embodiment discloses a microgrid transaction consensus method based on the Q method and power grid detection and evaluation;

[0052] In order to achieve consensus among the participants in the microgrid market and establish a microgrid blockchain consensus mechanism, that is, to solve the Nash equilibrium of the microgrid market, this embodiment first establishes a mathematical model for the power market in which the microgrid participates. Considering that the detection and evaluation of the grid voltage can effectively prevent the voltage from exceeding the limit value, the improved Q-learning algorithm is used to explore the consensus solution, such as Figure 1 As shown, the specific steps include:

[0053] S1. Based on the blockchain power market information of microgrid participation, a market transaction model based on power grid detection and evaluation technology is established;

[0054] The market transaction model includes a market revenue function, a detection and evaluation of grid voltage, constraint conditions and a profit distribution function for grid participants.

[0055] The market revenue function is the difference between the revenue from selling electricity in the market and the cost of producing electricity. The market clearing target is to maximize the market revenue. The cost of producing electricity includes reputation cost, traditional unit cost and energy storage cost.

[0056] The present invention proposes a reputation cost calculation method for market clearing and judging the reputation of microgrid operators. The market transaction model is specifically established as follows:

[0057] In order to ensure that market participants are honest and trustworthy when participating in blockchain transactions, the present invention discloses a reputation cost, as shown in Formula 1. When a microgrid participates in the market, failure to fulfill the contract will result in additional cost penalties. When the reputation is good, the cost is 0.

[0058]

[0059] in, is the reputation cost of the ith participant at time t, α represents the reputation coefficient related to the historical reputation score, k represents the number of trustworthiness k≥1, P C is the contract transaction power, P M is the actual transaction amount, and q(t) is the credibility function.

[0060] The cost of traditional units can be approximately fitted as a quadratic function, as shown in Formula 2:

[0061]

[0062] in, is the traditional power generation cost of the ith participant, a, b, c are its cost coefficients, P i (t) is the power generation of the traditional unit;

[0063] The energy storage cost can be approximately fitted as a linear function, as shown in Formula 3:

[0064]

[0065] in, is the energy storage cost of the ith participant, d is its cost coefficient, N represents 24 time periods, P F (t) is the actual power consumption, P M (t) is the actual power generation.

[0066] The market revenue function is the difference between the revenue from selling electricity in the market and the cost of producing electricity. The market clearing goal is to maximize the market revenue, as shown in Formula 4:

[0067]

[0068] Among them, U is the actual revenue of the electricity market, N is the number of participants, ρ(t) is the real-time electricity price, P M (t) is the actual electricity consumption, and C(t) is the total production cost.

[0069] Consider testing and evaluating the grid voltage to avoid voltage exceeding the limit and threatening the safe operation of the grid during blockchain transactions. When reaching consensus, consider the actual voltage constraints of the grid operation and combine the consensus mechanism with the actual grid operation model. The formula for grid voltage detection and evaluation is as follows:

[0070]

[0071] Among them, V L is the detection voltage, V L =Z ij *I L , Z ij is the impedance between nodes i and j, I L Line current, is the maximum voltage allowed by the line, The minimum voltage allowed for the line.

[0072] The main constraints for microgrids to participate in the blockchain power market are power balance constraints, power generation capacity constraints, and energy storage capacity constraints, as follows:

[0073] Power balance constraints:

[0074]

[0075] Among them, P M (t) is the actual power generation, To store electricity for energy storage, To store energy and release electricity, P J (t) is the actual power consumption.

[0076] Power generation capacity constraints:

[0077]

[0078] Among them, P M (t) is the actual power generation capacity, For maximum power generation capacity.

[0079] Energy storage capacity constraints:

[0080]

[0081] Among them, P M (t) is the actual power generation, P F (t) is the actual power consumption, Stores electricity for maximum energy storage.

[0082] In order to achieve a reasonable distribution of profits, the invention adopts the Shapley value method to calculate the profit U of the grid participants. m ,m∈[1,M]. The Shapley value method can distribute the income according to the marginal contribution of the microgrid to the market income, and can reasonably distribute the income. m The calculation formula is:

[0083]

[0084] in, Represents the weight coefficient of microgrid participation allocation; s m Represents all market participants; |s| represents the number of market participants; U(s) represents the benefits of market participants; U(s / m) represents the benefits after excluding market participant m from the market.

[0085] S2. Combine the KKT condition with the Q-learning algorithm to solve the Nash equilibrium of the market transaction model and obtain the block that reaches the Nash equilibrium;

[0086] First, it is necessary to use the Q-learning algorithm to solve the Nash equilibrium solution of the market and determine which nodes are the first to achieve market equilibrium. The Q-learning algorithm is a type of reinforcement learning. This algorithm still uses the exploration plus reward method to establish a Q table. This table reflects the rewards that can be brought by selecting different actions a in the current state S, so as to explore the path with the greatest return, to achieve market optimization, and then find the Nash equilibrium solution required by the present invention. Due to the characteristics of Q-learning itself, it lacks the ability to cope with complex constraints in the power market. In this regard, the present invention provides a combination of a KKT condition and a Q-learning algorithm for solving microgrid market clearing calculations with complex constraints. The Q value iteration formula is shown below.

[0087]

[0088] The Q-learning algorithm is used to solve the process of the transaction consensus mechanism on the blockchain of the power market in which the microgrid participates, such as Figure 2 As shown, the specific steps are:

[0089] S2-1: Initialize the Q(s,a) table, use the state of the previous round of market transactions of blockchain market participants as the initial state of the market, use the function U(t) as the reward function, and set the threshold for ending the cycle.

[0090] S2-2: Update the market parameters of the microgrid power market, including energy storage capacity constraints, power generation capacity constraints, microgrid power generation parameters, and credibility model parameters.

[0091] S2-3: Since Q-learning has limited ability to handle complex constraints, the KKT condition is used to improve the Q-learning algorithm. The improved algorithm is as follows:

[0092]

[0093] Among them, L is the Lagrangian function, U is the objective function, λ, μ, ν, θ are the unknown coefficients, P M(t) is the actual power generation capacity, For the maximum power generation capacity, To store electricity for energy storage, To store energy and release electricity, P J (t) is the actual power consumption.

[0094] As long as the following conditions are met, it is equivalent to satisfying the constraints in the market.

[0095]

[0096] λ≥0,ν≥0,θ≥0,μ≠0 (13)

[0097] Among them, t* is the time when the optimal goal is achieved. When t=t*, the following conditions are met:

[0098]

[0099] S2-4: Use known microgrid market information for exploration. First, select an action based on the current Q-Table and ε-greedy strategy, calculate the current market revenue, and use the Shapley value method to allocate it. Determine whether the revenue of a certain node reaches Nash equilibrium. After reaching equilibrium, add the market information and equilibrium time of the node to the Nash equilibrium region sequence, and sort them from small to large according to the equilibrium time.

[0100] S2-5: Calculate the new Q value according to the Q value formula, reward and given coefficient, and update the Q table according to the market calculation results.

[0101] S2-6: Determine whether there is a block that has reached Nash equilibrium, and determine whether the number of iterations has reached the preset value, otherwise restart from S2-4.

[0102] S3. Make consensus judgments on blocks that have reached Nash equilibrium, and qualified blocks serve as master nodes to package and manage blockchain market information.

[0103] The Nash equilibrium solution obtained by the market calculation using the Q-learning algorithm is used for consensus in the blockchain. A verification and sorting mechanism is used to make consensus judgments, and finally determine whether the block that reaches the Nash equilibrium can be used as the main node to package and manage blockchain market information. The specific steps are as follows:

[0104] S3-1: Perform a timeout check on the block that reaches the Nash equilibrium obtained in S2. If the equilibrium time is greater than the preset maximum time, the error probability is high and it is not adopted. Return to step S2 and execute again.

[0105] S3-2: If it has not timed out, the node is temporarily designated as the master node, and the identification mechanism is entered. At the same time, the next region in the Nash equilibrium region sequence is selected as the candidate node.

[0106] S3-3: Check whether the masternode’s reputation status meets the standards and determine the reputation cost Whether the threshold is met and the specification is met, if yes, the node successfully becomes the master node, otherwise the timer number is increased by 1 and the candidate is judged.

[0107] S3-4: If the master node is not selected in step S3-3, re-execute S3-1.

[0108] Embodiment 2

[0109] This embodiment discloses a microgrid transaction consensus system based on the Q method and power grid detection and evaluation;

[0110] like Figure 3 As shown, the microgrid transaction consensus system based on the Q method and power grid detection and evaluation includes a model building module, a Nash equilibrium module and a consensus judgment module;

[0111] The model building module is configured to: establish a market transaction model based on power grid detection and evaluation technology based on the blockchain power market information in which the microgrid participates;

[0112] The Nash equilibrium module is configured to: combine the KKT condition with the Q-learning algorithm to solve the Nash equilibrium of the market transaction model and obtain the block that reaches the Nash equilibrium;

[0113] The consensus judgment module is configured to: make consensus judgments on blocks that have reached Nash equilibrium, and use qualified blocks as master nodes to package and manage blockchain market information.

[0114] Embodiment 3

[0115] The purpose of this embodiment is to provide a computer-readable storage medium.

[0116] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the microgrid transaction consensus method based on the Q method and power grid detection and evaluation as described in Example 1 of the present disclosure.

[0117] Embodiment 4

[0118] The purpose of this embodiment is to provide an electronic device.

[0119] An electronic device includes a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, the steps in the microgrid transaction consensus method based on the Q method and power grid detection and evaluation as described in Example 1 of the present disclosure are implemented.

[0120] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0121] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0122] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0123] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0124] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. For those skilled in the art, the present disclosure may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

[0125] Although the above describes the specific implementation methods of the present disclosure in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present disclosure. Technical personnel in the relevant field should understand that on the basis of the technical solution of the present disclosure, various modifications or variations that can be made by those skilled in the art without creative work are still within the scope of protection of the present disclosure.

Claims

1. A microgrid transaction consensus method based on the Q method and power grid detection and evaluation, characterized in that: include: Step S1: Based on the blockchain power market information of the microgrid, a market transaction model based on power grid detection and evaluation technology is established; The market transaction model includes a market revenue function, a detection and evaluation of grid voltage, constraints, and a profit distribution function for grid participants, specifically: The market revenue function is the difference between the revenue from selling electricity in the market and the cost of producing electricity. The market clearing target is to maximize the market revenue, which can be expressed as: Among them, U is the actual revenue of the electricity market, N is the number of participants, For real-time electricity prices, is the actual power consumption, is the total production cost; The cost of producing electricity, including reputation costs, traditional unit costs, and energy storage costs; The reputation cost is expressed as: in, is the reputation cost of the ith participant at time t, α represents the reputation coefficient related to the historical reputation score, k represents the number of trustworthiness k≥1, The contract transaction electricity, is the actual transaction volume, q(t) is the credibility function; The cost of traditional units is expressed as: in, is the traditional power generation cost of the ith participant, a, b, c are its cost coefficients, The power generation of the conventional unit; The energy storage cost is expressed as: in, is the energy storage cost of the ith participant, d is its cost coefficient, N represents 24 time periods, is the actual power consumption, is the actual power generation; The detection and evaluation of the grid voltage is expressed by the formula: in, is the detection voltage, , is the impedance between nodes i and j, Line current, is the maximum voltage allowed by the line, The minimum voltage allowed for the line; The profit distribution function of the grid participants uses the Shapley value method to distribute the revenue according to the marginal contribution of the microgrid to the market revenue and calculate the profit of the grid participants. , expressed as: in, Represents the weight coefficient of the microgrid’s participation in allocation; Representing all market participants; Indicates the number of market participants; represents the returns of market participants; Represents the profit after excluding market entity m from the market; Step S2: Combine the KKT condition with the Q-learning algorithm to solve the Nash equilibrium of the market transaction model and obtain the block that reaches the Nash equilibrium; The specific steps of solving the Nash equilibrium of the market transaction model are as follows: Initialize Q table; Update microgrid power market parameters; The KKT condition is used to improve the Q-learning algorithm; Use known microgrid market information for exploration; Calculate new Q values ​​and update the Q table based on market calculation results; Determine whether there is a block that has reached Nash equilibrium. If not, continue exploring; Step S3: Consensus judgment is made on the blocks that have reached the Nash equilibrium, and the qualified blocks are used as master nodes to package and manage blockchain market information; Among them, the verification and sorting mechanism is used to make consensus judgments on blocks that have reached Nash equilibrium. The specific steps are as follows: S3-1: For the block that reaches Nash equilibrium obtained in S2, a timeout judgment is performed. If the equilibrium time is greater than the preset maximum time, the error probability is high and it is not adopted. Return to step S2 and execute again; S3-2: If it has not timed out, the node is temporarily designated as the master node, and the identification mechanism is entered. At the same time, the next region in the Nash equilibrium region sequence is selected as the candidate node; S3-3: By judging whether the reputation cost meets the threshold, check whether the reputation status of the master node meets the specification. If yes, the node successfully becomes the master node, otherwise the timer number is increased by 1, and the candidate is judged continuously; S3-4: If the master node is not selected in step S3-3, re-execute S3-1.

2. The microgrid transaction consensus method based on the Q method and power grid detection and evaluation as claimed in claim 1, characterized in that: The constraints include power balance constraints, power generation capacity constraints and energy storage capacity constraints.

3. A microgrid transaction consensus system based on the Q method and power grid detection and evaluation, characterized in that: The method according to any one of claims 1 to 2 is used to perform microgrid transaction consensus, including a model building module, a Nash equilibrium module and a consensus judgment module; The model building module is configured to: establish a market transaction model based on power grid detection and evaluation technology based on the blockchain power market information in which the microgrid participates; The Nash equilibrium module is configured to: combine the KKT condition with the Q-learning algorithm to solve the Nash equilibrium of the market transaction model and obtain the block that reaches the Nash equilibrium; The consensus judgment module is configured to: make consensus judgments on blocks that have reached Nash equilibrium, and use qualified blocks as master nodes to package and manage blockchain market information.

4. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the steps in the microgrid transaction consensus method based on the Q method and power grid detection and evaluation as described in any one of claims 1-2 are implemented.

5. An electronic device comprising a memory, a processor, and a program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps in the microgrid transaction consensus method based on the Q method and power grid detection and evaluation as described in any one of claims 1-2 are implemented.