Next Article in Journal
Pool-Type Fishway Design for a Potamodromous Cyprinid in the Iberian Peninsula: The Iberian Barbel—Synthesis and Future Directions
Previous Article in Journal
A Study on the Complementary Direction of Guidelines for Developing Green Conventions in Korea: Using Comparative Analysis among Domestic and Overseas Cases
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Blockchain Based Sustainable Local Energy Trading Considering Home Energy Management and Demurrage Mechanism

1
Department of Computer Science, COMSATS University Islamabad, Islamabad 44000, Pakistan
2
Computer Engineering Department, Umm AlQura University, Mecca 24381, Saudi Arabia
3
Artificial Intelligence & Data Analytics Lab (AIDA), CCIS Prince Sultan University, Riyadh 11586, Saudia Arabia
4
Department of Electrical Engineering, University of Engineering and Technology Peshawar, Bannu 28100, Pakistan
5
Department of Information and Communication Engineering, Yeungnam University, Gyeongsan 38541, Korea
*
Authors to whom correspondence should be addressed.
Sustainability 2020, 12(8), 3385; https://doi.org/10.3390/su12083385
Submission received: 5 February 2020 / Revised: 28 February 2020 / Accepted: 28 February 2020 / Published: 21 April 2020
(This article belongs to the Special Issue Energy Management in a "Smart Home" with Integrated Solar Cells)

Abstract

:
With the increase in local energy generation from Renewable Energy Sources (RESs), the concept of decentralized peer-to-peer Local Energy Market (LEM) is becoming popular. In this paper, a blockchain-based LEM is investigated, where consumers and prosumers in a small community trade energy without the need for a third party. In the proposed model, a Home Energy Management (HEM) system and demurrage mechanism are introduced, which allow both the prosumers and consumers to optimize their energy consumption and to minimize electricity costs. This method also allows end-users to shift their load to off-peak hours and to use cheap energy from the LEM. The proposed solution shows how energy consumption and electricity cost are optimized using HEM and demurrage mechanism. It also provides economic benefits at both the community and end-user levels and provides sufficient energy to the LEM. The simulation results show that electricity cost is reduced up to 44.73% and 28.55% when the scheduling algorithm is applied using the Critical Peak Price (CPP) and Real-Time Price (RTP) schemes, respectively. Similarly, 65.15% and 35.09% of costs are reduced when CPP and RTP are applied with demurrage mechanism. Moreover, 51.80% and 44.37% electricity costs reduction is observed when CPP and RTP are used with both demurrage and scheduling algorithm. We also carried out security vulnerability analysis to ensure that our energy trading smart contract is secure and bug-free against the common vulnerabilities and attacks.

1. Introduction

Currently, energy is primarily produced by large, centralized energy-plant rendering through Nonrenewable Energy Sources (NRESs). The use of centralized energy plants run by NRESs causes energy losses during power transmission and environmental degradation. The high penetration of Renewable Energy Sources (RESs) into the power system reduces the environmental crisis and the energy losses as energy is generated close to where it is consumed. Another solution to centralized energy generation is the introduction of Distributed Energy Resources (DERs). DER increases the overall cost savings for the customer, allows consumers to control their power, and reduces gas emissions by shifting from NRES to RES.
As a result of the rapid increase in DERs’ connections, conventional consumers of energy are transforming into prosumers, i.e., someone who simultaneously generates and consumes energy. DER simply mean electricity resources, which are connected directly to Low Voltage (LV) or Medium Voltage (MV) distributed system [1]. DERs include both energy storage technology and generation units such as flywheels, batteries, Superconducting Magnetic Energy Storage (SMES), Photovoltaics (PVs), micro-turbines, and Electric Vehicles (EV) as illustrated in Figure 1, and Nomenclature shows the list of abbreviations and symbols in this research work. The figure depicts the technologies that support the DER system. For more information about technologies mentioned in the figure, please refer to Reference [1]. It is challenging to forecast the intermittent energy generation of DER. Due to this issue, prosumers curtail their surplus electricity, store it in a device, transport it to the main grid, or trade it with neighbors (other consumers) [2]. Customer in this paper refers to both consumer and prosumer, especially in a situation where both perform the same function. The direct buying or selling of energy among prosumers and consumers is known as Peer-to-Peer (P2P) trading of energy. Trading of energy among prosumers and consumers is one of the rapidly growing concepts in distributed networks. The sharing economy model is the foundation of P2P energy exchange in a distributed local electricity network [3]. A node in a network of energy trading is referred to as local energy prosumer or consumer. A node is also known as a peer who directly sells or purchases energy with other peers without the involvement of an intermediary controller. The current energy markets lack the ability to react in real-time or near real-time to the intermittent and volatile nature of RES generation [4]. In addition, market prices are usually set at the national level, which does not show the availability of local surplus energy or energy supply shortages [5]. However, modern market techniques must also reflect the locality of their services in order to promote DER’s inclusion into the power system. Microgrids are a geographically small community of numerous connected DER and loads [6] and can also improve energy supply stability since they provide the opportunity to supply power in the case of superordinate grid energy failures [7].
The advancement in information and communication technology allows P2P energy trading to take place. In conventional energy trading, the flow of transactions is unidirectional, whereby energy is transmitted from a single source of energy generation to customers from a very long distance while the flow of cash goes the other way round. However, P2P energy trading needs multidirectional trading within a local area and allows advanced communication. The challenges identified in P2P energy trading are information security, information leakages, privacy, loss of data, etc. Most of these problems can be addressed using blockchain technology.
The evolving technology, blockchain [8], brings new potential for decentralized network designs and provides transparent and user-friendly frameworks [9]. It creates opportunities for energy users to be involved in making choices about who supplies their energy and the technologies used to generate it.
In recent years, industries, academics, and research domains are involved in utilizing blockchain technology with its potentials to decentralize the complex energy market’s networks and P2P energy trading. The authors in Reference [10] propose a small machine-to-machine energy market based on blockchain with a customer and two suppliers in a chemical industry. The proposed system uses proof-of-concept algorithm for consensus. The proposed work shows that blockchain can create a small-scale energy market. In another work [11], the authors examine neighborhood energy growth into local self-sufficient utility production. The authors further explore the opportunities of microgrid energy markets based on blockchain for the development of distributed RES platforms and the associated problems for Australia’s conventional power grid. It is explicitly stated that the usage of modern distributed ledger (blockchain) in transactions of energy makes microgrids more robust by establishing confidence among the agents involved, particularly with regard to energy delivery and financial payments processes. The authors in Reference [12] utilize blockchain-based technology to establish a continuous auction platform. The auction mechanism in the model allows supply and demand to keep adding and matching without discrete clearing steps. The authors in Reference [13] present a P2P negotiation model in Local Energy Market (LEM) that has randomized sellers and buyers matching without a central authority. The trading takes place between directly affected parties on a bilateral basis. LEM is a regionally limited market system with special sale price mechanisms among interdependent customers (generators, prosumers, and consumers). The customers can either have an energy generation or demand at any given time slot.
In Reference [14], the authors present a combinatorial double auction technique for pricing and distribution of energy resources, taking into account the needs of energy consumers and prosumers in particular. In this research work, we propose a secure, decentralized, anonymous, transparent, immutable, and verifiable energy trading mechanism. The objective of the proposed work is to maximize energy supplies and economic benefits at all levels for both the community and end-users.
The remaining part of this paper is organized as follows: related work and problem statement are discussed in Section 2 and Section 3. Section 4 presents the proposed system model and its description. Section 5 elaborates price model and cost model of consumers and prosumers and discusses self-sufficiency and self-consumption, while security analysis and simulation results are presented in Section 6 and Section 7. Finally, the conclusion and future work are presented in Section 8.

2. Related Work

