Next Article in Journal
Phase-Homogeneous LiFePO4 Powders with Crystallites Protected by Ferric-Graphite-Graphene Composite
Next Article in Special Issue
Optimal Incorporation of Intermittent Renewable Energy Storage Units and Green Hydrogen Production in the Electrical Sector
Previous Article in Journal
Estimating the Error of Fault Location on Overhead Power Lines by Emergency State Parameters Using an Analytical Technique
Previous Article in Special Issue
Impact of Electric Vehicle on Residential Power Distribution Considering Energy Management Strategy and Stochastic Monte Carlo Algorithm
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Developing an Appropriate Energy Trading Algorithm and Techno-Economic Analysis between Peer-to-Peer within a Partly Independent Microgrid

Department of Electrical and Computer Engineering, Faculty of Engineering and Applied Science, Memorial University of Newfoundland (MUN), St. John’s, NL A1C 5S7, Canada
*
Authors to whom correspondence should be addressed.
Energies 2023, 16(3), 1549; https://doi.org/10.3390/en16031549
Submission received: 7 December 2022 / Revised: 19 January 2023 / Accepted: 30 January 2023 / Published: 3 February 2023
(This article belongs to the Special Issue Energy for Sustainable Development and Circular Economy)

Abstract

:
The intimidating surge in the procurement of Distributed Energy Resources (DER) has increased the number of prosumers, creating a new possibility of local energy trading across the community. This project aims to formulate the peer-to-peer energy (P2P) sharing model to encourage the DERs to share surplus energy among the consumers. An effective pricing method is developed based on the supply-demand ratio (SDR) with the importance of self-optimization, which allows the prosumers to maximize their energy sharing and profits. To implement this pricing method, a simplified dynamic matchmaking algorithm has been deployed to introduce the Outstanding Prosumer to interact with existing consumers to increase the efficiency and profitability of the trade network. Consumers also benefit from this model, as they can pick the most economical energy supplier instead of relying on the utility grid. The prosumer with high excess energy and the consumer with the highest energy demand will be prioritized to maintain the SDR ratio to one or greater than one. Here, all the above-stated features of the peer-to-peer energy trading have been demonstrated with some calculations to back up some tangible results. Finally, a case study is simulated among the residents of Dhaka, Bangladesh, to demonstrate how peers can profit from participating in trading at a given time. Comparing the results with and without P2P trading, there has been a 17.54% reduction in an electric bill on a typical day of July, and a 49.53% reduction in the interaction with the grid.

1. Introduction

