A blockchain-based microgrid two-stage hybrid power transaction method and system

CN122905784APending Publication Date: 2026-10-13XJ ELECTRIC CO LTD +2
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611046070.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-14
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

[0008]本发明的目的是提供一种基于区块链的微电网双阶段混合电力交易方法及系统,以解决目前的交易方式依靠电力调度商以固定价格进行宏观兜底调控导致的储能设备真实物理容量受限、且成本随充放电深度变化的技术问题

Benefits of technology

[0061]本发明的有益效果是: 本发明首先在第一阶段交易时交易双方采用加权清算机制的双向拍卖,将成交价动态地向更有利于高价买方或低价卖方的方向微调,相对于现有技术中的算术平均中间价清算机制,加权机制巧妙地向更有利于高价买方或低价卖方的方向倾斜,实现了更精细的交易公平性和市场激励。其次,本发明在第二阶段交易时引入了独立储能商,独立储能商根据其单次交互电量动态调整充电价格和放电价格,使充电价格随着单次交互电量增大而减小,放电价格随着单次交互电量增大而增大,使得模型能够精确模拟独立商业储能的运营模式,赋予了储能商动态主动调节的能力,提升了系统的整体经济效益。最后,本发明采用内外层混合求解算法对主从博弈模型中的博弈目标函数进行求解,保障了博弈算法在面对复杂非线性约束时的强收敛性和高计算精度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122905784A_ABST
    Figure CN122905784A_ABST
Patent Text Reader

Abstract

The present application relates to a kind of microgrid double-stage hybrid power transaction method and system based on blockchain, belong to electric power transaction technical field.The present application first in the first stage transaction, transaction party adopts weighted clearing mechanism to be traded price dynamically to the direction of more beneficial to high price buyer or low price seller fine-tune, relative to the arithmetic average intermediate price clearing mechanism in prior art, more beneficial to the direction of high price buyer or low price seller tilt, realized more delicate transaction fairness and market incentive.Second, the present application introduces independent energy storage merchant in the second stage transaction, independent energy storage merchant adjusts charge price and discharge price according to its single interactive electric quantity, so that charge price decreases with the increase of single interactive electric quantity, and discharge price increases with the increase of single interactive electric quantity, so that model can accurately simulate the operation mode of independent commercial energy storage, gives energy storage merchant dynamic active adjustment ability, improves the overall economic benefit of system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a blockchain-based microgrid two-stage hybrid power trading method and system, belonging to the field of power trading technology. Background Technology

[0002] Distributed power trading in microgrids currently faces challenges such as centralized management, conflicts of interest among multiple parties, and imperfect mechanisms. These mainly involve the following aspects:

[0003] 1) It is difficult to balance transaction efficiency and fairness: Existing transaction mechanisms usually adopt a single model. For example, although the two-way auction mechanism has a fast matching speed, it is insufficient in ensuring transaction fairness and meeting the needs of all participants, which can easily lead to some supply and demand mismatches; while game theory-based optimization models can pursue better resource allocation, they usually face many-to-many game scenarios, with extremely high computational complexity, making it difficult to meet the real-time requirements of electricity trading.

[0004] 2) Lack of independent energy storage participation mechanism: With the development of new power systems, energy storage is encouraged to participate in trading as an independent market player. However, most existing trading models do not fully consider the independent market status of energy storage, lack clear pricing and interaction mechanisms, and cannot effectively play their role in smoothing market fluctuations and improving system economics. Their commercial value has not been fully explored.

[0005] 3) Trust and security issues in the transaction process: Traditional centralized trading platforms have risks such as opaque data, easy tampering, and single points of failure. Information asymmetry exists between participants, making it difficult to establish trust relationships, resulting in high transaction costs and low efficiency.

[0006] Therefore, there is an urgent need for a distributed power trading technology that can balance trading efficiency and economic benefits, clearly define the role of independent energy storage in the market, and ensure the safety and transparency of the trading process.

[0007] Chinese invention patent application CN117541382A discloses a two-stage trading method for distributed power in microgrids based on blockchain. This method constructs a two-stage trading mechanism combining bilateral auctions and master-slave game theory. In the first stage, the system quickly matches most of the power supply and demand through bilateral auctions. For the unmatched portion, the system enters the second stage of master-slave game theory, where power generators, as leaders, set electricity prices, and power consumers, as followers, adjust their purchased electricity volumes. Both parties reach an equilibrium state that maximizes their interests through iterative game theory, and the entire process is automatically executed using blockchain smart contracts. This method mainly relies on traditional power dispatchers for macro-level control with fixed prices. This mechanism has the following limitations in the actual commercial operation of microgrids: First, the physical capacity assumption is distorted. The fixed-price control method essentially assumes that the external power grid or dispatcher is an ideal node with unlimited capacity and no adjustment costs. However, the actual distributed energy storage devices in microgrids have strictly limited charging and discharging physical capacity, and the operating depreciation cost of the devices increases significantly with the depth of charging and discharging. Second, the price mechanism fails. Fixed control prices cannot reflect the real-time supply and demand tensions within a microgrid. This leads to microgrid participants becoming overly reliant on indiscriminate control provided by dispatchers, weakening the economic incentives for power generators to reduce costs and increase efficiency, and for users to stagger their electricity consumption, thus failing to effectively promote the local consumption of distributed green energy. Summary of the Invention

[0008] The purpose of this invention is to provide a blockchain-based microgrid two-stage hybrid power trading method and system to solve the technical problems of current trading methods that rely on power dispatchers to provide macro-level support and control at fixed prices, resulting in limited actual physical capacity of energy storage devices and cost variations with charge and discharge depth.

