A Blockchain-Based Game Approach to Multi-Microgrid Energy Dispatch

2024-02-19 12:03ZhikangWangChengxuanWangWendiWuChengSunandZhengtianWu

Zhikang Wang,Chengxuan Wang,Wendi Wu,Cheng Sun and Zhengtian Wu

School of Electronic and Information Engineering,Suzhou University of Science and Technology,Suzhou,215123,China

ABSTRACT

As the current global environment is deteriorating,distributed renewable energy is gradually becoming an important member of the energy internet.Blockchain,as a decentralized distributed ledger with decentralization,traceability and tamper-proof features,is an important way to achieve efficient consumption and multi-party supply of new energy.In this article,we establish a blockchain-based mathematical model of multiple microgrids and microgrid aggregators’revenue,consider the degree of microgrid users’preference for electricity thus increasing users’reliance on the blockchain market,and apply the one-master-multiple-slave Stackelberg game theory to solve the energy dispatching strategy when each market entity pursues the maximum revenue.The simulation results show that the blockchain-based dynamic game of the multi-microgrid market can effectively increase the revenue of both microgrids and aggregators and improve the utilization of renewable energy.

KEYWORDS

Multi-microgrid;blockchain;stackelberg game;energy scheduling

1 Introduction

With global warming,serious land desertification,biodiversity reduction,water environment pollution and other problems increasingly prominent,traditional energy is not enough to meet the needs of modern social production and development,and the use of renewable energy sources gradually become the focus of energy reform.At the same time,due to the rapid development of the economy,the demand for electricity from all walks of life is constantly increasing,although China’s power facilities and equipment are gradually improving,the situation of continuous shortage of power supply has been alleviated,but in the peak load period China’s power grid is still facing enormous pressure.How to use power resources more efficiently is of great importance to relieve the power supply tension and protect the ecological environment.

A microgrid is an energy supply system based on distributed generation and energy storage technology,which enables energy to be generated,transmitted,and stored in different locations,providing a new solution for the efficient use of energy.However,when each MG participates in the market,the problem of interest game between MG and the main network will arise,thus,Microgrid Aggregator(MA)is introduced into the multi-microgrid system to achieve a win-win situation between different interest subjects through the coupling decision-making role of MA and main network[1–4].However,because of its centralised system,it generates problems such as high operating costs,the inability to guarantee the information security of participating subjects and the lack of a central supervisory mechanism,thus requiring the exploration of a path that can effectively reduce costs,improve efficiency and protect the information security of users[5].

Blockchain technology is a distributed and decentralized database technology that achieves decentralized verification and confirmation of transactions through the consensus mechanism between network nodes[6].The emergence of blockchain technology has brought new changes to the energy industry.With blockchain technology,energy transactions can be decentralized and secure,making energy supply more transparent and trustworthy.The introduction of blockchain technology into the transaction between microgrid aggregator,main network and multi-microgrid has the following advantages:

1) Strong confidentiality:the decentralized feature of blockchain makes the transaction between microgrid aggregator,main network and multi-microgrid can be completed directly without the third-party trading platform,avoiding the risk of information leakage caused by the improper operation of the third-party trading platform.This feature ensures that transactions between microgrid aggregators,the main grid,and multiple microgrids are more secure.

2) Anti-tampering: the decentralized nature and consensus mechanism of blockchain make it almost impossible for attackers to manipulate the data in a block without challenging over 50% of the network’s computing power.This high threshold makes it extremely difficult for attackers to carry out such an attack in practice[7].

3) Intelligent:the use of smart contracts in the blockchain to automatically complete transactions effectively reduces labor costs and third-party trust maintenance costs[8].