This paper aims to develop a peer-to-peer (P2P) energy trading system for the prosumers (those who consume and produce energy) to trade locally and gain ownership of locally generated renewable energy. With a third-party regulator, one can securely make a transaction with another peer connected to the microgrid to facilitate energy mobility without needing a central authority. This will subsequently facilitate eliminating the upfront cost of running the centralized energy trading administration and lowering the transaction cost. This paper proposes an effective pricing method based on SDR that concentrates more on maximizing the energy sharing and profit of the prosumers by optimizing the load as per the energy generation and demand response pattern. Outstanding prosumers are introduced in this paper and a simplified matchmaking algorithm has been developed to match the most suitable match between prosumers and consumers, significantly reducing the trading time in the network, eventually enhancing the energy trade efficiency. Furthermore, an intelligent algorithm has been developed to declare the energy price according to the hourly updated generation, consumption, excess energy, and SDR, so that the prosumers will be extra motivated to self-optimize their consumption to take part in the trading. Thus, this project is an optimal solution for motivating the residents and other organizational groups to use green energy, facilitating decarbonization and a sustainable energy culture.
According to Alhasnawi et al. [1], P2P energy trading technology has the potential to shift the current centralized energy market to a decentralized system. Globalization is driving the integration of new technologies into major infrastructure worldwide. Despite the benefits of green energy resources, many households are hesitant to invest in them due to high upfront costs and long breakeven periods. The P2P energy trading platform aims to attract more participation in energy trading by allowing individuals to treat their private energy as a commodity in the market. The use of blockchain technology, as noted by Alhasnawi et al. [1], further enhances the security and privacy of the trading process. AlSkaif et al. [2] conducted a study in which they proposed two strategies to determine the trading preferences of households participating in P2P energy trading. One strategy focused on balancing excess power generation and consumption between prosumers and consumers, while the other strategy was based on the proximity between peers. The simulation results from data gathered in a residential area in The Netherlands showed that P2P energy trading leads to less interaction with the traditional utility grid and higher energy trading, particularly when trading is done based on proximity.
The installation of distributed generation (DG) systems has several benefits, including reducing dependency on the utility grid, lowering electricity costs, and promoting the use of prosumers’ electricity by the utility grid, as reported by [3,4,5,6,7,8]. However, autonomous energy trading, as stated in [9], relies on policies and protocols for energy matching and sharing, but lacks a pricing mechanism, making it difficult to facilitate energy sharing and demand response. Researchers have proposed various solutions to address the pricing problem between retailers and consumers of electricity. For example, Carrion et al. proposed a bi-level stochastic programming approach to determine pricing available to consumers [10]. A Stackelberg game model was also demonstrated by [11], which optimizes day-ahead hourly prices through the interaction of prosumers and consumers. A survey by Abdella et al. reviewed existing demand response optimization models, power routing devices, and algorithms for P2P energy trading and identified challenges in this area [12]. Energy traders also implement different pricing strategies such as Real-Time Pricing (RTP) and Time-of-Use Pricing (TOU) to encourage consumers to participate in demand-side management programs, lower peak demand, and balance power consumption in residential areas [13]. The RTP-based DSM in home energy management systems (HEMS) has been shown to be effective in reducing costs and increasing energy efficiency [14]. The authors in [15] proposed a new two-stage hybrid method for HEMS that schedules power consumption based on the preferences, cost of electricity, and amount of energy produced or stored by the trading participants with Distributed Energy Resources. Lauinger et al. [16] have also proposed an optimization of household energy systems using linear programming.
The use of a Real-Time Pricing (RTP)-based Home Energy Management System (HEMS) can be enhanced through the implementation of twin delayed deep deterministic policy gradient learning techniques, as proposed by [17], to reduce electricity costs. The effectiveness of HEMS increases when it is combined with demand response optimization in P2P energy trading. A new interactive RTP has also been developed by taking into account the consumer’s level of discomfort during the demand response process as proposed by [18]. Liu et al. developed an internal pricing and cost model for prosumers willing to shift their energy load by using a distributed iterative algorithm to solve this problem, and achieved cost savings compared to trading with the grid [19]. P2P energy trading allows for the exchange of excess energy from prosumers to consumers [20], providing consumers with more affordable electricity costs than utility costs [21]. Paudel et al. [22] modeled prosumers as buyers or sellers based on their supply-demand ratio (SDR), where prosumers act as sellers when generation exceeds demand, and buyers when demand exceeds generation. However, energy trading has primarily benefited prosumers, leaving consumers behind, which is a concern [22]. Bidding-based trading is particularly beneficial for wind power producers with regard to maximizing their profits [23]. Peers communicate their power requirements and availability through P2P energy trading. In 2019, Alam et al. developed an energy cost optimization algorithm for energy sharing between smart homes to minimize electricity consumption [24]. Spiliopoulos et al. proposed a framework in [25] for improving the economic and resilient operation of microgrids, examining the impact of P2P energy exchange on system resilience and battery lifetime in different locations and under different fault scenarios.
Many studies have been conducted on developing pricing methods for peers who are willing to self-optimize their energy load. Cost models have been developed based on the Supply-Demand Ratio (SDR) and frameworks for improving the economic and resilient operation of a microgrid for enhancing the effectiveness of the trade. Through a literature review, it was found that efforts have been made at controlling fully Distributed Energy Resources (DERs), and strategies have been proposed for matching and sharing energy between market participants based on distance and demand response, but they lack a pricing mechanism to facilitate energy sharing with demand response. There are some models that optimize energy consumption patterns and formulate internal pricing and cost models supported by distributed iterative algorithms for prosumers willing to do this. In this study, we focused on developing an appropriate algorithm to handle the dynamic interaction between outstanding prosumers and other consumers in the energy trading platform to reduce unwanted traffic in the trading network and promote efficient trading that can be scaled up to larger networks. The implemented pricing mechanism is based on the Supply and Demand Ratio (SDR), which projects higher prices when demand is high and vice versa. The main goal is to optimize electricity costs and motivate more participants to get involved in the trade and make extensive use of Distributed Energy Resources, making the microgrid community independent of the main utility grid. In this paper, we have designed a microgrid with two different prosumers and executed P2P trading to examine the internal pricing trend among buyers and sellers at different times of the day. The internal pricing method is derived from the mathematical modeling of the supply and demand ratio between the peers. We also focused on the significance of self-optimization, which can increase the profit of the peers while they perform the trading. The trading algorithm and pricing technique are implemented based on real-time data in Dhaka, Bangladesh, where the country is facing frequent load-shedding and energy crises due to decreasing fossil fuels. The key contributions of the project are:
  • The P2P trading process is divided into three layers: registration, matchmaking, and pricing. Each layer plays a unique role in facilitating the entire P2P trading process.
  • The excess energy of prosumers will be consumed by consumers. The pricing pattern is determined by the total selling and buying power of the peers.
  • As excess energy will be utilized in trading, the peer self-optimization of electricity is given priority. Higher self-optimization enables prosumers to store more energy, allowing them to trade more electricity and increase profits for both parties.
  • Homer Pro software is used to simulate real-time data. To evaluate the potential of P2P, we analyzed the consumption pattern in July, as it is a month when energy consumption is higher due to the frequent use of air conditioners and ceiling fans. Therefore, this month is considered an ideal month to validate the effectiveness of P2P as the load consumption is relatively higher, resulting in less excess energy.
  • This paper proposes an effective pricing method based on SDR that concentrates more on maximizing the energy sharing and profit of the prosumers by optimizing the load as per the energy generation and demand response pattern. Outstanding prosumers are introduced in this paper and a simplified matchmaking algorithm has been developed to make the most suitable match between prosumers and consumers, significantly reducing the trading time in the network, eventually enhancing the energy trade efficiency.
The rest of the paper is organized as follows: Section 2 describes the principle of the entire project, including the project methodology in Section 2.1, followed by the system architecture in Section 2.2. Section 3 explains the inconvenience factor, while Section 4 illustrates the project’s case study, which shows the benefits of P2P. Section 5 and Section 6 discuss and make conclusions with regard to the fundamental prospects of the paper and outlines future areas of research.

2. Project Description and Methods

2.1. Proposed Project Methodology

The main objective of any P2P energy trading is to utilize the excess generation of different DERs. The proposed trading will also limit the interaction with the grid and reduce electricity bills. The trading price and mechanism will be regulated and developed by live market variables (i.e., generation, consumption, excess energy, and SDR). Thus, the system creates a fair sharing of profits for all prosumers. The proposed system architecture is presented in Figure 1 The implementation of our proposed scheme will be done in the following stages:
  • A microgrid community has been designed in Homer Pro for P2P energy trading between two prosumers and one consumer. Hourly generation, consumption, and excess energy are extracted and examined by simulating the proposed system. The available excess energy from the prosumers is used for trading and is used by the consumers. As a result, the prosumers do not have to dump the surpass energy through a dump load.
  • The prosumer’s total selling power and the consumer’s total buying power is used to calculate SDR. Based on the SDR, prosumer and consumer buying and selling prices are declared.
  • Load flow analysis is performed to verify the effectiveness of P2P trading among buyers and sellers in the peak month of July, when the consumption is generally higher than in other months. The average electricity bills and integration with the centralized network of the consumers are compared before and after the implementation of the P2P trading.
  • The peers are encouraged to self-optimize the electricity consumption to maintain the supply and demand at an equilibrium level, ensuring maximum benefit from the pricing model to both prosumers and consumers.
  • The recording and facilitating of transactions between generators and consumers via a third-party regulator.

2.2. Architectural Model of the P2P Trading

