Design and implementation of a blockchain multi-energy system

The growing adoption of photovoltaic panels on roof-tops increases the pressure on grid operators for offsetting surplus or deficiency in generation. A multi-carrier energy system allows energy to be converted and stored using different energy carriers, thus relieving the stress from grid operators. However, these systems require efficient operation to unfold their full potential. This paper proposes a novel blockchain-enabled process to coordinate, allocate, and settle intra-day energy transactions in a district multi-carrier energy system with electricity and heating sub-networks. An incentive mechanism is designed for an optimal allocation of local green energy generation. The mechanism is implemented for the Ethereum blockchain and operates fully on-chain. The design leaves energy producers the freedom to choose their preferred pricing strategy for profit maximization while restricting them to behavior favoring the common good. We test three pricing strategies, with different levels of knowledge on users’ pricing behaviors, that energy producers may adopt. The price-availability-based allocation system guarantees consumers the lowest possible cost.


Introduction
To mitigate climate change and increase energy efficiency, Europe envisions to have at least 27% of the power produced by renewable energy by 2030 (European Commission 2014). Renewable energy integration, system operation, transparent billing, and data integrity, are common challenges for grid operators when adopting new solutions (Intergovernmental Panel on Climate Change 2015; Dell and Rand 2001). A holistic view of those technologies in operation (i.e., on district or community level) still has many aspects to be investigated and optimized.
One kind of Distributed Ledger Technologies (DLTs), blockchain, has been flourishing for the past decade. It has advantages in securing immutability and guaranteeing transparency of transactions. Its decentralized nature and integrated computing feature bring the potential of adding value in the energy sector, especially regarding energy dispatching, billing, as well as energy financing.
This paper offers three main contributions: (i) We propose a novel process to coordinate, allocate and settle intra-day energy transactions in a multi-carrier energy system.
(ii) The introduced mechanism offers optimal energy allocation that empowers the role of the community. (ii) The system is implemented for the Ethereum blockchain and evaluated. It operates in a decentralized way, fully on-chain.

Background
A multi-carrier energy system (MES) combines multiple energy carriers, whereby electricity, heating, cooling, etc. optimally interact with each other on various levels (for instance, within a district, a city, or on a regional level). In terms of energy consumption, heating and electricity are the two major subsystems (Gierek 2016). An MES with distributed generation of multiple energy sources is a key option to decarbonize the energy sector while improving the technical, economic, and environmental performance (Mancarella 2014). With the increasing adoption of renewable energies by end-users, distributed MESs require more flexible power and ancillary services to prevent potential operation failure derived from their high variability and volatility.
To efficiently operate such a system, one solution is to segment the energy network and control the sub-networks asynchronously on a distribution network level (Stöcker 2018). A district-level distributed MES is an ideal representative of such a sub-network, because the complexity of its operation is reduced in comparison to a system that involves management of a higher voltage electricity network. A district heating network and other bi-directional distributed energy resources (DERs), such as electric vehicles, batteries and hydrogen storages, could also be added on top to form a district MES.
Another solution to answer the increasing demand for flexible power is a Transactive Energy System (TES). Via a set of economic and controllable mechanisms, in particular price signals (Perez-Arriaga and Bharatkumar 2014), which balance the supply and demand of power over time across an entire electrical infrastructure, a TES enhances the value for transacting parties while being consistent with the overall system reliability (Tesfatsion 2018). Our project combines the said two solutions together for efficient operation of MES. We integrate the pricing-based TES methods to a district-level MES, to optimize the technical operation as well as maximize the utility function for each consumer. As consumers demand constant and real-time transparency as well as accurate billing on their energy consumption for a sustained demand reduction (Darby 2006), blockchain technology is adopted here for instant and transparent settlement.
Blockchain is one kind of Distributed Ledger Technology (DLT), which is a novel approach to recording and sharing data spread across a distributed network of participants (Natarajan et al. 2017). Globally distributed nodes are linked by a peer-to-peer (P2P) communication network with its own layer of protocol messages for node communication and peer discovery (Glaser 2017). Without the use of a central server, blockchain technology eliminates the risk of having one node with superior power that may influence or manipulate the process of consensus establishment in the network. New data can only be added when consensus is reached among a majority of participants. Some commonly used consensus mechanisms are Proof-of Authority (PoA), Proof-of-Work (PoW), Proof-of-Stake (PoS), and Practical Byzantine Fault Tolerance (PBFT). Tschorsch et al. (Tschorsch and Scheuermann 2016) conducted a comprehensive review on Proof-of-X algorithms. With smart contracts, i.e. scripts running on the blockchain, inputs can be processed automatically based on the predefined logical calculation.