The authors in Reference [8] proposed an NRGcoin model, also called a novel decentralized digital currency. The model allows locally generated renewable energy from prosumers to be sold using the digital currency organized by the market paradigm of buyers and sellers of green energy in a smart grid. The authors in Reference [12] presented an adaptive aggressive strategy in a microgrid using blockchain-based Continuous Double Auction (CDA), putting forward a new perspective on an energy market. However, various bid combinations may have distinct initial conditions, and there is an inadequate flexibility to change the bid quantity during the CDA bid process.
Similarly, in Reference [15], the authors presented a secure credit-based system of payment by reducing wait times for transaction confirmation of the energy chain in permissioned blockchain-based Industrial Internet of Things (IIoTs). Reducing the wait time makes electricity trading faster and responses more frequent. The authors also used an optimal pricing mechanism by exploring the idea of stackelberg game theory to optimize bank utility credit-based loans.
The authors in Reference [16] proposed a P2P Electricity Trading system with COnsortium blockchaiN (PETCON) model to conduct secure private P2P trading of energy between plugin hybrid electric vehicles. The study focused on establishing trust and used the anonymous property of blockchains to defend the user’s privacy. In Reference [17,18,19], an approach based on the power quality perceived by a specific economical category is proposed. However, the proposed model does not consider security issues, privacy leakages, and single point of failure.
The authors in Reference [20] attempted to provide a decentralize and secure transaction using blockchain technology in the smart grid. In the research, participants anonymously negotiate the trading price and perform secure transactions using anonymous, encrypted messaging streams and multi-signatures. The proposed work is different from this research work by willingly allowing or encouraging all prosumers to become sellers and self-sufficient consumers in peak hours of energy generation. Similarly, in Reference [21], the authors proposed a system of distributed energy trading to encourage P2P sharing of electricity between prosumers. There are two layers in the proposed model. In the first layer, the agent coalition mechanism is proposed to allow prosumers to establish a coalition and to negotiate energy trading. A blockchain-based settlement of transactions is proposed in the second layer. A distributed approach to control Demand Response (DR) systems in a smart grid context is proposed in Reference [22]. The elements of the grid are integrated with the smart contract’s blockchain framework to ensure the verification of DR agreements, the programmatic definition of expected energy flexibility levels, the balance within production and demand of energy, and the validation of DR agreements. In Reference [23], Thakur et al. presented a distributed, scalable, and secure blockchain-based network for coalition structure creation and microgrid energy trading. However, the determination of the trading price between the parties is difficult to reach via negotiation. Similarly, the research work in Reference [24] aimed to provide an energy trading model that will facilitate a sustainable transaction of energy ecosystems among smart homes’ consumers and prosumers. However, energy and profit optimizations are not considered.
The work proposed in Reference [25] not only decreases the peak to average ratio, benefiting the grid, but also smoothens the dips of the profile load caused by constraints in supply. Also, the work proposed an enhanced blockchain approach to implement a distributed microgrid network that handles the micro-payment along with the exchange of energy and information. Furthermore, a noncooperative theoretical game approach is proposed for a Demand Side Management (DSM) model that incorporates storage components. Privacy has been highlighted as a major barrier to customer engagement in the research. The authors in Reference [26] proposed an Internet of Things (IoT) system to account for power flows as well as a blockchain platform to resolve the need for a centralized entity. It allows LEM to manage the decentralized transfers of energy without the need for central control. On the other hand, a new approach for smart city network architecture is proposed [27]. The architecture combined the benefits of blockchain technology and emerging Software-Defined Network (SDN). The rapid growth in volume and number for the connected IoT devices came with challenges: for instance, bandwidth bottleneck, scalability, privacy, and high latency in the current architecture of smart city networks. The current limitations are drastically reduced by introducing blockchain and by dividing the architecture into the core and edge networks. However, there are still some issues that are left unresolved, such as memory scalability, high latency, and efficient deployment of edge nodes. An interesting lab-scale implementation is proposed in Reference [28]. For the sake of sharing solar energy, this framework depends on a hyperledger fabric blockchain platform.
In another work [29], the authors propose a survey on distributed energy trading principles in a smart grid. The authors discussed topics like the advantages of distributed energy trading and reasons behind its implementation, the technology needed to develop these framework, and a review of past literature work. Mengelkamp et al. [30] identified seven microgrid electricity market principles and assessed the Brooklyn Microgrid in compliance with those principles. The authors developed and modeled a local power market with a more realistic emphasis on a private Ethereum blockchain that allows users to exchange locally generated energy supply on a distributed and decentralized exchange system without the involvement of control authority. However, efficient allocation and pricing mechanisms are not developed. Furthermore, Table 1 gives a summary of the related work.

3. Problem Statement

The authors in Reference [30] proposed a decentralized market mechanism using a private blockchain and an auction method to determine the price. However, trading of surplus energy through auction or bidding is logically impossible for all users [33]. The reason is that some consumers or prosumers cannot participate in the trading due to limited time, lack of expertise, and above all, lack of technology. Similarly, another problem arose in References [31,32], and there is a possibility for the occurrence of single point of failure since the proposed models allowed a third party to serve as a controller to manage or control prosumers’ batteries and all transaction information. Moreover, the system is prone to privacy threats, i.e., information disclosure and security concern. Additionally, including a third party requires a central processing center to process and collect the information of all participants, which is challenging in DER. Two problems naturally arise when relying on a third party. Firstly, intensive communication infrastructures are needed in the case of a central controller. Secondly, it is difficult to encourage a large number of participants in energy trading. The exponential development of energy trading shows the importance of related research.
Generally, according to the literature discussed in References [30,31,32], most of the research do not emphasize how to resolve the privacy and security challenges and a single point of failure problem. Moreover, none of the literature explicitly considers resolving the issues of energy hoarders in peak generation hours. Also, the research work does not consider combining the conventional LEM mechanism, HEM system, and blockchain technology concurrently. Combining these mechanisms will centrally merge their benefits in a single pool. We propose an LEM using private blockchain by considering the HEM system and demurrage mechanism in a community with residential PV energy generations. The proposed model allows prosumers and consumers to manage their resources and information in a decentralized, secure, trustful, transparent, anonymous, and verifiable manner. The comparison of existing work with proposed model is given in Table 2. The main research contributions of the proposed work are as follows:
  • an LEM using private blockchain is proposed, which considers both HEM system and demurrage mechanism simultaneously,
  • a dynamic pricing mechanism is proposed for energy trading to take place. This mechanism ensures that all members participating in local energy trading gain better economic benefits. This pricing model is modified from the Supply and Demand Ratio (SDR) mechanism [32] to include demurrage value, and
  • a thorough assessment is conducted in the research to evaluate the economic benefits of the buyers and sellers of locally generated energy in a residential community. Also, based on the proposed system, the potential security risks of the energy trading system are analyzed. Conclusively, a complete security protection technique is provided against these security vulnerabilities in the system.

4. Proposed System Model

In this section, the proposed system model is first presented; thereafter, the blockchain technology in LEM is elaborated. Lastly, the optimization problem formulation is discussed.

4.1. Description of the System Model

The proposed model comprises three participants: prosumers, consumers, and the main grid as depicted in Figure 2, which is inspired by References [30,31,32]. Prosumers and consumers participate in the local energy trading when PV energy generation is at its peak. The prosumers are equipped with PV solar panels, which generate electricity, and equipped with smart meters that record, monitor, and transmit energy information (both generation and consumption) to the blockchain through smart contract, while the consumers are equipped only with smart meters through which energy consumption information is generated and sent to the blockchain using smart contracts for future purposes. The main grid supplies energy to the local community when the local energy generated is insufficient to satisfy the user’s demand. According to the proposed model, both prosumers and consumers optimize their electricity consumption through shifting demand from on-peak hours to off-peak hours, as discussed in the next subsection. The pricing model and demand shifting are executed at the individual local level, i.e., the consumers and prosumers level. The pricing model is developed using SDR by including the demurrage mechanism. Details on the pricing model are discussed in Section 5. Transactions information, payment processes, and market platforms are executed on the private blockchain through the smart contract to get rid of the third party. The blockchain technology provides a secure, decentralized, transparent, anonymous, and verified information platform. Demurrage is a mechanism used to disincentivize energy hoarding and to foster price signals to customers. This mechanism allows customers to shift their electricity consumption to a period where local energy generation is overflowing. With the demurrage mechanism, the redemptive value of the energy-backed price declines with time.

4.2. Blockchain Technology and Smart Contract in LEM

This section discusses blockchain technology and smart contract in LEM.

4.2.1. Blockchain Technology in LEM

We modeled a blockchain-based architecture to decentralize an LEM within a small community with many residential PV systems, as represented in Figure 3. The framework comprises nodes in the network, which are prosumer, consumer, and the main grid. These nodes can coordinate through blockchain’s infrastructure to support the decentralization of energy generation and demand. Moreover, a copy of the blockchain ledger is created at an individual level (node). The challenges in P2P energy trading are identified as lack of data security and privacy. However, the problems can be addressed using decentralized and distributed blockchain ledger features. The issues of storing and maintaining energy transactions in a centralized approach are still open research challenges. In a decentralized manner, energy transactions can be maintained locally and stored in the blockchain. The process is done with the help of customers’ unique identifier that shares and replicates the copy of the transaction to all the peers in the network for validation. The benefits of using blockchain technology in the proposed system are information immutability, self-enforced smart contract, security, etc. Information immutability in blockchain technology ensures that all information stored in Ethereum blockchain remains unchanged after validation. To achieve consensus among the energy trading participants, we adopt a Proof of Work (PoW) consensus mechanism [10].

4.2.2. Smart Contract in LEM

The author in Reference [34] defined smart contracts as a collection of instructions or rules that execute the terms of contracts. It is also suggested to convert contractual clauses, e.g., bonding, collateral, etc., into code and to incorporate them into hardware and software that could self-impose them so as to reduce or remove the need for trusted third parties. A smart contract is a set of blockchain’s residing code or script. There is a unique address for each entity stored in a blockchain. According to the rules set, smart contracts are performed independently and automatically on each node in the network. It means that each node operates a virtual machine in the smart contract-enabled blockchain and that the blockchain serves as a distributed virtual machine [35].
In the proposed model, smart contracts are the collection of guidelines that regulate energy trading mechanisms (energy selling and buying) as well as monitor and record all the energy transactions information. Besides that, the smart contract is responsible for executing all payment processes between the prosumers, consumers, and the main grid. Due to the limited availability of mathematical functions in blockchain to calculate demurrage and their expensive gas consumption, we perform the arithmetic calculation off-chain and passed the results to the smart contracts. Algorithm 1 shows the excerpt of the smart contract.
Algorithm 1 Buy and sell with demurrage smart contract functions.
  Input a d d r , I d , q u a n t i t y , d p r i c e , T i m e     ▹ d p r i c e is demurrage price computed off-chain
  Output U p d a t e d Q u a n t i t y , F i n a l C o s t
 1: function BuywithDemurrage( a d d r , I d , q u a n t i t y , d p r i c e , T i m e )
 2:   if < q u a n t i t y of required energy is not enough> then
 3:     terminate
 4:   end if
 5:   if < T i m e is within the demurrage agreed time> then
 6:     update consumer’s and prosumer’s q u a n t i t y
 7:     update consumer’s and prosumer’s wallet F i n a l C o s t
 8:   else
 9:     update consumer’s and prosumer’s q u a n t i t y