A step-down model is developed to automate the peer-to-peer trading platform. The process workflow has been divided into three layers, which execute a series of inputs, processes, and outputs. The Registration Layer prompts to import all of the necessary information of the market participants by establishing a secure connection with the smart meter and retrieves the real-time values of load consumption, energy generation, geographical location, and national identity number. This is often achieved using smart meters and other advanced technology that can monitor and control the flow of electricity. Smart grids and P2P energy management technology are closely related, as both rely on advanced technology to monitor and manage the flow of electricity. Smart grids use two-way communication to adjust the flow of electricity in real-time, while P2P energy management technology enables individuals and businesses to buy and sell electricity among themselves. Together, these technologies can help to improve the efficiency, reliability, and sustainability of the electricity supply by allowing for more flexible and decentralized management of the grid.
The second layer executes the matchmaking process among the peers. The main goal of this layer is to maximize the surplus energy utilization without creating the need to store the energy, which contributes to lowering the capital cost of distributed energy resources. The other matchmaking utility feature is executing the energy trading process to the nearest in-demand peer. This will allow minimal energy loss in the transmission process and maximize efficiency. The final layer is defined as the price execution layer responsible for maintaining the unit price of energy lower than the utility grid price, encouraging the peers to accommodate their load demand by the distributed energy resources. The frequent use of electrical devices, such as dishwashers and washing machines, will increase overall consumption, resulting in less trade energy. Therefore, the peer self-optimization factor will be integrated into the system to differentiate the profit made by each prosumer.
To monitor and facilitate the exchange of electricity between prosumer and consumer, we introduce a third-party entity. This third party will be equipped with trading algorithms which, according to the requirements of the circumstances, automatically execute, control, or record all legally necessary events and acts. Therefore, the prosumers and consumers will exchange electricity from utility grid via this third-party regulator. Figure 2 displays how the energy sharing between the peers will be executed in the presence of the third party regulator.
The third party agent will calculate the available excess energy of prosumers that can be sold to the consumer and will proceed with payment accordingly. Hence, it will eliminate all the tedious paperwork required for the customers for energy trading as these agents are responsible for the energy sharing between the peers.

2.2.1. Registration Layer

The job of this layer is to allow market participants to register themselves as a prosumer or just a consumer in the P2P system. An agreement contract is executed between the energy trading entity and the participants generating a unique identifier to track the participants in the energy trading network. The algorithm for the registration layer is presented in Figure 3.
A relational database system should be integrated into the registration layer of the P2P platform. It requires special attention and care from security breaches and risks to data privacy. There are several frameworks established which describes the set of protocols that binds the information exchange processes and protocols, including NSIT frameworks, cyber security frameworks, IEC 62351, ISO 2001, etc. Based on this ground level framework, certain technologies have evolved over the years which are assisting with the functioning of private and confidential information networks on the internet facility. Some examples are cryptography, authentication and authorization, firewall and intrusion detection systems, data encryption, network segmentation, and cybersecurity protocols, etc.
A fast and responsive server is required to host the database for all the market participants involved in distributed energy sources. It requires greater computation power, an extensive developer team, and more capital cost. Nonetheless, with the emerging use of DER resources, there is a higher demand for P2P trading facilities in the energy market for a better, efficient, resilient, and robust trading stack.

2.2.2. Cyber Security Scheme

One can invest their time building a security layer over this proposed architecture. A multi-layered security reference suggests that the most significant concern with security threats is the unexpected power outage that may occur during the peak load time affecting all the micro-grid community user. The authors in [multi-layered] have proposed a multi-layer security architecture upon conducting a vulnerability assessment over different nodes in the network. Blockchain is one of the most reliable architectures that currently exists which is designed to overcome attacks such as FDIA. Figure 4 shows the architectural diagram of blockchain technology.
Blockchain technology can enhance security in a network by providing a decentralized and distributed ledger system that ensures the integrity of data and prevents unauthorized access. This is achieved through the use of cryptographic techniques such as hashing and digital signatures [26].
A transaction hash is a unique code generated by a cryptographic function that identifies a specific transaction in the blockchain. It ensures the integrity of the transaction by making it tamper-evident. Any alteration made to the transaction will result in a change of the hash, making it easily detectible. A nonce is a random number that is added to a transaction before it is hashed. It is used to ensure that each transaction has a unique hash, making it difficult for attackers to reuse or predict the hash value of a transaction. A root trace is a summary of all the transactions in a block. It is created by combining the hashes of all the transactions in a block and then hashing the combination. This creates a single hash value that represents the entire block, making it tamper-evident. A time stamp is a value that is added to a transaction that indicates the time it was added to the blockchain. This allows for the chronological ordering of transactions and helps in detecting any fraudulent activity [27].
Together, these elements provide a secure and tamper-evident system that ensures the integrity of the data stored in the blockchain, making it difficult for attackers to compromise the network.

2.2.3. Matchmaking Layer