[0009] To address the aforementioned technical problems, the first aspect of this invention provides a blockchain-based two-stage hybrid power trading method for microgrids, comprising the following steps:

[0010] 1) Each participant joins the blockchain as an independent node and completes identity verification and registration. Participants include power generators, electricity consumers, and at least one independent energy storage provider.

[0011] 2) The first stage of the transaction is carried out based on the power supply and demand orders of both parties. During this stage, the two parties adopt a weighted settlement mechanism to dynamically adjust the transaction price in a direction that is more favorable to the high-price buyer or the low-price seller.

[0012] 3) The generators that failed to match in the first stage are regarded as leaders, the electricity consumers that failed to match in the first stage are regarded as followers, and the independent energy storage providers are regarded as market regulators. A master-slave game model is constructed for the second stage of trading. In the second stage of trading, the independent energy storage providers dynamically adjust the charging price and discharging price according to their single interaction volume, so that the charging price decreases as the interaction volume increases, and the discharging price increases as the interaction volume increases.

[0013] 4) A hybrid inner and outer layer solution algorithm is used to solve the objective function of the master-slave game model, and the transaction matching is achieved based on the solution results.

[0014] In one possible implementation, the transaction price determined by the weighted clearing mechanism is:

[0015]

[0016]

[0017] Where P am,ij p is the weighted clearing price, i.e., the transaction price. a,ij The benchmark midpoint price is P, where pos is the price relative position parameter. ag,i For the seller's offer, P ac,j Offer for the buyer, As the weight of external price influence, p s p b These are the upper and lower limits of the pre-set regulatory price range.

[0018] In one possible implementation, the charging and discharging prices dynamically adjusted by independent energy storage providers based on the amount of electricity exchanged per transaction are as follows:

[0019]

[0020]

[0021] q represents the battery consumption per interaction, p s p b p represents the upper and lower limits of the preset regulatory price range. cb The base charging price published by independent energy storage providers, p db The base discharge price published by independent energy storage providers, k c k d These are the charging price sensitivity coefficient and the discharging price sensitivity coefficient, respectively.

[0022] In one possible implementation, the game objective function includes a leader objective function and a follower objective function, which are as follows:

[0023]

[0024]

[0025] Where maxR g To maximize total revenue for leaders, SR g For revenue from electricity sales to followers and independent energy storage providers, ES g For green energy subsidies, GC g For the cost of power generation, SF g For transaction service fees, maxR c To maximize the net utility of its followers, UF c PC is the utility function for purchasing electricity. c For electricity purchase costs, SF c This is for the discharge service fee.

[0026] In one possible implementation, the utility function UF c It is in logarithmic form.

[0027] In one possible implementation, the hybrid inner and outer layer solution algorithm first uses particle swarm optimization to perform the outer loop, i.e., leader strategy search, and then uses Brent optimization to perform the inner loop, i.e., follower optimal response calculation.

[0028] In one possible implementation, the solution process of the hybrid inner and outer layer algorithm includes: using a particle swarm optimization algorithm to search for the leader's optimal pricing within the feasible price range, where each particle in the particle swarm optimization algorithm represents a candidate price; for each candidate price given by the particle swarm optimization algorithm, using the Brent optimization method to precisely solve the utility maximization problem for each follower, thereby obtaining its optimal purchase volume; substituting the optimal responses of all followers into the leader's payoff function to calculate the fitness of the current candidate price; and iterating the particle swarm optimization algorithm based on the fitness until finding an approximate optimal price that maximizes the leader's payoff.

[0029] In one possible implementation, the first phase of the transaction includes:

[0030] A. Sort all sell orders in ascending order to form a sell order list, and sort all buy orders in descending order to form a buy order list;

[0031] B. Loop through the top of the sorted sell order list and buy order list to match orders. A successful match is indicated when the seller's bid is less than or equal to the buyer's bid, and the transaction volume is determined.

[0032] C. For each successfully matched trading pair, the transaction price is determined according to the weighted clearing mechanism, and the transaction is executed at the transaction price;

[0033] D. Update the remaining power of both parties in the transaction, and remove participants whose power is perfectly matched from the matching list. Repeat this process until the list is empty or there are no more transaction pairs that meet the matching criteria.

[0034] In one possible implementation, the method further includes generating a transaction list based on the agreed-upon transaction matches. This transaction list is then confirmed by the private keys of the relevant participating nodes, packaged into a transaction block, and uploaded to the blockchain.

[0035] To address the aforementioned technical problems, a second aspect of the present invention provides a blockchain-based microgrid two-stage hybrid power trading system, comprising a processor that executes the steps of the blockchain-based microgrid two-stage hybrid power trading method of the present invention, including:

[0036] 1) Each participant joins the blockchain as an independent node and completes identity verification and registration. Participants include power generators, electricity consumers, and at least one independent energy storage provider.

[0037] 2) The first stage of the transaction is carried out based on the power supply and demand orders of both parties. During this stage, the two parties adopt a weighted settlement mechanism to dynamically adjust the transaction price in a direction that is more favorable to the high-price buyer or the low-price seller.

[0038] 3) The generators that failed to match in the first stage are regarded as leaders, the electricity consumers that failed to match in the first stage are regarded as followers, and the independent energy storage providers are regarded as market regulators. A master-slave game model is constructed for the second stage of trading. In the second stage of trading, the independent energy storage providers dynamically adjust the charging price and discharging price according to their single interaction volume, so that the charging price decreases as the interaction volume increases, and the discharging price increases as the interaction volume increases.