Protocol
This paper proposes an innovate process to seamlessly coordinate, allocate and settle near real-time energy transactions in a district MES that includes electricity and heating sub-systems. The process operates in a decentralized way, fully on-chain. The mechanism aims at (i) forging the solidarity of the community, where participants act for common good. (ii) increasing the penetration of renewable energies, where participants are willing to purchase as much renewable energy as possible. (iii) minimizing the cost of energy consumption, by building the best possible portfolio for consumers to optimize their energy bill.
The energy transaction is matched according to the criteria of (i) connectivity: physical connection by cable or tunnel in the energy network, (ii) availability: real-time energy supply and demand, and (iii) priority: community generated green energy has higher priority for usage than energy from the grid, or other customized whitelist or blacklist.
The system architecture (as shown in Fig. 1) and testing data are derived from the eHub demonstrator of EMPA in Dübendorf, Switzerland.
In intraday trading, energy and financial transactions are resolved in a 15 min interval. We propose a 5-step settlement mechanism, where each step has an allocated period, globally coordinated by a single smart contract. Figure 2 illustrates the sequence of actions in one trading interval. Activities take place in both networks at the same time.
In the first step, all the devices register basic information for the upcoming 15 min. In the second step, all the consumers send out price queries to renewable energy producers or to storage units of the community. After all queries have been responded to, consumers sort all possible offers according to the updated unit prices. The received responses are sorted by the following guidelines: (i) Sort from the lowest price to the highest price. (ii) Rank down the unresponsive devices. At the same time, heat pumps receive the demand of hot water from their connected water tanks. Heat pumps convert the requested volume into needed electricity and broadcast the demand to connected devices. Meanwhile, water tanks calculate their new averaged unit price of the stored hot water for the upcoming trading period. In the third step, producers ask for the sorted result from their connected consumers and make their own list of ranks based on the preference of consumers. The guideline for producers to sort their connected consumers follows: (i) Outdated information is not considered for sorting. (ii) Sort all consumers based on their Rank. The smallest Rank is placed highest in the list. Fig. 1 Layout of the interconnected electricity (left) and heating (right) sub-networks with 3 households, 3 solar panels, 1 storage system, 3 medium−/high-temperature (MT/HT) heat pumps, and 4 MT/HT water tanks (iii) For two items with the same Rank, the smaller Total ranks up. (iv) Devices with larger consumption are ranked down. In the heating network, the water tanks query houses for the hot water consumption at this step. At stage four, nodes with negative energy load initiate energy transactions based on the sorted rank list. If one heat pump receives energy during this stage, it immediately initiates another transaction in the heating network to the connected water tank, as it consumes electricity to produce heat. Similarly, in the heating grid, each water tank transacts hot water to corresponding households. If there are still residues of generation or lack of supply, at the final clearing step five, producers and consumers act at the same time with storage or grid to offset the surplus or deficiency. It is possible for devices in the community to define "blacklists" for some connected devices. The communication is cut off with the blacklisted device. This mechanism allows punishment against deceit or unaffordable energy price.
Energy producers can choose different pricing strategies that aim for various goals, such as maximum payoff or maximum selling volume. Here we adapt several pricing scenarios in three categories. First, zero-intelligence pricing, a basic Real-Time-Pricing (RTP) strategy where agents have little or no information on both the performance of their own and others' devices. This makes the pricing strategy totally random and independent of any system impulses. Secondly, inversed-production pricing, where agents need to predict the production of their own devices for the next 15 min interval based on historical data and set up the price according to a general demand-supply relation. It is a Critical Peak Pricing (CPP) strategy. Each agent performs independently, relying only on the historical information of its own device. Thirdly, game-theory based pricing, where each energy producing agent can adjust the selling price based on the behavior of other energy producers who hold a similar role, to maximize their utility function in a collective non-cooperative way. Here we define the utility function as the portion of energy sold out to the community at each time interval. Agents firstly share necessary information with each other and make their own decisions in combination with the historical performance of their own device. Unit prices are set by energy producers. The adopted strategy affects the payoff of the energy producer.
The mechanism is deployed as a set of smart contracts written in Solidity on the local test Remote Procedure Call (RPC) Ethereum simulator using the Truffle framework. All tests were later run on Node.js using the Mocha testing framework. The input data, as shown in Fig. 3, that record full-day activities are collected from the sensors at eHub is firstly scaled and processed to cohere with the assumption of the project. Three pricing strategies, as shown in Fig. 4, are tested on three different layouts of the district system. Besides the layout shown in Fig. 1, one testing layout does not contain a battery, while in the other layout, the battery is connected to all other devices. Apart from the differences in layouts, the following operating conditions are applied identically in the tests: (i) No active purchase from the battery, (ii) the unit price for the battery is static, and (iii) the load capacity of the grid is ±100 kW. Figure 5 shows the composition of energy supply of each house under three pricing strategies, in the default system layout. The game-theory pricing strategy holds a clear advantage comparing to other strategies because more than 90% of energy is supplied by the locally produced green energy. By choosing a competitive pricing strategy, households pay significantly less than in a determined pricing case. In general, the price influence depends very much on the energy supply distribution. Game-theory based strategy provides a feedback loop for devices to make better decisions with limited information. The agility it provides is essential in the intra-day, high-frequency trading. Figure 6 shows how the behavior of devices affect the usage of grid capacity. Although a battery provides a certain degree of flexibility to the grid and the community energy system by shaving the peak, a good pricing strategy can effectively adjust the dispatch of energy and reduce the volatility of energy demand from the district energy system to the grid.