The second layer matches the trading peers who produce the highest amount of excess energy, thereby putting the peers in the primary position to initiate the trading. For optimization, the following information needs to be validated by each prosumer [28]. The total electricity consumption ( T C i ) and total production ( T P i ) from DERs for every hour interval in a day are bypassed from the registration layer, which allows the extracting of the microgrid of each connected participant in the DER network.
T C i = T C 1 1 , , T C n h
T P i = T P 1 1 , , T P n h
where i is the number of prosumers and h is the number of hours. With the help of the above two equations, the net power value ( N P i ) of the overall system can be determined.
N P i = T C i T P i
As per the above equation, an algorithm is created which will select a peer who produces more excess energy ( N P i ) than other peers. For simplicity, we will consider two prosumers and a consumer to demonstrate the scenario. Once a specific prosumer is selected for trading, a suitable consumer will be sorted out if multiple consumers request a trade. In that case, the ratio of current demand and total available power from the prosumer will be calculated. Based on the resulting ratio, a decision will be taken. The whole scenario can be summarized from the following equations. The total electricity consumption ( T C c i ) from consumer and total net power ( N P i ) from prosumers for every hour interval in a day is as follows.
T C c i = T C 1 1 , , T C n h
N P i = N P 1 1 , , N P n h
where i is the number of prosumers and c i is the number of consumers. h ndicates the number of hours. The consumption-generation (CG) ratio of the consumer is as follows.
C G = T C c i N P i
An algorithm (Algorithm 1) is created which will select a peer based on the CG ratio. Depending upon the usage pattern, different consumers will have different demands. Higher consumption will increase the CG ratio, whereas lower consumption will reduce the CG ratio. As we prioritize the self-optimization of electricity, the consumer with the lowest CG ratio will start the trading first. Hence, by implementing this scheme, more consumers will attach importance to self-optimization, and the prosumer will also have the opportunity to sell electricity to multiple consumers.
Algorithm 1: Algorithm for Matchmaking Layers
1:Start: Initialize Matchmaking Layer
2:Process: Establish Connection with Registration Layer Database
3:Process: Compute Net Power (Np) of each participant
4:Process: If (Np < 0)?
5:TrueInsert Digital Identifier in Supplier Array
6:TrueSort Supplier Array with sort algorithm & Identify Outstanding Prosumer (OP)
7:TrueCompute Total Selling Power (TSP)
8:FalseInsert Digital Identifier in demand array
9:FalseSort demand array with sort algorithm
10:FalseCompute Total Buying Power (TBP)
11:Process: Compute Supply Demand Ratio (SDR)
12:Process: If (SDR >= 1)?
13:TrueProcess: if (OP > C(j))
14:TrueTrueProcess: **Matchmaking Succeed** Trade energy from outstanding prosumer to C(j)
15:TrueTrueProcess: Increment j = j + 1
16:TrueTrueProcess: Establish Connection with pricing layer
17:TrueTrueProcess: Establish loop network with 13
18:TrueFalseProcess: Compute energyDeficit < C(j) − P(i) >
19:TrueFalseProcess: If energyDeficit < P(i+1)
20:TrueFalseTrueProcess: Trade Energy to Outstanding Prosumer
21:TrueFalseTrueProcess: Establish connection with pricing layer
22:TrueFalseTrueProcess Establish loop network with algorithm number 19
23:TrueFalseFalseProcess: Trade energy from P(i+1) to outstanding prosumer (OP)
24:TrueFalseFalseProcess: Compute energyDeficit = energyDeficit − P(i+1)
25:TrueFalseFalseProcess: Increase i = i + 1
26:TrueFalseFalseProcess: Establish loop network with algorithm number 19
27:FalseProcess: if (0 < SDR <1)
28:FalseTrueProcess: energyDeficit = TBP − TSP
29:FalseTrueProcess: Trade deficit energy from utility grid to Outstanding Prosumer (OP).
30:FalseTrueProcess: Establish Connection with pricing layer.
31:FalseTrueProcess: Establish loop network with 13
32:FalseFalseProcess: energyDeficiet = TBP
33:FalseFalseProcess: Trade deficit energy from utility grid to outstanding prosumer (OP)
34:FalseFalseProcess: Establish Connection with pricing layer
35:FalseFalseProcess: Establish loop network with after check
The matchmaking layer is one of the main architectures that operate beneath the P2P energy trading application. In order to automate an efficient matchmaking process, an outstanding prosumer is defined as a player that generates the highest energy in the network. The sort algorithm sorts out all the participants in a descending manner. In that way, an outstanding prosumer is always responsible for feeding the energy to the demand array. At the same time, the other prosumer contributes to energy trading only by interacting with the outstanding prosumer. This will allow fast, smooth, and error-free energy trading in the complex group of participants. The battle of being an outstanding prosumer will also encourage all other prosumers to produce more energy to leverage the market by interacting with more consumers. This workflow also indicates the minimum involvement of the utility grid, improving their load stability, less chance of power outage, and more flexibility in organizing the demand side loads. This can be scaled up to a large-scale optimization problem, as blockchain is the foundational backbone to handle the large test cases which is already a proven technology to sustain thousands of transactions taking place per second. A simple UI dashboard can then be coded using any programming language in order to track the transaction that is being made in the blockchain network. In this way, by using smart contracts and an Ethereum virtual machine one can develop an energy peer-peer trading model. Figure 5 represents the flowchart of matchmaking algorithm between the peers.

2.2.4. Pricing Mechanism

The internal pricing method will define the electricity price during the electricity exchange between a buyer and a seller. A positive value of NP means that the consumption of the prosumers is higher than that of the generation. Hence, the prosumer will not be able to participate in the trade and must buy electricity from the grid. The negative value of NP indicates that there is surpassed energy available; therefore, the peers will be able to sell electricity to other peers. Therefore, the total selling power (TSP) of the prosumers and the total buying power (TBP) of the consumer are:
T S P = i n   N P i , when   N P i < 0
T B P = i n   T S P , when   N P i < 0
The pricing method will be determined by the SDR [18]. The SDR is a term used in economics to illustrate the relation between supply-demand and price. By using this principle, the internal price of P2P will be fixed. As per this principle, the relation between internal price and SDR is inverse-proportional. The ratio of the SDR can be derived from the following function.
S D R = T S P T B P
TBP is the total amount of buying power the consumer purchases from the prosumer. When SDR > 0, the excess electricity will be used for trading. For this paper, we consider that the maximum selling price will be less than the average utility price; thus, the consumer will buy electricity at a lower price than the grid. When 0 ≤ SDR ≤ 1, the amount of available energy is lower than the demand; hence, the internal price of the system will be set as per the inverse proportion function 1/(ax + b). This function will demonstrate the variation of the internal selling price ( P r s e l l ) according to SDR.
P r s e l l = f ( S D R ) = 1 a S D R + b , 0 S D R 1 λ s e l l , S D R > 1
To simplify the above formulation, first, we will consider SDR = 0, which means that there is no surpass energy from the prosumer; hence, they need to purchase electricity ( λ b u y ) from the utility grid. After that, we will consider SDR = 1; the prosumer will be able to sell electricity to other peers, which can be denoted as λ s e l l . Thus, we can obtain the following equation by putting (0, 1) in Equation (10).
1 a × 0 + b = λ b u y 1 a × 1 + b = λ s e l l
By solving the above equation, we can get
λ b u y λ s e l l λ b u y λ s e l l = a 1 λ b u y = b
By putting Equation (12) into Equation (10), we can obtain the following equation.
P r s e l l = f ( S D R ) = λ b u y λ s e l l ( λ b u y λ s e l l ) . S D R + λ s e l l , 0 S D R 1 λ s e l l , S D R > 1
Similarly, based on the internal selling price P r s e l l , we can derive the internal buying price P r b u y which will facilitate generation and consumption balance in the system. When, 0 S D R 1 , the internal buying price ( P r b u y ) of the system can be described as follows.
P r b u y . T B P = T B P . S D R . P r s e l l + ( T B P T B P . S D R ) λ b u y
If S D R > 1 , then the internal buying price λ b u y will be equal to the internal selling price λ s e l l . Therefore, finally the internal buying price of the system can be formulated as:
P r b u y = S D R . P r s e l l + ( 1 S D R ) λ b u y , 0 S D R 1 λ s e l l , S D R > 1
Figure 6 illustrates the pricing mechanism at different SDR ratio. Based on the mentioned internal pricing scheme, the per kWh buying and selling price for the peers are formulated as follows:
P r s e l l = λ b u y λ s e l l ( λ b u y λ s e l l ) . S D R + λ s e l l . T S P , 0 S D R 1 λ s e l l . ( T S P T B P ) , S D R > 1
P r b u y = S D R . P r s e l l + ( 1 S D R ) λ b u y . T S P + ( T B P T S P ) . λ b u y , 0 S D R 1 λ s e l l . T B P , S D R > 1
The SDR will be calculated at every hour. If there is a surplus amount of electricity that the consumer does not consume in a specific hour interval, that excess amount cannot be used later. Therefore, a constraint needs to be set while calculating the SDR.
S D R h = T S P h T B P h     when   T S P = i n N P i
where h indicates every hour interval for the consumers, which is 0 ≤ h 24 .