In recent years,there has been significant research in multi-microgrid gaming schemes.One such proposal,Zhao et al.[9] proposed a double-layer framework for energy trading in multi-microgrids based on blockchain technology.Utilizing a continuous double auction mechanism,this approach aims to achieve fair and free trading between nodes while effectively improving energy utilization.Another proposal,discussed in Yang et al.[10],presented a PoS-based public blockchain peer-to-peer energy trading model.This model enhances producer revenue and consumer cost savings,eliminates price gaps,and reduces mining difficulty and energy consumption.Through a case study and numerical results,the feasibility and effectiveness of this approach are demonstrated.Okoye et al.[11]combined licensing and shortening the consensus reaching time authorization,parallel processing of transactions,and off-chain processing into a blockchain Internet to improve transaction speed.Meanwhile,Rezaei et al.[12]proposed a framework for demand-side integration based on smart microgrids,which supports efficient power consumption through Nash bargaining games and dynamic tariff schemes.This framework aims to achieve smart grid goals and customer needs.Additionally,Mensin et al.[13]proposed an optimal peer-to-peer energy trading model based on prioritization techniques,which seeks to maximize self-consumption for prosumers.Through real-time energy trading and real-time pricing,the approach addresses energy sharing problems in P2P energy trading to achieve payoff fairness for all groups.Another proposal,Mengelkamp et al.[14]proposed a framework for designing microgrid energy markets based on blockchain technology,evaluated with the Brooklyn microgrid case study.This literature also summarizes seven necessary components to design efficient microgrid energy markets.Finally,Noor et al.[15]combined blockchain with microgrids and proposes a demand side management pricing game model.However,there is a lack of effective incentives to attract microgrids to the blockchain.

In this paper,based on the existing research,the distributed bookkeeping and de-centralized processing of blockchain are used to determine the optimal trading price and electricity consumption strategy in peak and valley hours from the MA side through the design of smart contract.The efficiency loss caused by the fluctuation of flexible load in multi-microgrid and the preference of microgrid users for electricity are fully considered as the measures to attract users to the blockchain.The blockchain is used as a measure to attract users to access the blockchain and achieve efficient utilization and highly reliable trading of new energy in the multi-microgrid.

2 Blockchain-Enabled Multi-Microgrid Marketplace Framework Design

In recent years,the hotness of Bitcoin has attracted attention,and blockchain technology,the underlying technology that underpins Bitcoin,is slowly attracting attention.As a decentralized distributed ledger,blockchain technology can solve the problem of attribution in the transaction process by using a consensus algorithm,hash encryption algorithm,asymmetric key mechanism and peer-to-peer(P2P)network carrier without the supervision of third-party regulators,effectively solving the problem of information asymmetry in the transaction process.

2.1 Blockchain Technology

A block consists of two parts:the block header and the block body,as shown in Fig.1.The block header contains the hash of the previous block used for linking and the target hash pointing to the next block,the random number used for mining,the version number,the timestamp,and the Merkle root,and the block body consists of the main transaction information of this block and the hash of this block.The current block is linked to the previous block by finding the hash of the previous block connected to it,forming a blockchain with a chain structure.In the process of microgrid energy transactions,if the transaction information is maliciously modified,it can be traced through the Merkle tree,thus ensuring the security and transparency of the transactions.

In this study,the blockchain is used to store information related to multi-microgrid transactions,such as generation unit IDs,power lines,energy types and electricity prices.This transaction information is stored on the blockchain,which ensures transparency,security and immutability of transactions.

2.2 Blockchain-Based Transaction Model for Microgrid Aggregators

