Skip to main content

ORIGINAL RESEARCH article

Front. Energy Res., 05 January 2023
Sec. Smart Grids
This article is part of the Research Topic Key Technologies, Markets, and Policies towards A Smart Renewables-Dominated Power System View all 13 articles

Peer-to-peer energy trading and smart contracting platform of community-based virtual power plant

Mingxing GuoMingxing Guo1Ke ZhangKe Zhang2Su WangSu Wang1Jinlei XiaJinlei Xia2Xiaohui WangXiaohui Wang1Li LanLi Lan1Lingling Wang
Lingling Wang2*
  • 1Economic and Technical Research Institute, Shanghai Municipal Electric Power Company, Shanghai, China
  • 2Key Laboratory of Control of Power Transmission and Conversion, Shanghai Jiao Tong University, Shanghai, China

Traditional centralized transactions require a control center for user demand matching, settlement and other processes. However, with the increase in the penetration rate of distributed energy in the community, the explosive increase in the number of transactions leads to a decrease in efficiency and it is difficult to guarantee user privacy and information security. The smart contract technology based on blockchain technology has the characteristics of decentralization, traceability and tamper resistance, and these key factors show unique advantages in distributed energy transactions. This paper explores Ethereum and smart contract technology, designs a peer-to-peer energy sharing mechanism with reward and punishment incentives and establishes a smart contract trading platform for smart community-based virtual power plant (CVPP). This paper verifies the functionality and effectiveness of smart contract. The results show that when the supply and demand ratio changes, the user can conduct energy transactions according to the contract without a third-party organization, which solves the problem of trust between the two parties and achieves the expected effect and runs successfully. In addition, the simulation results show that the peer-to-peer transaction based on smart contracts reduces the energy cost per household and increases the total benefit of CVPP.

1 Introduction

With the increasing maturity of distributed generation technology, the penetration rate of renewable energy such as solar energy and wind energy in the power system continues to increase (Wang, Li, Shahidehpour, and Jiang). Multi-energy entities are eager to participate in electricity market competition (Gong et al., 2110; Wang et al., 2019a; Wang et al., 2019b). Distributed energy nearby autonomous trading has become the future development trend of distribution network (Feng et al., 2022; Gan et al., 2022). Among them, CVPP acts as an energy supplier by aggregating multiple types of distributed generator sets, energy storage facilities, etc.

Although some studies believe that CVPP energy trading can learn from the experience of traditional markets and establish a centralized trading center (Kristov et al., 2016). But in fact, there are big differences between distributed power trading and traditional power trading: 1) the number of prosumers is huge, but the scale of a single transaction is usually small; 2) prosumers have complete control over their own power generation and consumption equipment, but the power generation and consumption characteristics and quotation strategies have strong uncertainties and differences; 3) The self-interest of prosumers makes them have higher requirements for transaction fairness, privacy and non-discrimination (Masiello and Aguero, 2016). Facing the transformation and upgrading of the electricity market, the traditional centralized management method has great limitations: 1) the operation and maintenance costs of the trading center are high, the trading freedom is low, and the effective operation of the microgrid cannot be guaranteed; 2) It is difficult for users to trust third-party institutions, and management institutions have high trust maintenance costs, lack of transparency and credibility; 3) The trading center has a large target and is easily attacked, so there is the possibility of data loss or tampering, and information security risks are high.

Compared with traditional centralized energy trading, peer-to-peer (P2P) energy trading based on smart grid is safer, faster and more automated. It can effectively deal with the penetration of distributed energy and is more suitable for solving the problem of distribution network. The National Development and Reform Commission and the National Energy Administration of China issued the “Guiding Opinions on Accelerating the Construction of a Unified National Electricity Market System” (The National Development and Reform Commission and the National Energy Administration of China, 2022), which encourages distributed photovoltaics and other entities to trade directly with surrounding users. This policy pushes China to build a distributed trading market, which promotes the sharing of electricity, carbon emissions and backup resources. The Sonnen pilot, a community of owners of the Sonnen Batterie, was originally launched by the German business Sonnen and has continued to expand. There are Sonnen community members in Germany, Austria, Switzerland and Italy and Sonnen is currently developing a new community pilot in Australia. In the Sonnen pilot, there is a central software that connects and tracks all community members to balance energy supply and demand at all times (Clean Technica, 2015; IRENA, 2020). The UK Piclo pilot is one of the relatively mature peer-to-peer trading pilots currently. Based on this, the United Kingdom has launched an online peer-to-peer trading market for clean energy. In this pilot, the power generation entity can choose and know the counterparty to which it sells electric energy, and users can also choose which power generation entity to purchase electric energy on blockchain (Zhang et al., 2017; Open Utility, 2021). For the P2P transaction of electric energy between VPPs, the literature (Shan, Hu, Wu) established a P2P market transaction mechanism and model for VPP energy management, and realized the energy transaction between the prosumers within the VPP. The literature (Wu, Ma, Yang, Wu, Kong) established a P2P transaction model between VPPs to formulate the price and capacity of P2P transactions between VPPs.

In 2014, Buterin and Wood created Ethereum and firstly apply the smart contract to the blockchain (Buterin, 2014). The application of blockchain is no longer limited to digital cryptocurrency transactions. The two combine to complete more complex functions such as transaction settlement. Smart contract forces the execution of pre-implanted commands through code and the process done automatically and without intervention. The programmable features of smart contracts allow both parties to a transaction to agree on various transaction terms, ensuring the automation and integrity of transaction execution. This technology has been relatively mature in the fields of finance (Turkanović et al., 2018), medical (Angraal et al., 2017), and the Internet of Things (Zhang and Wen, 2017). In P2P energy trading, research on smart contract is still in its infancy. At present, there are some pilot projects. For example, LO3 Energy Company of the United States cooperated with Consensus System Company to design a distributed photovoltaic power sales platform based on blockchain technology (Mengelkamp, Garttner, Rock, Kessler, Orsini, and Weinhardt), which is the first time to apply the Ethereum blockchain technology in the field of energy trading. The Scenery-Project funded by European Union is studying ways to implement decentralized transactions based on blockchain technology to achieve high efficiency and high returns for peer-to-peer transactions (Mihaylov et al., 2014). The German electric power company RWE has cooperated with Slock.it to develop an electric vehicle charging station management system based on blockchain smart contracts to verify user identities and achieve independent billing and transaction settlement (Xu, 2016). In addition to this, there is the Brooklyn Microgrid Project (Molle, 2016). It enables residents to directly sell the electricity generated by rooftop solar equipment to nearby users, and the two parties trade directly without the participation of third-party companies.