3. Inconvenience Factor

When the value of SDR is 0, there is no excess energy available; hence, prosumers and consumers must rely on the central entity to cover up the load demand. To increase the ratio of SDR to greater than zero, the peers need to minimize the self-consumption that will make the value of TSP higher than the TBP. Due to this price incentive, the peers may adjust the load profile by changing the usage pattern of some shiftable devices, such as dishwashers and washing machines [18]. Therefore, if the total adjustable load is x i for peer i at a time interval of h, Equation (3) can be rewritten as:
N P i = x i h T P i
x i h = [ x i 1 , x i 2 , x i H ]
We will consider the inconvenience factor α to illustrate the difference in internal cost function when P2P trading occurs. As different peers will have different preferences, the inconvenience factor will vary depending upon their usage pattern of electrical appliances. Lower α means that the peers are unwilling to adjust their load, and the higher α indicates that the peers are more concerned about reducing their self-consumption. Hence, the incentive cost of the prosumer is:
i n c i = α i ( x i h T C i h ) 2
By integrating the inconvenience factor α, the optimized cost function c i h of a prosumer becomes as follows.
c i h x i h = P r i h x i h T P i + α i ( x i h T C i h ) 2
Here P r i h is the price of power, which can be either the selling price or the buying price, depending on the value of NPi. If the value of NPi is negative, then the P r i h will be equivalent to P r s e l l , which will minimize the c i h x i h , hence maximizing the profit of the peer. If the NPi is positive, then the P r i h will be equal to P r b u y , which indicates that the peer needs to adjust the inconvenience factor α to reduce the cost of c i h x i h .
P r i h = P r s e l l , N P i < 0 P r b u y , N P i > 0
The following constraint needs to be considered while adjusting the load x i .
M i n   ( T C i ) x i h M a x   ( T C i )
It is important to remember that, for peers, when adjusting the inconvenience factor α the total adjustable does not go below the base load or does not go above the rated load capacity of the residence.

4. Results

This section represents a real-time data analysis of P2P trading in Homer Pro based on the above mathematical equations. To illustrate this scenario, we have designed a microgrid with two prosumers in the Homer Pro software as per Figure 7. The average monthly load consumption of the peers has been calculated from the monthly electricity bills from different residential households in Dhaka, Bangladesh and integrated into the software.
Three different scenarios have been tested in this model. In the first scenario, the prosumer is connected to a wind turbine. In scenario 2, the prosumer gets power from the PV source. Lastly, in scenario 3, the amount of excess energy is compared between two prosumers to decide who will participate in the trading with the consumer. The overall generation and consumption pattern of the prosumers is presented in Figure 8. The inconvenience factor α is changed among prosumers to differentiate the income variation. A lower value of α indicates that the peers are concerned about self-consumption, whereas a higher α means that the peers consume a high amount of electricity. As the Bangladesh government does not have a feed-in-tariff, we have considered the λ s e l l as equivalent to 4 Taka/kWh. λ b u y is calculated as per the current per unit price set by the power generation authority of Bangladesh. The inconvenience factor α is set as 0.01. Table 1 shows the Bangladesh government’s electricity rate at different kWh in residential households [29].
As per our collected utility bills, most of the residential households in Dhaka, Bangladesh consumed 250–350 units of electricity in July. Based on this consumption, the rate of λ b u y is considered to be 6.34 Taka/kWh for this paper. A significant consumption difference will create a major difference between selling and buying power; therefore, we have chosen three peers who consume almost the same amount of electricity to keep the SDR optimal. Table 2 displays the hourly generation and consumption of the prosumers and consumers on a typical day of July extracted from Homer. SDR is written as N/A when P2P trading does not occur between prosumers and consumers.
Based on the above load profile, it is evident that, the peers will be able to participate in the P2P trading at certain hours of the day. The negative net output indicate the trading participation by the peers in those hours. P r b u y and P r s e l l are calculated as per the ratio of SDR. Figure 9 and Figure 10 show the hourly variation of internal pricing during P2P trading.
The first figure displays the reduction of the internal buying price of the consumer between 10:00 and 18:00 h and 22:00 and 24:00 h. The second figure displays the internal selling price of the prosumers, which reveals that they will be able to earn money by selling their excess energy to the consumers when P2P trading takes place. Therefore, in these periods, both parties will benefit.
Figure 11 and Figure 12 display the difference in utility bills of the consumer and the subsequent reduction with the utility grid before and after the implementation of P2P. Based on the load consumption, internal buying price, and Equation (17), the optimized energy bill of the consumer is calculated.
Table 3 indicates that the consumer deducts 17.54% of the electric bill on a typical day in July. The interaction with the grid has been also reduced by 49.53%.
The optimization leads to a change in net power for both prosumers, as they can sell excess energy to the consumers. Figure 13 shows the difference in net power curves for PV and wind turbine prosumers.

Variation of the Inconvenience Factor α