[0039] 4) A hybrid inner and outer layer solution algorithm is used to solve the objective function of the master-slave game model, and the transaction matching is achieved based on the solution results.

[0040] In one possible implementation, the transaction price determined by the weighted clearing mechanism is:

[0041]

[0042]

[0043] Where P am,ij p is the weighted clearing price, i.e., the transaction price. a,ij The benchmark midpoint price is P, where pos is the price relative position parameter. ag,i For the seller's offer, P ac,j Offer for the buyer, As the weight of external price influence, p s pb These are the upper and lower limits of the pre-set regulatory price range.

[0044] In one possible implementation, the charging and discharging prices dynamically adjusted by independent energy storage providers based on the amount of electricity exchanged per transaction are as follows:

[0045]

[0046]

[0047] q represents the battery consumption per interaction, p s p b p represents the upper and lower limits of the preset regulatory price range. cb The base charging price published by independent energy storage providers, p db The base discharge price published by independent energy storage providers, k c k d These are the charging price sensitivity coefficient and the discharging price sensitivity coefficient, respectively.

[0048] In one possible implementation, the game objective function includes a leader objective function and a follower objective function, which are as follows:

[0049]

[0050]

[0051] Where maxR g To maximize total revenue for leaders, SR g For revenue from electricity sales to followers and independent energy storage providers, ES g For green energy subsidies, GC g For the cost of power generation, SF g For transaction service fees, maxR c To maximize the net utility of its followers, UF c PC is the utility function for purchasing electricity. c For electricity purchase costs, SF c This is for the discharge service fee.

[0052] In one possible implementation, the utility function UF c It is in logarithmic form.

[0053] In one possible implementation, the hybrid inner and outer layer solution algorithm first uses particle swarm optimization to perform the outer loop, i.e., leader strategy search, and then uses Brent optimization to perform the inner loop, i.e., follower optimal response calculation.

[0054] In one possible implementation, the solution process of the hybrid inner and outer layer algorithm includes: using a particle swarm optimization algorithm to search for the leader's optimal pricing within the feasible price range, where each particle in the particle swarm optimization algorithm represents a candidate price; for each candidate price given by the particle swarm optimization algorithm, using the Brent optimization method to precisely solve the utility maximization problem for each follower, thereby obtaining its optimal purchase volume; substituting the optimal responses of all followers into the leader's payoff function to calculate the fitness of the current candidate price; and iterating the particle swarm optimization algorithm based on the fitness until finding an approximate optimal price that maximizes the leader's payoff.

[0055] In one possible implementation, the first phase of the transaction includes:

[0056] A. Sort all sell orders in ascending order to form a sell order list, and sort all buy orders in descending order to form a buy order list;

[0057] B. Loop through the top of the sorted sell order list and buy order list to match orders. A successful match is indicated when the seller's bid is less than or equal to the buyer's bid, and the transaction volume is determined.

[0058] C. For each successfully matched trading pair, the transaction price is determined according to the weighted clearing mechanism, and the transaction is executed at the transaction price;

[0059] D. Update the remaining power of both parties in the transaction, and remove participants whose power is perfectly matched from the matching list. Repeat this process until the list is empty or there are no more transaction pairs that meet the matching criteria.

[0060] In one possible implementation, the method further includes generating a transaction list based on the agreed-upon transaction matches. This transaction list is then confirmed by the private keys of the relevant participating nodes, packaged into a transaction block, and uploaded to the blockchain.

[0061] The beneficial effects of this invention are as follows: First, in the first stage of the transaction, both parties adopt a weighted settlement mechanism in a two-way auction, dynamically adjusting the transaction price in a direction more favorable to high-price buyers or low-price sellers. Compared to the arithmetic average median price settlement mechanism in existing technologies, the weighted mechanism cleverly tilts towards a direction more favorable to high-price buyers or low-price sellers, achieving more refined transaction fairness and market incentives. Second, in the second stage of the transaction, this invention introduces independent energy storage providers. These providers dynamically adjust charging and discharging prices based on their single-transaction electricity volume, causing charging prices to decrease as single-transaction electricity volume increases, and discharging prices to increase as single-transaction electricity volume increases. This allows the model to accurately simulate the operation mode of independent commercial energy storage, giving energy storage providers the ability to dynamically and proactively adjust, thus improving the overall economic efficiency of the system. Finally, this invention employs a hybrid inner and outer layer solution algorithm to solve the game objective function in the master-slave game model, ensuring strong convergence and high computational accuracy of the game algorithm when facing complex nonlinear constraints.

[0062] This invention abandons the idealized assumption of a fixed price and, for the first time, constructs a dynamic pricing interaction mechanism that introduces independent energy storage providers (ESPs). Specifically, it uses the following mathematical model to map real physical and economic laws:

[0063] This invention designs a dynamic pricing model for independent energy storage providers that is strongly correlated with the single-transaction electricity volume q, i.e., the charging price P. c (q) = max(p b , p cb - k c ×q), discharge price P d (q) = min(p s , p db + k d ×q). In the physical constraint mapping: k in the formula c , k d The (price sensitivity coefficient) accurately simulates the marginal cost changes brought about by the depth of charge and discharge of energy storage. When energy storage purchases large amounts of electricity, as q increases, the charging price P... c (q) Decreases linearly; when energy storage generates large amounts of electricity, the discharge price P... d (q) Linear increase. This utilizes price signals to naturally suppress the physical risks of overcharging and over-discharging of energy storage. Regarding economic boundary control: the formula introduces max and min limiting functions to ensure that the dynamically adjusted price is always constrained within the regulatory range [p] b , p s This system empowers energy storage providers to dynamically and proactively adjust the market based on electricity volume (q), while also ensuring the compliance of transaction prices.