10:     update consumer’s and prosumer’s wallet F i n a l C o s t with d p r i c e
11:   end if
12:   return U p d a t e d Q u a n t i t y , F i n a l C o s t
13: end function
 1: function SellwithDemurrage( a d d r , I d , q u a n t i t y , d p r i c e , T i m e )
 2:   if < q u a n t i t y of energy to sell is not enough> then
 3:     terminate
 4:   end if
 5:   if < T i m e is within the demurrage agreed time> then
 6:     update consumer’s and prosumer’s q u a n t i t y
 7:     update consumer’s and prosumer’s wallet F i n a l C o s t
 8:   else
 9:     update consumer’s and prosumer’s q u a n t i t y
10:     update consumer’s and prosumer’s wallet F i n a l C o s t with d p r i c e
11:   end if
12:   return U p d a t e d Q u a n t i t y , F i n a l C o s t
13: end function

4.3. Optimization Problem

The optimization problem is categorized based on appliance scheduling in each time slot to reduce the cost of electricity. Power rating and appliance status (ON or OFF) are the attributes associated with each appliance. The description and specifications of the household appliances are provided in Table 3. The multi-objectives scheduling problem formulation is explained and presented in the next subsections.

4.3.1. Appliance Categorization

Based on the pattern of energy consumption and operational behavior, residential appliances are classified, i.e., appliances that are shiftable and nonshiftable, which are explained below.
Shiftable appliances: shiftable appliances for household load are categorized into interruptible and uninterruptible load. Interruptible appliances are the kind of devices that can be shifted and interrupted at any time, even when they start their operation, and have a fixed energy consumption rate. Examples of interruptible appliances are water heater, refrigerator, air conditioner, etc. The uninterruptible loads are the kind of appliances which can be shifted to any time slot before they are turned on but, once they start their operation, they cannot be interrupted unless they finish their LoT. Examples are dishwasher, cloth dryer, washing machine, etc. Let the shiftable appliances number be N s h i f t a b l e for all appliances in the smart home, and Y a p ( t ) represents appliance status at time interval t T as demonstrated in Equation (1).
Y a p ( t ) = 1 ,   if   < appliance = ON > , 0 ,   < otherwise > .
Non-shiftable appliances: non-shiftable appliances, sometimes referred to as unchangeable household devices, are those appliances that are not manageable, for example, fan, light, tv, etc.

4.3.2. Cost of Electricity

The reduction in costs of electricity is described as the lowest possible rates (charges) of energy loads consumed issued by the utility to energy users. For minimizing the problem of electricity costs, we consider non-shiftable and shiftable appliances loads. The problem is formulated as given in Equation (2):
M i n a = 1 N a t = 1 T Y a p ( t ) ρ E a P r i c e ( t ) .
where E a P r i c e ( t ) represents the price of electric energy consumed at any time interval t. a is the index for the overall number of appliances in the smart home, and time index is represented as t with maximum threshold of T hours of a day. N a is the total number of appliances in a smart home.

4.3.3. Energy Consumption

The energy consumption is shifted from on-peak to off-peak hours in a stable manner with the aid of the HEM system. The shift in energy load over a period of time is based on demand and is inversely proportional to the market price of the electricity. It is mathematically represented in Equation (3):
P c o n s u m p t i o n = t = 1 T S s h i f t a b l e = 1 N s h i f t a b l e Y a p ( t ) ρ + t = 1 T S n o n s h i f t a b l e = 1 N n o n s h i f t a b l e Y a p ( t ) ρ .
where the energy consumption of shiftable and non-shiftable appliances is given as P c o n s u m p t i o n . The electricity load is divided based on the consumer’s behavior and household appliances operation. ρ represents each appliance power rating, and S s h i f t a b l e represents the collection of household appliances that are shiftable. The number of non-shiftable appliances is denoted as N n o n s h i f t a b l e for all household appliances. S n o n s h i f t a b l e represents the collection of household appliances that are non-shiftable.

4.3.4. Load Balancing

The stability of the power grid is essential to ensure the reliability and sustainability of grid operations and management. A decrease in the Peak-to-Average Ratio (PAR) helps to maintain the reliability of the utility, thereby reducing the cost of electricity. It is mathematically shown in Equation (4):
P A R = M a x i m u m ( P c o n s u m p t i o n ) 2 A v e r a g e ( P c o n s u m p t i o n ) 2 ,
where P c o n s u m p t i o n is calculated using Equation (3).

4.3.5. Objective Function

The aggregated objective function is represented as a function of multi-objective optimization techniques to reduce energy cost and energy consumption in residential homes of prosumers and consumers while maximizing energy consumption from LEM. The optimization techniques are adopted from References [36,37] to achieve the overall objectives. The load scheduling is carried out using earliglow-based optimization algorithm. The earliglow algorithm is a hybrid algorithm, which is a combination of jaya and strawberry algorithms. To evaluate the HEM consumption and electricity cost, we consider Real-Time Price (RTP) scheme and Critical Peak Price (CPP) scheme to show the effectiveness of the optimization technique. The objective function is computed using Equations (2) and (3).

5. Price and Cost Models

This section discusses the price model, cost model of the consumer and prosumer, and self-consumption and self-sufficiency.

5.1. Price Model

The PV generation at the ith prosumer premises in a given interval of time t is defined as follows:
P i ( t ) = { P 1 ( t ) , P 2 ( t ) , , P N B ( 24 ) } ,   i = { 1 , 2 , , N B } .
where N B represents the prosumers’ number ( N N B ) in the network. The consumption of prosumers or consumers at time t is defined as follows:
T P i ( t ) = { T P 1 ( t ) , T P 2 ( t ) , , T P N ( 24 ) } ,   i = { 1 , 2 , , N } .
where the consumers number in the network is represented as N. For any prosumer i, the net power in a given time t is represented as follows:
N P i ( t ) = T P i ( t ) P i ( t ) ,   t = { 1 , 2 , , 24 } .
As all customers have different electricity consumption patterns. The customers can serve as either sellers or buyers depending on the net power at a certain time slot. Therefore, the Total Selling Power (TSP) and the Total Buying Power (TBP) are defined as follows:
T S P ( t ) = t = 1 24 N P i ( t ) ,   N P i ( t ) < 0 ,
T B P ( t ) = t = 1 24 N P i ( t ) ,   N P i ( t ) 0 .
According to economics theory [38], price and SDR relationships are inversely proportional. Similarly, as the price model in Reference [32] is formulated based on SDR. In this research, we apply the same price model, which is modified by introducing a demurrage mechanism. The TBP is the prosumer’s or consumer’s energy consumptions, and the TSP is the PV power generations. Therefore, the SDR at time slot t is represented as follows:
S D R ( t ) = T S P ( t ) T B P ( t ) .
The selling and buying prices change over the period of time of the day. Therefore, the prices are assumed to be
P r b u y ( t ) = { P r b u y ( 1 ) , P r b u y ( 2 ) , , P r b u y ( t ) }   and   P r s e l l ( t ) = { P r s e l l ( 1 ) , P r s e l l ( 2 ) , , P r s e l l ( t ) } ,
P r = { P r b u y ( t ) ; P r s e l l ( t ) } .
where selling and buying prices at time slot t at the prosumer’s side are represented as P r s e l l ( t ) and P r b u y ( t ) , respectively. The purchasing and selling powers to utility grid are represented as α b u y ( t ) and α s e l l ( t ) at time slot t, respectively.
In order to motivate both consumers and prosumers to fully participate in energy trading, especially, at peak PV generation, the prosumer or consumer buying prices ( P r b u y ( t ) ) should not be greater than the price ( α b u y ( t ) ) of energy bought from the main grid. Additionally, the selling price ( P r s e l l ( t ) ) of the prosumer(s) must not be less than the selling price ( α s e l l ( t ) ) of the utility grid.
Thus, the buying price P r b u y ( t ) and selling price P r s e l l ( t ) are represented as a function of S D R ( t ) :
P r s e l l ( t ) = f ( S D R ( t ) ) = ( α s e l l ( t ) + α ) . α b u y ( t ) ( α b u y ( t ) α s e l l ( t ) α ) . S D R ( t ) + α s e l l ( t ) + α , 0 S D R ( t ) 1 , α s e l l ( t ) + α S D R ( t ) , S D R ( t ) > 1
P r b u y ( t ) = f ( S D R ( t ) ) = P r s e l l ( t ) . S D R ( t ) + α b u y ( t ) . ( 1 S D R ( t ) ) , 0 S D R ( t ) 1 . α s e l l ( t ) + α , S D R ( t ) > 1
In our scenario, the demurrage mechanism will be triggered whenever the prosumer or consumer hoards energy or delays to buy energy within peak power generation periods. In this case, the condition of the given S D R ( t ) will be slightly different, i.e., the buying price will be slightly higher and the selling price will be slightly lower than the utility grid’s buying and selling price. This is to encourage participants to patronize local energy generated at on-peak hours, while at peak power generation, the prices obey the SDR pricing model. When S D R ( t ) = 1 , both the buying and selling power in the neighborhood are the same ( T B P ( t ) = T S P ( t ) ) and no power is needed to import from or export to the utility grid. Also, both selling price and buying price are equal to the utility grid selling price, along with the compensation price ( P r s e l l ( t ) = P r b u y ( t ) = α s e l l ( t ) + α ) . When S D R ( t ) = 0 , this means that there is no selling power in the neighborhood. All customers must buy energy from the main grid with a grid price of α b u y ( t ) . Therefore, the buying and selling prices are equal to the main grid’s buying price ( P r s e l l ( t ) = P r b u y ( t ) = α b u y ( t ) ) . The compensation price α is introduced to compensate the prosumer to ensure that all prosumers are better remunerated when participating in local energy trading. It also ensures that the selling and buying prices are not the same when S D R ( t ) > 1 , and it provides more economic benefits to the prosumers than the consumers. The buying and selling prices will variably change based on Equations (11) and (12), when 0 < S D R ( t ) < 1 . Figure 4 shows the relationship between S D R ( t ) and the proposed buying or selling prices. The figure shows that S D R ( t ) is reduced when power consumption increases. An increase in S D R ( t ) decreases both the selling and buying prices and vice versa. To increase the selling price, the participants must increase their energy consumption and the buyer would also need to decrease their energy consumption for a lower buying price.
In order to discourage energy hoarders and to encourage consumers to purchase energy at peak power generation hours, we introduce a demurrage mechanism in prosumer buying and selling prices [39]. Let β be the demurrage value as represented in Equations (13) and (14). The new buying and selling prices are P r b u y β ( t ) and P r s e l l β ( t ) , which are derived from the demurrage mechanism and are represented in Equations (15) and (16), while Equation (17) represents the combination of buying and selling price with demurrage:
β = P r ( t ) = P r ( t ) P r t ( t K ) ,
t = [ M i n , M a x ] ,
P r s e l l β ( t ) = P r s e l l ( t ) ,   0 t M a x , P r s e l l ( t ) β ,   otherwise
P r b u y β ( t ) = P r b u y β ( t ) ,   0 t M a x , P r b u y β ( t ) + β ,   otherwise
P r i ( t ) = P r s e l l β ( t ) . P r b u y β ( t )