Conclusion
This project proposes a novel process to coordinate, allocate and settle energy transactions in a district multi-carrier energy system. The process operates in a decentralized way, fully on-chain. The mechanism allows a custom dynamic tariff setting model. It leaves producers the freedom to choose their preferred pricing strategy for profit maximization. A price-availability-based allocation system guarantees that consumers pay only the lowest possible cost for their energy. An incentive mechanism is  Rows from top to bottom correspond to House 0 , House 1 , and House 2 . Energy supplied by local generation is marked in green, while the supply from the grid and battery is marked in yellow introduced. Each device reacts for the common good of the community and follows the principle of relieving the operation burden of the grid. Game-theory based strategy provides a feedback loop for devices to make better decisions with limited information. The agility it provides is essential in the intraday trading. This design is implemented for the Ethereum blockchain and tested with real consumption and production profiles of electricity and heating systems. Three pricing strategies, namely zero-intelligence pricing, inversed-production pricing, and game-theory based pricing, are compared and evaluated. An analysis of the energy consumption and operation cost of such systems is performed in the end. The design incentivizes the access to local green energy with minimized cost. In general, the degree of price's influence on energy consumers depends on their connectivity to energy suppliers. Consumers have more stable green supply from the community when they have a better connectivity. By choosing a competitive pricing strategy, households pay significantly less than in a determined pricing case. Battery plays an inevitable role in providing stability in the system shaving the peak. To make the operation more sustainable, the system needs more storage or other forms of renewable energy that do not share a similar production pattern with PVs.