The inconvenience factor α is used to indicate the self-optimization of the peers. A lower level of α means that the peers are more willing to self-optimize their consumption; hence, they will profit more from the system. By increasing the value of α, the change in income of the prosumer can be seen in Table 4. Therefore, the prosumers need to pay more attention to keep the value of α at the minimum level. This inconvenience factor will encourage the peers to focus more on the energy management of different appliances.

5. Discussion

The case study reveals the potential of P2P trading in residential households in Dhaka, Bangladesh. Generally, the consumers have to pay high electricity bills in the peak months due to the higher consumption. However, as per the real-time data analysis in Homer Pro software based on the consumption pattern on a typical day in July, Table 3 shows that the consumer still has 50% less interaction with the grid after the implementation of P2P trading. Therefore, the success of P2P during a peak month will bring economic benefits, especially among middle-class people. On the other hand, the prosumer can also earn money when they participate in the process by selling surplus energy to the consumer. In addition, an Ethereum virtual machine shall be used in designing our algorithm, as this is an already proven technology. Its currently operating to decentralize the network of Ethereum blockchain networks around the. Similar virtual machines will provide sufficient accuracy to the idea of peer-to-peer energy management. With a couple of lines of code, we can easily design complex neural connections between peers while the energy is being transacted. As a result, the proposed trading mechanism could significantly alleviate this country’s recent energy crisis without any issues or uncertainties.
The architectural model of the P2P model has been divided into three categories: (i) a registration layer; (ii) a matchmaking layer; and (iii) a pricing layer. The registration layer will allow the peers to register themselves as prosumers or consumers before initiating P2P trading. The matchmaking algorithm matches the P2P participants as per their generation and consumption. The algorithm is set up in such a way so that the trading model equally benefits every prosumer. As the excess energy of the prosumer will be used for trading, the prosumers generating more excess energy will start the trading first according to the matchmaking algorithm. On the other hand, the consumer consuming the least energy will participate in the trading first with that prosumer. Hence, the SDR ratio can be maintained at one or greater than one, providing the most optimum pricing for prosumers and consumers. As a result, the peers will be more concerned with self-optimizing their usage pattern, which will further increase the model’s effectiveness and generate more profit.
The pricing layer will calculate the internal buying and selling price according to the matchmaking algorithm. Different SDRs will provide different internal prices as the pricing will be based on the SDR ratio. Figure 6 reveals the internal buying and selling trends at different SDRs.
Lastly, we have varied the inconvenience factor α to reveal the prosumers’ income difference. Table 4 shows that by increasing the value of α, the income has been reduced for both PV and wind prosumers. When the value of α is 0.03, both prosumers’ income has decreased by about 1.5 taka from the original. This will encourage the prosumers to consume less electricity and keep the SDR ratio ideal. The overall process will be monitored and controlled by a third-party regulator. This agent will validate the energy transactions and billing process. Hence, the peers will not have to engage directly with the utility grid while they sell or buy electricity from them.

6. Conclusions

This paper represents an energy trading model between prosumers and consumers. As most prosumers produce surplus energy from renewable sources, the P2P trading model proposes a path to utilize this excess energy. By selling the extra power to other peers, the prosumer does not have to dispatch it through a dump load. The whole process will be regulated in three sets of layers. Each layer is designed by a distinctive set of algorithms that will select the most appropriate buyers and sellers according to the generation and consumption pattern of the peers. Thus, the peers generate maximum amounts of profit from the platform. In contrast to the recent developments going on in this sector, this paper introduces Outstanding Prosumers and proposes a simplified matchmaking algorithm to interact with other existing consumers to significantly reduce the unnecessary loss of time in the trading network, which enhances the efficiency of trading for larger-scale network trades.
The internal pricing model is developed based on the SDR. According to this principle, the relationship between price and SDR is inversely proportional, which means that a higher SDR will lower the price, whereas a lower SDR will increase the price. Figure 8 and Figure 9 depict that when SDR becomes less than one, the consumer starts buying the electricity at a higher rate than the original price. Therefore, peer self-optimization is prioritized among the peers to keep the SDR at the optimum level (i.e., 1). To prove the effectiveness of this scheme, a microgrid has been designed in Homer Pro with two prosumers and one consumer. The simulation results show that P2P trading opens an income source to the prosumer and reduces electricity bills and interaction with the utility grid to the consumers. During peak times when the demand for electricity is high, the P2P scheme reduces the electricity cost. This cost has been seen to be reduced by 17.54% on a typical day of July, which is a month of peak demand. There is a reduction in interaction with the grid by 49.53%. Here, the SDR plays an important role, so it should be kept at a low value to maximize the profit from the system. The success of P2P in a peak month such as July when consumption is comparatively higher proves that this sharing platform can make a massive difference in the renewable energy industry. Thus, it is vital to examine the site location and weather patterns in order to set up any renewable sources so that the peers can participate in this process, even during peak times.
This is just the beginning of the P2P energy trading system design; in the future we will execute this algorithm using blockchain technology. A full-stack application shall be developed where all of these algorithms shall be deployed using Smart-Contract Technology.

Author Contributions