5.2. Cost Model of Consumers and Prosumers

Prosumers and consumers involved in energy trading DR are expected to have some portion of shiftable loads. Participants change their energy profile consumption because of the price incentives. This makes the initial energy consumption T P i ( t ) change from the actual values. The energy consumption adjusted is given in Equation (18):
y i = { y 1 , y 2 , , y t } .
The adjusted net consumption for both prosumer and consumer at time slot t is updated as in Equation (19):
N P i ( t ) = y i P i ( t ) ,   t = { 1 , 2 , , 24 } .
The cost function for PV prosumers i at time slot t is defined in Equation (20):
C o s t ( y i ( t ) ) = P r i ( t ) N P i ( t ) .
The total cost for PV prosumers i for a day is defined in Equation (21):
C o s t ( i ) = t = 1 24 C o s t ( y i ( t ) ) .
P r i ( t ) is the customer price at time slot t, which can be either the buying or selling price. The status of the price is determined by the net power to be either the buying or selling price P r i ( t ) and is given in Equation (22).
P r i ( t ) = P r s e l l β ( t ) , N P i ( t ) > 0 0 , N P i ( t ) = 0 . P r b u y β ( t ) , N P i ( t ) < 0
In the energy scheduling process, we have two constraints:
t = 1 24 y i ( t ) = t = 1 24 T P i ( t ) ,
m i n ( T P i ) y i ( t ) m a x ( T P i ) .
Equation (23) means that the total energy before and after shifting the load is assumed to be unchanged, while Equation (24) means that the shifted electricity load must lie between the minimum and maximum electricity loads of the original customer profile.

5.3. Self-Consumption and Self-Sufficiency

Self-consumption and self-sufficiency ideas are adopted from Reference [40], which are mathematically expressed in the next subsections.

5.3.1. Self-consumption

Self-consumption can be determined as the total power consumption of a prosumer T P i ( t ) and the total power generated from on-site PV system by the prosumer P i ( t ) . The energy generated on-site is limited by taking the smallest load between the generation or load profile of the customer, which is shown in Equation (25). Self-consumption is represented in Equation (26).
M i ( t ) = m i n { T P i ( t ) , P i ( t ) }
Self - Consumption = t = 1 t = 24 M i ( t ) d t t = 1 t = 24 P i ( t ) d t .

5.3.2. Self-Sufficiency

Self-sufficiency is calculated using Equation (27). A prosumer’s self-sufficiency defines the share of the total load supplied by the PV system.
Self - Sufficiency = t = 1 t = 24 M i ( t ) d t t = 1 t = 24 T P i ( t ) d t .
The relationship between self-sufficiency and self-consumption is expressed as follows:
Self - Consumption Self - Sufficiency = t = 1 t = 24 T P i ( t ) d t t = 1 t = 24 P i ( t ) d t .

6. Security Analysis

In this section, a security analysis is discussed, which ranges from vulnerability analysis of the smart contract and the tool used to perform the analysis to the overall security analysis of the system.

6.1. Vulnerability Analysis of Smart Contract

Ethereum smart contracts are still advancing; therefore, the code in the contracts can contain some bugs and may result in a serious security vulnerability. It is necessary to develop bug-free and secure smart contracts code. In 2016, the insecure smart contract allowed the loss of more than 3 million ether as a result of re-entrancy vulnerability [41]. Thus, careful inspection of the code and the need for secure smart contracts using automated tools are necessary and very important. The common attacks and security vulnerabilities identified against smart contracts are summarized as follows [42,43].
  • Re-entrancy vulnerability: This type of attack happens when the same function is being called continuously over and over so that executing another function will be impossible.
  • Timestamp dependence: The miners can manipulate the transaction timestamp, so it is essential to handle all use cases, which include both indirect and direct timestamps. The miners can change the block timestamp to their advantage, which manipulates the execution of the output.
  • Call stack depth vulnerability: External function calls may fail at any moment whenever the calls surpass 1024’s maximum call stack. Solidity throws an exception in such scenarios. Before communicating with the contract, mischievous attackers can force a high value of the call stack.
  • Transaction ordering attack: This security vulnerability can change the price during processing of transactions, as a transaction has been executed by somebody else (another user, miner, or the contract owner) that can modify the price prior to the completion of the transaction. Such an incident happens whenever the blockchain’s expected state is not the transaction’s actual state. The sequence where transactions are validated may have negative impacts on other transaction executions, as the validators can decide the transactions patterns, whereby more than one transactions can take place at a given period. These kind of bugs are identified in approximately 16% of all blockchain contracts.
  • Integer underflow and overflow: Underflow and overflow happens when the value given to a variable is more than the permitted limit for that data type. It is very common for the integer data type in solidity, and all data should be carefully verified at the time of variable assignment.
  • Assertion failure: If the “uint” is of higher value for a number used in traditional JavaScript, an assertion failure happens when it is not defined in quotations so that the input can indeed be read as a string and manipulated as a large number.

Oyente Tool

Oyente tool is an automated tool used to check possible violations or security vulnerabilities in smart contracts’ code and is developed by Loi et al. [42,44] as an open-source tool.
Our energy trading smart contract is evaluated with oyente tool against the commonly known attacks and vulnerabilities of security. As shown in Table 4, all reported results were “False”, which means that the smart contract of energy trading is bug-free and that it is secure enough from the abovementioned vulnerabilities. Each function in the contract is evaluated with the tool, in which the results show better functionalities for ensuring smooth trading among the participants. The oyente tool analyses the smart contract on the basis of symbolic execution mechanism. Every path of symbolic execution has a path condition, i.e., a formula, which is developed based on the inputs obeying particular secure rules identifying potential vulnerabilities to security. The inputs selected must be in line with the rules given in order to follow the path. A path is feasible if and only if its condition is satisfiable; otherwise, the path is infeasible [42]. The main objectives of symbolic execution are given as follows [42]:
  • to investigate all execution paths using symbolic values for all variables,
  • to cross-check whether any of the properties are violated,
  • to store the behavior of the smart contract in every path, and
  • to summarize the conditions on the input for each path.

6.2. Security Analysis of the Overall System

Potential attacks and threats are described in this section for the overall system as are how security goals can be achieved. The potential attacks in this research is similar to that of [42], therefore, we adopted same style of discussion. Our system’s main security features are inherited from the blockchain technology. These features are integrity, trust, decentralization, availability, and non-repudiation. The system also manages access control and authentication through blockchain’s smart contract feature by applying restrict modifiers, which restrict some functions’ execution by certain actors. In addition, the system is protected against replay and Man-In-The-Middle (MITM) attacks as all messages are timestamped and signed cryptographically. Integrity is an important element that helps to ensure that vital information cannot be modified. The solution proposed offers the opportunity to trace historical events via logs. The immutability of blockchain ensures the integrity of messages shared between the two parties and logs as well as the events executed. To ensure availability, it should be remembered that the proposed smart contracts, which are built on blockchain, would always be available to the entities involved in the energy trading to perform their functions. It ensures easy access to services. The model is secured from Denial of Service (DoS) attacks, since the energy transactions are recorded in a distributed and decentralized private Ethereum ledger and are not subject to failure, compromise, or hacking. The Ethereum blockchain is Distributed DoS (DDoS) resistant and highly robust as it is globally distributed and protected by many mining nodes that host duplicate data with extreme integrity and consistency. Generally, in blockchain, confidentiality can be achieved using permissioned or private blockchain, such as that of hyperledger, multichain, or private Ethereum blockchain networks. In our scenario, the proposed system allows only authorized users. Thus, we use private Ethereum blockchain to perform energy trading transactions and to store the generated results for future purposes.

7. Results and Simulations

This section gives the simulation results and their discussions.

7.1. Assessment Metrics

In this paper, we consider electricity cost, self-sufficiency, and self-consumption as assessment metrics to evaluate the performance of a community and individual customers. Besides that, the simulation setup of the proposed system is presented in this subsection.

Simulation Setup

We perform the simulations by considering 100 households (N), which include both residents with a PV system ( N B ) and without PV systems. In the simulations, we assume that all residents with PV systems have the same PV generation capacity and that all households have the same pattern of electricity consumption profile. One day (24 hr) with one-hour resolution is simulated for energy load and generation of customers’ profile. The proposed market mechanism is implemented in a private Ethereum blockchain network through a smart contract. Solidity scripting language and JavaScript programs are used to develop smart contracts and Application User Interface (API). These programs allow communication between smart contracts and API. All these programs are executed on the Node.js runtime environment. We use a basic concept of blockchain technology with no transaction cost and compensation for miners.
The computational experiments are conducted on a desktop computer with the following specifications. The configuration of the experimental environment is AMD E1-6015 APU with radeon (TM) R2 graphics 1.4 GHz processor and 4.00 GB RAM, and the operating system is Microsoft Windows 10. The simulation results of the proposed model are generated using MATLAB2018a. We took the appliances’ load consumption datasets for the simulations from Reference [36], and the parameters used in the simulations are given in Table 5.

7.2. Results of Internal Prices

The main grid’s buying and selling prices for the CPP and RTP pricing schemes are collected from the Scandinavian electricity market Nordpoolspot, which is an European based utility company [45]. From the grid prices schemes, it is observed that the price signal is at its peak between 10:00 to approximately 18:00. These peak hour price signals happen to occur during peak hours of energy generation as shown in Figure 5. In this paper, customers are encouraged to participate in local energy trading during peak hours of PV generation in such a way that the energy generated at peak hours is utilized. According to Equations (10)–(17), S D R ( t ) decides the internal prices for each time slot. As depicted in Figure 4, it is clearly shown that the buying and selling prices change with an increase in S D R ( t ) . As shown in Figure 6a,b, the modified dynamic price model discourages customers from participating during low energy generation. Additionally, a prosumer that refused to sell surplus energy during peak generation will be disincentivized. The disincentive is applied using a demurrage mechanism in which the redemptive value of the energy-backed prices declines with time. It further leads to either increase in the selling prices or decrease in the buying prices and makes them worse than the utility selling and buying prices. The reason for the results shown in Figure 6a,b is that the demurrage mechanism is triggered when consumers delay buying local energy. As a result, all the prices will be affected. The mechanism will also penalize the consumer by increasing the buying price and by decreasing the selling price value for the prosumers whenever they hoard energy. Generally, an increase in S D R ( t ) decreases both the selling and buying prices and vice versa. However, the S D R ( t ) would be enhanced by adjusting the electricity load consumption, in which the value of the prices are reduced.

7.3. Results of Customers Cost

The results in Figure 5 show the typical energy consumption for an average household and the PV energy generation of a residential prosumer. The results show that the average energy demand for a day is approximately the same for all hours except from 10:00 to approximately 18:00, whereby the consumption is higher. It causes an issue in a typical average household which abruptly increases the electricity cost while trading energy using utility prices. As a result of this problem, electricity load optimization takes place. In our scenario, we first optimize the average household electricity load by shifting the electricity load from on-peak hours to off-peak hours as shown in Figure 7. The reason for applying the scheduling algorithm is to shift all shiftable appliances to a cheaper price hour that reduces the total electricity cost for a day. The electricity load shifting is carried out using the scheduling algorithm. The scheduling algorithm is adopted from Reference [36] to shift the electricity load to off-peak hours. As discussed in the previous sections, the role of the customers depends on the net load power. Figure 8 shows a net load power of a prosumer after shifting the electricity load.
The results in Figure 9a and Figure 10a show that, after applying the optimization algorithm, the electricity cost reduces drastically when using utility prices. Still, the electricity costs are higher between 10:00 and 18:00. To further reduce the electricity cost, we trade with locally generated energy, where the prices are lower than the utility electricity prices.
The results in Figure 9b and Figure 10b show that the customers achieve effective cost savings with local energy trading as compared with the main grid. The economic benefits of trading with local energy not only are for prosumers but also involves the consumers too. Moreover, the results in Figure 11a and Figure 12a show the electricity cost savings when trading with purely locally generated energy and when trading with either utility with scheduled appliances load or a combination of both methods by taking CPP and RTP as base pricing schemes. It is because the dynamic prices for LEM are always better depending on the S D R ( t ) as compared to the utility prices.
Furthermore, Figure 11b shows that the economic benefit gained by a prosumer is approximately equal to the consumers’ total electricity cost when using the CPP scheme. Moreover, Figure 12b shows the profit gained by prosumers when using the RTP scheme. However, the findings show that the economic benefits gained using CPP is much better than RTP. This is because the RTP scheme changes in real time for consumers’ usage behaviors. In RTP, price changes on an hourly basis and consumers are charged with different prices at each interval of time, while the CPP scheme defines distinct pricing frameworks for different seasons and annual events, which allows proper planning for the energy users.

7.4. Feasible Region for Energy Load and Electricity Cost

A Feasible Region (FR) [36], solution space or feasible set is a collection of possible points that satisfy constraints of the objective problem. In this article, CPP price signal cost for a household lies in the range of (11.40, 111858.75) cents and the load consumption without the HEM model and demurrage mechanism lies between (1.00, 13.25) kW for the four possible cases, as shown in Table 6 and Table 7. Moreover, the price signal cost for the RTP scheme falls inside the range of (10.63, 5167.50) cents for each household. Likewise, in each situation (case), the hourly energy consumption for every household comes within the range of (1.00, 13.25) kW in the RTP pricing scheme. As it can be seen in Table 6 and Table 7, to satisfy FR with modified price, the hourly electricity cost has to be less than or equal to the maximum of 11858.75 and 5167.50 cents without HEM and demurrage mechanisms, respectively. Similarly, each household energy consumption satisfies the optimization problem constraints given in Equations (23) and (24) and falls within the FR boundary. To compute the FR points, the maximum and minimum energy loads are multiplied with maximum and minimum electricity cost prices collected from the utility and the agreed price from local energy trading. The modified prices achieve optimal electricity cost for every time interval as compared to the original price, which falls within the FR range.
Furthermore, the demurrage mechanism affects electricity cost of the prosumers when energy is hoarded and increases cost when consumers delay purchasing energy at the agreed time. These effects depend on the agreement made by the prosumers and the consumers involved in the energy trading process.

7.5. Performance with Different Numbers of Customers Involved in P2P Sharing of Energy

In reality, it is almost impossible to find all the customers participating in local energy trading. Some might wish to be involved in local energy trading while others do not. In this study, we consider different numbers of customers participating in energy trading to carry out the evaluation. The number of customers in the evaluation varies from “0” to “100”, with an interval of “20” as an increment. The number “100” means that all the customers are prosumers, while the number “0” implies that all the customers are not participating in local energy trading. We assume that the PV power generations of all the prosumers are the same and that the energy consumptions are also the same. As depicted in Figure 13, a decrease in the number of customers participating in energy trading increases the self-consumption of energy. According to Equation (28), in terms of self-sufficiency, when the number of customers participating in energy trading increases, the self-sufficiency of energy also increases.

8. Conclusions and Future Work

In this work, we propose an LEM using private blockchain within a small community with many PV systems. In this research, users perform trading using a simple exchange mechanism to eradicate the problem of auctions, as stated in the literature. A dynamic pricing model and HEM system are introduced to increase economic benefits at both the community and individual levels. The simulation findings demonstrate that the proposed method reduces electricity cost and optimizes energy consumption, especially at peak hours. With CPP, the electricity costs are reduced up to 44.73% when the scheduling algorithm is applied. It reduced the electricity cost up to 65.17% when the P2P price model and demurrage are used. Furthermore, it reduced the electricity cost up to 51.80% when applying the P2P pricing model and the scheduling algorithm with demurrage at peak hours. Similarly, with the RTP scheme, the proposed method that implements the P2P price model with demurrage mechanism and scheduling algorithm reduces the electricity cost up to 44.37% as compared to 28.55% when scheduling algorithm is used and to 35.09% when P2P pricing model with demurrage mechanism is applied at peak hours. Moreover, the proposed method achieves optimal electricity cost for each time slot as compared to the utility prices and falls within the FR range. Additionally, the proposed model balances the local energy demand and generation of households without violating the customers’ comfort. Furthermore, security vulnerability analysis is carried out, and the results show that the energy trading smart contract is secure and bug-free against the known vulnerabilities and attacks.
In the future, penalty policy will be incorporated to evaluate prediction deviations in the forecast profile and to improve trading within the neighborhoods. Additionally, a robust mechanism will be developed to solve the issues of the creation of rebounce in off-peak hours.

Author Contributions

All authors discussed and agreed on the idea and scientific contributions. A.S.Y., F.A.A. and N.J. proposed the idea and wrote system model. They also performed simulations and wrote simulation section. A.R. did mathematical modeling in the manuscript. I.U., A.S. and M.S. contributed in manuscript writing and revisions. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the National Research Foundation of Korea (NRF) through the Brain Korea 21 Plus Program under Grant 22A20130012814.

Conflicts of Interest

The author declares no conflict of interest.

Nomenclature

APIApplication User Interface
BESBattery Energy Storage
CDAContinous Double Auction
EVElectric Vehicle
FRFeasible Region
DDoSDistributed Denial of Service
DERDistributed Energy Resources
DoSDenial of Service
DSMDemand Side Management
DRDemand Response
HEMHome Energy Management System
LEMLocal Energy Market
LVLow Voltage
MVMedium Voltage
NRESNonrenewable Energy Sources
P2PPeer-to-Peer
PVPhotovoltaic
RESRenewable Energy Source
SDNSoftware-Defined Network
SMESSuperconducting Magnetic Energy Storage
SDRSupply and Demand Ratio
TODTransaction-Ordering Dependence
Y a p ( t ) Appliance status
y i Adjusted energy consumption
α Compensation price
C o s t ( y i ( t ) ) Cost function for customers
T P Customers energy consumption
β Demurrage value
α b u y ( t ) Main grid buying price at time t
α s e l l ( t ) Main grid selling price at time t
M i ( t ) Minimum power generated on-site between generated and load profile
N P Net power for both customers
N B Number of prosumers in the network
N s h i f t a b l e Number of shiftable appliances
N n o n s h i f t a b l e Number of non-shiftable appliances
ρ Appliance power rating
E a P r i c e ( t ) Price of electric energy consumed
P r b u y ( t ) Prosumer’s buying price at t
P r b u y β ( t ) Prosumer’s buying price at t with demurrage
P r s e l l ( t ) Prosumer’s selling price at time t
P r s e l l β ( t ) Prosumer’s selling price at time t with demurrage
P i ( t ) PV energy generated at ith prosumer in a time slot t
S s h i f t a b l e Set of shiftable household appliances
S n o n s h i f t a b l e Set of non-shiftable household appliances
S D R ( t ) Supply and demand ratio
tTime slot
T B P ( t ) Total buying power
P c o n s u m p t i o n Total consumption of energy for both non-shiftable and shiftable appliances
C o s t ( i ) Total cost for all consumers
N a Total number of appliances in smart home
T S P ( t ) Total selling power

References

  1. Akorede, M.F.; Hizam, H.; Pouresmaeil, E. Distributed energy resources and benefits to the environment. Renew. Sustain. Energy Rev. 2010, 14, 724–734. [Google Scholar] [CrossRef]
  2. Zhang, C.; Wu, J.; Zhou, Y.; Cheng, M.; Long, C. Peer-to-Peer energy trading in a Microgrid. Appl. Energy 2018, 220, 1–12. [Google Scholar] [CrossRef]
  3. Hamari, J.; Sjöklint, M.; Ukkonen, A. The sharing economy: Why people participate in collaborative consumption. J. Assoc. Inf. Sci. Technol. 2016, 67, 2047–2059. [Google Scholar] [CrossRef]
  4. Monacchi, A.; Elmenreich, W. Assisted energy management in smart microgrids. J. Ambient Intell. Humaniz. Comput. 2016, 7, 901–913. [Google Scholar] [CrossRef] [Green Version]
  5. Nieße, A.; Lehnhoff, S.; Tröschel, M.; Uslar, M.; Wissing, C.; Appelrath, H.J.; Sonnenschein, M. Market-based self-organized provision of active power and ancillary services: An agent-based approach for smart distribution grids. In Proceedings of the 2012 Complexity in Engineering (COMPENG) Proceedings, Aachen, Germany, 11–13 June 2012; pp. 1–5. [Google Scholar]
  6. Hanna, R.; Ghonima, M.; Kleissl, J.; Tynan, G.; Victor, D.G. Evaluating business models for microgrids: Interactions of technology and policy. Energy Policy 2017, 103, 47–61. [Google Scholar] [CrossRef]
  7. Prete, C.L.; Hobbs, B.F. A cooperative game theoretic analysis of incentives for microgrids in regulated electricity markets. Appl. Energy 2016, 169, 524–541. [Google Scholar] [CrossRef] [Green Version]
  8. Mihaylov, M.; Jurado, S.; Avellana, N.; Van Moffaert, K.; De Abril, I.M.; Nowé, A. NRGcoin: Virtual currency for trading of renewable energy in smart grids. In Proceedings of the 11th International conference on the European energy market (EEM14), Cracow, Poland, 28–30 May 2014; pp. 1–6. [Google Scholar]
  9. Alam, M.T.; Li, H.; Patidar, A. Bitcoin for smart trading in smart grid. In Proceedings of the 21st IEEE International Workshop on Local and Metropolitan Area Networks, Beijing, China, 22–24 April 2015; pp. 2451–2458. [Google Scholar]
  10. Sikorski, J.J.; Haughton, J.; Kraft, M. Blockchain technology in the chemical industry: Machine-to-machine electricity market. Appl. Energy 2017, 195, 234–246. [Google Scholar] [CrossRef]
  11. Green, J.; Newman, P. Citizen utilities: The emerging power paradigm. Energy Policy 2017, 105, 283–293. [Google Scholar] [CrossRef]
  12. Wang, J.; Wang, Q.; Zhou, N.; Chi, Y. A novel electricity transaction mode of microgrids based on blockchain and continuous double auction. Energies 2017, 10, 1971. [Google Scholar] [CrossRef] [Green Version]
  13. Blouin, M.R.; Serrano, R. A decentralized market with common values uncertainty: Non-steady states. Rev. Econ. Stud. 2001, 68, 323–346. [Google Scholar] [CrossRef] [Green Version]
  14. Block, C.; Neumann, D.; Weinhardt, C. A market mechanism for energy allocation in micro-chp grids. In Proceedings of the 41st Annual Hawaii International Conference on System Sciences (HICSS 2008), Waikoloa, HI, USA, 7–10 January 2008; p. 172. [Google Scholar]
  15. Li, Z.; Kang, J.; Yu, R.; Ye, D.; Deng, Q.; Zhang, Y. Consortium blockchain for secure energy trading in industrial internet of things. IEEE Trans. Ind. Inform. 2017, 14, 3690–3700. [Google Scholar] [CrossRef] [Green Version]
  16. Kang, J.; Yu, R.; Huang, X.; Maharjan, S.; Zhang, Y.; Hossain, E. Enabling localized peer-to-peer electricity trading among plug-in hybrid electric vehicles using consortium blockchains. IEEE Trans. Ind. Inform. 2017, 13, 3154–3164. [Google Scholar] [CrossRef]
  17. Caciotta, M.; Leccese, F.; Trifirò, T. From power quality to perceived power quality. In Proceedings of the IASTED International Conference on Energy and Power Systems EPS, Chiang Mai, Thailand, 29–31 March 2006. PDF 526-119. [Google Scholar]
  18. Leccese, F. Rome: A first example of perceived power quality of electrical energy. In Proceedings of the Seventh IASTED International Conference on Power and Energy Systems EuroPES, Palma de Mallorca, Spain, 29–31 August 2007; pp. 29–31. [Google Scholar]
  19. Caciotta, M.; Leccese, F.; Trifirò, A. The perceived power quality of electrical energy: An assessment in Italy. In Proceedings of the XVIII IMEKO WORLD CONGRESS, Metrology for a Sustainable Development, Rio de Janeiro, Brazil, 17–22 September 2006; pp. 17–22. [Google Scholar]
  20. Aitzhan, N.Z.; Svetinovic, D. Security and privacy in decentralized energy trading through multi-signatures, blockchain and anonymous messaging streams. IEEE Trans. Dependable Secur. Comput. 2016, 15, 840–852. [Google Scholar] [CrossRef]
  21. Luo, F.; Dong, Z.Y.; Liang, G.; Murata, J.; Xu, Z. A distributed electricity trading system in active distribution networks based on multi-agent coalition and blockchain. IEEE Trans. Power Syst. 2018, 34, 4097–4108. [Google Scholar] [CrossRef]
  22. Pop, C.; Cioara, T.; Antal, M.; Anghel, I.; Salomie, I.; Bertoncini, M. Blockchain based decentralized management of demand response programs in smart energy grids. Sensors 2018, 18, 162. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  23. Thakur, S.; Breslin, J.G. Peer to peer energy trade among microgrids using blockchain based distributed coalition formation method. Technol. Econ. Smart Grids Sustain. Energy 2018, 3, 5. [Google Scholar] [CrossRef] [Green Version]
  24. Park, L.W.; Lee, S.; Chang, H. A sustainable home energy prosumer-chain methodology with energy tags over the blockchain. Sustainability 2018, 10, 658. [Google Scholar] [CrossRef] [Green Version]
  25. Noor, S.; Yang, W.; Guo, M.; Van Dam, K.H.; Wang, X. Energy Demand Side Management within micro-grid networks enhanced by blockchain. Appl. Energy 2018, 228, 1385–1398. [Google Scholar] [CrossRef]
  26. Ferreira, J.C.; Martins, A.L. Building a community of users for open market energy. Energies 2018, 11, 2330. [Google Scholar] [CrossRef] [Green Version]
  27. Sharma, P.K.; Park, J.H. Blockchain based hybrid network architecture for the smart city. Future Gener. Comput. Syst. 2018, 86, 650–655. [Google Scholar] [CrossRef]
  28. Pipattanasomporn, M.; Kuzlu, M.; Rahman, S. A Blockchain-based Platform for Exchange of Solar Energy: Laboratory-scale Implementation. In Proceedings of the 2018 International Conference and Utility Exhibition on Green Energy for Sustainable Development (ICUE), Phuket, Thailand, 24–26 October 2018; pp. 1–9. [Google Scholar]
  29. Bayram, I.S.; Shakir, M.Z.; Abdallah, M.; Qaraqe, K. A survey on energy trading in smart grid. In Proceedings of the 2014 IEEE Global Conference on Signal and Information Processing (GlobalSIP), Atlanta, GA, USA, 3–5 December 2014; pp. 258–262. [Google Scholar]
  30. Mengelkamp, E.; Notheisen, B.; Beer, C.; Dauer, D.; Weinhardt, C. A blockchain-based smart grid: Towards sustainable local energy markets. Comput. Sci. Res. Dev. 2018, 33, 207–214. [Google Scholar] [CrossRef]
  31. Mengelkamp, E.; Bose, S.; Kremers, E.; Eberbach, J.; Hoffmann, B.; Weinhardt, C. Increasing the efficiency of local energy markets through residential demand response. Energy Inform. 2018, 1, 11. [Google Scholar] [CrossRef]
  32. Long, C.; Wu, J.; Zhou, Y.; Jenkins, N. Peer-to-peer energy sharing through a two-stage aggregated battery control in a community Microgrid. Appl. Energy 2018, 226, 261–276. [Google Scholar] [CrossRef]
  33. Khalid, A.; Aslam, S.; Aurangzeb, K.; Haider, S.I.; Ashraf, M.; Javaid, N. An efficient energy management approach using fog-as-a-service for sharing economy in a smart grid. Energies 2018, 11, 3500. [Google Scholar] [CrossRef] [Green Version]
  34. Nick, S. Smart Contracts, 1994. Available online: http://szabo.best.vwh.net/smart.contracts.html (accessed on 4 January 2018).
  35. Christidis, K.; Devetsikiotis, M. Blockchains and smart contracts for the internet of things. IEEE Access 2016, 4, 2292–2303. [Google Scholar] [CrossRef]
  36. Samuel, O.; Javaid, S.; Javaid, N.; Ahmed, S.H.; Afzal, M.K.; Ishmanov, F. An efficient power scheduling in smart homes using Jaya based optimization with time-of-use and critical peak pricing schemes. Energies 2018, 11, 3155. [Google Scholar] [CrossRef] [Green Version]
  37. Khan, Z.A.; Zafar, A.; Javaid, S.; Aslam, S.; Rahim, M.H.; Javaid, N. Hybrid meta-heuristic optimization based home energy management system in smart grid. J. Ambient Intell. Humaniz. Comput. 2019, 10, 4837–4853. [Google Scholar] [CrossRef]
  38. Gans, J.; King, S.; Stonecash, R.; Mankin, N.G. Principles of Economics; Cengage Learning: Boston, MA, USA, 2011. [Google Scholar]
  39. Devine, M.T.; Cuffe, P. Blockchain electricity trading under demurrage. IEEE Trans. Smart Grid 2019, 10, 2323–2325. [Google Scholar] [CrossRef]
  40. Luthander, R.; Widén, J.; Nilsson, D.; Palm, J. Photovoltaic self-consumption in buildings: A review. Appl. Energy 2015, 142, 80–94. [Google Scholar] [CrossRef] [Green Version]
  41. Atzei, N.; Bartoletti, M.; Cimoli, T. A survey of attacks on ethereum smart contracts (sok). In International Conference on Principles of Security and Trust; Springer: Berlin/Heidelberg, Germany, 2017. [Google Scholar]
  42. Nizamuddin, N.; Hasan, H.; Salah, K.; Iqbal, R. Blockchain-based framework for protecting author royalty of digital assets. Arab. J. Sci. Eng. 2019, 44, 3849–3866. [Google Scholar] [CrossRef]
  43. GitHub. Ethereum Smart Contract Best Practices: Known Attacks. 2018. Available online: https://consensys.github.io/smart-contract-best-practices/known_attacks/ (accessed on 28 November 2019).
  44. Luu, L.; Chu, D.H.; Olickel, H.; Saxena, P.; Hobor, A. Making smart contracts smarter. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security (CCS 16), Vienna, Austria, 24–28 October 2016; pp. 254–269. [Google Scholar]
  45. Nord Pool. Price Development. 2020. Available online: https://www.nordpoolgroup.com/ (accessed on 11 January 2020).
Figure 1. Technologies in Distributed Energy Resource (DER): Superconducting Magnetic Energy Storage (SMES), Photovoltaics (PV), and Battery Energy Storage (BES).
Figure 1. Technologies in Distributed Energy Resource (DER): Superconducting Magnetic Energy Storage (SMES), Photovoltaics (PV), and Battery Energy Storage (BES).
Sustainability 12 03385 g001
Figure 2. Proposed system model.
Figure 2. Proposed system model.
Sustainability 12 03385 g002
Figure 3. Blockchain-based architecture for decentralized LEM.
Figure 3. Blockchain-based architecture for decentralized LEM.
Sustainability 12 03385 g003
Figure 4. Relationship between the supply and demand ratio and the price with compensation.
Figure 4. Relationship between the supply and demand ratio and the price with compensation.
Sustainability 12 03385 g004
Figure 5. Energy generation and demand for 24 h from a prosumer.
Figure 5. Energy generation and demand for 24 h from a prosumer.
Sustainability 12 03385 g005
Figure 6. (a) Internal Prices with Critical Peak Price (CPP) for buying and selling with demurrage and without demurrage; (b) internal prices with Real-Time Price (RTP) for buying and selling with demurrage and without demurrage.
Figure 6. (a) Internal Prices with Critical Peak Price (CPP) for buying and selling with demurrage and without demurrage; (b) internal prices with Real-Time Price (RTP) for buying and selling with demurrage and without demurrage.
Sustainability 12 03385 g006
Figure 7. Energy demand for a single household with scheduled and unscheduled consumption.
Figure 7. Energy demand for a single household with scheduled and unscheduled consumption.
Sustainability 12 03385 g007
Figure 8. Net load of the prosumer.
Figure 8. Net load of the prosumer.
Sustainability 12 03385 g008
Figure 9. (a) Electricity cost for a single household with scheduled and unscheduled consumption using CPP; (b) electricity cost of scheduled, scheduled with demurrage, and unscheduled without demurrage using CPP.
Figure 9. (a) Electricity cost for a single household with scheduled and unscheduled consumption using CPP; (b) electricity cost of scheduled, scheduled with demurrage, and unscheduled without demurrage using CPP.
Sustainability 12 03385 g009aSustainability 12 03385 g009b
Figure 10. (a) Electricity cost for a single household with scheduled and unscheduled consumption using RTP; (b) electricity cost of scheduled, scheduled with demurrage, and unscheduled without demurrage using RTP.
Figure 10. (a) Electricity cost for a single household with scheduled and unscheduled consumption using RTP; (b) electricity cost of scheduled, scheduled with demurrage, and unscheduled without demurrage using RTP.
Sustainability 12 03385 g010
Figure 11. (a) Comparison of total P2P cost with demurrage, total P2P and scheduled cost with demurrage, total cost scheduled without demurrage, and total unscheduled cost using CPP; (b) comparison of consumer cost, prosumer cost and profit, and prosumer profit using CPP.
Figure 11. (a) Comparison of total P2P cost with demurrage, total P2P and scheduled cost with demurrage, total cost scheduled without demurrage, and total unscheduled cost using CPP; (b) comparison of consumer cost, prosumer cost and profit, and prosumer profit using CPP.
Sustainability 12 03385 g011
Figure 12. (a) Comparison of total P2P cost with demurrage, total P2P and scheduled cost with demurrage, total cost scheduled without demurrage, and total unscheduled cost using RTP; (b) comparison of consumer cost, prosumer cost and profit, and prosumer profit using RTP.
Figure 12. (a) Comparison of total P2P cost with demurrage, total P2P and scheduled cost with demurrage, total cost scheduled without demurrage, and total unscheduled cost using RTP; (b) comparison of consumer cost, prosumer cost and profit, and prosumer profit using RTP.
Sustainability 12 03385 g012
Figure 13. Performance metric with varying number of customers participating in energy trading.
Figure 13. Performance metric with varying number of customers participating in energy trading.
Sustainability 12 03385 g013
Table 1. Summary of the Related Work.
Table 1. Summary of the Related Work.
Types of Blockchain/TechniquesObjectivesResearch AchievementsLimitations
Public blockchain [8]Improve local energy generation and increase interaction between prosumers and power plantProposed an NRGcoin model that allows locally generated renewable energy to be sold using digital currency in the smart gridElectricity cost minimization is not considered
Public blockchain and CDA [12]Improve energy market designProposed an adaptive aggressive strategy in a microgrid using blockchain-based CDA, putting forward a new perspective on an energy marketThere is an inadequate flexibility to change the bid quantity during the CDA bid process
Stackelberg game and permissioned blockchain [15]Maximize the bank utility credit-based loansProposed a secure credit-based payment scheme by reducing wait time on transaction confirmation of the energy chain for permissioned blockchain-based IIoTsProfit and energy optimization is not considered
Consortium blockchain and iterative double auction [16]Improve privacy and security of the transaction and maximize social welfareThe authors proposed a PETCON model to conduct secure private P2P trading of energy between plugin hybrid electric vehiclesElectricity cost is not considered
Public blockchain and encryption algorithms [20]Improve privacy and security of the transactionProvide a decentralized secure transaction in smart grid by using blockchain technologyProfit maximization is out of the scope of this research
Public blockchain and multi-agent coalition [21]Maximize usage of renewable energyProposed a system of distributed energy trading to encourage P2P sharing of electricity among prosumersElectricity cost is not considered
Public blockchain and smart contract [22]Address energy demand and supply problemA distributed approach to control DR systems in smart grid context is proposedSpeed of the transaction is not considered
Public blockchain [23]Improve energy tradingProposed a decentralized, scalable, and secure blockchain-based network for coalition structure creation and microgrid energy tradingFixing price for the trading is almost impossible
Smart contract and public blockchain [24]Improve energy tradingProvide an energy trading model that will facilitate a sustainable transaction of energy ecosystems among smart homes’ consumers and prosumersEnergy and profit optimizations are not considered
Public blockchain and noncooperative game theoretic approach [25]Decrease the peak to average ratio and smoothen the fluctuation in profile of the energy load consumptionProposed an enhanced blockchain approach for implementing a distributed microgrid network that handled the micro-payment required along with the exchange of energy and informationPrivacy has been highlighted as a major barrier to customer engagement in this research
Public blockchain [26]Improve energy tradingProposed an Internet of Things (IoT) system to account for power flows as well as a blockchain platform to resolve the need for a centralized entityDeployment efficiency is not discussed
Public blockchain andsmart contract [27]Improve privacy and securityA new approach for smart city network architecture is proposed. The architecture combines the benefits of blockchain technology and emerging Software-Defined Network (SDN)There are still some issues that are left unresolved, such as memory scalability, high latency, and efficient deployment of edge nodes
Private blockchain [30]Minimize electricity cost in the local marketProposed a decentralized market mechanism using a private blockchainSelling surplus energy through auction or bidding is logically impossible
Scheduling algorithms [31]Electricity costminimizationProposed an LEM by integrating DRPrivacy leakage, security concern, and single point of failure
SDR method with compensation price [32]Electricity cost minimizationProposed P2P sharing of energy in a neighborhood with several PV storage systemsPrivacy leakage, security concern, and single point of failure
Table 2. Comparison with existing work. ✓: considered; X: not considered.
Table 2. Comparison with existing work. ✓: considered; X: not considered.
ReferencesBlockchainDemurrage MechanismSDRScheduling
Base Paper 1 [30]XXX
Base Paper 2 [31]XXX
Base Paper 3 [32]XXX
Proposed Model
Table 3. Specification of appliances [36]. LoT: Length of Operational Time.
Table 3. Specification of appliances [36]. LoT: Length of Operational Time.
Appliances TypesName of ApplianceTime Starts (Hour)Time Ends (Hour)Power Rating (kW)LoT (Hour)
ShiftableAir conditioner12241.0010.00
ShiftableCloth dryer06141.504.00
ShiftableDish washer08221.000.50
ShiftableElectric vehicle16242.502.50
ShiftableHair dryer06131.001.50
ShiftableIron06161.000.50
ShiftablePool pump12212.008.00
ShiftableRefrigerator06150.12524.00
ShiftableTelevision01160.256.75
ShiftableVacuum cleaner06151.000.50
ShiftableWater heater06231.503.00
ShiftableOther06241.502.00
Non-shiftableElectric stove06141.505.00
Non-shiftableHeater03151.503.00
Non-shiftableLight16240.506.25
Non-shiftablePersonal computer08240.254.00
Table 4. Report of the security vulnerability analysis using oyente tool for energy trading smart contract. Ethereum Virtual Machine (EVM)
Table 4. Report of the security vulnerability analysis using oyente tool for energy trading smart contract. Ethereum Virtual Machine (EVM)
ParametersEnergy Transaction Contract
EVM Code Coverage42.4%
Integer UnderflowFalse
Integer OverflowFalse
Parity Multisig Bug 2False
Callstack Depth Attack VulnerabilityFalse
Transaction-Ordering Dependence (TOD)False
Timestamp DependencyFalse
Re-Entrancy VulnerabilityFalse
Table 5. Parameters of the model.
Table 5. Parameters of the model.
ParametersValue
S D R 0.5
[ m i n m a x ] [10 16]
T24
N100
N a 16
Table 6. Cases formulated for CPP.
Table 6. Cases formulated for CPP.
CasesLoadPrice CPPCost CPPPrice at Agreed TimeCost at Agreed Time
Minimum load, Maximum price1.00 kWh895.00 Cents895.00 Cents60.00 Cents60.00 Cents
Minimum load, Minimum price1.00 kWh11.40 Cents11.40 Cents10.40 Cents10.40 Cents
Maximum load, Minimum price13.25 kWh11.40 Cents151.05 Cents10.40 Cents137.80 Cents
Maximum load, Maximum price13.25 kWh895.00 Cents11,858.75 Cents60.00 Cents792.00 Cents
Table 7. Cases formulated for RTP.
Table 7. Cases formulated for RTP.
CasesLoadPrice RTPCost RTPPrice at Agreed TimeCost at Agreed Time
Minimum load, Maximum price1.00 kWh390.00 Cents390.00 Cents30.00 Cents30.00 Cents
Minimum load, Minimum price1.00 kWh10.63 Cents10.63 Cents10.40 Cents10.40 Cents
Maximum load, Minimum price13.25 kWh10.63 Cents140.85 Cents10.40 Cents137.80 Cents
Maximum load, Maximum price13.25 kWh390.00 Cents5167.50 Cents30.00 Cents397.50 Cents

Share and Cite

MDPI and ACS Style

Yahaya, A.S.; Javaid, N.; Alzahrani, F.A.; Rehman, A.; Ullah, I.; Shahid, A.; Shafiq, M. Blockchain Based Sustainable Local Energy Trading Considering Home Energy Management and Demurrage Mechanism. Sustainability 2020, 12, 3385. https://doi.org/10.3390/su12083385

AMA Style

Yahaya AS, Javaid N, Alzahrani FA, Rehman A, Ullah I, Shahid A, Shafiq M. Blockchain Based Sustainable Local Energy Trading Considering Home Energy Management and Demurrage Mechanism. Sustainability. 2020; 12(8):3385. https://doi.org/10.3390/su12083385

Chicago/Turabian Style

Yahaya, Adamu Sani, Nadeem Javaid, Fahad A. Alzahrani, Amjad Rehman, Ibrar Ullah, Affaf Shahid, and Muhammad Shafiq. 2020. "Blockchain Based Sustainable Local Energy Trading Considering Home Energy Management and Demurrage Mechanism" Sustainability 12, no. 8: 3385. https://doi.org/10.3390/su12083385

APA Style

Yahaya, A. S., Javaid, N., Alzahrani, F. A., Rehman, A., Ullah, I., Shahid, A., & Shafiq, M. (2020). Blockchain Based Sustainable Local Energy Trading Considering Home Energy Management and Demurrage Mechanism. Sustainability, 12(8), 3385. https://doi.org/10.3390/su12083385

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