The blockchain multi-microgrid market transaction model involved in this paper is shown in Fig.2,which contains the main network,microgrid aggregators,multiple microgrids,Hyperledgerbased microgrid blockchain smart management platform,and each microgrid contains energy storage devices,power-using devices (e.g.,electric vehicles,industrial users,residential users,commercial users,etc.) and capacity devices (e.g.,wind power generation,PV power generation,thermal power generation,hydroelectric power generation,etc.).When there is excess capacity,the microgrid will sell electricity to the microgrid aggregator through the blockchain intelligent management platform to obtain benefits; when there is insufficient capacity,the microgrid will purchase energy from the microgrid aggregator through the blockchain intelligent management platform to relieve the load pressure.Meanwhile,considering that the multiple microgrids(i.e.,producers and consumers)in the microgrid aggregator trading model will switch between power sources and users,the strategy of separate peak and valley pricing in the blockchain open market can effectively incentivize multiple microgrid users to reasonably allocate their power consumption time and alleviate the tight power consumption of multiple microgrids during peak periods [16].Based on the open and transparent characteristics of blockchain,the time-of-use tariff can be developed according to the actual electricity consumption in the market to guide the energy production and consumption of each microgrid user,and the peak-valley time-of-use tariff model can be defined as:

wherePf,Pprepresent the peak electricity price,off-peak electricity price,and valley electricity price,respectively,andPf>Pp>Pg;Tf,TpandTgrepresent the time periods of peak electricity price,offpeak electricity price,and valley electricity price,respectively.The multi-microgrid in the blockchain reasonably allocates the energy production and consumption moments according to the peak and valley hour electricity prices in the open market,which also reflects the guiding role of the blockchain market for electricity.

Figure 1 :Blockchain structure

Figure 2 :Microgrid energy storage strategy based on blockchain

2.3 Blockchain-Based Multi-Microgrid Market

The multi-microgrid market is a mechanism in which buyers and sellers interact to determine production and prices.Its market players mainly include local grid companies for infrastructure construction,microgrid aggregators for buying excess capacity and selling electricity,multi-microgrid users for obtaining the minimum cost,and blockchain networks for regional energy trading.Compared to platforms such as Ethereum,Substrate,Ripple,and IBM,Hyperledger Fabric uses a unique system architecture that separates the automatic execution of contracts from the consensus mechanism,achieving modular and plug-and-play consensus and membership services.This architecture allows developers to customize blockchain networks to better meet the needs of different scenarios[17].Furthermore,compared to competitors like Ethereum,Hyperledger Fabric has higher applicability in blockchain energy trading.Therefore,this article selects Hyperledger Fabric as the blockchain energy trading platform.At the same time,the practical Byzantine fault tolerance(PBFT)algorithm is used as the consensus mechanism,which uses mathematical calculations and does not require mining to achieve consensus on the blockchain management platform in the shortest possible time,thereby improving the transaction speed of the blockchain to meet the efficiency requirements of the microgrid market.In the transaction process,participants need to register on the blockchain intelligent platform and submit the necessary information,such as the organization name,node name,and node type.The certificate issuance authority Fabric CA(CA)will verify this information and generate a digital certificate,then encrypt and store the “individual” ID that meets the admission market conditions in the corresponding blockchain.The microgrid is connected to the main grid through a public coupling point.When the microgrid’s electricity production cannot meet the needs of local users,the main grid will provide power.When the microgrid produces excess electricity,it will sell it to the main grid.The price that the microgrid purchases from the main grid should be lower than the local electricity price,and the price reported by consumers should be higher than the local electricity price,stimulating both buyers and sellers to trade through this incentive mechanism.To prevent collusion pricing from disrupting the market order,a closed interval declaration price mechanism is set up.At the beginning of each round of the microgrid’s game,the management platform broadcasts real-time information on electricity quantity and price to various system nodes.The public sharing,distributed ledger,tamper resistance,open transparency,and traceability features of blockchain can effectively improve the current problems caused by the centralized mode in energy trading,such as untraceable transactions and unreliable trading partners.Smart contract technology can also promote mutual cooperation among entities.Blockchain technology can effectively ensure the accuracy and timeliness of energy transactions and thus improve the quality and efficiency of comprehensive services[18].In summary,Table 1 compares the performance of traditional electricity market transactions and blockchain-based multi-microgrid energy transactions in four aspects:transaction method,information trustworthiness,energy selection,and data security.

Table 1 : Comparison of energy transaction effect between blockchain-free and blockchain-based microgrid

1) Transaction method: Traditional electricity market relies on trusted third-party institutions,while blockchain provides a storage and broadcasting platform for all users participating in the market,and all participants can access direct P2P transactions.

2) Information trustworthiness:Traditional electricity market relies on trusted third-party institutions as credit guarantees,while blockchain,as a distributed ledger,has the characteristics of openness,transparency and non-comparability of transactions.

3) Energy choice:Users can use the traceability feature in blockchain to know the source of energy they buy,such as wind power,thermal power and hydropower,thus having more opportunities to choose energy.

4) Data security:The data in traditional electricity market transactions are stored in the database of the central institution,which is difficult to recover after an attack.Blockchain database adopts distributed storage method,and when the data is damaged,it can be recovered in time using copies.

2.4 Degree of Preference of Blockchain Multi-Microgrid Users for Energy Type

Based on the traceability of blockchain,users of multi-microgrid can freely choose the type of energy in the blockchain compared to purchasing electricity from the main network.Although different types of energy can eventually meet the final electricity demand of users,the different costs,output and stability of different energy types lead to differences in energy selection and therefore there is a preference for energy types.Secondly,the open and transparent feature of blockchain enables users to grasp timely and accurate information on power supply in the multi-microgrid system,thus increasing the willingness of microgrid users to access the blockchain.It can be seen that the degree of information interoperability of blockchain networks greatly affects the preference of users to use blockchain networks for electricity trading,and the preference degree is shown in Eq.(2):

whereis the initial degree of preference of user i for electricity m when blockchain technology is not applied; θ∈[0,1] denote the degree of blockchain application,i.e.,whether each microgrid is on the chain or not,and the higher the degree of chain,the higher the degree of blockchain application.φ∈[0,1]denote the coefficient of blockchain influence on the degree of user preference;m∈[2,M],M denotes the microgrid access to the number of blockchain networks,and m denotes that the power comes from the capacity equipment in them-thmicrogrid.Since the main grid has the characteristic of stability and irreplaceability,for m=1,φ=0 andδik,1=δik,10.

3 Blockchain-Based Multi-Microgrid Model

3.1 Multi-Microgrid Revenue Function Model

The revenue of the multi-microgrid is composed of the profit of power sales from MG to MA,the cost of power purchase by MG from MA and the operating cost of MG’s own energy storage equipment,whose function model can be defined as:

The upper equation in the segment function indicates that when the capacity of the generator set in MG is larger than the MG’s electricity load,i.e.,excess capacity,MG chooses to charge the energy storage device first to relieve the load pressure at the peak of electricity consumption,and then chooses to sell the remaining capacity to MA through the blockchain open market when the storage capacity of the energy storage device reaches its limit.

The following equation in the segmentation function indicates that when the capacity of the generating units in the MG is less than the MG’s electricity load,i.e.,the capacity is insufficient,the MG first releases the electricity stored in the storage device to relieve the load pressure,and when it is still insufficient to cope with the load pressure at the peak moment,it chooses to purchase electricity from the MA through the blockchain open market.

3.2 Microgrid Aggregator Revenue Function Model

The return of MA consists of the trading spread between the main,multi-microgrid network,and its functional model can be defined as:

where Yhmais the revenue function of MA at moment h;Phma,buy,Phma,shouare the purchase price and sale price of electricity in the blockchain open market for the main grid at moment h,respectively.

3.3 Binding Conditions

3.3.1ConstraintofMA

In order to enable the blockchain multi-microgrid system to operate stably and at the same time speed up the response time of MA and each MG,the price set needs to satisfy the following conditions:

3.3.2ConstraintofMG

The blockchain multi-microgrid system is internally bounded by both flexible loads and energy storage devices.

Flexible loads facilitate demand-side management[19],and multi-microgrid users can reasonably allocate electricity consumption periods for appliances based on time-of-day tariffs in the blockchain open market.In order to reduce multi-microgrid users’deviation from desired consumption of electricity due to the actual consumption of electricity,the operation of flexible loads needs to satisfy the following constraints:

In daily use,in order to prevent loss problems caused by improper use of energy storage equipment,it is necessary to control its active power and state of charge within certain limits,the constraints of which satisfy Eq.(8):

4 Multi-Microgrid and Microgrid Aggregator Game Model

The concept of the master-slave game was first proposed by the German economist Heinrich Von Stackelberg,and later many scholars did related studies on Stackelberg’s model.Basar and Olsder based on Stackelberg’s theoretical research proposed the definition of a two-player and multiplayer master-slave game and the existence of the equilibrium point of the master-slave game proposition[20].

4.1 Blockchain-Based Multi-Microgrid One-Master-Multi-Slave Stackelberg Game Model

In the game process,MA first generates the electricity price curve according to the contract signed with the power grid to maximize its own profit published in the open market.MG decides the optimal electricity purchase and sale plan according to the price in the blockchain open market intending to maximize its own benefit,which constitutes a typical Stackelberg game model [3].In this paper,we take MA as the leader and each MG as different followers,and establish a Stackelberg game model with one master and many followers,whose game model can be expressed as follows:

There are 3 elements in the model:participants,strategies and benefits,which are expressed as:

1) Participants:the participants of all games are denoted as{MG}∪{MA}.

3) Benefit: {Un}n∈Gdenotes the set of benefit functions of MG; R denotes the benefit function of MA.

4.2 Objective Function

(1)TheobjectivefunctionofMA

(2)TheobjectivefunctionofMG

The game reaches a Stackelberg equilibrium solution(both sides gain the maximum benefit)when all followers respond optimally according to the leader’s decision and the leader accepts this optimal response,subject to the following conditions:

where

4.3 Blockchain Microgrid Aggregator Revenue Model

Microgrid aggregators provide a trading platform to microgrid users and profit by charging a proportional service fee.The benefit of the aggregator gaming process is the operating revenue,and the revenue function can be expressed as follows:

where δ is the ratio coefficient of the service fee charged by the blockchain microgrid aggregator;N1andN2are the number of power sources and loads in the multi-microgrid market,respectively.

When the service fee ratio coefficient is certain,the aggregator and the participating operating entities in the multi-microgrid system have the same benefits,and at this time,the optimal economic benefit of the blockchain microgrid aggregator is the result of the power bidding game.In addition,the aggregator influences the power supply and user in the multi-microgrid market benefits and tariffs by adjusting the values ofδiandδjin the pricing strategy,so as to maximize the obtained benefits[21].

4.4 Energy Scheduling Strategy

Before the energy dispatch of the day,the Microgrid Aggregator (MA) updates the daily main network electricity price prediction information,while each Microgrid (MG) updates the predicted load data,generation equipment predicted capacity,and energy storage equipment predicted state of charge for the day.The MA determines the internal electricity prices for the multi-microgrid system based on the main network electricity prices in each time period on the blockchain open market.The resulting information is then published in a block structure on the open market.

Subsequently,each MG responds to the received price information as a target,adjusting the charging and discharging power of flexible loads and energy storage equipment by calling optimization algorithms.Simultaneously,the MG feeds back the price signal to the MA.Upon receiving feedback information from the MG,the MA calls the optimization algorithm again,adjusts the electricity prices,and publishes them again on the blockchain open market.This iterative process continues between the MA and MGs until their interests are maximized.Specifically,the MGs adjust their electricity consumption based on the published electricity prices,while the MA adjusts the prices based on the feedback received from the MGs.The specific flowchart of this process is illustrated in Fig.3.