Conceptualization, F.M.; Methodology, F.M. and M.J.A.B.; Software, F.M. and A.C.; Validation, A.C.; Formal analysis, A.C. and K.M.; Investigation, K.M.; Writing—original draft, K.M.; Writing—review & editing, M.J.A.B., M.J. and A.A.K.; Supervision, M.J.; Project administration, M.J.; Funding acquisition, A.A.K. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Alhasnawi, B.N.; Jasim, B.H.; Rahman, Z.A.S.A.; Guerrero, J.M.; Esteban, M.D. A novel internet of energy based optimal multi-agent control scheme for microgrid including renewable energy resources. Int. J. Environ. Res. Public Health 2021, 18, 8146. [Google Scholar] [CrossRef] [PubMed]
  2. Alskaif, T.; Crespo-Vazquez, J.L.; Sekuloski, M.; Van Leeuwen, G.; Catalao, J.P.S. Blockchain-Based Fully Peer-to-Peer Energy Trading Strategies for Residential Energy Systems. IEEE Trans. Ind. Inform. 2022, 18, 231–241. [Google Scholar] [CrossRef]
  3. Camilo, H.F.; Udaeta, M.E.M.; Veiga Gimenes, A.L.; Grimoni, J.A.B. Assessment of photovoltaic distributed generation–Issues of grid connected systems through the consumer side applied to a case study of Brazil. Renew. Sustain. Energy Rev. 2017, 71, 712–719. [Google Scholar] [CrossRef]
  4. Baig, M.J.A.; Iqbal, M.T.; Jamil, M.; Khan, J. Blockchain-Based Peer-to-Peer Energy Trading System Using Open-Source Angular Framework and Hypertext Transfer Protocol. Electronics 2023, 12, 287. [Google Scholar] [CrossRef]
  5. Baig, M.J.A.; Iqbal, M.T.; Jamil, M.; Khan, J. A Low-Cost, Open-Source Peer-to-Peer Energy Trading System for a Remote Community Using the Internet-of-Things, Blockchain, and Hypertext Transfer Protocol. Energies 2022, 15, 4862. [Google Scholar] [CrossRef]
  6. Baig, M.J.A.; Iqbal, M.T.; Jamil, M.; Khan, J. Design and Implementation of an Open-Source IoT and Blockchain-Based Peer-to-Peer Energy Trading Platform Using ESP32-S2, Node-Red and, MQTT Protocol. Energy Rep. 2021, 7, 5733–5746. [Google Scholar] [CrossRef]
  7. Elsaraf, H.; Jamil, M.; Pandey, B. Techno-Economic Design of a Combined Heat and Power Microgrid for a Remote Community in Newfoundland Canada. IEEE Access 2021, 9, 91548–91563. [Google Scholar] [CrossRef]
  8. Rasheed, M.B.; Javaid, N.; Ahmad, A.; Jamil, M.; Khan, Z.A.; Qasim, U.; Alrajeh, N. Energy Optimization in Smart Homes Using Customer Preference and Dynamic Pricing. Energies 2016, 9, 593. [Google Scholar] [CrossRef]
  9. Luo, Y.; Itaya, S.; Nakamura, S.; Davis, P. Autonomous cooperative energy trading between prosumers for microgrid systems. In Proceedings of the 39th Annual IEEE Conference on Local Computer Networks Workshops, Edmonton, AB, Canada, 8–11 September 2014; pp. 693–696. [Google Scholar] [CrossRef]
  10. Carrión, M.; Arroyo, J.M.; Conejo, A.J. A bilevel stochastic programming approach for retailer futures market trading. IEEE Trans. Power Syst. 2009, 24, 1446–1456. [Google Scholar] [CrossRef]
  11. Jia, L.; Tong, L. Dynamic Pricing and Distributed Energy Management for Demand Response. IEEE Trans. Smart Grid 2016, 7, 1128–1136. [Google Scholar] [CrossRef]
  12. Abdella, J.; Shuaib, K. Peer to peer distributed energy trading in smart grids: A survey. Energies 2018, 11, 1560. [Google Scholar] [CrossRef]
  13. Du, P.; Lu, N. Appliance commitment for household load scheduling. IEEE Trans. Smart Grid 2011, 2, 411–419. [Google Scholar] [CrossRef]
  14. Özkan, H.A. Appliance based control for Home Power Management Systems. Energy 2016, 114, 693–707. [Google Scholar] [CrossRef]
  15. Alhasnawi, B.N.; Jasim, B.H.; Mansoor, R.; Alhasnawi, A.N.; Rahman, Z.A.S.A.; Haes Alhelou, H.; Guerrero, J.M.; Dakhil, A.M.; Siano, P. A new Internet of Things based optimization scheme of residential demand side management system. IET Renew. Power Gener. 2022, 16, 1992–2006. [Google Scholar] [CrossRef]
  16. Lauinger, D.; Caliandro, P.; Van Herle, J.; Kuhn, D. A linear programming approach to the optimization of residential energy systems. J. Energy Storage 2016, 7, 24–37. [Google Scholar] [CrossRef]
  17. Ye, Y.; Qiu, D.; Wang, H.; Tang, Y.; Strbac, G. Real-time autonomous residential demand response management based on twin delayed deep deterministic policy gradient learning. Energies 2021, 14, 531. [Google Scholar] [CrossRef]
  18. Wang, Z.; Sun, M.; Gao, C.; Wang, X.; Ampimah, B.C. A new interactive real-time pricing mechanism of demand response based on an evaluation model. Appl. Energy 2021, 295, 117052. [Google Scholar] [CrossRef]
  19. Liu, N.; Yu, X.; Wang, C.; Li, C.; Ma, L.; Lei, J. Energy-Sharing Model with Price-Based Demand Response for Microgrids of Peer-to-Peer Prosumers. IEEE Trans. Power Syst. 2017, 32, 3569–3583. [Google Scholar] [CrossRef]
  20. Zhou, Y.; Wu, J.; Long, C.; Ming, W. State-of-the-Art Analysis and Perspectives for Peer-to-Peer Energy Trading. Engineering 2020, 6, 739–753. [Google Scholar] [CrossRef]
  21. U.S. Energy Information Administration (EIA). Prices and Factors Affecting Prices. Available online: https://www.eia.gov/energyexplained/electricity/prices-and-factors-affecting-prices.php (accessed on 27 July 2022).
  22. Paudel, A.; Chaudhari, K.; Long, C.; Gooi, H.B. Peer-to-peer energy trading in a prosumer-based community microgrid: A game-theoretic model. IEEE Trans. Ind. Electron. 2019, 66, 6087–6097. [Google Scholar] [CrossRef]
  23. Vahedipour-Dahraie, M.; Rashidizadeh-Kermani, H.; Shafie-Khah, M.; Siano, P. Peer-to-Peer Energy Trading between Wind Power Producer and Demand Response Aggregators for Scheduling Joint Energy and Reserve. IEEE Syst. J. 2021, 15, 705–714. [Google Scholar] [CrossRef]
  24. Alam, M.R.; St-Hilaire, M.; Kunz, T. Peer-to-peer energy trading among smart homes. Appl. Energy 2019, 238, 1434–1443. [Google Scholar] [CrossRef]
  25. Spiliopoulos, N.; Sarantakos, I.; Nikkhah, S.; Gkizas, G.; Giaouris, D.; Taylor, P.; Rajarathnam, U.; Wade, N. Peer-to-peer energy trading for improving economic and resilient operation of microgrids. Renew. Energy 2022, 199, 517–535. [Google Scholar] [CrossRef]
  26. Mohamed, M.A.; Hajjiah, A.; Alnowibet, K.A.; Alrasheedi, A.F.; Awwad, E.M.; Muyeen, S.M. A Secured Advanced Management Architecture in Peer-to-Peer Energy Trading for Multi-Microgrid in the Stochastic Environment. IEEE Access 2021, 9, 92083–92100. [Google Scholar] [CrossRef]
  27. Springer. Springer Briefs in Applied Sciences Series Editor; Springer: Berlin/Heidelberg, Germany, 2016. [Google Scholar]
  28. Meinke, R.J.; Sun, H.; Jiang, J. Optimising Demand and Bid Matching in a Peer-to-Peer Energy Trading Model. IEEE Int. Conf. Commun. 2020, 2020. [Google Scholar] [CrossRef]
  29. Residential Rates. Available online: https://berc.portal.gov.bd/ (accessed on 6 December 2022).