In terms of the application of this technology in CVPP, American LO3 Energy and ConsenSys have developed the Trans Active Grid project in a community in Brooklyn (Orsini et al., 2019), which allows resident users in the community to participate in peer-to-peer electricity transactions within the community. Users can obtain real-time data such as electricity generation or electricity consumption by using smart meters and use the blockchain to sell or buy electricity energy. But the shortcomings are that the initially designed device is cumbersome, the user interface is not friendly enough, and there are very few users involved and the scale is small in a community. Subsequently, the American Exergy Engineering pilot followed the application of Trans Active Grid to peer-to-peer distributed transaction technology, especially blockchain technology (Exergy, 2017).

Although the combination of blockchain technology and distributed energy trading has the advantages of safety, efficiency and automation, there are still some shortcomings and many risks in practical applications. On the one hand, the security of distributed energy transactions based on blockchain and smart contract technology needs to be improved. The evaluation revealed that 8,519 existing smart contracts contain at least one new defect (Wang et al., 2020). On the other hand, the transaction rules and settlement mechanisms in smart contracts still need to be improved. A more complete and reliable trading mechanism is needed to improve user income, enhance the enthusiasm and initiative of users to participate in transactions and ensure the development of the distributed energy trading market.

In summary, the P2P trading behaviors between the nodes during the negotiation process is studied to set up the P2P bidding system and corresponding smart contracts. Considering the negative impact of forecast error, this contract incorporates a reward and penalty mechanism according to The Incentive Principle of Positive Economics. Prosumers are encouraged to refine their models for predicting power generation, while consumers are urged to regulate their consumption habits. The feasibility of the smart contract on P2P energy trading under multiple conditions are verified and validated. Then the economic impact of P2P energy transactions conducted by this contract is further discussed.

2 Overall design

This paper learns the design science guidelines proposed by Hevner et al. (Hevner, March, Park, Ram), and the design idea is shown in Supplementary Material.

2.1 Trading rules

It is assumed that prosumers, including CVPP, generate electricity through distributed equipment and have reliable forecasting models. Prosumers are willing to sell their surplus energy and consumers with continuous demand for electricity intend to purchase energy from prosumers through the P2P market.

1) Prosumers and consumers upload their forecasted power generation and demand, as well as expected electricity prices.

2) The contract sorts consumers’ bid amounts from high to low and then selects the optimal bid for each user. If multiple consumers give the same price, the system will preferentially match consumers with higher demand, thereby reducing the possibility of wasting energy. On the other hand, since each blockchain transaction needs to consume Gas, reducing the number of transactions under the premise of ensuring the efficacy of the contract is conducive to maximizing the overall benefit.

3) The contract matches all users in the queue. If the needs of both the prosumer and consumers are met, the transaction will be fired and then removed from the matching queue. Users who fail to match will complete the transaction with those who still have surplus power or their energy suppliers.

4) The smart meter reads the actual power generation and consumption of the previous transaction and uploads it to the platform.

5) The platform calculates the difference between the expected transaction volume and the actual power generation or consumption in this trading cycle.

6) The platform rewards and punishes users for this transaction performance according to the incentive policy.

2.2 Incentive policy

Although electricity is continuously generated in real time, it is usually traded in half-hour segments for ease of settlement. Both parties predict the supply and demand through the models, and the actual transaction volume may not be consistent with the predicted volume. For example, a consumer may purchase electricity without planning to use an air conditioner, but the weather is hotter than expected, the consumer finally uses the air conditioner. In this case, the agreed transaction volume does not match the actual situation and the system is difficult to maintain balance and becomes fragile, thereby increasing the operating cost of the microgrid (Chakraborty et al., 2018). According to The Incentive Principle of Positive Economics, a person is more likely to take an action if its benefits rises, and less likely to take it if its cost rise (Shen et al., 2008). This paper introduces an incentive mechanism into the contract to minimize the impact of residents’ behavior and renewable energy uncertainty on P2P transactions. The contract records the number of users defaults and rewards or punishes accordingly to regulate electricity consumption, such as a higher P2P transaction probability as a reward and an appropriate fine as a punishment.

Referring to the current fault handling standard of the Short Term Operating Reserve (STOR) of the British power grid (National Grid, 2015), in order to facilitate settlement of the difference between the agreed electricity and the actual electricity, the system sets two unbalanced electricity prices (Elexon, 2020). System Buying Price (SBP) is the unit price paid by the grid to purchase excess electricity from prosumers. The System Selling Price (SSP) is the price paid by prosumers when they purchase energy from the distribution grid, measured in pennies per kilowatt-hour (p/kWh). User losses can be controlled within 30%.

Taking into account the uncertainty of renewable energy, this contract has been adjusted on the basis of the current STOR standard. The punishment is controlled within 15% and incentive measures have been added to the contract to fully mobilize the enthusiasm of users to participate in the P2P energy trading market. On the one hand, it ensures that users will not incur higher costs by participating in P2P transactions. On the other hand, this distribution method is more easily accepted by small-scale prosumers, incentivizing them to participate in P2P transactions and reducing the risk of energy waste. The reward and punishment incentive mechanism adopted is shown as follows:

For prosumers, if the actual power generation exceeds the forecast, the contract will record the excess power. Other users can continue to buy the excess and prosumers can choose to sell to the grid as well. If the actual power generation is less than the transaction volume, prosumers are slightly penalized to encourage them to improve their forecasting models. The specific punishment mechanism is as follows, and summarized in Figure 1:

1) Considering the uncertainty of renewable energy, the forecast error of prosumers is allowed to be between −5% and +5%. Prosumers are not penalized when actual production is higher than 95% of the forecast and receive payments that match the actual transaction volume. Consumers need to purchase the credits from the energy provider themselves. Since SSP is usually higher than the transaction price, in order to subsidize consumers, the system will waive the service fee for users participating in P2P transactions this time and next time.

2) When the actual power generation is less than 95% of the predicted amount, prosumers receive the amount corresponding to the actual transaction volume. Consumers purchase the shortage of electricity by themselves, and prosumers should subsidize consumers by 10% of the shortage amount. Considering that SSP is usually higher than the P2P transaction unit price, this contract waives the service fee for this and the next P2P transaction for consumers whose interests are damaged.

3) For consumers, if their actual power consumption exceeds the transaction volume, consumers should purchase the excess power by themselves. If the actual electricity consumption is lower than the transaction volume, the user still needs to pay the prosumers in full. But the consumers can sell the excess electricity to the grid or other consumers. The SBP is usually below the contract price, and other consumer bids may also be lower. Defaulting consumers could face some of the losses, prompting them to regulate their energy usage.

4) When the actual power generation or power consumption meets the agreed transaction volume, the user will be rewarded. If the forecast by the prosumers is accurate or the consumer’s power consumption is consistent with the agreed amount, it is considered that the user has performed well in this transaction, and the system will record it. If the user has accumulated five good performances, each transaction can be reduced by 20% of the service fee. Accumulate ten good performances and get a 40% discount. Twenty well-performing user transactions get 60% off. And so on.

FIGURE 1
www.frontiersin.org

FIGURE 1. Illustration of incentive policy.

2.3 Safety measures

1) Function encapsulation. Encapsulates one or more functions and only provides a simple calling interface to external programs. The caller cannot access the internal logic of the function. Key variables and functions are declared as internal calls.

2) Declare main storage type variables and basic functions as internal parameters. In order to reduce the cost of data storage, data in the blockchain is divided into two types: storage variables and memory variables. Storage variables refer to variables stored in the blockchain, while memory variables are only for temporary storage. For example, public variables are forced to be of storage type, while function return parameters are defaulted to memorized types. For security reasons, critical storage variables and functions cannot be called directly by external accounts.

3) User transaction authorization. Users need to obtain transaction authorization from the management node before calling the contract function, which further helps the trading platform to screen individual users. Authorization information will be stored in the user structure.

4) Use a mapping structure to ensure that variables are unique. A map is a key-value store structure. In the Solidity language, “msg. sender” is a special mapping that represents the Ethereum address of the current function caller. When the user calls the contract function, this variable is automatically set as the sender’s address, which ensures the unique correspondence between key values.

3 Smart contract based trading platform

The main functions of the contract include user registration, quotations uploaded by prosumers, sealed bids by consumers, system matching, smart meter reading, transaction balance settlement, and incentives for rewards and punishments. The contract also provides auxiliary functions to query order status based on ID or address. Figure 2 shows the logical relationship between contract functions.

FIGURE 2
www.frontiersin.org

FIGURE 2. Logical relationship of contract functions.

3.1 User registration

Users participating in P2P energy trading need to register for a blockchain account. The account corresponds to a pair of public key and private key. The key serves as the account address and can be used to activate the account. The user enters information such as name, email address, zip code and smart meter number, and the registration is successful after obtaining authorization.

3.2 Upload quotation

The system queries the authorization information of the prosumers to ensure that only authorized prosumers can call this function. After passing the inspection, the prosumers enter the following information: 1) the quotation ID, which is used as an index label to find the quotation; 2) the total transaction volume, which represents the electricity expected by the prosumers; 3) the expected electricity price, the prosumers can decide the expected price selling price. After the quotation is submitted, the system automatically records the time stamp. Quote details are permanently stored on the blockchain as transactions. The system defaults to this quote as “valid.” All consumers are free to participate in bidding unless the prosumers actively mark the offer as invalid.

3.3 Sealed bid

After entering the address and quotation ID corresponding to the quotation, the consumer creates a bid ID and determines his expected unit price and demand. The system first verifies that the electricity purchased by the consumer does not exceed the electricity provided by the prosumers and then checks whether the bid already exists. If a bid already exists, duplicate submissions are not allowed, preventing malicious bidding behavior. After the bid passes the checks, the function will execute and record the bid on the blockchain. Bids in this contract can only be set to four states of “create,” “reserved,” “confirmed” and “rejected.” At this point, the bid is in the “created” state and will be added to the sequence of consumers participating in the bid.

3.4 Contract matching

The bid confirmation function is called, and the system checks all bids and selects the best bid according to the transaction mechanism. The best bid is not selected based on unit price, but is prioritized based on the total bid amount. It can not only maximize the interests of both users, but also reduce energy waste. In the case of multiple users bidding the same total amount, the system will give priority to matching consumers with higher demand. Successfully matched bids have their status changed to “Accepted.”

3.5 Smart meter reading

Call the smart meter to obtain the actual power generation and consumption of the user. Enter the smart meter number to verify against the smart meter number stored in the sealed user structure. After validation, the data will be imported into the corresponding user structure.

3.6 Transaction settlement

The system calculates the difference between the predicted transaction volume and the actual amount of electricity generated or consumed, and settles between prosumers and consumers, as well as energy suppliers. The blockchain stores the calculation results, and the user completes the token transfer. This function can only be called by the contract owner. Therefore, there is no interface for the user to input parameters. Supplementary Material shows the three basic built-in functions of this process.

3.7 Query function

The query function does not change any data in the blockchain, so calling the query function does not consume Gas. The query function returns the data in the caller’s structure and outputs the requested information. Users can use the ID to get order details, including bid quantity, expected unit price, total supply and demand, and remaining unsold electricity.

4 Deploy contracting

All node data in the blockchain is synchronized (Vranken, 2017) and each node can fully participate in the negotiation process. Public blockchains allow everyone read and write access, while private blockchains limit the read or write rights of nodes. Public chains are open and allow anyone to access the blockchain network. There are many public chain nodes, it takes a lot of time to propagate transactions, the throughput of operations is limited, the latency is high, and the processing efficiency is relatively low (Hahn et al., 2017). The private chains are managed by administrators, and only specific nodes are allowed to join the negotiation process. Compared with public chains, private chains are in a sense more centralized and operate more efficiently (Xiaoling et al., 2019). This contract is more suitable to be deployed in a private chain with internal control, faster processing, lower cost and higher security.

Deploying a smart contract can be understood as a special transaction on the blockchain. Before deploying the contract, the destination address is empty. Transactions are sent from the deployer address and the destination is the contract address. When a transaction is recorded on the blockchain, a new address is automatically generated for the contract.

First, the constructor function which only executes once in a contract is called to input the necessary initial information, including the address of the grid, SBP, SSP, and the service fee. Then, Web3 Provider is adopted to deploy smart contracts compiled with Remix to a private blockchain created by Ganache. Call the constructor and enter the necessary information, including the energy provider address, SBP, SSP, and service charge. Constructors can only be executed once in a contract. Several accounts can be created to test the smart contract. Specially, the first address who deploys the smart contract is default as the owner of the contract. Each account has an initial amount of ethers, which can be used to pay gas for making transactions on the blockchain. Those test account can be used to call the previously constructed functions in turn, and the running result of each function are written in the contract log.

However, the blockchain cannot store the calculation details of the smart contract. This is because the blockchain technology stores data in blocks of the blockchain network. Each node will get a copy of the data on the chain to be kept synchronized with the network. Therefore, there is no specific data storage zoom for the operating details of the smart contract. To further test the function of the contract, this paper uses the flask API to interact with Python as a tool for storing and analyzing contract operation data (Atia, 2016) The data flow is shown in Figure 3. After system interaction, the following functions can be realized: 1) Send ether from wallet to smart contract address in exchange for energy; 2) Call functions in the contract to execute transactions or access certain inform.

FIGURE 3
www.frontiersin.org

FIGURE 3. Platform data flow.

5 Case analysis

5.1 Evaluation standard

Based on the evaluation system of literature (Zhou et al., 2018a), this study uses two technical indicators and two economic indicators to evaluate the P2P energy trading platform. Technical indicators include validation basis and condition adaptation index. Economic indicators are made up of value utilization index and participation willingness index.

5.1.1 Verification basis

According to Magazzeni et al. (2017), verifying the validity of a smart contract should be based on five criteria: 1) whether the natural language contract accurately and adequately expresses the mutual intent of both parties; 2) whether the computer code is compiled correctly natural language contract; 3) whether the computer program can do what it is supposed to do; 4) whether the program only does what it is designed to do; 5) if multiple programs run in parallel, does the system operate only as expected and no errors. Through the five criteria, developers can test whether the contract structure conforms to the logical paradigm and requirements of the research, check whether the contract can adapt to different usage scenarios, and ensure the efficiency and effectiveness of the test.

Criteria 1 and 2 verify the validity of the contract’s natural language and encoding. The most basic attribute of a smart contract is the accurate coding of requirements, and this contract conforms to the trading wishes of all users. Criteria 3 and 4 validate individual program properties. The contract is completed and only what is required to be done, subject to the agreement of the parties. Input that meets the criteria can lead to the desired result, whereas incorrect input will lead to incorrect results. Criterion 5 verifies the effectiveness of the platform as a whole. All nodes cooperate to execute the contract, the data in the block is kept synchronized, and the contract is locally valid, that is, globally valid. In conclusion, the contract conforms to the logical paradigm and requirements of this research.

5.1.2 Performance indicators

Zhou et al. (2018b) have developed an evaluation system P2P energy trading mechanism. The evaluation method of these contracts is adapted and built on this indexing scheme. Two economic indexes and one technical index are eventually adopted. The meaning of each indicator is described below.

1) Condition adaptation index, which measures how the contract operates under different conditions. This study explores the operation of the contract under two conditions of high supply-demand ratio and low supply-demand ratio.

2) Value mining index. Compare the energy cost of residents under the traditional transaction framework, measure the energy cost saved by P2P transaction, and reflect the overall benefit of CVPP. The higher the indicator value, the higher the CVPP return, that is, the higher the value obtained.

3) Participation willingness index. In addition to evaluating the overall benefit, the income per household is equally important. Participation willingness index reflects the benefits obtained by users after participating in the contract, thereby affecting the willingness of residents in the region to join the CVPP and P2P markets, which is crucial to the long-term development of the P2P ecosystem. If participating in P2P transactions leads to an increase in user energy costs, users will have sufficient incentives to return to the traditional transaction state. Therefore, the willingness to participate index measures the willingness of residents to participate in CVPP and P2P energy sharing mechanisms through user interests.

5.2 Example description

5.2.1 Power data

Al-Ammari and Al-Thani (2019) tested and compared blockchain transaction throughput for 10, 20, 30 to 140 nodes, proving that smart contracts in this range are capable of handling large numbers of transactions without sacrificing performance. Network expansion within a reasonable range will not affect the efficiency of the network. Therefore, this study tests 10 nodes of the system and performs economic analysis on each node.

In this paper, the photovoltaic power generation of each household collected by the Thames Valley Vision project (Potter et al., 2015) is selected as the data of the virtual power plant. The photovoltaic penetration level is 30%, the statistical accuracy is 30 min, and the data of smart meter uploaded in 24 h, the unit is watt per hour (Wh). This accuracy is not only in line with the general settlement time of the electricity trading market, but also better understand the customer’s electricity consumption behavior.

The types of energy storage devices that provide or absorb energy are not discussed separately herein. Although energy storage technology can provide greater versatility for P2P energy trading, they are also very costly. The energy storage facility is equivalent to a special prosumer, which does not affect the feasibility and validity of the contract.

The blue part of Figure 4 is the energy consumption of all participants in the P2P market over a 24-h period. The orange part represents the net electricity generation after CVPP actual electricity generation minus electricity consumption. Assuming that all consumers put their excess electricity into the P2P market for sale, the net electricity generation is equal to the electricity available for sale. Figure 4 shows the daily power generation curve of prosumers participating in P2P transactions. Assuming that all consumers put their excess electricity into the P2P market for sale, the net electricity generation is equal to the electricity available for sale. Figure 5 shows the net production curve after integrating the power consumption of CVPP.

FIGURE 4
www.frontiersin.org

FIGURE 4. PV daily power generation curve of each prosumer.

FIGURE 5
www.frontiersin.org

FIGURE 5. The daily net production curve of each prosumer.

According to the electricity consumption characteristics of CVPP, electricity consumption is concentrated in lighting, kitchen supplies and electronic equipment. The use of home appliances is not completely random, which is largely affected by the living habits of residents (Torriti, 2017). Also, electricity usage varies by household size. These differences and fluctuations are verified in the Supplementary Material. This study focuses on whole-household energy costs and overall CVPP benefits and therefore does not consider the specific size within each household.

5.2.2 Pricing model

The electricity price of each user varies according to their needs, usage habits and the frequency of electricity price package updates. The price gap between energy suppliers does not exceed 10% (Quarterly Energy Prices, 2019). Therefore, the average electricity price is used for settlement between users and energy suppliers in this study. In 2019, the average retail price of electricity in the United Kingdom was 18 pence per kilowatt-hour (p/kWh) (Sönnichsen, 2021).

This article refers to energy prices in the market. Octopus Energy (Octopus Energy, 2020) is a new type of green energy supplier that emerged in the UK in 2016. The company buys energy from home solar at 6 p/kWh. Another British company, Green Energy, proposed tidal electricity pricing strategy (Green Energy UK, 2020). According to statistics, customers who choose this package have an average electricity price of 4.9 p/kWh between 11 p.m. and 6 a.m. However, electricity rates between 4 p.m. and 7 p.m. are five times the nightly rate. The source of energy supply in this study is solar energy and P2P transactions are concentrated during the day. Consumers only need to buy low-cost off-peak electricity from the grid at night, thus cutting their electricity bills during peak hours. Even taking into account tidal electricity prices, the economic advantages of P2P are further increased. Therefore, this paper only uses average prices to model P2P transactions. Although the effectiveness of the P2P transaction mechanism may be underestimated, this does not affect the verification results of contract validity.

Taking the above considerations into account, the electricity price for the user to sell the surplus energy to the grid is 6 p/kWh in this case. The price the user buys from the grid is 18 p/kWh. Usually the transaction price of P2P transactions will remain within this range.

Although prosumers can freely set energy prices under the auction-based market transaction mechanism, the settlement price is mainly affected by demand and power generation in the actual P2P market. Therefore, this study adopts the pricing model proposed by Amin et al. (2020) to simulate bidding. The purpose of the tender is to minimize the cost per household and the total CVPP cost to maximize benefits. Take the settlement time of 11:30 a.m. as an example. The energy supply in the P2P trading market is higher than the demand. According to the pricing strategy, the consumer’s bid and the price of the consumer’s bid are shown in Figure 6.

FIGURE 6
www.frontiersin.org

FIGURE 6. Auction-based pricing strategy.

5.3 Result analysis

5.3.1 Technical performance

The supply-demand ratio (SDR) is defined as the ratio of total supply to total demand. When the SDR is greater than 1, it means that the production supply is oversupplied. If the SDR is equal to 1, it means that supply and demand are exactly the same. Likewise, if SDR is less than 1, it means that supply is not sufficient to meet demand. Figure 7 compares the shifts in the demand and supply curves over a day. Total supply is higher than demand during the settlement period in 11:30–12:30. In most other cases, the SDR is less than 1.

FIGURE 7
www.frontiersin.org

FIGURE 7. Comparison of daily supply and demand curves.

Figure 8 shows a trade settlement at 11:30 with an SDR greater than 1. For prosumers, the bar graph reflects the revenue they earn from selling energy. And for consumers, this represents their energy bills. It can be seen that the income of prosumers participating in P2P transactions is higher than that of directly selling energy to the grid. For users, the energy cost of P2P transactions is lower than that of direct transactions with the grid.

FIGURE 8
www.frontiersin.org

FIGURE 8. User energy costs (SDR > 1).

Figure 9 shows the settlement results at 17:00 with SDR less than 1. Although there is still enough solar energy to generate electricity at this time, the demand of prosumers has also increased. So there is less energy available for sale in the market. In this case, as long as the prosumers also provide electricity, the revenue from P2P transactions is much higher than that of selling electricity directly to the grid. However, if the net power generation is insufficient, participating in P2P transactions will improve the energy cost very little. At this time, the power generation in the CVPP area cannot meet the demand and some users who participate in the bidding may not be able to trade. Even for the winning bidder, the savings in energy costs are not significant due to the smaller transaction volume. However, it is still economical to participate in P2P transactions when all-day returns are taken into account.

FIGURE 9
www.frontiersin.org

FIGURE 9. User energy costs (SDR < 1).

No matter how the SDR changes, the Condition Adaptation Index and Value Mining Index indicators are within the normal range and do not affect the validity of the contract. It indicates that the contract can accurately balance and settle transactions under different conditions. The contract performed well on the technical level including the extreme conditions. In addition, users participating in the energy sharing mechanism reduce energy costs to a certain extent.

5.3.2 Economic analysis

In this paper, all prosumers have their own forecasting methods and models by default. Does not focus on optimization of predictive models. The prosumers’ forecast bias is shown in Figure 10.

FIGURE 10
www.frontiersin.org

FIGURE 10. Producer forecast bias.

Among the seven consumers, consumers 1 and 2 are set as users with extremely irregular usage behavior. In other words, they are not used to using appliances as planned. Consumers 3, 4 and 5 are considered to be slightly irregular users. Sometimes they follow the rules and sometimes they don't follow the plan. Consumers 6 and 7 are considered to have good electricity habits. The users’ prediction errors are shown in Figures 1113 respectively.

FIGURE 11
www.frontiersin.org

FIGURE 11. Electricity deviation of irregular consumers.

FIGURE 12
www.frontiersin.org

FIGURE 12. Electricity deviation of ordinary consumers.

FIGURE 13
www.frontiersin.org

FIGURE 13. Electricity deviation of standardizing consumers.

The cost of each household is obtained after the simulation shown in Figure 14. The negative bar represents the revenue that prosumers receive from selling surplus energy. Compared with trading directly with the grid, some prosumers participating in P2P transactions have increased their profits and the rest have also succeeded in further reducing energy costs. Likewise, consumer energy bills have been reduced to some extent.

FIGURE 14
www.frontiersin.org

FIGURE 14. Daily energy consumption of each household.

The transaction results of each settlement period are affected by various factors, including bid price, estimated power generation or consumption, and user performance in previous P2P transactions. The contract calculates and compares the number of deals for each consumer and its deal probability is shown in Figure 15.

FIGURE 15
www.frontiersin.org

FIGURE 15. Consumer transaction probability.

While suppliers tend to seek high returns, buyers tend to go after low costs. However, users not only look at the price but also give more consideration to the credit of the trading partner under the incentive mechanism of reward and punishment. It turns out that the prosumer is more likely to prioritize the Consumer 6 and Consumer 7 transactions with good performance. It seems strange that Consumer 5 with normal performance also has a greater chance of clinching a deal than consumers with similar credits. This is because Consumer 5 usually has higher demand and the contract will recommend prosumers to make a deal with him preferentially. As for the ones with poor performance, Consumer1 and 2 have a much lower trading chance. The incentive system allows users who perform well to be rewarded, encouraging them to maintain a good state, and actively participate in P2P transactions. The penalty mechanism, on the one hand, encourages producers to improve their forecasting models. On the other hand, consumers who do not use electricity properly are urged to regulate their usage behaviours. However, the punishment is very humanized so as not to bring users too much loss, avoiding affecting their enthusiasm to participate in P2P transactions.

The case study shows that all households participating in P2P energy trading have reduced energy costs without reducing demand. In addition, P2P energy trading can balance local demand and reduce the transmission amount of electricity between CVPP and the grid, thereby reducing the risk of power system. The P2P transaction model is worthy of further promotion and becomes the soil for the growth of distributed energy.

6 Conclusion

This study proposes a smart contract model for P2P energy trading by taking advantage of the decentralized nature of the underlying technology of blockchain. On the one hand, user data is more secure, which solves the problem of trust between the two parties of the transaction. On the other hand, heavy maintenance costs such as unified management and data storage are avoided. At the same time, the transaction network based on blockchain technology can also ensure the traceability and real-time performance of transactions. In addition, this paper introduces a reward and punishment mechanism into the energy sharing mechanism to motivate participants to upgrade the prediction models and regulate electricity consumption behaviors. The simulation results show that the trading platform can reasonably and reliably complete resource allocation according to the trading mechanism and achieve a partial balance between distributed generation and regional demand. This paper conducts a preliminary study on the application of smart contract in the field of P2P energy trading. The research results provide theoretical basis and practical knowledge for the research and growth of future blockchain networks.

Smart contract is still a developing technology. Once the contract is deployed on the blockchain, it cannot be modified. If there is a breach, the consequences would be catastrophic. To avoid unnecessary losses, smart contracts need to be fully verified and tested. The prosumer data used in this case study is all photovoltaic power generation and there is almost no excess energy flow in the nighttime P2P market. Introducing other types of renewable power generation methods to extend the transaction time of P2P, the validity and practicality of the contract needs to be further explored. This paper does not consider the impact of power flow constraints and countermeasures on P2P energy trading. Future work can continue to study smart contracts combined with power grid models, expand security control and market assessment, and establish diversified P2P trading mechanism evaluation indicators. At the same time, the strategic behavior of participants deserves to be studied and modeled in detail to design a P2P energy trading mechanism that is more stable and friendly to the power system, and further develop an integrated, advanced and reliable P2P energy trading platform.

Data availability statement

Publicly available datasets were analyzed in this study. This data can be found here: R. Potter, N. SSEPD, C. Edwards, N. SSEPD, T. Leonard, and G. DNV, New Thames Valley Vision, 2015.

Author contributions

The contributions of all authors are listed in strict order. MG made the main contribution with the original design of the working concept. KZ is in charge of and drafted the thesis. JX approved the final version of the paper for publication. SW, XW, and LL were responsible for data collection. LW made important revisions to the paper.

Funding

This work was supported by the program of Research on multi-objective control strategy and business model of virtual power plant for new power system regulation needs of Economic and Technical Research Institute Shanghai Municipal Electric Power Company.

Conflict of interest

MG, SW, XW, and LL were employed by Shanghai Municipal Electric Power Company.

The remaining authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

Publisher’s note

All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.

Supplementary material

The Supplementary Material for this article can be found online at: https://www.frontiersin.org/articles/10.3389/fenrg.2022.1007694/full#supplementary-material

References

Al-Ammari, M. A., and Al-Thani, Mohamed M. (2019). Dena (committee member); Oligeri, Gabriele (committee member) smart contract for P2P energy trading in smart grids: Ethereum Implementation and performance evaluation. PQDT - Global, HAMAD BIN KHALIFA UNIVERSITY ProQuest Dissertations Publishing.

Google Scholar

Amin, W., Huang, Q., Afzal, M., Khan, A. A., Zhang, Z., Umer, K., et al. (2020). Consumers’ preference based optimal price determination model for P2P energy trading. Electr. Power Syst. Res. 187, 106488. doi:10.1016/j.epsr.2020.106488

CrossRef Full Text | Google Scholar

Angraal, S., Krumholz, H. M., and Schulz, W. L. (2017). Blockchain technology: applications in health care. Circ. Cardiovasc. Qual. Outcomes 10, e003800. doi:10.1161/circoutcomes.117.003800

PubMed Abstract | CrossRef Full Text | Google Scholar

Atia, R. (2016). Integration of renewable energy sources in microgrids: Sizing and intelligent management. National Changgang University of Technology and Science.

Google Scholar

Buterin, V. (2014). A next-generation smart contract and decentralized application platform. white Pap. 3, 37.

Google Scholar

Chakraborty, N., Naskar, A., Ghosh, A., Chandra, S., Banerji, A., and Biswas, S. K. Multi-party energy management of microgrid with Heat and electricity coupled demand Response. In 2018 IEEE International Conference on Power Electronics, Drives and Energy Systems (PEDES). December 2018. Chennai, India. IEEE, 1–6.

Google Scholar

Clean Technica, (2015). Germany's sonnenbatterie launches energy trading platform. Available at: https://cleantechnica.com/2015/12/06/germanys-sonnenbatterie-launches-energy-trading-platform/(Accessed December 6, 2015).

Google Scholar

Elexon, (2020). System sell price, system buy price and net Imbalance volume data.

Google Scholar

Exergy, (2017). Electric power technical whitepaper. Available at: http://www.truevaluemetrics.org/DBpdfs/Initiatives/Exergy/Exergy-2018-Technical-Whitepaper-v8.pdf (Accessed December 14, 2017).

Google Scholar

Feng, C., Liang, B., Li, Z., Liu, W., and Wen, F. (2022). Peer-to-Peer Energy Trading under network constraints based on generalized fast dual ascent. IEEE Trans. Smart Grid (Early Access), 1. doi:10.1109/TSG.2022.3162876 (Accessed March 29, 2022)

CrossRef Full Text | Google Scholar

Gan, W., Yan, M., Yao, W., Guo, J., Fang, J., Ai, X., et al. (2022). Multi-network coordinated hydrogen supply infrastructure planning for the integration of hydrogen vehicles and renewable energy. IEEE Trans. Ind. Appl. 58 (2), 2875–2886. doi:10.1109/tia.2021.3109558

CrossRef Full Text | Google Scholar

Gong, K., Wang, X., Jiang, C., Shahidehpour, M., Liu, X., and Zhu, Z. Security-constrained optimal sizing and siting of BESS in hybrid AC/DC microgrid considering post-contingency corrective rescheduling. IEEE Trans. Sustain. Energy 12 (4), 2110–2122.

Google Scholar

Green Energy UK (2020). Green energy UK. [Online]. Available at: https://www.greenenergyuk.com (accessed July 19, 2020).

Google Scholar

Hahn, A., Singh, R., Liu, C.-C., and Chen, S. Smart contract-based campus demonstration of decentralized transactive energy auctions. In 2017 IEEE Power & energy society innovative smart grid technologies conference (ISGT). April 2017. Washington, DC, USA. IEEE, 1–5.

Google Scholar

Hevner, A. R., March, S. T., Park, J., and Ram, S. Design science in information systems research. MIS Q. 28, 75–105.

Google Scholar

IRENA (2020). Peer-to-peer electricity trading: Innovation landscape brief. Available at: https://www.irena.org/-/media/Files/IRENA/Agency/Publication/2020/Jul/IRENA_Peer-to-peer_trading_2020.pdf?la=en&hash=D3E25A5BBA6FAC15B9C193F64CA3C8CBFE3F6F41 (Accessed November 15, 2021).

Google Scholar

Kristov, L., De Martini, P., and Taft, J. D. (2016). A tale of two visions, Designing a decentralized transactive electric system. IEEE Power Energy Mag. 14 (3), 63–69. doi:10.1109/mpe.2016.2524964

CrossRef Full Text | Google Scholar

Magazzeni, D., McBurney, P., and Nash, W. (2017). Validation and verification of smart contracts: A research agenda. Computer 50 (9), 50–57. doi:10.1109/mc.2017.3571045

CrossRef Full Text | Google Scholar

Masiello, R., and Aguero, J. R. (2016). Sharing the ride of power: Understanding transactive energy in the ecosystem of energy economics. IEEE Power Energy Mag. 14 (3), 70–78. doi:10.1109/mpe.2016.2524965

CrossRef Full Text | Google Scholar

Mengelkamp, E., Garttner, J., Rock, K., Kessler, S., Orsini, L., and Weinhardt, C. Designing microgrid energy markets: A case study: The Brooklyn microgrid. Appl. Energy 15 (210), 870–880.

Google Scholar

Mihaylov, M., Jurado, S., Avellana, N., Van Moffaert, K., de Abril, I. M., and Nowé, A. (2014). NRGcoin: Virtual currency for trading of renewable energy in smart grids. in 11th International conference on the European energy market (EEM14) IEEE, 1–6.

CrossRef Full Text | Google Scholar

Molle, G. (2016). How blockchain helps Brooklyn dwellers use neighbors’ solar energy: National Public Radio (NPR). [Online]. Available at: http://www.npr.org/sections/Alltech/considered/2016/07/04/482958497/how-blockchain-helps-Brooklyn-dwellers-use-neighbors-solar-energy.

Google Scholar

National Grid (2015). Short-term operating Reserve Events of default and consequences. [Online]. Available at https://www.nationalgrid.com/sites/default/files/documents/BM%20STOR%20Events%20of%20Default%20-%202015_0.pdf.

Google Scholar

Octopus Energy (2020). Octopus energy. [Online]. Available at: https://octopus.energy (accessed July 19, 2020).

Google Scholar

Open Utility (2021). A glimpse into the future of Britain's energyeconomy. Available at: https://piclo.energy/publications/piclo-trial-report.pdf (Accessed November 15, 2021).

Google Scholar

Orsini, L., Kessler, S., Wei, J., and Field, H. (2019). How the Brooklyn microgrid and Trans Active Grid are paving the way to next-gen energy markets. Energy Internet, Woodhead 223–239. doi:10.1016/B978-0-08-102207-8.00010-2

CrossRef Full Text | Google Scholar

Potter, R., SSEPD, N., Edwards, C., SSEPD, N., Leonard, T., and DNV, G. (2015). New Thames Valley Vision.

Google Scholar

Shan, J., Hu, J., and Wu, J. Peer-to-peer market trading mechanism and model for virtual power plant energy management. Power Syst. Technol. 44 (9), 3401–3408.

Google Scholar

Shen, Y., Ross, K. W., Panwar, S. S., and Wang, Y.Substream trading: Towards an open P2P live streaming system. In 2008 IEEE international conference on network protocols. 2008 October. Orlando, FL, USA. IEEE, 94–103.

Google Scholar

Sönnichsen, N. (2021). Electricity prices for households in the United Kingdom (UK) 2010-2019, semi-annually. [Online]. Available at: https://www.statista.com/statistics/418126/electricity-prices-for-households-in-the-uk/.

Google Scholar

The National Development and Reform Commission and the National Energy Administration of China (2022). Guidelines on accelerating the construction of a unified national electricity market system. Available at: https://www.ndrc.gov.cn/xxgk/zcfb/tz/202201/t20220128_1313653.html?code=&state=123 (Accessed January 18, 2022).

Google Scholar

Torriti, J. (2017). Understanding the timing of energy demand through time use data: Time of the day dependence of social practices. Energy Res. Soc. Sci. 25, 37–47. doi:10.1016/j.erss.2016.12.004

CrossRef Full Text | Google Scholar

Turkanović, M., Hölbl, M., Košič, K., Heričko, M., and Kamišalić, A. (2018). EduCTX: A blockchain-based higher education credit platform. IEEE access 6, 5112–5127. doi:10.1109/access.2018.2789929

CrossRef Full Text | Google Scholar

Vranken, H. (2017). Sustainability of bitcoin and blockchains. Curr. Opin. Environ. Sustain. 28, 1–9. doi:10.1016/j.cosust.2017.04.011

CrossRef Full Text | Google Scholar

Wang, T., Yang, B., and Chen, C. Double-layer Game based Wireless charging Scheduling for electric vehicles. In 2020 IEEE 91st Vehicular Technology Conference (VTC2020-Spring). May 2020. Antwerp, Belgium. IEEE.

Google Scholar

Wang, X., Li, Z., Shahidehpour, M., and Jiang, C. Robust line hardening strategies for improving the resilience of distribution systems with variable renewable resources. IEEE Trans. Sustain. Energy 10 (1), 386–395.

Google Scholar

Wang, X., Shahidehpour, M., Jiang, C., and Li, Z. (2019). Coordinated planning strategy for electric vehicle charging stations and coupled traffic-electric networks. IEEE Trans. Power Syst. 34 (1), 268–279. doi:10.1109/tpwrs.2018.2867176

CrossRef Full Text | Google Scholar

Wang, X., Shahidehpour, M., Jiang, C., and Li, Z. (2019). Resilience enhancement strategies for power distribution network coupled with urban transportation system. IEEE Trans. Smart Grid 10 (4), 4068–4079. doi:10.1109/tsg.2018.2848970

CrossRef Full Text | Google Scholar

Wu, Z., Ma, G., Yang, S., Wu, Y., and Kong, Y. Virtual powerplant operation optimization strategy based on analysis target cascading of distributed transaction model. Power Demand Side Manag. 24 (1), 7–13.

Google Scholar

Xiaoling, Jin, Cuifen, Bai, Zhebo, Zhang, Shenyi, Zhao, Haoran, Wang, Zheng, Yan, et al. Blockchain-enabled transactive method in distributed systems considering security constraints. In 2019 IEEE Congress on Evolutionary Computation (CEC). Wellington, New Zealand. June 2019. IEEE, 1203–1207.

Google Scholar

Xu, Annie (2016). German power company integrates Ethereum blockchain technology with car charging service. Available at: https://www.sohu.eom/a/62418810_286863 (Accessed March 8, 2016).

Google Scholar

Zhang, C., Wu, J., Long, C., and Cheng, M. (2017). Review of existing peer-to-peer energy trading projects. Energy Procedia 105, 2563–2568. doi:10.1016/j.egypro.2017.03.737

CrossRef Full Text | Google Scholar

Zhang, Y., and Wen, J. (2017). The IoT electric business model: Using blockchain technology for the internet of things. Peer. Peer. Netw. Appl. 10 (4), 983–994. doi:10.1007/s12083-016-0456-1

CrossRef Full Text | Google Scholar

Zhou, Y., Wu, J., and Long, C. (2018). Evaluation of peer-to-peer energy sharing mechanisms based on a multiagent simulation framework. Appl. energy 222, 993–1022. doi:10.1016/j.apenergy.2018.02.089

CrossRef Full Text | Google Scholar

Zhou, Y., Wu, J., and Long, C. (2018). Evaluation of peer-to-peer energy sharing mechanisms based on a multiagent simulation framework. Appl. energy 222, 993–1022. doi:10.1016/j.apenergy.2018.02.089

CrossRef Full Text | Google Scholar

Keywords: virtual power plant, electricity market, blockchain, smart contract, trading platform

Citation: Guo M, Zhang K, Wang S, Xia J, Wang X, Lan L and Wang L (2023) Peer-to-peer energy trading and smart contracting platform of community-based virtual power plant. Front. Energy Res. 10:1007694. doi: 10.3389/fenrg.2022.1007694

Received: 30 July 2022; Accepted: 20 September 2022;
Published: 05 January 2023.

Edited by:

Zhiyi Li, Zhejiang University, China

Reviewed by:

Yang Li, Hohai University, China
Changsen Feng, Zhejiang University of Technology, China
Yifei Wang, Southeast University, China

Copyright © 2023 Guo, Zhang, Wang, Xia, Wang, Lan and Wang. This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.

*Correspondence: Lingling Wang, wanglingling1993@sjtu.edu.cn

Disclaimer: All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article or claim that may be made by its manufacturer is not guaranteed or endorsed by the publisher.