[0064] Through the above mechanism, this invention overcomes the limitations of traditional models that rely solely on dispatchers for unidirectional, static control, enabling independent energy storage providers to participate in transactions as market players with independent pricing power. By using dynamic price signals to guide the supply and demand within the microgrid to achieve self-balancing, it maximizes the commercial value of energy storage providers and fundamentally solves the technical defects of the original scheme, which is detached from physical reality and lacks sufficient market incentives. Attached Figure Description

[0065] Figure 1 This is a flowchart of the blockchain-based microgrid two-stage hybrid power trading method of the present invention;

[0066] Figure 2 This is a schematic diagram of the transaction model architecture used in the blockchain-based microgrid two-stage hybrid power trading method of this invention. Detailed Implementation

[0067] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments.

[0068] The concept of this invention lies in constructing a two-stage process that combines "rapid matching through two-way auctions" with "optimized decision-making through master-slave game theory," and introducing the roles of aggregated power generators and independently operating energy storage providers with dynamic pricing, thereby achieving a balance between transaction efficiency and system benefits. The entire process is automatically executed through blockchain smart contracts, ensuring fair, transparent, and efficient transactions.

[0069] Implementation of a Blockchain-Based Microgrid Two-Stage Hybrid Power Trading Method

[0070] This invention improves upon existing microgrid two-stage trading methods in three aspects: first, it introduces Independent Energy Storage Providers (ESPs) and a dynamic pricing mechanism; second, it upgrades the underlying solution algorithm to the "Brent Hybrid Optimization Algorithm" (i.e., a hybrid solution algorithm combining inner and outer layers); and third, it upgrades the first-stage auction and settlement mechanism to "Weighted Adaptive Settlement" (achieving more refined price incentives). These three aspects will be explained in detail below.

[0071] 1. Each participant joins the blockchain as an independent node and completes identity verification and registration. Participants include power generators, electricity consumers, and at least one independent energy storage provider. The first phase of the transaction is executed based on the electricity supply and demand orders of both parties. During this phase, the two parties adopt a weighted settlement mechanism for the two-way auction, which dynamically adjusts the transaction price in a direction that is more favorable to the high-price buyer or the low-price seller.

[0072] This invention relies on the microgrid physical transmission network and the energy blockchain digital interaction environment. Blockchain, as the underlying technology, ensures transaction security, transparency, and traceability through its decentralized, tamper-proof data, and automatic smart contract execution characteristics. The core participants include: 1) Green Energy Producers (GEPs): renewable energy producers who act as electricity suppliers in the market; 2) Power Consumers (PCs): consumers with electricity demand who act as electricity demanders in the market; 3) Energy Storage Providers (ESPs): balancing market supply and demand during the master-slave game phase, and may engage in electricity transactions with GEPs and consumers as needed.

[0073] To address the shortcomings of existing arithmetic average settlement mechanisms, which often employ arithmetic mean mid-price, the lack of precision in price incentives in complex commercial transactions, particularly in cases of significant price discrepancies between buyers and sellers, can easily lead to transaction imbalances. Therefore, this invention introduces a relative price position parameter `pos` (reflecting the relative position of the benchmark mid-price within the regulatory range) and an external price influence weight `w`. The weighted settlement mechanism determines the transaction price as follows:

[0074]

[0075]

[0076] Where p am,ij p is the weighted clearing price, i.e., the transaction price. a,ij The benchmark midpoint price is P, where pos is the price relative position parameter. ag,i For the seller's offer, P ac,j The bid is for the buyer, w is the weight of external price influence, and p s p b These are the upper and lower limits of the pre-set regulatory price range.

[0077] The transaction price can be adaptively adjusted according to the current supply and demand tension in the market (whether it is biased towards the high-price end or the low-price end). The weighting mechanism is cleverly tilted in the direction that is more favorable to high-price buyers or low-price sellers, thus achieving more refined transaction fairness and market incentives.

[0078] 2. The generators that failed to match in the first phase are designated as leaders, the electricity consumers who failed to match in the first phase are designated as followers, and the independent energy storage providers are designated as market regulators. A master-slave game model is constructed for the second phase of trading. In the second phase of trading, the independent energy storage providers dynamically adjust the charging price and discharging price based on their single interaction volume, so that the charging price decreases as the single interaction volume increases, and the discharging price increases as the single interaction volume increases.

[0079] This invention, building upon existing technologies that primarily rely on traditional power dispatchers (EDs) for macro-level control at fixed prices, introduces for the first time an "Independent Energy Storage Provider (ESP)" with independent commercial attributes. A linear function (with max and min limits) for charging and discharging prices is designed for ESPs, dynamically adjusting with the amount of electricity exchanged per transaction (q). Furthermore, new calculation dimensions, such as electricity purchase fees from ESPs and discharging service fees, are added to the objective function during the master-slave game phase. The formulas for calculating charging and discharging prices are as follows:

[0080]

[0081]

[0082] q represents the battery consumption per interaction, p s p b p represents the upper and lower limits of the preset regulatory price range. cb The base charging price published by independent energy storage providers, p db The base discharge price published by independent energy storage providers, k c k d These are the charging price sensitivity coefficient and the discharging price sensitivity coefficient, respectively.

[0083] Based on this, the present invention can solve the technical problems of limited actual physical capacity of energy storage devices in microgrids and cost variation with charge and discharge depth, enabling the model to accurately simulate the operation mode of independent commercial energy storage, giving energy storage companies the ability to dynamically and proactively adjust, and improving the overall economic benefits of the system.