Figure 1. System architecture of the proposed system.
Figure 1. System architecture of the proposed system.
Energies 16 01549 g001
Figure 2. Single line diagram of the proposed P2P zone.
Figure 2. Single line diagram of the proposed P2P zone.
Energies 16 01549 g002
Figure 3. A working model of a registration layer.
Figure 3. A working model of a registration layer.
Energies 16 01549 g003
Figure 4. Blockchain architecture.
Figure 4. Blockchain architecture.
Energies 16 01549 g004
Figure 5. Matchmaking peer-peer for energy trading.
Figure 5. Matchmaking peer-peer for energy trading.
Energies 16 01549 g005
Figure 6. Pricing layer for different SDR ratios.
Figure 6. Pricing layer for different SDR ratios.
Energies 16 01549 g006
Figure 7. The microgrid schematic diagram designed in Homer Pro.
Figure 7. The microgrid schematic diagram designed in Homer Pro.
Energies 16 01549 g007
Figure 8. Daily load profile of prosumers in a typical day in July: (a) PV generation; (b) Wind turbine generation; (c) Combined generation: (d) Combined generation with consumption.
Figure 8. Daily load profile of prosumers in a typical day in July: (a) PV generation; (b) Wind turbine generation; (c) Combined generation: (d) Combined generation with consumption.
Energies 16 01549 g008
Figure 9. Hourly internal buying price of the consumer.
Figure 9. Hourly internal buying price of the consumer.
Energies 16 01549 g009
Figure 10. Hourly internal selling price of the prosumer.
Figure 10. Hourly internal selling price of the prosumer.
Energies 16 01549 g010
Figure 11. Reduction of utility bills.
Figure 11. Reduction of utility bills.
Energies 16 01549 g011
Figure 12. Reduction of exchange of electricity with the utility grid.
Figure 12. Reduction of exchange of electricity with the utility grid.
Energies 16 01549 g012
Figure 13. Difference of net power curves (a) PV prosumer (b) Wind turbine prosumer.
Figure 13. Difference of net power curves (a) PV prosumer (b) Wind turbine prosumer.
Energies 16 01549 g013
Table 1. Electric bills in residential households in Bangladesh.
Table 1. Electric bills in residential households in Bangladesh.
Range of kWhRate (Taka)/kWhRate (USD)/kWh
0–503.750.036
0–754.190.04
76–2005.720.055
201–3006.000.058
301–4006.340.061
401–6009.940.096
600+11.560.11
Table 2. Net generation of two prosumers, consumer consumption and SDR.
Table 2. Net generation of two prosumers, consumer consumption and SDR.
HourNet Output from PV (kWh)Net Output from Wind (kWh)Consumer Consumption (kWh)SDR
00.1070.0270.030N/A
10.1140.0470.042N/A
20.1140.0570.039N/A
30.1140.0570.066N/A
40.3920.1960.098N/A
50.5390.3000.246N/A
60.2680.3300.080N/A
7−0.0020.3000.1680.013
80.2190.2520.186N/A
9−0.8340.0880.245<1
10−1.2750.1190.222<1
11−0.6370.2680.624<1
12−0.5940.2470.301<1
13−1.514−0.1290.224<1
14−0.6730.0000.260<1
15−0.280−0.6590.232<1
160.110−0.9520.252<1
170.399−0.3800.314<1
181.3980.2230.690N/A
191.2040.5241.006N/A
200.8110.2320.596N/A
210.576−0.2970.3920.750
220.360−0.9900.135<1
230.245−0.2940.124<1
Table 3. Comparison between original exchange and modified exchange with the grid in a typical day.
Table 3. Comparison between original exchange and modified exchange with the grid in a typical day.
Original bill (Taka/Day)Optimized bill (Taka/Day)Reduction (%)
41.6634.3517.54
Original exchange (kW/Day)Exchange after P2P (kW/Day)Reduction (%)
6.563.3349.23
Table 4. Income of the prosumers at between different values of α in a typical day.
Table 4. Income of the prosumers at between different values of α in a typical day.
ProsumersIncome (Taka/Day) (α =0.01)Income (Taka/Day) (α = 0.02)Income (Taka/Day) (α = 0.03)
PV14.5414.1413.03
Wind10.179.88.4
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Muntasir, F.; Chapagain, A.; Maharjan, K.; Baig, M.J.A.; Jamil, M.; Khan, A.A. Developing an Appropriate Energy Trading Algorithm and Techno-Economic Analysis between Peer-to-Peer within a Partly Independent Microgrid. Energies 2023, 16, 1549. https://doi.org/10.3390/en16031549

AMA Style

Muntasir F, Chapagain A, Maharjan K, Baig MJA, Jamil M, Khan AA. Developing an Appropriate Energy Trading Algorithm and Techno-Economic Analysis between Peer-to-Peer within a Partly Independent Microgrid. Energies. 2023; 16(3):1549. https://doi.org/10.3390/en16031549

Chicago/Turabian Style

Muntasir, Fahim, Anusheel Chapagain, Kishan Maharjan, Mirza Jabbar Aziz Baig, Mohsin Jamil, and Ashraf Ali Khan. 2023. "Developing an Appropriate Energy Trading Algorithm and Techno-Economic Analysis between Peer-to-Peer within a Partly Independent Microgrid" Energies 16, no. 3: 1549. https://doi.org/10.3390/en16031549

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop