[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

A Blockchain-based Co-Simulation Platform for Transparent and Fair Energy Trading and Management

Ye Chen, Santa Clara University, USA, ychen40@scu.edu
Peilin Wu, Shenzhen University, China, wupeilin2021@email.szu.edu.cn
Yuanliang Li, Concordia University, Canada, yuanliang.li@concordia.ca
Peng Zhang, Shenzhen University, China, zhangp@szu.edu.cn
Jun Yan, Concordia University, Canada, jun.yan@concordia.ca
Mohsen Ghafouri, Concordia University, Canada, mohsen.ghafouri@concordia.ca
Yuhong Liu, Santa Clara University, USA, yhliu@scu.edu

With the rapid adoption of renewable energy and smart meters, more distributed energy consumers are becoming capable of generating energy and participating in energy trading. However, it raises great challenges to establish trust among these distributed energy sources. A more transparent and fair energy trading market is required. With its unique advantages in supporting fair and transparent transactions, blockchain is recognized as an effective solution to facilitate distributed energy transactions. However, existing studies often propose blockchain-based energy trading schemes without considering the management of energy generation, consumption, and transmission. In addition, the sensitive nature of the power grid may make the grid operators hesitate to adopt anyone to directly access the energy trading market. Therefore, in this study, we adopt a permission-based blockchain, Hyper-ledger Fabric, to establish a fair and transparent distributed energy trading market, due to its strong access control and efficient consensus mechanism. Furthermore, the proposed blockchain-based energy trading market is integrated with the Packetized Energy Management and Trading Co-Simulation platform (PEMT-CoSim), developed by our prior work, so that a holistic co-simulation platform is established to facilitate further studies by closely coordinating energy trading and management. The demonstration results based on the proposed blockchain-based co-simulation platform are discussed in detail, which validate the effectiveness of the proposed architecture.

CCS Concepts:Computer systems organization → Embedded systems; Redundancy;Computer systems organization~Robotics;Networks~Network reliability;

Keywords: Packetized Energy, Transactive Energy, Smart Grid, Blockchain, co-simulation, Fair Trading

ACM Reference Format:
Ye Chen, Peilin Wu, Yuanliang Li, Peng Zhang, Jun Yan, Mohsen Ghafouri, and Yuhong Liu. 2023. A Blockchain-based Co-Simulation Platform for Transparent and Fair Energy Trading and Management. In The 5th ACM International Symposium on Blockchain and Secure Critical Infrastructure (BSCI '23), July 10--14, 2023, Melbourne, VIC, Australia. ACM, New York, NY, USA 10 Pages. https://doi.org/10.1145/3594556.3594627

1 INTRODUCTION

The penetration of renewable energy has promoted the transition of traditional energy consumers to prosumers who also own and manage distributed energy resources (DERs) in the smart grid. These prosumers can actively participate in the transactive energy (TE) market either as a seller when excessive energy is generated or a buyer when additional energy consumption needs to be satisfied. However, the conventional energy market is typically controlled by a central party, leading to low transparency in the pricing structure and potential unfairness in determining which user can sell/buy energy with a higher priority. Recently, blockchain-related technology has been recognized as a promising solution to facilitate a more decentralized, transparent, and fair market. Diverse blockhain-related architectures are proposed [2, 3, 11, 13, 14, 17, 20, 29, 31, 32].

Although many studies directly build their systems in public blockchains (e.g., BitCoin, Ethereum) for easy deployment and validation, the openness of these public blockchain platforms also introduces various security and privacy risks. Due to the sensitive nature of the power grid, we propose to adopt a permission-based blockchain, Hyper-ledger Fabric, on which only authorized users are able to participate in the market. But since Fabric does not issue digital currency, additional designs are required to allow exchanges between the tokens used by Fabric and digital currencies generally accepted by individual users. Therefore, we further propose a cross-chain protocol to handle such asset exchanges.

More importantly, due to the complexity of the problem, most existing studies handle the blockchain-based energy trading market independently from the management of energy generation, consumption, and transmission, making it very difficult to perform a holistic study on how to coordinate these components to optimize social welfare while ensuring fairness for all participants. Specifically, most existing studies only focus on the blockchain-based energy trading process, while ignoring two important aspects. The first one is the energy management aspect, such as how prosumers adjust their energy generation and consumption behaviors based on the bidding results and how such behavior will influence the next round bidding process. The separation of energy trading from energy management can significantly limit the realisticity of the developed energy trading market. The second aspect ignored by existing studies is the fairness issue of energy trading, as to whether all auction participants will follow the bidding results in an honest way. In particular, whether a seller will honestly deliver the committed amount of energy to the buyer, and whether a buyer will honestly provide payment for the received energy. In existing studies, due to the lack of connection between the blockchain-based trading system and the energy management system, it is impossible for the blockchain system to validate the actual delivery of the traded energy, leaving transaction fairness as an open issue.

The solution to both of these two issues requires the blockchain-based energy trading system to be able to interact with a realistic energy management system in real-time. In the energy domain, due to the high costs of establishing a real grid system, many researchers utilize co-simulation platforms [16][5] for data generation and validation. In this work, we propose to integrate the blockchain-based energy trading system with the Transactive Energy Simulation Platform (TESP) developed by the Pacific Northwest National Laboratory (PNNL), which can synchronize different simulation modules (also named federates), such as domain-specific simulation tools (e.g., GridLAB-D for distribution systems, PYPOWER for transmission systems, PSST for wholesale power markets, and NS-3 for communication systems), sample prosumer agents for controlling common DERs(e.g., HVAC units, electric water heaters, and electric vehicle chargers), communication modules, weather modules and etc. This effort enables us to design and validate the blockchain-based TE market in a more realistic way. Furthermore, by connecting blockchain with the physical energy grid, it also allows the proposed system to validate the actual delivery of the traded energy to ensure fair transactions.

The code of this platform is available at the GitHub 1and the major contributions are summarized as follows.

  • We build the proposed blockchain-based TE market on top of TESP, an open-source energy co-simulation platform, which provides a highly coordinated platform for energy trading and management. It enables us to not only design and validate the blockchain-based TE market in a more realistic setting, but also close the loop to ensure the transparency and fairness of energy trading by tracking the actual energy delivery.
  • We propose to adopt a permission-based blockchain, Fabric, to establish the TE market, which protects the security of the smart grid by only allowing authenticated users to participate.
  • A sequence of smart contracts is proposed to ensure the transparency, fairness, and convenience of energy trading among individual prosumers. Specifically, a double-auction-based energy bidding contract is designed for the TE market by matching distributed energy generation with energy demand. An assets transaction contract is designed to ensure that an energy seller can obtain payment if and only if the correct amount of energy is delivered to the designated buyer. Finally, a Hashed Timelock Contract (HTLC) based cross-chain token exchange contract is designed to enable prosumers to securely and conveniently exchange their energy tokens with digital currencies.

2 RELATED WORK

In this section, we discuss related works from two aspects: (1) literature that focuses on transactive energy trading, and (2) literature that adopts blockchain architecture for energy trading.

2.1 Transactive Energy Trading

Transactive Energy (TE) trading provides a platform that matches prosumers using mutually accepted regulations and provides trading information to market participants [28]. There are some advantages of TE trading. First, it allows energy consumers to improve their economic benefits by purchasing energy from other prosumers at a lower price as compared to the tariff offered by Distribution System Operator (DSO) [8]. Second, by enabling flexible energy trading among prosumers, TE trading can effectively stimulate renewable energy generation and consumption, and contribute to social sustainable development[9].

Various game theoretical models are available to generate trading algorithms based on auction mechanisms [24], cooperative games [22][23], and non-cooperative games [21]. The most popular game theory is the auction mechanism that allows consumers and prosumers to trade energy according to their desired price. The use of a double auction mechanism for TE trading has resulted in better trading algorithms with unprecedented economic and technical benefits [24]. Therefore, in this work, we also adopt the double auction as the market auction mechanism.

Although some realistic cases are used to evaluate P2P energy trading market model and strategies, to the best of our knowledge, most of the P2P energy trading frameworks in the literature have ignored the energy injection and distribution, making it an open issue as to whether the bidding results are honestly committed by the prosumers involved. To address this issue, we develop an open-source energy co-simulation platform based on TESP, which integrates not only the energy trading market but also prosumers’ controls over their own energy generation and consumption. As a result, we are able to close the loop by tracking different prosumers’ energy generation and consumption behaviors to ensure that all energy transactions can be executed in an honest way.

2.2 Blockchain Architecture

Recently, blockchain technology has emerged as a viable solution to the aforementioned power grid challenges, due to its ability to provide decentralization, immutability, security and privacy, and transparency in power grids. As described in [25], there are three potential application scenarios to adopt Blockchain technology in power grids. The first one is a transactive energy trading, where prosumers in a community with excessive or surplus electricity can sell the extra energy to others [30][10]. The second one is power flow studies, which are helpful for planning and operating the power network [12][6]. The third one is to integrate electric vehicles (EVs) as either an electricity load or an energy provider [7].

Focusing on the transactive energy trading issue, many existing studies are proposed based on either permissionless or permission-based blockchain architectures. With the permissionless blockchain architecture (also named public blockchain), any user can participate in the energy trading market without being authenticated. For example, Ethereum is often used as a permissionless blockchain platform [17][31] due to its open nature and the support of smart contracts. However, the open nature of public blockchains also makes them more vulnerable to various security and privacy attacks. In addition, public blockchains often have to handle challenges from their scalability and efficiency [18].

Different from public blockchains, private blockchains allow only authorized users to enter the market. The process of granting access and verifying users can be done by an authorized entity, such as a Distribution System Operator (DSO). For example, a permission-based blockchain is configured in [15] for energy trading. Among different permission-based blockchains, the IBM Hyperledger Fabric [3] is often adopted by existing literature [2][29] due to its secured design and efficient consensus mechanism. In particular, Fabric is a permission-based blockchain platform, which involves a Certificate Authority (CA) to grant permissions, so that only authorized users can participate in the energy trading market.

Due to the sensitivity nature of the power grid, we propose to adopt a permission-based blockchain architecture to facilitate energy trading. Fabric is chosen since it provides smart contract support in the form of chain code, and offers better efficiency compared to other platforms due to its unique consensus protocol. Nevertheless, since Fabric supports only tokens, not cryptocurrency, which may limit prosumers’ capabilities to use their energy profits for more general purchases outside of Fabric. Therefore, we further adopt Ethereum and connect its cryptocurrency with Fabric token by a cross-chain swap protocol.

3 PRELIMINARIES

In this section, we will introduce some critical mechanisms or tools adopted by the proposed architecture.

3.1 Double Auction

Double auction is one of the most popular auction mechanisms adopted by existing energy trading market studies. It allows multiple participants to submit their bids for the desired product quantities and prices, and clears the market with one "market clearing price". In particular, the system will sort buyers’ bids in descending order and sellers’ bids in ascending order, where the order of the bids represents the trading priority of each participant. And the clearing price and the clearing quantity are derived by the intersection of the buyer and seller curves shown in Figure 1.

Figure 1 shows the possible scenarios of double auctions in the transactive energy market [4]. The horizontal axis represents product quantities, and the vertical axis means the bidding prices. Each subplot has two step charts, representing the supply side (i.e., the red curve) and the demand side (i.e., the blue curve). Each "step" denotes a unique bidding price and quantity, which can also be an aggregated result of multiple participants’ bids as long as their bidding prices are identical. Specifically, for each "step", its height represents the bidding price, whereas its width represents the aggregated quantity. As shown in Figure 1, the market sorts the buyers in descending order and the sellers in ascending order based on their bidding prices. When the demand and supply curves intersect, the market can be cleared at the intersection point, whose x-axis and y-axis represent the clearing quantities and prices respectively. If the intersection of these two curves involves a line rather than a single point, the determination of clearing price and quantities should follow the instructions in [4].

Figure 1
Figure 1: Possible situations of double auction.

In this study, the proposed blockchain-based TE market adopts double auction as the market mechanism.

3.2 Packetized Energy

Packetized energy is a new concept proposed by Rezaei et al. [1] for electricity management. In particular, by packetizing the continuous energy flow into small and discrete "energy packets", Packetized Energy Management (PEM) allows the power grid to balance the energy load and supply to improve its reliability while maximizing the utilization of renewable energy without requiring massive amounts of energy storage [1]. Furthermore, by including the energy source and destination information in each "energy packet", it enables blockchain to track whether a particular energy supplier has successfully completed its commitment for energy delivery. As a result, we are able to ensure the fairness of energy trading, meaning that an energy supplier can only get paid for the amount of energy he/she has successfully delivered. Therefore, in this study, we adopt the concept of packetized energy in the energy trading market.

3.3 The Co-Simulation Platform

The Co-Simulation platform adopted by this study is based on the Transactive Energy Simulation Platform (TESP), an energy simulation platform developed by Pacific Northwest National Laboratory [16]. Specifically, TESP integrates a comprehensive set of simulation modules (also named federates) through a Hierarchical Engine for Large-scale Infrastructure Co-Simulation (HELICS) [27], which can synchronize different federates and transmit messages among them. For example, GridLAB-D is utilized to simulate the power distribution system; and PYPOWER, MATPOWER/MOST, or AMES is used to simulate the bulk power system and the transmission system operator (TSO). EnergyPlus is designed for simulating large commercial buildings and ns-3 is a communication system simulator that can also host software agents [26]. In addition, TESP also provides several built-in transactive energy examples with a well-organized software package so that researchers can easily deploy the platform and get familiar with transactive energy operations.

Based on TESP, in our prior work, we further developed PEMT-CoSim [19], a set of federates for Packetized Energy Management (PEM) and Packetized Energy Trading (PET). The overview architecture is shown in Figure 2. Specifically, the orange highlighted part is the newly developed PEMT-CoSim federates, which include (1) a PEM controller and a coordinator to facilitate the control and management of packetized energy, (2) a PET market that adopts double auction as the main market mechanism, (3) PET prosumers who participate in the packetized energy trading process, and the AI module which can facilitate individual prosumers’ decision making on their energy consumption and trading strategies, and (4) a federate helper that bridges the newly developed PEMT-CoSim with the TESP platform.

Figure 2
Figure 2: The Architecture of PEMT-CoSim

4 THE PROPOSED BLOCKCHAIN-BASED ENERGY TRADING SYSTEM

Based on the co-simulation platform developed from our prior work, in this study, we propose to further integrate blockchain with the PET market, so that (1) prosumers can participate in the packetized energy trading process in a more transparent and distributed way; (2) the bidding results will not only be stored in the blockchain as a non-repudiated record but also transmitted to the PEM controller for energy transmission; and most importantly, (3) the energy delivery results will be monitored by each PET prosumer agent and returned to the blockchain smart contracts as evidence to ensure the fairness of the energy transaction.

In this rest part of this section, we will first present an overview of the proposed architecture and then discuss the key components in detail. Key notations are described in Table 1.

Table 1: Key notations
Notation Definition
Bi Buyers participating in the auction
Si Sellers participating in the auction
IDi User's identity information
R Constants for generating smart meter addresses
Pays The money buyers pay for energy
N Seller's liquidated damages
$E_s^i$ Total power consumption of the prosumer with IDi
Ethres Acceptable difference between received and cleared units
$E^i_{hvac}$ Energy load from HAVC of the prosumer with IDi
$E^i_{base}$ Base load (e.g., lightning) of the prosumer with IDi
$E^i_{batt}$ Battery charging load of the prosumer with IDi
$E^i_{solar}$ Generated solar energy of the prosumer with IDi

4.1 Overview of Proposed Architecture

The overview architecture of our system is shown in Figure 3. There are several major components, including a prosumer agent, which can operate as either a buyer agent or a seller agent, a blockchain-based packetized energy trading market. Next, we will briefly discuss each module and their interactions.

Figure 3
Figure 3: Overview of the proposed architecture

Prosumer Agent: Prosumer agents are the major participants in the proposed packetized energy trading market. Each prosumer possesses different types of energy load, including some basic loads (e.g., lighting or fridge) and some controllable loads (e.g., HVAC system or Electrical Vehicles), as well as some types of energy generator and storage, such as solar panel and battery. In addition, each prosumer agent is equipped with a smart meter, which can provide accurate readings of the house's energy consumption and generation data, respectively. By communicating with the blockchain smart contracts, these data can be monitored to verify if a seller has delivered the committed amount of energy to a specific buyer. Last but not least, each prosumer has a Fabric wallet connecting to the Fabric blockchain to send or receive Fabric energy tokens for transactions, as well as an Ethereum wallet to allow exchanges between Fabric energy tokens and the more generally acceptable digital currency (i.e., ETH).

Note that each prosumer makes his/her decisions on whether to participate in the market; if yes, as a seller or a buyer, he/she will try to maximize his/her own economic benefits. Such decisions can be made by the AI module, which employs either optimization modeling or data-driven learning schemes. In this study, we adopt the AI modules developed by our prior work [19]. In Figure 3, we illustrate prosumers and their connection with the blockchain-based packetized energy trading market through one buyer agent and one seller agent.

Blockchain-based Packetized Energy Trading (PET) Market: This is the core component of the proposed architecture. In particular, two blockchain systems are involved. As discussed in Section 1 and Section 2, the openness of permission-less blockchain makes it very difficult to ensure effective access control, which may raise great security concerns from the grid operator perspective. In addition, since the transactive energy market often involves prosumers’ sensitive data, such as their energy generation equipment and capability, consumption patterns, bidding information, and even geographic location, etc., it is desired that certain access control can be employed to reduce security and privacy risks. Therefore, in this work, we adopt Hyperledger Fabric, a permission-based blockchain, as the packetized energy trading platform. Through a CA, Fabric ensures that only authorized users can participate in the energy trading market. In addition, compared with other blockchain systems, Fabric also has the advantages of smart contract support, high transaction efficiency and scalability. On the other hand, although the adoption of Fabric can effectively reduce security risks from unauthorized users, it also has a limitation as Fabric does not support cryptocurrency. By receiving only Fabric tokens for energy generation, prosumers cannot directly use these tokens in other digital markets, which may limit prosumers’ interest in participating in the proposed energy market. To address this issue, we further adopt Ethereum, which provides one of the most popular cryptocurrencies (i.e., ETH), and allows convenient exchanges between the Fabric energy tokens and ETH by designing a secure cross-chain swap protocol.

Furthermore, we have designed three smart contracts (1) Energy Bidding Contract to facilitate the double-auction-based transactive energy bidding process, (2) an Assets Transaction Contract to monitor and record the energy transmission execution, and (3) an HTLC-based cross-chain contract to perform prosumers’ assets exchanges (i.e., exchanges between Fabric energy tokens and ETH). We will discuss each of the smart contracts in detail in the following subsections.

Interfaces: To integrate the proposed blockchain-based packetized energy trading market with PEMT-CoSim, some JavaScript-based interfaces are developed to facilitate all the communications between prosumer agents and Fabric blockchain. Specifically, these interfaces can be triggered by the prosumer agents to place bids, return bidding results, read energy generation/consumption data from smart inverters/meters, and send them back to Fabric smart contracts.

4.2 Initialization

To enable prosumers’ participation in the PET market, the first step is user initialization, through which each prosumer can get registered on Fabric, obtain a unique wallet for his/her energy tokens, and a smart meter ledger to record the prosumer's energy transaction history. The smart meter ledger is an array that is stored on the Fabric blockchain, and it is used to keep a record of the transmission of energy between prosumers. As shown in Algorithm 1, the User Initialization algorithm takes a sequence of user IDs and a constant value R as inputs. Then for each user ID, a unique wallet ID and a unique smart meter ledger ID will be generated. Specifically, the wallet ID is generated by passing the user ID directly through SHA256, while the smart meter ID is generated by passing the concatenation of the user ID and the constant value R through SHA256. After the execution, each prosumer will be assigned a digital wallet and a smart meter ledger on Fabric.

Algorithm 1

4.3 Double Auction based Energy Bidding

In this section, we present the design of the double auction-based energy trading market. Specifically, the energy trading market runs the auction in a periodical way (e.g., every 5 minutes). In each auction cycle, each prosumer makes his/her own decision on (1) whether he/she will participate in this round auction; (2) if yes, as a buyer or a seller; and (3) the specific bidding quantity and price. These decisions can be made with or without the AI module of the prosumer agent in the proposed co-simulation platform. For example, a prosumer agent can retrieve an optimal bidding strategy based on either an optimization algorithm or a data-driven learning model. As a result, with the proposed co-simulation platform, prosumers’ bidding strategy on the energy trading market is closely related to his/her energy management strategy and thereby more realistic.

Algorithm 2

Each prosumer can participate in the energy trading by submitting his/her bid to the energy bidding smart contract, as described in Algorithm 2 . When receiving all the bidding information, the contract will first, based on the bidding prices, sort sellers’ bids in ascending order and buyers’ bids in descending order. Then a one-shot double auction mechanism is applied to the sorted bids to retrieve the clearing price for the market. Each prosumer's allocated amount of energy (also named clearing units) is also determined by comparing his/her bidding price with the market clearing price. The payment Pays of each buyer is calculated as the clearing price times his/her allocated energy quantity. Then, based on the bidding results, a shared wallet is generated to manage the funds involved in this energy transaction. Next, the buyer pays the amount of Pays to the shared wallet, while the seller pays N token to the shared wallet for liquidated damages, which can be used to penalize a seller's dishonest behaviors during the energy delivery process.

4.4 Energy Transmission

Algorithm 3

The Energy Transmission procedure is shown in algorithm 3, which is programmed and run on PEMT-CoSim and uses an interface to communicate with Fabric. The inputs of this program are the bidding results from the PET market on Fabric. This program tracks each prosumer's power per second within each double auction round, and aggregates them to get the total energy that obtains within this time interval. Due to the possible loss of power during the transmission process, there may be some offset between the dispatched amount of energy simulated by PEMT-CoSim and the cleared units of energy determined by the trading market. If the energy loss is below a predetermined threshold value, the energy transmission is acceptable. When the buyers receive the bidding energy successfully, the flag is set as true, which allows the market to proceed to the asset transaction process.

4.5 Assets Transaction Process

Algorithm 4

The assets transaction contract running on Fabric is described in Algorithm 4 . In particular, this contract receives three inputs, including the buyer's wallet and bidding information, the seller's wallet and bidding information, and an energy transmission flag from the Energy Transmission Program. According to this flag, the shared wallet makes corresponding fund scheduling. If the flag is true, it shows the seller has delivered the allocated amount of energy to the buyer, and the buyer has received the corresponding energy. Therefore, the shared wallet transfers the escrowed liquidated damages N tokens and payment Pays to the seller. If the return flag is false, it indicates that the buyer has not received the energy, and the seller may be malicious. In this case, the shared wallet returns the corresponding payment to the buyer, and transfers the liquidated damages N Tokens to the buyer as compensation.

5 EXPERIMENT

In this section, we use an energy trading example to instantiate the proposed Blockchain-based PET market.

5.1 Development Environment

We implement this system with GO (go 1.15.8 Linux/amd64), Python (Python 3.8.10), and Node.js (v10.19.0). The simulation experiments are executed on a computer with Intel(R) Core(TM) i5-9500 CPU at 3.00GHz, and 16GB RAM. The operating system used is Ubuntu 20.04 LTS, which supports the use of Fabric, Ethereum, and PEMT-CoSim.

The proposed system development environment has two major modules: blockchain-based packetized energy transaction module and PEMT-CoSim. In the blockchain-based packetized energy transaction module, the use of Fabric (V 2.2.3) has the characteristics of access control mechanism, openness, and transparency to realize energy transactions. The Fabric network we use is a test network, which contains two organizations, where each organization has two nodes. The Ethereum network adopted in this study is the Rinkeby network. With the help of MetaMask and Remix IDE, the asset swap experiments between fabric and Ethereum are completed.

In the PEMT-CoSim module, the microgrid contains 30 houses. These houses include controllable loads (CLs), HVAC, batteries, PV, and other equipment. The energy generation, storage, and consumption data for each house are generated from the real-time simulation by PEMT-CoSim. In addition, we set one additional prosumer in the system as an unresponsive buyer. Specifically, the unresponsive buyers represent energy demand that needs to be satisfied before any other bidding buyers are processed. Such a buyer can mean either a consumer with a mandatory load or losses on the distribution system. In our system, we involve one unresponsive buyer with the bidding price at the price cap. The simulation time is 42 consecutive hours in summer when the market auction is performed periodically for every 300s. The PEMT-CoSim status update is set to be every second. Through Node.js, PEMT-CoSim can communicate with the blockchain-based packetized energy transaction module and manage and control the packetized energy based on the exchanged information. We also conduct case studies on a specific round of transactions during the simulated time period.

To initialize the 32 household information, PEMT-CoSim registers these houses to the Fabric network by calling the Node.js command, initializes the wallet of the houses, and sets the amount to 100 tokens (Set 1 token equal to 1 USD). Register two accounts on MetaMask and deposit ETH.

5.2 Energy Bidding

According to the energy generation and consumption data of the 32 prosumers simulated by PEMT-CoSim, each prosumer agent makes its own decisions on being either a seller or a buyer, whether to participate in the PET market, and the specific bidding quantities and prices. Then each prosumer agent that decides to participate in the auction will submit its own bidding data to the market when the auction starts. Double-auction conducts iterative bidding auctions based on the bid data submitted by the participating prosumers. Table 2 and Table 3 provide a detailed bidding example from energy sellers and buyers, respectively. In particular, we can observe that the bidding quantity from each seller and buyer is an integer. This is due to the adoption of the packetized energy concept, where we assume that each energy packet contains 1 kwh.

Through a double auction process, these seller bids and buyer bids are matched. Figure 4 shows the market clearing process of this bidding. Unresponsive buyers actually become always first satisfied buyers. Only when the needs of these unresponsive buyers are met are bids from other buyers accepted. So the blue line initially has a gap from the vertical axis. The blue line represents the buyer bids in descending order of price. The red line represents the seller's bids in ascending order of price. The intersection of the blue and red lines is the market-clearing point. The resulting clearing price and quantities are shown in Table 4. From Table 4, we can observe that all the buyers’ demand has been satisfied, which is in total 24.0 kwh. Since the total amount of energy supplies is higher than the total demand, only the top eight sellers’ energy has been successfully sold, leaving two sellers (house_A18 and house_A04) not able to sell their energy. The market clearing price is therefore set as the price offered by house_A16, which is $0.001073058.

Table 2: Seller bidding info in ascending order for the case study.
Seller Quantity(kw · h) Price($/kw · h)
house_A07 4.0 0.01010816
house_A22 2.0 0.01013292
house_A01 4.0 0.01016603
house_A24 3.0 0.01025019
house_A00 3.0 0.01056761
house_A23 3.0 0.01059814
house_A05 3.0 0.01066953
house_A16 3.0 0.01073058
house_A18 4.0 0.01081770
house_A04 4.0 0.01099019
Table 3: Buyer bidding info in descending order for case study
Buyer Quantity(kw · h) Price($/kw · h)
Unresponsive_Buyer 1.0 1.0
house_A14 5.0 0.2214204
house_A03 9.0 0.02642243
house_A29 9.0 0.02499904
Figure 4
Figure 4: Market clearing scenario
Table 4: Bidding Results
cleared Units clearing Price
24.0 0.01073058

5.3 Energy Transmission

According to the bidding results, if a prosumer wins a bid as a buyer, PEMT-CoSim calls the Store Tokens function with the Node.js command to freeze the prosumer's energy tokens on Fabric. The frozen token amount is computed as the prosumer's total purchasing costs for this auction round, which is the energy market's clearing price times the energy quantities allocated for this prosumer. Meanwhile, PEMT-CoSim controls the energy generation and/or consumption of the prosumers participating in this energy transaction. Since the PEMT-CoSim simulates the energy data with a frequency of every second, for a given prosumer at the tth second, we define his/her energy consumption as below.

\begin{equation} E_s^t=E^t_{hvac}+ E^t_{base} + E^t_{batt} - E^t_{solar} \end{equation}
(1)
where $E_s^t$ is the total power consumption of the prosumer; $E^t_{hvac}$, $E^t_{base}$ and $E^t_{batt}$ represent the energy load from HAVC, baseload (e.g., lightning), and battery charging load, respectively. Please note that $E^t_{batt}$ can be a positive value indicating the energy demand to charge the battery, or a negative value if the prosumer decides to discharge the battery to provide additional energy. On the other hand, $E^t_{solar}$ represents the energy that is generated by the prosumer's solar panel.

Furthermore, we cumulatively compute the energy consumption/generation of each prosumer during one auction round (every 300 seconds) as follows.

\begin{equation} E_s=({\textstyle \sum _{t=1}^{300}} E_s^t) \end{equation}
(2)

Figure 5 shows the energy received by the three buyers during the auction cycle from 1199s to 1498s. In particular, a new round of market auctions starts at 1199s, and buyers begin to receive energy after successful bidding and stop receiving energy at 1498s when the auction round ends. Please note that the unresponsive buyer is not associated with a specific house in our simulation, and therefore its received energy is not simulated in the system. In addition, in our simulation, house_A03 and house_A29 receive their energy packets with a very similar rate, resulting in the two overlapping curves. In addition, Table 5 shows the final energy obtained by the buyers.

Figure 5
Figure 5: The received energy amount by each buyer during an auction cycle

Table 5: The total amount of energy obtained
Houses Quantity(kw · h)
house_A03 8.8036
house_A14 3.4266
house_A29 8.7738

PEMT-CoSim calls the Store Meter function to record the reading of the smart meters on the Fabric block. When the buyer's smart meter records the received energy amount, it means that the seller sent the energy packets honestly and did not perform a malicious action. Otherwise, if the amount of received energy does not match the bidding quantity, only part of the reserved payment will be released to the seller. Please note that due to delays or transmission losses, there can sometimes be an offset between the amount of power allocated by PEMT-CoSim to the buyer and the buyer's original bidding quantity. We set the energy transmission results to be accepted when a small offset between the received energy quantity and the buyer's bidding quantity is observed.

5.4 Assets Transaction

After successfully verifying the meter readings of all buyers participating in this auction, PEMT-CoSim invokes a node.js command to release the frozen token in the Fabric shared wallet. Table 6 shows the information of the prosumers’ wallets after releasing the frozen token.

Table 6: Wallet Data After Assets Transaction
Houses Amount(Token)
house_A00 100.03219175
house_A01 100.04292233
house_A03 99.90342473
house_A04 100.0
house_A05 100.03219175
house_A07 100.04292233
house_A14 99.94634707
house_A16 100.02146116
house_A18 100.0
house_A22 100.02146116
house_A23 100.03219175
house_A24 100.03219175
house_A29 99.90342473
Unresponsive_Buyer 99.98926942

As shown in Table 6, the token amount of house_A4 and house_A18 is identical with the initial value. This is because although house_A04 and house_A18 participated in this round of energy auction as sellers, their bidding prices were higher than all other sellers. As a result, they were ranked with lower priorities and ended up with not being selected as energy suppliers. The other houses’ token amounts involved in this round are in line with the energy auction results. This result validates the correctness of our design and implementation.

5.5 Assets Exchange

In our experiments, for the sake of simplification, we set 1 token in Fabric to be equivalent to 1 ETH on Ethereum. After this round of energy auction, the wallet amount of house_A00 is 100.03219175. In addition, house_A30 is a newly registered prosumer and is preparing to participate in the next round of energy auction. But the wallet amount of house_A30 on Fabric has 0 tokens, and there is no token for purchasing energy. Since house_A00 intends to embody the tokens on Fabric into Ethereum, house_A00 uses 20 tokens on Fabric to exchange 20ETH in Ethereum with house_A30. Table 7 shows the wallet of these two houses before and after the asset exchange.

Table 7: Assets Exchange Results.
Before Assets Exchange
Houses Amount(Token) Balance(ETH)
house_A00 100.03219175 0
house_A30 0 20
After Assets Exchange
house_A00 80.03219175 20
house_A30 20 0

As shown in Table 7, before the asset exchange, the account balance of house_A00 on Fabric is 100.03219175 tokens, and the balance on Ethereum is 0 ETH. The account balance of house_A30 on Fabric is 0 tokens, and the balance on Ethereum is 20 ETH. After the asset exchange, the account balance of house_A00 on Fabric is 80.03219175 tokens, and the balance on Ethereum is 20 ETH. The account balance of house_A30 on Fabric becomes 20 tokens, and the balance on Ethereum is dropped to 0 ETH. This result validates the correctness of the asset exchange contract.

5.6 Comparison

As shown in Table 8, we compare the proposed platform with two state-of-the-art relevant studies. Firstly, all these studies share the same design goal as establishing a blockchain-based decentralized energy trading platform. Similar to our study, the authors in [17] also leverage permission based blockchain to only enable the access to the bidding platform for authorized users. However, different from these studies that focus only on the market side, the proposed simulation environment integrates the energy trading market with prosumer houses where the energy generation and consumption are simulated in a more realistic setting. This enables a holistic co-simulation environment for future studies to model prosumers’ decision makings by considering both the house side and the market side. Furthermore, due to the lack of connection with the energy delivery status, existing studies are not able to defend against non-delivery attacks, where dishonest sellers receive payment without delivering the committed amount of energy.

Table 8: Comparison of Energy Trading Platforms
Platform Energy Trading SEGC* Non-Delivery Attack Permission Based
Khalid et al.[17] × ×
AlSkaif et al.[2] × × ×
TESP-CoSim
Note: SEGC stands for Simulation of Energy Generation and Consumption.

6 CONCLUSION

Based on Fabric and PEMT-CoSim, a blockchain-based packetized energy transaction co-simulation platform is proposed in this paper. On our proposed platform, the functions of bidding, payment, and transmission have been achieved by smart contracts to support distributed energy trading. The trading results are recorded on blockchain to ensure non-repudiation. The adoption of Fabric blockchain eliminates the need for a centralized trading system operator and therefore allows the energy transactions to be decided through a double auction-based bidding process. Fabric blockchain is adopted in this study mainly due to its advantages in access control and high transaction efficiency. Through comprehensive experiments, we validate that the proposed system can enable decentralized energy trading in an accurate and efficient way. More importantly, by connecting Fabric with PEMT-CoSim, we are able to not only close the loop by tracking different prosumers’ energy generation and consumption behaviors to ensure that all energy transactions can be executed in an honest and fair way, but also establish a holistic co-simulation platform for further studies to closely coordinate energy trading and management to maximize social welfare.

ACKNOWLEDGMENTS

This project is partially supported by the IEEE Blockchain-Enabled Transactive Energy (BCTE) Demonstration award. The IEEE BCTE is a strategic IEEE Blockchain Initiative, sponsored by the IEEE Future Directions.

REFERENCES

  • Mads Almassalkhi, Luis Duffaut Espinosa, Paul D H. Hines, Jeff Frolik, Sumit Paudyal, and Mahraz Amini. 2018. Asynchronous coordination of distributed energy resources with packetized energy management. Energy Markets and Responsive Grids: Modeling, Control, and Optimization (2018), 333–361.
  • Tarek AlSkaif, Jose L Crespo-Vazquez, Milos Sekuloski, Gijs van Leeuwen, and João PS Catalão. 2021. Blockchain-based fully peer-to-peer energy trading strategies for residential energy systems. IEEE Transactions on Industrial Informatics 18, 1 (2021), 231–241.
  • Elli Androulaki, Artem Barger, Vita Bortnikov, Christian Cachin, Konstantinos Christidis, Angelo De Caro, David Enyeart, Christopher Ferris, Gennady Laventman, Yacov Manevich, et al. 2018. Hyperledger fabric: a distributed operating system for permissioned blockchains. In Proceedings of the thirteenth EuroSys conference. 1–15.
  • Battelle Memorial Institute. Accessed March 8, 2023. Market Module Overview - Auction. Website. http://gridlab-d.shoutwiki.com/wiki/Market_Auction
  • Martin Burns, Thomas Roth, Edward Griffor, Paul Boynton, Janos Sztipanovits, and Himanshu Neema. 2018. Universal CPS environment for federation (UCEF). In 2018 Winter Simulation Innovation Workshop.
  • Sijie Chen, Ling Zhang, Zheng Yan, and Zeyu Shen. 2021. A distributed and robust security-constrained economic dispatch algorithm based on blockchain. IEEE Transactions on Power Systems 37, 1 (2021), 691–700.
  • Xi Chen, Tianyang Zhang, Wenxing Ye, Zhiwei Wang, and Herbert Ho-Ching Iu. 2020. Blockchain-based electric vehicle incentive system for renewable energy consumption. IEEE Transactions on Circuits and Systems II: Express Briefs 68, 1 (2020), 396–400.
  • Min Hee Chung. 2020. Comparison of economic feasibility for efficient peer-to-peer electricity trading of PV-equipped residential house in korea. Energies 13, 14 (2020), 3568.
  • AR Dehghani-Sanij, E Tharumalingam, MB Dusseault, and R Fraser. 2019. Study of energy storage systems and environmental challenges of batteries. Renewable and Sustainable Energy Reviews 104 (2019), 192–208.
  • Ayman Esmat, Martijn de Vos, Yashar Ghiassi-Farrokhfal, Peter Palensky, and Dick Epema. 2021. A novel decentralized platform for peer-to-peer energy trading market with blockchain technology. Applied Energy 282 (2021), 116123.
  • Sizheng Fan, Hongbo Zhang, Yuchen Zeng, and Wei Cai. 2020. Hybrid blockchain-based resource trading system for federated learning in edge computing. IEEE Internet of Things Journal 8, 4 (2020), 2252–2264.
  • Magda Foti, Costas Mavromatis, and Manolis Vavalis. 2021. Decentralized blockchain-based consensus for Optimal Power Flow solutions. Applied Energy 283 (2021), 116100.
  • Keke Gai, Zhengkang Fang, Ruili Wang, Liehuang Zhu, Peng Jiang, and Kim-Kwang Raymond Choo. 2020. Edge computing and lightning network empowered secure food supply management. IEEE Internet of Things Journal 9, 16 (2020), 14247–14259.
  • Keke Gai, Qiang Xiao, Meikang Qiu, Guolei Zhang, Jianyu Chen, Yihang Wei, and Yue Zhang. 2022. Digital Twin-enabled AI Enhancement in Smart Critical Infrastructures for 5G. ACM Transactions on Sensor Networks (TOSN) 18, 3 (2022), 1–20.
  • Dong Han, Chengzhenghao Zhang, Jian Ping, and Zheng Yan. 2020. Smart contract architecture for decentralized energy trading and management based on blockchains. Energy 199 (2020), 117417.
  • Qiuhua Huang, Thomas E McDermott, Yingying Tang, Atefe Makhmalbaf, Donald J Hammerstrom, Andrew R Fisher, Laurentiu Dan Marinovici, and Trevor Hardy. 2018. Simulation-based valuation of transactive energy systems. IEEE Transactions on Power Systems 34, 5 (2018), 4138–4147.
  • Rabiya Khalid, Nadeem Javaid, Ahmad Almogren, Muhammad Umar Javed, Sakeena Javaid, and Mansour Zuair. 2020. A blockchain-based load balancing in decentralized hybrid P2P energy trading market in smart grid. IEEE Access 8 (2020), 47047–47062.
  • Aron Laszka, Scott Eisele, Abhishek Dubey, Gabor Karsai, and Karla Kvaternik. 2018. TRANSAX: A blockchain-based decentralized forward-trading energy exchanged for transactive microgrids. In 2018 IEEE 24th International Conference on Parallel and Distributed Systems (ICPADS). IEEE, 918–927.
  • Yuanliang Li, Luyang Hou, Hang Du, Jun Yan, Yuhong Liu, Mohsen Ghafouri, and Peng Zhang. 2022. PEMT-CoSim: A Co-Simulation Platform for Packetized Energy Management and Trading in Distributed Energy Systems. In 2022 IEEE International Conference on Communications, Control, and Computing Technologies for Smart Grids (SmartGridComm). IEEE, 96–102.
  • Xuyang Ma, Du Xu, and Katinka Wolter. 2022. Blockchain-enabled feedback-based combinatorial double auction for cloud markets. Future Generation Computer Systems 127 (2022), 225–239.
  • Sweta Malik, Maeve Duffy, Subhasis Thakur, and John G Breslin. 2021. Fractional Hedonic Coalition Formation Game for Peer to Peer Energy Trading in a Microgrid. In 2021 IEEE Madrid PowerTech. IEEE, 1–6.
  • Sweta Malik, Maeve Duffy, Subhasis Thakur, Barry Hayes, and John Breslin. 2022. A priority-based approach for peer-to-peer energy trading using cooperative game theory in local energy community. International Journal of Electrical Power & Energy Systems 137 (2022), 107865.
  • Sweta Malik, Maeve Duffy, Subhasis Thakur, Barry Hayes, and John G Breslin. 2020. Cooperative game theory based peer to peer energy trading algorithm. In The 12th Mediterranean Conference on Power Generation, Transmission, Distribution and Energy Conversion (MEDPOWER 2020), Vol. 2020. IET, 135–142.
  • Sweta Malik, Subhasis Thakur, Maeve Duffy, and John G Breslin. 2022. Double auction mechanisms for peer-to-peer energy trading: A comparative analysis. In 2022 IEEE 7th International Energy Conference (ENERGYCON). IEEE, 1–6.
  • Tanus Bikram Malla, Abhinav Bhattarai, Amrit Parajuli, Ashish Shrestha, Bhupendra Bimal Chhetri, and Kamal Chapagain. 2022. Status, Challenges and Future Directions of Blockchain Technology in Power System: A State of Art Review. Energies 15, 22 (2022), 8571.
  • Pacific Northwest National Laboratory. Accessed March 8, 2023. TESP Overview. Website. https://tesp.readthedocs.io/en/latest/TESP_Overview.html
  • Bryan Palmintier, Dheepak Krishnamurthy, Philip Top, Steve Smith, Jeff Daily, and Jason Fuller. 2017. Design of the HELICS high-performance transmission-distribution-communication-market co-simulation framework. In 2017 Workshop on Modeling and Simulation of Cyber-Physical Energy Systems (MSCPES). IEEE, 1–6.
  • Ari Pouttu, Jussi Haapola, Petri Ahokangas, Yueqiang Xu, Maria Kopsakangas-Savolainen, Eloisa Porras, Javier Matamoros, Charalampos Kalalas, Jesus Alonso-Zarate, Francisco David Gallego, et al. 2017. P2P model for distributed energy trading, grid control and ICT for local smart grids. In 2017 European Conference on Networks and Communications (EuCNC). IEEE, 1–6.
  • Shivam Saxena, Hany Farag, Aidan Brookson, Hjalmar Turesson, and Henry Kim. 2019. Design and field implementation of blockchain based renewable energy trading in residential communities. In 2019 2nd international conference on smart grid and renewable energy (SGRE). IEEE, 1–6.
  • Ashish Shrestha, Rajiv Bishwokarma, Anish Chapagain, Sandesh Banjara, Shanta Aryal, Bijen Mali, Rajiv Thapa, Diwakar Bista, Barry P Hayes, Antonis Papadakis, et al. 2019. Peer-to-peer energy trading in micro/mini-grids for local energy communities: A review and case study of Nepal. IEEE access 7 (2019), 131911–131928.
  • Pornpit Wongthongtham, Daniel Marrable, Bilal Abu-Salih, Xin Liu, and Greg Morrison. 2021. Blockchain-enabled Peer-to-Peer energy trading. Computers & Electrical Engineering 94 (2021), 107299.
  • Yue Zhang, Keke Gai, Jiang Xiao, Liehuang Zhu, and Kim-Kwang Raymond Choo. 2022. Blockchain-Empowered Efficient Data Sharing in Internet of Things Settings. IEEE Journal on Selected Areas in Communications 40, 12 (2022), 3422–3436.

FOOTNOTE

1 https://github.com/Yuanliang-Li/PEMT-CoSim

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.

BSCI '23, July 10–14, 2023, Melbourne, VIC, Australia

© 2023 Copyright held by the owner/author(s). Publication rights licensed to ACM.
ACM ISBN 979-8-4007-0198-6/23/07…$15.00.
DOI: https://doi.org/10.1145/3594556.3594627