In the game process,there is a deviation value between the flexible loadeiand the optimal load,and the fluctuation of the load will lead to the deviation of the power bought and sold in the blockchain multi-microgrid system from the optimal strategy,resulting in the loss of benefits to MA in the transaction process.In this regard,the impacts and countermeasures brought by the deviation values are discussed separately for the two cases of overcapacity and understaffing in the system.

Figure 3 :Multi-microgrid pricing Dynamic Game Process based on blockchain

(1)Microgrid users with excess capacity in the system

When MG sells less electricity to MA than the optimal strategy,i.e.,-≥0,MG is positive benefit;and when MG sells more electricity to MA than the optimal strategy,i.e.,-<0,MG is negative benefit,and in order to ensure the leader’s benefit,the benefit will be compensated to MA,at which time the benefit contributed by MG to MA is:

(2)Microgrid users with insufficient capacity in the system

When MG buys more power from MA than the optimal strategy,i.e.,-≥0,MA is a positive benefit;and when MG sells more power to MA than the optimal strategy,i.e.,-≥0,MG is the negative benefit,and in order to ensure the leader’s benefit,the benefit will be compensated to MA,at which time the benefit contributed by MG to MA is:

Combining Eqs.(15)and(16),the combined benefit function of MA can be derived as:

In summary,MG sends the deviation value to MA after each game,and MA receives the deviation and updates the benefit function according to the above countermeasures,which in turn compensates for the impact on MA caused by the fluctuation of the flexible load during the game[22].

5 Example Analysis

This article designs an optimization cycle T of 24 h,optimizing every hour.Compared with traditional particle swarm algorithms,the improved adaptive particle swarm algorithm can solve problems faster by constraining the problem.In the simulation process,the solution of the nonlinear utility function involves using the YALMIP toolbox to call the CPLEX solver.The improved adaptive particle swarm algorithm is used to solve Eqs.(10) and (11) within the MA and MG.In the game process,the pursuit of a globally optimal solution is achieved,thus the optimal utility of{MG}∪{MA}is used as the objective function for experimental analysis.

5.1 Basic Data

In this paper,we assume that the multi-microgrid system contains 3 microgrids and 1 microgrid aggregator.The initial state of charge(SOC)is taken as 0.3,the maximum state of charge is taken as 0.85,and the minimum state of charge is taken as 0.2;the electricity consumption satisfaction factorfor thei-thMG at moment h is taken as 95; the maximum charging powerof the energy storage device is 50 kW,maximum discharge powerof 50 kW; the charging efficiencyNchand discharging efficiencyNdcof the energy storage equipment are taken as 0.9; the operating loss cost factorβchof the energy storage equipment is taken as 0.03;the capacity of the energy storage deviceγcais 96 kW·h; the optimization time interval Δh for energy storage devices is 0.2 h.The predicted tariff information is temporarily taken as a reference for a city’s time-of-day tariff,as shown in Fig.4,and the load and capacity of each microgrid are shown in Fig.5.The capacity,load,and battery basic parameter data of each microgrid are obtained from the literature[23,24].

Figure 4 :Tou price curve

5.2 Internal Tariff Optimization Results

As can be seen from Fig.5,during 11:00–17:00,the internal power generation of the multimicrogrid system is smaller than the load demand,showing a trend of supply exceeding demand,at this time,MA can increase the electricity purchase price to guide MG to sell the excess capacity to MA,to meet the demand response of MA’s power purchase; while during 00:00–10:00 and 18:00–24:00,the internal power generation of the multi-microgrid system is larger than the load demand,showing a trend of supply exceeding demand,at this time,MA can reduce the electricity sale price to meet the demand response of MG’s power purchase,to protect the environment and ensure its revenue at the same time.At 00:00–10:00 and 18:00–24:00,the power generation within the multi-microgrid system is larger than the load demand,showing the state of oversupply,at this time,MA can meet the demand response of MG’s power purchase by reducing the electricity sales price,to consume more renewable energy and protect the environment while ensuring its revenue.The internal tariff of the multi-microgrid after the optimization game is shown in Fig.6.

Figure 5 :Capacity and load curves

Figure 6 :Microgrid post-game price

5.3 Contrast Analysis

5.3.1Multi-MicrogridBenefitAnalysis

The comparison of microgrid revenue for each period is shown in Fig.7.After the game,the revenue of microgrid in each period has slightly increased.Meanwhile,MG1 at 11:00,13:00,15:00;MG2 at 09:00–17:00: MG3 at 10:00,14:00–16:00,because the microgrid capacity is larger than the load demand,by selling the excess capacity There is a significant increase in the revenue obtained by selling the excess capacity to MA,and in the other hours,with the help of energy storage equipment thus reducing the amount of electricity purchased from MA and thus improving the overall revenue,thus verifying the effectiveness of this optimization strategy.

5.3.2MicrogridAggregatorRevenueAnalysis

The comparison of profits for microgrid aggregators is shown in Fig.8.Before optimization,since the multi-microgrid has not started its capacity at 0:00–6:00,the multi-microgrid can only purchase electricity from the main network through the blockchain open market,and the revenue of the microgrid aggregator is 0.At 11:00–17:00,the microgrid aggregator acquires surplus electricity and sells energy that exceeds the capacity of the storage device at the same time,and at 19:00–22:00,the capacity in the system is much smaller than the load.At 19:00–22:00,the capacity in the system is much less than the load demand,at this time,the microgrid aggregator sells to the microgrid at a lower price than the main network,reaching the peak stage of revenue,while at 23:00–24:00,all the electricity purchased by the aggregator is sold out,and the multi-microgrid buys electricity from the main network again,based on which the real-time game is added to expand the revenue obtained by the aggregator while reducing the impact of the load deviation value on the MA revenue.

5.3.3LoadCurveComparisonAnalysis

According to Fig.9,after optimized scheduling,the load curves within the multi-microgrid system changed at different time periods.During peak hours(such as 8:00–13:00 and 18:00–22:00),the system’s load significantly decreased,indicating that the microgrid aggregator successfully implemented peak shaving,i.e.,purchasing more energy from the main grid during peak periods to meet user demand and selling excess energy back to the main grid during off-peak periods.This strategy can reduce internal load fluctuations and improve energy utilization efficiency.In contrast,during offpeak hours(such as 15:00–17:00 and 22:00–next day 7:00),the system’s load increased slightly.This may be because the microgrid aggregator purchased more energy from the main grid to meet user demand response.Although there was more internal generation capacity at this time,purchasing more energy from the main grid was necessary to ensure supply due to lower user demand.

Figure 8 :Revenue curve of microgrid aggregator based on blockchain

Figure 9 :Improvement of load curve in each period

5.3.4SmartContractTradingDetails

In the simulation of smart contract trading,there are two energy producers q and v,and three energy consumersx,y,andz.Tables 2 and 3 show the entire trading process and results of the multimicrogrid using smart contracts.As shown in Table 2,before the game,the lowest bid of producervwas higher than the highest bid of consumerx.All participants in the multi-microgrid adjusted their bids in turn based on the APSO algorithm.After multiple rounds of adjustments,the true bid of producervbecame lower than the true bid of consumerx,so both sides began to trade.After the transaction,producervstill had surplus energy,and consumerx′s true bid for selling energy was lower than consumery′s bid,so both consumers reached a consensus to trade.After the transaction,consumerydid not receive enough energy.Although producerq′s bid met the conditions of consumery′s bid,they failed to match multiple times due to not meeting the dynamic constraint conditions.After submitting the true bid,consumerz′s bid was lower than the bids of consumeryand producerq,but consumery′s bid was higher than producerq′s bid,so consumerzwas matched with producerqfor the transaction.However,at this point,bothqandzstill had surplus energy,andydid not receive enough energy,soq,y,andzre-bid for the next round of trading until the end of the transaction.The final trading results are as follows: consumersx,y,andztransferred 31.43,34.24,and 39.99 ether respectively from their accounts,and the corresponding energy was added to their accounts.Producerqandvsold 62 and 99 kW·h of energy respectively and received 42.51 and 63.15 ether.

Table 2 : First round of participant bids

Table 3 : Trading information

5.3.5ComparisonwithExistingSolutions

Table 4 shows the different functionalities provided by recent representative solutions,including the use of peer-to-peer networks,blockchain-based technology,support for smart contracts,availability to the public,use of aggregation mechanisms,and support for gaming.

Table 4 : Comparison with relevant solutions

The literature[9]and[15]provided a solution based on blockchain technology,but they do not choose a suitable transaction method,such as smart contracts,which not only makes the transaction system lack a certain degree of flexibility and security,but also prevents further reduction of transaction costs.The literature[10]used a suitable auction method but does not introduce an aggregator mechanism on top of it,which prevents the integration of multiple decentralized microgrid systems into a whole with the participation of multiple consumers,thus allowing for unified management and improved economic efficiency.In addition,literature[9,10] and[15]did not use a game mechanism,making it impossible to maximize the benefits of both sides of the energy auction.Although the literature [12] used peer-to-peer trading and a suitable trading method,it is not aided by a reliable trading platform and security is greatly reduced.In contrast,the solution proposed in this paper uses a smart contract-based energy scheduling gaming method for multi-microgrid aggregators,which not only maximizes the revenue for both sides of the transaction but also keeps the transaction information from leaking,ensuring a secure and reliable system.

6 Conclusions

In this paper,we have proposed a blockchain-based mathematical model for the revenue of multiple microgrids and microgrid aggregators.By utilizing automated transactions of smart contracts and combining the stackelberg game method of one master and many slaves,we aim to maximize profits between multiple microgrids and microgrid aggregators while also taking into account the degree of preference of microgrid users for electricity and thus increasing their reliance on the blockchain market.Our simulation results show that the proposed dynamic game model can effectively increase the revenue of both multi-microgrids and aggregators,as well as improve the utilization of renewable energy.

However,there are still some limitations in our research.For example,we have not considered the impact of flexible load fluctuations on transaction efficiency and the lack of effective incentive measures to promote microgrid access to the blockchain.Therefore,future research should focus on improving our model by addressing these limitations and verifying its effectiveness in practical applications.

Acknowledgement:The authors would like to thank the anonymous reviewers and the editors of the journal.Your constructive comments have improved the quality of this paper.

Funding Statement:This research was funded by the NSFC under Grant No.61803279,in part by the Qing Lan Project of Jiangsu,in part by the China Postdoctoral Science Foundation under Grant Nos.2020M671596 and 2021M692369,in part by the Suzhou Science and Technology Development Plan Project (Key Industry Technology Innovation) under Grant No.SYG202114,in part by the Open Project Funding from Anhui Province Key Laboratory of Intelligent Building and Building Energy Saving,Anhui Jianzhu University,under Grant No.IBES2021KF08,in part by the Postgraduate Research & Practice Innovation Program of Jiangsu Province under Grant No.KYCX23_3320,in part by the Postgraduate Research&Practice Innovation Program of Jiangsu Province under Grant No.SJCX22_1585.

Author Contributions:The authors confirm contribution to the paper as follows:study conception and design:Zhikang Wang,Zhengtian Wu;data collection:Chengxuan Wang;analysis and interpretation of results: Zhikang Wang,Wendi Wu; draft manuscript preparation: Zhikang Wang.All authors reviewed the results and approved the final version of the manuscript.

Availability of Data and Materials: Due to the nature of this research,participants of this study did not agree for their data to be shared publicly,so supporting data is not available.

Conflicts of Interest:The authors declare that they have no conflicts of interest to report regarding the present study.