[0084] 3. A hybrid inner and outer layer solution algorithm is used to solve the objective function in the master-slave game model, and the transaction matching is achieved based on the solution results. The objective function includes the leader's objective function and the follower's objective function, which are as follows:

[0085]

[0086]

[0087] Where maxR g To maximize total revenue for leaders, SR g For revenue from electricity sales to followers and independent energy storage providers, ES g For green energy subsidies, GC g For the cost of power generation, SF g For transaction service fees, maxR c To maximize the net utility of its followers, UF c PC is the utility function for purchasing electricity. cFor electricity purchase costs, SF c This is for the discharge service fee.

[0088] Because existing technologies use a fixed safety net price and a smooth, differentiable objective function, conventional analytical methods (setting the derivative to zero to obtain an analytical solution) are employed. However, this invention introduces dynamic pricing for energy storage with limits (max and min), transforming the objective function into a complex, non-smooth, and non-differentiable nonlinear model, rendering the original differentiation methods ineffective. Therefore, this invention proposes a hybrid inner-outer-layer solution algorithm. This algorithm first utilizes particle swarm optimization for the outer loop (leader strategy search), and then employs Brent optimization for the inner loop (follower optimal response calculation).

[0089] Specifically, the solution process of the hybrid inner and outer layer algorithm includes: using a particle swarm optimization algorithm to search for the leader's optimal pricing within the feasible price range, where each particle in the particle swarm optimization algorithm represents a candidate price; for each candidate price given by the particle swarm optimization algorithm, using the Brent optimization method to precisely solve the utility maximization problem for each follower, thereby obtaining its optimal purchase volume; substituting the optimal responses of all followers into the leader's revenue function to calculate the fitness of the current candidate price; and iterating the particle swarm optimization algorithm based on the fitness until finding an approximate optimal price that maximizes the leader's revenue.

[0090] Based on the above introduction, the specific implementation process of the blockchain-based microgrid two-stage hybrid power trading method of the present invention will be described in detail below, such as... Figure 1 As shown, firstly, each participant joins the energy blockchain as a node and completes identity verification and registration. Secondly, green energy generators and consumers submit their expected power generation, electricity price, and electricity consumption orders, respectively. At the same time, independent energy storage providers publish their basic charging and discharging prices and price sensitivity service parameters on the blockchain. Then, in the first stage of the transaction, a two-way auction model is established, and a weighted settlement mechanism based on an external market price benchmark is established, so that the transaction price can be adaptively fine-tuned according to the current market supply and demand tension (leaning towards the high-price end or the low-price end). Participants who fail to match successfully enter the second stage of the transaction. In the second stage of the transaction, a green energy generator integration scheme is proposed to improve game efficiency, and a master-slave game model is established with aggregated generators as leaders, consumers as followers, and independent energy storage providers as market regulators. In this model, independent energy storage providers dynamically adjust charging and discharging prices based on the electricity volume of a single interaction. A hybrid inner and outer layer solution algorithm is used to solve the master-slave game model. The blockchain's smart contract automatically integrates the results of the first-stage two-way auction and the second-stage master-slave game to generate a final transaction list containing all trading pairs. After the relevant participants sign and confirm the list, the list is packaged into a transaction block, verified, and linked to the main chain.

[0091] This blockchain-based two-stage hybrid power trading method for microgrids employs, for example... Figure 2 The model architecture shown is implemented by including the following steps:

[0092] Step S1: Each participant joins the energy blockchain as a node and completes identity verification and registration. Participants include green energy generators (hereinafter referred to as generators), electricity consumers, and at least one independent energy storage provider (hereinafter referred to as energy storage provider). Green energy generators and electricity consumers submit their expected power generation, electricity price, and electricity consumption orders (electricity supply and demand data) to the blockchain, as detailed below:

[0093] In the energy blockchain network, the participating entities are initialized, including Green Energy Producers (GEPs), responsible for generating electricity (hereinafter referred to as producers); Electricity Consumers (PCs), responsible for purchasing electricity (hereinafter referred to as consumers); and Independent Energy Storage Providers (ESPs), responsible for recovering unsold electricity from producers and supplementing electricity when consumer demand exceeds the producers' output (hereinafter referred to as storage providers). Each participating entity completes identity authentication and registration on the blockchain through its node. Assume that the microgrid area includes N producers (GEPs), M electricity consumers (PCs), and at least one independent energy storage provider (ESP). Let N = {1, 2, ..., n} represent producers, and M = {1, 2, ..., m} represent consumers, where each producer is represented by i (i ∈ N), and each consumer is represented by j (j ∈ M).

[0094] Before the start of each transaction cycle, each party submits its transaction intention information by calling specific functions of the smart contract. The information is encrypted, recorded, and visible to the authorized party.

[0095] generator ( ): Submit expected power generation and quotes ;

[0096] Electricity consumers ( Submit your expected electricity consumption. and bid ;

[0097] Independent energy storage providers : Publish its service parameters, including the basic charging and discharging price p cb p db and the corresponding price sensitivity coefficient k c k d .

[0098] Step S2: Entering the first stage of the transaction, namely the two-way auction stage, the two-way auction process is executed according to the power supply and demand orders of both parties to the transaction, quickly matching transactions with clear supply and demand, as detailed below:

[0099] The first phase of the transaction is executed through a two-way auction based on a weighted settlement mechanism. The smart contract automatically triggers the two-way auction process on the supply and demand orders collected in step S1 to quickly match transactions with clear supply and demand. The specific steps are as follows:

[0100] 1. Order Sorting: The smart contract automatically assigns prices to all sell orders. Arrange in ascending order; if bids are the same, proceed according to expected power generation. Sort in descending order; simultaneously submit all buy orders. Sort in descending order; if bids are the same, sort by expected electricity consumption. Sort in ascending order.

[0101] 2. Iterative Matching: Orders are retrieved from the top of the sorted sell order list and buy order list and matched cyclically. Before the first match, each participant has its initial remaining battery power. This refers to the expected power generation submitted in step S1. Or expected electricity consumption The matching criteria are: seller's offer. ≤ Buyer's bid If the conditions are met, then the transaction volume is determined. ,in This refers to the participant's current remaining battery power. (This is used to determine the transaction volume.) Afterwards, the remaining battery power of both the buyer and seller participating in this matching process. The transaction volume was reduced simultaneously. This is to dynamically update the remaining power. The remaining power q' refers to the difference between the total expected power initially submitted by the participant in the current transaction cycle and the cumulative transaction power that the participant has already traded with other successfully matched objects before this iteration matching.

[0102] 3. Price Settlement: For each successfully matched trading pair, the smart contract does not use a simple median price, but instead executes a weighted settlement mechanism based on an external market price benchmark to calculate the final transaction price. :

[0103] 1) Calculate the benchmark median price : , where P ag,i For the seller's offer, P ac,j Offer a price for the buyer.

[0104] 2) Calculate the price relative position parameter : , where pa,ij p is the benchmark midpoint price. s p b This represents the upper and lower limits of the preset regulatory price range. This parameter reflects the benchmark midpoint price within the preset regulatory price range. The relative position within. The range of pos is [0, 1]. The larger the pos is, the closer the price is to the upper limit.

[0105] 3) Calculate the final weighted settlement price : .in Weighting of external price influence ( ), is a configurable system parameter, p a,ij The benchmark midpoint price is P, where pos is the price relative position parameter. ag,i For the seller's offer, P ac,j This formula dynamically adjusts the transaction price in a way that favors high-priced buyers or low-priced sellers, thus incentivizing market behavior and achieving a more refined level of fairness.

[0106] 4. Status Update and Iteration: The smart contract automatically updates the remaining power of both parties in the transaction and removes participants whose power is completely matched from the waiting list.

[0107] Repeat steps 2 through 4 until the list is empty or there are no more trading pairs that meet the matching criteria.

[0108] Step S3: For the two parties who successfully matched transactions during the two-way auction phase, clear the orders, generate temporary transaction orders, and send them to the relevant participants.

[0109] Step S4: For the two parties that failed to match their transactions in the two-way auction phase, the second phase, namely the master-slave game phase, will be entered. Based on the above step S2, all participants that failed to match completely and their remaining supply and demand electricity will automatically enter the second phase.

[0110] Step S5: Construct a master-slave game model, designating the green energy generators that failed to match in the first stage as leaders, the electricity consumers that failed to match in the first stage as followers, and the independent energy storage providers as market regulators. The master-slave game model is constructed as follows:

[0111] The second phase of the transaction is executed, based on master-slave game optimization by the aggregated power generator. For the remaining supply and demand from step S2, the smart contract initiates a master-slave game model for global optimization, with the specific steps as follows:

[0112] Character creation and model definition:

[0113] Leader: This leader aggregates all generators with remaining power from the first phase into a virtual, single "aggregated generator" leader. Its total saleable power is the sum of all remaining power. This aggregation behavior greatly simplifies the "many-to-many" game into a "one-to-many" game, reducing computational complexity.

[0114] Followers: All electricity consumers with surplus electricity demand in the first phase are considered followers.

[0115] Market regulators: Independent energy storage providers (ESPs) act as regulators of market prices and electricity consumption. Their charging and discharging prices are not fixed values, but rather dynamically adjusted linear functions based on the amount of electricity (q) exchanged per transaction. The charging price is... The price of discharge is , where p b p is the preset regulatory minimum price. s p is the preset maximum regulatory price. db and p cb Based on the charging and discharging price, k c and k d This represents the corresponding price sensitivity coefficient. This dynamic pricing model accurately simulates the commercial operation mode of energy storage, where prices decrease when large quantities of electricity are purchased and increase when large quantities are sold.

[0116] The leader's goal is to determine a uniform electricity price P to maximize their total revenue R. g R g Including electricity sales revenue to followers and energy storage providers (SR) g and green energy subsidies ES g The revenue, minus the power generation cost GC g and transaction service fees SF g The formula is .

[0117] The resulting revenue function for power generation entropy is:

[0118]

[0119] The number of consumers participating in the game; The sum of the supply from the generators participating in the game; and The green energy subsidy coefficient; and This is the power generation cost coefficient; The energy storage charging service fee coefficient; the amount of electricity sold by power generators to energy storage providers. As shown in the following formula:

[0120]

[0121] Electricity prices set by power generators Subject to price upper and lower limits: .

[0122] The follower objective is that, after observing the leader's price P, each consumer j decides how much electricity q to purchase from the leader. j In order to maximize its net utility R c Net utility is the utility function UF obtained from purchasing electricity. c PC minus electricity purchase cost c With discharge service fee SF c Its total demand can be met by purchasing from leaders and from energy storage providers. The formula is as follows: The utility function UF c Logarithmic form is used to reflect diminishing marginal utility.

[0123] Therefore, the consumer's revenue function is established as follows:

[0124]

[0125] in The translation parameter is used to avoid negative values ​​in the utility calculation; , , , This refers to the utility parameters of electricity for consumers from power generators and energy storage providers; the amount of electricity consumers purchase from energy storage providers. for: , This represents the electricity demand of consumers during the negotiation phase.

[0126] Step S6: Solve the constructed master-slave game model, then distribute the profits, match transactions based on the solution results, generate a final transaction list, and finally upload it to the blockchain, as detailed below:

[0127] Game Theory Solution: Since this game model is difficult to solve analytically, this invention employs a hybrid inner and outer layer solution algorithm. First, an outer loop, i.e., leader strategy search, is performed. The Particle Swarm Optimization (PSO) algorithm is then used within the feasible price range [p...]. b ,p s Optimal pricing P for the leader in the search engine In the PSO (Price-Oriented Optimal Response) algorithm, each particle represents a candidate price. Then, an inner loop is performed to calculate the optimal response of the follower. For each candidate price P given by the PSO, the utility maximization problem is precisely solved for each follower using the Brent optimization method, thus obtaining their optimal electricity purchase. Finally, the optimal response of all followers. Substitute into the leader's payoff function Rg The fitness of the current candidate price P is calculated. The PSO algorithm iterates based on the fitness until a price R is found that satisfies the condition. g The largest approximate optimal price P .

[0128] The specific solution steps are as follows:

[0129] 1) Numerical calculation of the follower's optimal response

[0130] For any feasible price offered by the leader To determine the optimal response, it is necessary to solve the utility maximization problem for each follower. :

[0131]

[0132] Given the objective function Based on the characteristics of the followers, the Brent method is used for exact solution. This optimization is performed on all followers to obtain the optimal response vector. .

[0133] 2) PSO search for the leader's optimal pricing strategy

[0134] The leader's goal is to find the optimal price. In order to maximize its own benefits :

[0135]

[0136] The optimal reflection vector The numerical calculation obtained from step (1) shows that, due to the objective function... and The relationship is complex and lacks explicit derivatives, so the PSO algorithm is used to search for the approximate optimal price. To balance computational efficiency and blockchain costs, the PSO optimization process is primarily performed off-chain.

[0137] The PSO algorithm is within the leader's feasible price range. An iterative search is performed within the space. Each particle represents a candidate price. The core operations in each iteration include:

[0138] Fitness assessment: Calculate the price for each candidate. Corresponding Leader Benefits As its fitness. This calculation requires calling step (1) to obtain the price. The optimal reaction vector under these conditions .

[0139] Optimal Value and Particle Update: Based on fitness comparison, update the individual's historical best fitness and the population's global best fitness, and update the particle's velocity and position according to the standard PSO formula. The iterative process continues until a preset termination condition is met, such as reaching the maximum number of iterations or the global best fitness no longer improving significantly.

[0140] 3) Obtaining the equilibrium solution

[0141] When the PSO algorithm terminates, its globally optimal position is the leader's approximate optimal price strategy. .Will Substituting the values ​​into the numerical optimization process of step (1), we can obtain the optimal purchase amount for all followers in the final equilibrium state. Thus, an approximate Nash equilibrium solution for this game is obtained. .

[0142] Profit distribution:

[0143] To ensure fairness in the distribution of profits after the game, the total profit received by the leader will be allocated based on the amount of electricity generated by each original power generator during the game phase. First, a profit distribution coefficient is calculated, which is directly proportional to the amount of electricity generated. The formula for calculating the coefficient is:

[0144]

[0145] In the formula: This indicates the stage in the game that the player has participated in. The amount of electricity generated by each power generator participating in the game. , This indicates the number of generators participating in the game-playing phase. This indicates the stage in the game that the player has participated in. The profit distribution coefficient of individual e-commerce businesses.

[0146] The smart contract calculates the total revenue R of the aggregated generator. g According to the proportion of electricity contributed by each original power generator in the second phase, c i Automatically calculate and distribute income This ensures the fairness of the distribution.

[0147] Finally, the smart contract automatically integrates the results of the first-stage two-way auction and the second-stage master-slave game to generate a final transaction list containing all trading pairs. This list, after being confirmed by the private keys of the relevant participating nodes, is packaged into a transaction block. Through the blockchain network's PBFT consensus mechanism, this block is verified and linked to the main chain, thereby achieving permanent, secure, and tamper-proof storage of transaction data.

[0148] Implementation of a Blockchain-Based Microgrid Two-Stage Hybrid Power Trading System

[0149] The blockchain-based microgrid two-stage hybrid power trading system of the present invention specifically includes a memory, a processor, a system bus, and a computer program stored in the memory. The processor and the memory communicate and interact with each other via the system bus. The processor executes the computer program to implement the steps of the blockchain-based microgrid two-stage hybrid power trading method of the present invention. The processor can be a microprocessor (MCU) or other processing device; the memory can be any type of memory that stores information using electrical energy, such as non-volatile storage media (including computer programs, databases), or other types of memory.

[0150] Based on the above description of the blockchain-based microgrid two-stage hybrid power trading method and system of the present invention, the above solution of the present invention has the following effects:

[0151] 1) Achieving both high efficiency and high benefit: Through a two-stage design, the first stage of fast auctions handles most of the simple supply and demand, while the second stage of the game model focuses on optimizing complex decisions. Combined with the power generator aggregation strategy, the computational complexity is significantly reduced. While ensuring high transaction efficiency, it achieves near-global optimal social benefits and improves the economic benefits of all parties.

[0152] 2) Fully realize the value of energy storage: For the first time, a clear market role and dynamic pricing mechanism have been designed for independent energy storage companies, enabling them to effectively participate in market regulation, promote the local consumption of distributed green energy, smooth market price fluctuations, and realize their own commercial value.

[0153] 3) Highly trustworthy transaction process: Relying on blockchain technology, all transaction rules are solidified by smart contracts. The transaction process and results are open, transparent, tamper-proof, and traceable, which fundamentally solves the trust problem of traditional centralized transactions and ensures the fairness and impartiality of transactions.

[0154] 4) Strong system adaptability and practicality: The model framework can adapt to the complex market environment that includes multiple stakeholders such as power generators, consumers and independent energy storage providers, and provides an innovative solution that balances efficiency, fairness and practicality for diversified and market-oriented power trading in the future smart grid.

Claims

1. A blockchain-based two-stage hybrid power trading method for microgrids, characterized in that, The method includes the following steps: 1) Each participant joins the blockchain as an independent node and completes identity verification and registration. Participants include power generators, electricity consumers, and at least one independent energy storage provider. 2) The first stage of the transaction is carried out based on the power supply and demand orders of both parties. During this stage, the two parties adopt a weighted settlement mechanism to dynamically adjust the transaction price in a direction that is more favorable to the high-price buyer or the low-price seller. 3) The generators that failed to match in the first stage are regarded as leaders, the electricity consumers that failed to match in the first stage are regarded as followers, and the independent energy storage providers are regarded as market regulators. A master-slave game model is constructed for the second stage of trading. In the second stage of trading, the independent energy storage providers dynamically adjust the charging price and discharging price according to their single interaction volume, so that the charging price decreases as the interaction volume increases, and the discharging price increases as the interaction volume increases. 4) A hybrid inner and outer layer solution algorithm is used to solve the objective function of the master-slave game model, and the transaction matching is achieved based on the solution results.

2. The blockchain-based microgrid two-stage hybrid power trading method according to claim 1, characterized in that, The transaction price determined by the weighted clearing mechanism is: Where P am,ij p is the weighted clearing price, i.e., the transaction price. a,ij The benchmark midpoint price is P, where pos is the price relative position parameter. ag,i For the seller's offer, P ac,j Offer for the buyer, As the weight of external price influence, p s p b These are the upper and lower limits of the pre-set regulatory price range.

3. The blockchain-based microgrid two-stage hybrid power trading method according to claim 1, characterized in that, Independent energy storage providers dynamically adjust charging and discharging prices based on the amount of electricity exchanged per transaction, as follows: q represents the battery consumption per interaction, p s p b p represents the upper and lower limits of the preset regulatory price range. cb The base charging price published by independent energy storage providers, p db The base discharge price published by independent energy storage providers, k c k d These are the charging price sensitivity coefficient and the discharging price sensitivity coefficient, respectively.

4. The blockchain-based microgrid two-stage hybrid power trading method according to claim 1, characterized in that, The game objective function includes the leader's objective function and the follower's objective function, which are as follows: Where maxR g To maximize total revenue for leaders, SR g For revenue from electricity sales to followers and independent energy storage providers, ES g For green energy subsidies, GC g For the cost of power generation, SF g For transaction service fees, maxR c To maximize the net utility of its followers, UF c PC is the utility function for purchasing electricity. c For electricity purchase costs, SF c This is for the discharge service fee.

5. The blockchain-based microgrid two-stage hybrid power trading method according to claim 4, characterized in that, Utility function UF c It is in logarithmic form.

6. The blockchain-based microgrid two-stage hybrid power trading method according to claim 1 or 4, characterized in that, The hybrid inner and outer layer solution algorithm first uses particle swarm optimization to perform the outer loop, i.e., leader strategy search, and then uses Brent optimization to perform the inner loop, i.e., follower optimal response calculation.

7. The blockchain-based microgrid two-stage hybrid power trading method according to claim 6, characterized in that, The solution process of the hybrid inner and outer layer algorithm includes: using particle swarm optimization (PSO) to search for the leader's optimal pricing within the feasible price range, where each particle in PSO represents a candidate price; for each candidate price given by PSO, using the Brent optimization method to precisely solve the utility maximization problem for each follower, thereby obtaining their optimal purchase volume; substituting the optimal responses of all followers into the leader's payoff function to calculate the fitness of the current candidate price; and iterating the PSO based on the fitness until finding an approximate optimal price that maximizes the leader's payoff.

8. The blockchain-based microgrid two-stage hybrid power trading method according to claim 2, characterized in that, The first phase of the transaction includes: A. Sort all sell orders in ascending order to form a sell order list, and sort all buy orders in descending order to form a buy order list; B. Loop through the top of the sorted sell order list and buy order list to match orders. A successful match is indicated when the seller's bid is less than or equal to the buyer's bid, and the transaction volume is determined. C. For each successfully matched trading pair, the transaction price is determined according to the weighted clearing mechanism, and the transaction is executed at the transaction price; D. Update the remaining power of both parties in the transaction, and remove participants whose power is perfectly matched from the matching list. Repeat this process until the list is empty or there are no more trading pairs that meet the matching criteria.

9. The blockchain-based microgrid two-stage hybrid power trading method according to claim 1, characterized in that, The method also includes generating a transaction list based on the matched transactions. This transaction list is then confirmed by the private keys of the relevant participating nodes, packaged into a transaction block, and uploaded to the blockchain.

10. A blockchain-based microgrid two-stage hybrid power trading system, comprising a processor, characterized in that, The processor executes a computer program to implement the steps of the blockchain-based microgrid two-stage hybrid power trading method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Block chain-based micro-grid distributed power two-stage transaction method

    CN117541382A