Next Article in Journal
Investigation on Coalbed Methane Fracturing Using Supercritical CO2 Graphene Cement Slurry System
Next Article in Special Issue
Status, Challenges and Future Directions of Blockchain Technology in Power System: A State of Art Review
Previous Article in Journal
Effectiveness of the Chebyshev Approximation in Magnetic Field Line Tracking
Previous Article in Special Issue
Impact of Blockchain Technology on Smart Grids
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Blockchain-Based Hardware-in-the-Loop Simulation of a Decentralized Controller for Local Energy Communities

Department of Electrical & Electronic Engineering, University of Cagliari, Via Marengo, 2-09123 Cagliari, Italy
*
Author to whom correspondence should be addressed.
These authors contributed equally to this work.
Energies 2022, 15(20), 7623; https://doi.org/10.3390/en15207623
Submission received: 20 September 2022 / Revised: 10 October 2022 / Accepted: 11 October 2022 / Published: 15 October 2022
(This article belongs to the Special Issue Blockchain, IoT and Smart Grids Challenges for Energy)

Abstract

:
The development of local energy communities observed in the last years requires the reorganization of energy consumption and production. In these newly considered energy systems, the commercial and technical decision processes should be decentralized in order to reduce their maintenance costs. This will be allowed by the progressive spreading of IoT systems capable of interacting with distributed energy resources, giving local sources the ability to be optimally coordinated in terms of network and energy management. In this context, this paper presents a decentralized controlling architecture that performs a wide spectrum of power system optimization procedures oriented to the local market management. The controller framework is based on a decentralized genetic algorithm. The manuscript describes the structure of the tool and its validation, considering an automated distributed resource scheduling for local energy markets. The simulation platform permits implementing the blockchain-based trading process and the automated distributed resource scheduling. The effectiveness of the tool proposed is discussed with a hardware-in-the-loop case study.

1. Introduction

1.1. Motivation

The increasing amount of flexible loads and installed distributed generation (DG) is leading to different management approaches in power systems. The power system is based not anymore (or not only) on transmission grid-connected, programmable power plants but on a panoply of nonprogrammable renewable energy sources (RESs). These include photovoltaic, wind farms, and biomass power plants connected to all voltage levels. These generators are characterized by diverse sizes [1] and are spread throughout the territory, often with direct connection to low-voltage networks [2]. Small-scale smart microgrids, locally managed and capable of operating in islanding mode, can innovate the distribution network, adding flexibility and fostering the customers’ engagement [3]. The recent attention on local energy communities (LECs) is favored by the implementation of decentralized controls. In these setups, energy users and producers agree to manage energy resources via local energy markets (LEMs) [1,4,5,6]. LEMs will enable prosumers and energy communities to trade energy, thanks to the peer-to-peer (P2P) technology, and to participate in external markets, providing energy and flexibility to the local distribution system operator (DSO) or even the transmission system operator (TSO).
Nowadays, the integration of LEMs and LECs within the physical network has still a long way from being achieved. Power systems need tools and frameworks for LEMs’ automated management, enabling this structural transition. The availability of human–network interface systems, automating energy trading processes and load control, is key to LEM’s success. In this regard, Internet of Things (IoT) devices are an enabling technology for these issues [2,7,8]. Accessibility to intelligent devices able to measure and maneuver the network and user behavior in a distributed fashion will allow the progressive shift from human-based operation to machine-based automation. In this context, installed smart devices will interact in a collaborative fashion, analyzing, optimizing, and coordinating the operation of DERs in the LEC.
This paper proposes a decentralized blockchain-based platform for the simulation of a network operation that exploits IoT cooperative devices owned by LEC users. A real-time digital simulator (RTDS)–based hardware-in-the-loop (HIL) testing facility is adopted as a real-time simulation tool to appraise the technical and economic benefits of the decentralized tool.

1.2. State of the Art

The model described in this paper is specifically designed to be applied in an energy community. This requires the cooperation of different elements of the smart energy system, such as power system equipment, communication protocols, and market models. In this view, the proposed methodology is built to introduce new elements in various layers of the smart grid architecture model (SGAM) [9]. Several papers have attempted to transfer the overall SGAM concept to deal with the energy community operation and management [10,11,12]. This paper wants to structure the energy community control tool on three main layers: physical, communication, and information layers (more details are provided in Section 2).
The physical layer represents the bottom layer of SGAM and simulates the main components of the electricity grid, such as the high-voltage transmission lines or the low-/medium-voltage distribution lines. The optimal management of the networks, which employs power flow and optimal power flow (OPF), is widely used in this layer [12,13,14,15,16]. Several algorithms proposed in the literature are developed on this layer. For instance, in [16], the authors discuss and review the concept of the microgrid management system regarding centralized and distributed control in the primary, secondary, and tertiary levels. Ref. [17] proposed a decentralized secondary voltage control scheme based on a state estimation method for autonomous microgrids, and in [18], a droop control for DC networks was studied and tested on a software tool.
Significant efforts have made to develop decentralized and centralized control algorithms, but few have been tested in production environments due to risks associated with testing algorithms in current networks [19]. Hardware testbeds are typically small-scale prototypes with limited components and a simple system topology; therefore, software validations have been widely adopted. However, such an approach implements simplified models, in which all the features of the component are not accurately represented and rely on multiple protocols and time-varying latency, while data exchanges in a pure simulation environment are usually ideal. To overcome the above-mentioned drawbacks, real-time HIL simulations are adopted.
Concerning the communication layer, it is observable that the SG vision heavily relies on this layer. Each entity of this complex and heterogeneous network should communicate with the others. Various frameworks describing the SG architecture have been proposed by both industry and academia. By far, the most accepted model has been the reference model proposed by the U.S. NIST [20]. The model that conceptualizes SG as a multilayer ecosystem for devices is suitable to the author’s scope, in which an energy community-based ecosystem needs to be implemented. Within this system, each device must be connected to gather and share information. Such system configuration is implemented through both a human-to-machine and machine-to-machine IoT framework. Various protocols of communication may exist within the IoT environment, such as the TCP/IP architecture [21], Bluetooth Low Energy [22], Zigbee [23], 6LoWPAN [24], and IEEE 1901.2 standard, which allow communication via power lines [25].
Several technologies bring efficient communication protocols, in terms of both interoperability and scalability. However, TCP/IP is the protocol chosen for the paper. This is because, in general, the management IoT devices is expected to be installed in highly anthropized environments, in which stable internet connections and dedicated LANs are available. This facilitates the retrievability of devices of the network, which can be useful if the whole platform would be implemented using a private blockchain in which the managing devices perform as validating nodes.
Concerning the information layer, it should be noted that the emerging distributed ledger (DL) technology, with the blockchain as its most popular application, is suitable for realizing this layer. In this way, independence and information safety are guaranteed by adopting a full decentralized market [11,26,27]. However, considerable efforts need to be applied for the integration of energy market platforms and a blockchain using users’ IoT devices. Recent advancements in this field have proved that the emerging DL technology managed to develop a P2P platform in which the users have the main role in managing the local network. This is from the system operator’s point of view, which can be seen as a controllable load, which has to be optimally coordinated. A large number of studies and initiatives about the use of a blockchain in the energy sector are published [6,27,28,29,30,31,32,33], and the blockchain is seen as particularly promising in the area of P2P trading and decentralized energy management since, through the blockchain, a large number of self-interested actors can be connected and coordinated. This technology is widely adopted as a market layer, which can be divided into two structures: the P2P market, where traders may conduct direct energy exchange, and the energy community market, where the interest of the group is one of the main goals that each participant would want to reach. Full P2P markets in the energy sector have been investigated by recent studies [34,35]. A paper [2,35] theorized and experimented with blockchain-based local P2P electricity markets in which peers settle energy transfers with cryptocurrencies created fittingly, which is useful for the building-up platform. In [35], an appropriate cryptocurrency was used to implement an energy management architecture. The availability of this technology allows the creation of local markets running entirely on a distributed framework, in which the market settlement has moved towards a fully automated and decentralized approach. As a consequence, various decentralized energy community models running entirely on smart contracts are present in the literature [36], paving the path to the establishment of autonomous energy communities. Of particular interest for this paper are the works of Chen et al. [6,27,37], which described hybrid on-chain/off-chain market optimization models, which show strong attack resistance. Among them, of extreme interest is [6], in which the market optimization algorithm was used also as the blockchain consensus algorithm by using the proof of solution approach. Nevertheless, the methods proposed by the literature still show scalability issues and are highly dependent on cost–opportunity considerations. These mainly focus on blockchain-based local P2P electricity markets, in which peers settle energy transfers with ad hoc created cryptocurrencies, underestimating the potential for a P2P-based network management. To limit these drawbacks, in this paper, the energy community participants did not trade tokens. The financial settlements can be performed a posteriori when the energy community optimal network management process has finished. In addition, from an economic point of view, this implementation does not impede participants from adopting different monetary systems, guaranteeing a wider participation in the community.
In the domain of decentralized optimization algorithms, several alternatives may be used to solve an OPF problem or ensure market clearance. For this purpose, the most notable is the alternating direction method of multipliers (ADMM). ADMM has been used extensively in recent studies to decompose OPF problems [38,39,40]. This method solves management and control problems by looking for a consensus between many local optimizations, aiming at reaching an averaged global suboptimum. Despite the great resilience from a cybersecurity point of view, local optimization procedures sometimes fail to properly address the complexity of the global phenomena, which intervenes in the grid, possibly leading to unstable solutions [41,42]. In addition, a complex network may lead to a complex mathematical problem due to the introduction of dual variables [43]. In this paper, a heuristic decentralized method is applied to the optimization tool to overcome these drawbacks.

1.3. Contributions of This Paper

This paper aims at developing a decentralized controlling architecture for energy communities that can optimize energy flows and implementing automatic trading processes. The availability of a completely independent trusted third party that does not belong to a single entity and the availability of a smart internet connected IoT devices are pushing smart systems towards a higher level of autonomous and decentralized machine-to-machine (M2M) management. In this way, the management burden will be shared among cooperating IoT devices, which will perform the necessary optimization and control operations [7]. Concerning the decentralized M2M, this paper adopts a decentralized genetic algorithm (DGA) to perform a wide spectrum of power system optimizations in a fully decentralized fashion. The DGA can be run by IoT devices distributed over the distribution network, which represents the energy community participants.
By using modern ICT technologies [44] and a blockchain, the proposed tool can achieve a completely automated and decentralized execution [2,44,45]. Each energy community user can perform a global system optimization, sharing its best-obtained results with the other ones through a blockchain-based master ledger, making use of P2P notifications and transactions [44,45]. For this reason, the proposed method allows for performing a global optimization of a large spectrum of problems, keeping at the same time a resilient decentralized architecture. The proposed framework has been tested on a hardware-in-the-loop (HIL) architecture based on an RTDS machine [46] to simulate the near-real-time work progress of the operations. The IoT equipment is represented by Raspberry Pi (RPi) devices, which manage smart sensors and serve as smart controllers.
The main contributions of this work are as follows:
  • Providing a decentralized energy management tool based on blockchain technology that exploits the GA capabilities.
  • Developing a local energy trading blockchain-based platform for selling and buying energy in an energy community. The system reduces dependence on the main grid and enables the local management of the local community.
  • Testing the tool with an HIL experimental setup.
The rest of the paper is organized as follows: Section 2 describes the structure of the developed tool in terms of architecture, optimization problem, decentralized algorithm, and blockchain technology. Section 3 explains how the authors set up the laboratory environment. Section 4 reports results and discussions about the performance of the tool and energy community indicators. Conclusions regarding this research are given in Section 5.

2. Energy Community Decentralized Controlling Tool

2.1. Structure and Project Objectives of the Tool

The main goal of this study is to design and simulate an energy management tool for LECs. These new energy sharing schemes allow users to perform direct energy and power exchanges on the grid, leaving LEC members with the responsibility of energy procurement from the system/market operator. According to this vision, network users can autonomously operate in the system, with defined roles and responsibilities. All users involved are equipped with smart meters, which permits the decentralized operations. These schemes will be of particular interest for locally managed grids, for which the existence of a human-led control center will be hardly sustainable from an economic point of view, providing to LEC operators a high-level network management system able to perform LEM and P2P energy trading optimizations.
The tool architecture is subdivided into three main layers: physical, communication, and blockchain layer, as depicted in Figure 1. Following the SGAM concept, the physical layer depicts the component layer, the communication represents the SGAM communication layer, and finally, the blockchain layer embodies the SGAM information, functional, and business layer. Hence, the blockchain layer contains information objects. These information objects represent the common semantics for the correct functioning of the DGA and allow an interoperable information exchange via communication means. In addition, new business models, such as P2P transactions, and business/processes capabilities are represented in this layer.
The implemented tool aims at optimizing the energy flow in a decentralized manner. In order to achieve this objective, the AC-OPF is used in order to solve the problem. To solve the AC-OPF problem, this paper exploits the combination of GA with blockchain technology [47], which leads to the definition of DGA.
Employing this tool, energy community users are supposed to have a higher degree of independence and transparency by the employment of a blockchain network. Furthermore, the application of the Roth–Erev trading mechanism will guide personal choices and improve the freedom of customers. These elements combine to constitute a decentralized LEM for an energy community.

2.2. Problem Formulation

2.2.1. Optimization Problem

The physical structure of the electrical system is subject to technical constraints that must be satisfied during system operations. In the developed model, an OPF is applied in order to adjust the generator active power outputs while keeping the load bus voltages, network power flows, and all other state variables in their operational and secure limits. The production cost function of each participant equipped with a generator is defined as in Equation (1), where p j is the production (per MWh) of generator j, and I j , i is the coefficient i of the cost function for generator j. We can define the objective function of the entire system as the sum of the quadratic cost model at each generator (Equation (2)):
C p j , I j , i = I j , 0 + I j , 1 · p j + I j , 2 · p j 2
f x = i = 1 N a g e n t s I i , 0 + I i , 1 · p i + I i , 2 · p i 2
where Nagents represents the number of connected generators. In order to satisfy the technical limits and power flow equation, to the objective function has been added the following constraints, which take into account the OPF equality constraints, which reflect the power flow equations, and the inequality constraints of the OPF, which reflect the constraints on the components of the power system. The constraints to which the function will be subjected are the maximum active power of generator k (Equation (3)), the maximum and minimum voltage at each node k (Equation (4)), the maximum ampacity on the line between node k and node j (Equation (5)), and finally, the power flow equations (Equation (6)).
P k P k m a x  
V m i n V k V m a x  
I k , j I m a x  
P k G P k L = j V k · V j · G k , j · cos θ k , j + B k , j · sin θ k , j Q k G Q k L = j V k · V j · G k , j · sin θ k , j B k , j · cos θ k , j  
Therefore, the energy management problem can be formulated as follows (Equation (7)):
S * = arg min P k , V k , I k , j f x subject   to   constraints   ( 3 ) ,   ( 4 ) ,   ( 5 ) ,   and   ( 6 )
where the solution S * represents the users’ optimal scheduling.

2.2.2. Decentralized Energy Flow Algorithm

In conventional networks, an authorized coordinator collects all the energy management information and globally minimizes operational costs in a centralized manner. In particular, the authority resolves the OPF problem, taking into account technical limits and network constraints. In the paper, the implemented algorithm, called DGA and introduced in [47], provides that each participant performs the optimization needed locally, and to converge to the solution, the participants will share the best results with the other users. The combination of GAs and blockchain technology allows for obtaining complete emancipation from the centralized entities that manage the system while being able to optimize the power flow problem. In addition, due to the blockchain structure, the developed system ensures an overall optimization of the network for a large number of problems, while maintaining a decentralized architecture. Figure 2 depicts the iterative algorithm, which takes into account both the DGA and the automatic offering process (Appendix C).
The iterative steps of the algorithm are explained in the following:
  • Initialize population by generating random genomes.
  • Initialize propensities by setting them ( s k j ) to the same random value.
  • Check on the master ledger if better genomes are available by other participants.
    3.1
    If true, execute invasion. The invasion operator takes the best genomes provided that they yield better fitness function concerning the local genomes. This ensures variability of the population that would otherwise be not accessible and not modifiable by external agents. In this way, different genomes are merged from different participants. Consequently, each agent verifies whether genomes found on a shared memory satisfy all the constraints and the fitness function. Conversely, the nonvalid genomes are tagged.
    3.2
    If false, apply random population to the local.
  • Update propensities. According to the previous state, update the participant’s offering strategy following the Roth–Erev algorithm.
  • Place bids. Save on a shared memory the selected offer.
  • Elitism. Select genomes to be sent for the future generation.
  • Crossover. Each gene performs a variation of the gene.
  • Mutation.
  • Share best results. Share the best result with all participants. This step is executed by each participant by calculating the value of the fitness function for all results. The chromosome that has obtained the best fitness function value is going to be shared throughout the master ledger.
According to Figure 2, all participants in the network can collaborate to achieve the best result that is globally accepted. To reach the globally accepted solution, there is a need to adopt a consensus algorithm. To add the consensus in the optimization tool, the consensus is integrated into the iterative steps. In particular, each participant of the platform performs a check on the solutions presented on the decentralized master ledger (DML) and eventually reports byzantine attacks. In order to implement the checking operation, each energy community participant inspects the fitness functions previously published on DML before including them in the local population. If solutions are evaluated as unreliable, the participant that published them on the DML is tagged as a potential byzantine node. If this actor is tagged by several participants, then he will not be able to upload new results for a specific time. This, connected with the authentication method described in Section 2.3, enables identifying and excluding byzantine nodes from the process. Consequently, the IoT devices are treated as untrustworthy nodes.
Finally, to achieve a fully decentralized structure that achieves maximum social welfare by minimizing both grid import costs and trading costs for participants, to the GA AC-OPF optimization has been added an offering process. This automatic offering mechanism is implemented by the Roth–Erev learning, described in Appendix C, which allows users to define the various coefficients of the objective function in Equation (2). It is worth mentioning that in this study, the fitness function is evaluated by Equation (2), which represents the objective function of the AC-OPF problem. In this way, the fitness function mirrors the goals of the agents and, at the same time, employs its role: giving information about the quality of the proposed solution.

2.3. Blockchain Setup

The adoption of blockchain and smart contracts (SC) technology (Appendix D) allowed the proposal of a decentralized energy management algorithm. The proposed algorithm can be executed in a secure, verifiable manner that ensures the independence of the energy community participants. In this framework, the role of the SC is essential; hence, various steps of the decentralized algorithm exploit the SC functions. An SC is a codified set of instructions that, once deployed on the blockchain, can execute certain functions on a decentralized virtual machine [48]. In this paper, the SC performs as a community and market virtual aggregator. In this role, the SC performs several types of tasks:
  • Distributed cache for genomes;
  • Distributed memory for network data (for instance, network power injections and consumptions);
  • Distributed market for the agent’s bids.
In this work, the SC is written in the Ethereum native Solidity language. The remaining off-chain management codebase is written in Python, making use of the Web3.py package [49]. The local network optimization problems are solved using the pandapower package [50]. The blockchain network is set up by running a local Ethereum node with Ganache-cli [51]. It should be noted that the underlying blockchain system works on the following considerations. First, Ethereum is a mature and well-verified blockchain system that has been applied in many areas, with an active community. Second, Ethereum supports the SC that is needed to implement the decentralized algorithm. It should be mentioned that even though the tool is implemented on Ethereum, this framework is blockchain platform agnostic, as long as the blockchain technology supports SC. The SC that enables the algorithm is depicted in Figure 3, by the contract diagram. The contract diagram is a particular adaptation of the UML class diagram which represents the application logic in terms of SC and relationships between them. Figure 3 shows the contract and the libraries exploited, with data structures and mappings defined within them.
To build a test network of the blockchain system, we exploit the smart IoT devices to be both energy community participants and blockchain nodes (Figure 4). Since the tool could be adopted by smart home meters, in which there is a strong likelihood that the house owner is equipped with a modem and/or router, the TCP/IP protocol was adopted as enabling communication among nodes. Thus, the device sets a proper IP address, being able to send packets to other devices. Moreover, each consumer is tagged with a unique address, which is recognized by the blockchain platform. This address, the blockchain address, enables officially recognizing the customer’s identity. Through the private key, which is the identification method of the smart meter, each customer is free to interact with the blockchain.
Through the blockchain features, the blockchain technology employs the role of the DML. This role is crucial in the master–slave optimization and, in this work, is taken by blockchain technology. The availability of a shared trusted memory allows for the application of the concept of GA invasion. Each round, a specific rate of the local population is replaced by the best genomes that are saved in the DML at the start of each optimization round before the canonical selection, elitism, crossover, and mutation procedure, simulating the invasion of a better fit population in the local environment. As a result, participants share genomes that are most suited for the specified environment. This approach looks to be independent of a central authority and can be utilized to create a cost-effective decentralized management and control of the LEC, because the load of DML optimization is shared among the participants, which perform the necessary optimizations off-chain. It is worth mentioning that the role of blockchain technology, in this paper, goes beyond the three tasks described above. It allows the time synchronization of the decentralized optimization process, through timestamping of the different phases. The need for synchronization is crucial to eliminate delays that may be introduced by hardware devices and internet connections. These delays can lead to loss of synchronization of operations. To synchronize multiple devices, which represent participants, it is necessary to have a reference time that is shared and universally accepted by the entire community. The blockchain timestamp perfectly fits this task. Therefore, in order to synchronize the optimization steps, the block timestamp was adopted as a clock.

2.4. Participant Setup

More and more smart homes are transitioning to being prosumers as a result of the increasing penetration of renewable energies into the power grid. Typically, renewable energy sources, such as solar panels and wind turbines, are included in the smart home. To meet user needs, it also supports a variety of appliances (such as an air conditioner, a washer, and illumination). Additionally, the smart home might be equipped with a battery energy storage device to store any additional electrical energy. Last but not least, the home energy management system, which uses the smart home meter to connect the smart home to the local grid, schedules and manages the aforementioned components. To aggregate the distributed energy resources (DER), a cluster of smart houses forms the LEC via the existing power line and the IoT devices associated with the smart home meter. The smart meter schedules the energy resources based on the needs of the smart house. To manage the bid presentation phase of the community participants, an automated trading process is implemented. This process is adapted from an agent-based approach, which is based upon the Roth–Erev algorithm (Appendix C). This process provides participants with greater control over their trading and allows them to choose the best trades according to their previous choices and their profit constraints. Finally, the objective function of the OPF takes into account the information provided by the physical layer simulated by the HIL simulator.
In this work, the smart home meter is supposed to work in partnership with the IoT device, which enables the meter to schedule, optimize, and offer for the house owner. This combination led to the definition of energy community participant, who exploits the DER to reduce costs and improve self-consumption AND enhance the independence of the LEC from the main grid. With this, each user adopts the smart home meter not only for personal benefits but also for energy community benefits since the meter is able to optimize the network state, thus finding the optimal combination of generation. The advantage of this approach is to obtain better LEC inner price making, removing the energy brokerage arbitrage costs, as schematized in Figure 5.

3. Laboratory Environment Implementation

3.1. Laboratory Setup: Hardware-in-the-Loop

The described decentralized energy community optimization tool was tested with an HIL laboratory setup for simulating a decentralized optimization of energy communities. To validate the proposed architecture, the authors adopt an HIL testing simulation. HIL simulations are the most comprehensive ways to validate protection and control schemes in the laboratory environment, de-risking the integration of both elements and other aspects of grid modernization. The implemented setup is shown in Figure 6. Each agent is represented by Raspberry Pi 3 (Quad-Core 1.2 GHz CPU and 1 GB RAM), which was chosen as the IoT smart equipment. These components are used with an RTDS-simulated test network. Due to its ability to replicate distribution networks in real time, the RTDS® NovaCor hardware was chosen as the grid-simulating platform. RTDS® NovaCor, powered by an IBM Power8 CPU, can simulate the real-time evolution of large-scale power grids with a 100 μs time step. The RSCAD support software system, which is used to model the power system and specify the simulation settings, manages the hardware. Full decentralized management of the RTDS-simulated grid, including automatic scheduling of controlled resources and placement mechanisms, was made possible by the setup’s concept and assembly.
The DGA platform’s optimization cycle is divided into three stages, which are illustrated in Figure 6. The first step is the metering stage, during which each RPi reads the network operating parameters from the node’s simulated RTDS meters. The second phase is agent updating, during which RPi simulates agent behaviors and updates propensities. Additionally, the RPi writes the predicted generation along with the local market bids into the DML. The optimization phase is the last step, where the DGA OPF is carried out by the RPis utilizing the optimization criteria established in the DML. Each RPi can feedback its optimization result to its managed node once the final optimization result is available on the DML by sending a signal to the RTDS through wireless FTP.

3.2. Network Configuration

The proposed agent-based framework was tested on a HIL setup. The HIL experiments were conducted across a 1-min-step, week-long simulation on an RTDS-based energy community simulation representative of a 3-phase, 4-wire low-voltage (LV) distribution grid (230/400 V). It is a radially operated rural network with one feeder supplied by a 250 kVA (20 kV/400 V) transformer in a secondary substation. A collection of nodes N and connecting lines L can be used to represent a network. The point of common coupling (PCC) is identified as Node 0. Every user in N has access to a grid connection. Through these connections, power is supplied to and withdrawn from the grid. At the PCC, electricity is imported from the power grid. Some nodes in the network might produce local energy that can be used locally or sold.
The test case, shown in Figure 7, is a network constituted by 16 nodes, with 6 distributed generators (active nodes). Table 1, Table 2 and Table 3 summarize, respectively, data of customers, branches, and conductors. For the sake of simplicity and to maintain generality, only residential users are considered inside the simulated network. Figure 8 reports the consumption and profile with values in p.u. Each node with generation is managed by the RPi devices that carried out the DGA-agent-based technique in the network simulation created by RTDS. The DGA’s responsibility is to determine how to schedule manageable resources within a local market framework, where each participant makes an offer to sell or buy energy based on the polynomial cost function in Equation (2). In the market model, the loads are allowed to buy the energy supplied by the wholesale market as well, depending on the offer bids. Anyway, users are urged to settle over- and undergeneration among the LEC participants because wholesale market costs are higher than the local ones. In this case, the possibility of exchanging energy among participants allows for matching overgeneration and underproducing nodes, avoiding losing money by asynchronously buying and selling energy with the grid.

4. Results and Discussion

4.1. Setup Performance

In the first simulation, the performances of the hybrid setup, which includes the RPi, the RTDS, and the DGA algorithm, were evaluated. The convergence qualities of the DGA-based LEM were examined and matched with a centralized market strategy to demonstrate its efficacy. The entire OPF procedure was run through multiple iterations in order to evaluate DGA convergence. The final optimal outcomes for each run were recorded and examined. Table 4 compares the distribution of expenditures as found in the master ledger, compared with the EUR 2.750 solution achieved from the centralized Newton–Raphson solution method. As demonstrated, the DGA can uncover suboptimal solutions that are only 1% larger than centralized OPF techniques.
These optimization results, not equal but approximately similar to the centralized one, are common in heuristic approaches, such as GA. Although the results obtained with the decentralized approach are slightly worse than the centralized one, the DGA can be executed and find an optimal solution without a central authority, allowing the management of a decentralized LEM. According to this view, every user of the community can participate in the optimization by sharing its computational resources. Additionally, the optimization’s running length has been evaluated given the specific objective of the optimization process. The average runtime for the whole optimization and system adaptation process has been 34.17 s. This would significantly speed up the system’s response time and boost its local flexibility by enabling the network to adjust continuously and autonomously with a time step of about 1 min. A graphical representation of results is given in Figure 9 to confirm the hybrid setup’s proper operation. After the DGA optimization is completed and the RPis provide feedback on its outcome to the RTDS grid, the resulting nodes’ frequency fluctuations are exported from RTDS® NovaCor. The frequency adjustments, as seen, only take place once per minute, when the market operation closes and the production and consumption of LEC users are updated. As shown, these oscillations are controlled and never go over the system’s thresholds.

4.2. Energy Community Indicators

To evaluate the performance of the proposed tool, the tool was tested in the HIL setup for an extended period of time by adopting a noisy energy profile starting from the one given in Figure 8. An example of this is given in Figure 10, where the profile of the third user is shown. Moreover, for executing an auction between the various users of the network, each node with generation was characterized by a cost function, whose initial parameters of the market are presented in Table 5. In Table 5, the row titled “Node 0” represents the PCC, I k , 0 represents the term of the fixed initial cost for each unit of production, while I k , 1 and I k , 2 represent, respectively, the linear and quadratic term of the polynomial cost function. To be able to insert the electricity grid as an element that participates in the market, this was characterized by a cost function.
Two scenarios were studied to assess the validity of the method. The first scenario describes the management of the network without the DGA algorithm. In this case study, the various network users can only purchase energy from the electricity grid at the price set by the market authority. At the same time, any user provided with a generator is enabled to sell his energy surplus to the network. According to the Italian authority [45], the market prices are as follows: the energy purchasing price is equal to 16.2 cEUR/kWh, while the energy selling price to 5 cEUR/kWh. As reported, there is an asymmetry in the price between purchase and sale of energy, which would lead users to reduce the amount of energy purchased from the network.
In the second scenario, users can participate in an LEM, hence reducing the energy purchasing costs. Concerning price values implemented in this scenario, they were fixed differently to the previous one. In particular, since no transportation costs are included using the energy community vision, the price values do not include this term. In both scenarios, three users were employed among the various participants in the energy community. In particular, the three actors are represented by the users connected to nodes 1, 3, and 5. In Figure 11, Figure 12 and Figure 13, the optimal energy trading profiles of the three typical users over 1 day are depicted. According to the presented results, it is possible to see that the energy trading profiles of the three users tend to follow the user profile during the day, except for user 1. User 5 often needs to buy energy in the daytime but sells extra energy in the morning. User 1 exhibits opposite energy-trading patterns. User 1 has a lot of extra energy to sell over the day due to the nominal power of the generator, which allows the user to sell overproduction. The developed blockchain-based energy management tool provides opportunities for users to interact with each other to exploit their diverse generation and load profiles and, thus, gain benefits, such as reduce their costs.
Table 6 compares the total costs for the two scenarios and shows them against one another. In the first scenario, all users separately exchange their excess energy production without engaging in energy trading, driving up total costs for the system. Users can interact with one another to swap energy in the second scenario. As a result, their expenses are decreased, and the reduced grid competition results in a net system gain. The cost reductions for users 1, 3, and 5 attributable to the distributed energy management algorithm are shown in Table 6, showing a 40% decrease in the total cost of the single users.

5. Conclusions

This work is focused on the development of a decentralized optimization system for maximizing the benefit of local energy community participants. The procedure makes use of a decentralized master ledger based on a blockchain for ensuring certified communication among peers, overcoming the need for a central market authority in LEM and LEC management. The implementation of the DML in the proposed framework makes it possible to use any distributed ledger technology, provided that it has smart contract capability. For this reason, no DL cost analysis was performed since they may vary consistently between DL providers, with some being potentially cost-free in private implementations. Moreover, the recent advancements in the field will possibly allow for seamlessly integrating the optimization model into the DML consensus algorithm. The developed framework was tested through a hybrid setup obtained, exploiting the RTDS® NovaCor hardware and the RPi smart devices, which run the proposed optimization procedure. The results show how the energy community optimization tool can optimize the distributed resources of the energy community, enabling global social welfare, which reduces the final costs, as long as the users participate in a local energy market. In particular, the implementation of a local market allows for the automated economic management of a local energy community, providing up to 40% cost savings to the system. Moreover, very good convergence properties allow for reducing the overall management time frame from the current 15 minutes, used in Italy in the wholesale market, to 1 min. The HIL experimental setup allowed for testing the model in a close-to-reality application, which allowed for running the simulated network without observed failures and moving the application one step further towards the on-site testing.
Further developments of the research will be focused on extending the time frame of the simulation to larger periods (for instance, 1 week, 1 month, and 1 year). In addition, the integration of other energy resources will be taken into account. In the future, further distributed energy resources such as electric vehicles, storage systems, and controllable loads for the provision of demand response and flexibility service will be included in the simulation.

Author Contributions

Conceptualization, M.G., M.M., E.G. and F.P.; methodology, M.G. and M.M.; software, M.G. and M.M.; validation, M.G. and M.M.; writing—original draft preparation, M.M. and M.G.; writing—review and editing, M.G., M.M., E.G. and F.P.; supervision, E.G. and F.P. All authors have read and agreed to the published version of the manuscript.

Funding

This research work was funded by the Sardinian Region, POR FESR Sardegna 2014/2020, Axis I—Scientific Research, Technological Development, and Innovation, within the project “SEC-Smart Energy Community”, under the call “Action 1.2.2—Support for the implementation of complex projects of research and development activities on relevant thematic areas and the application of technological solutions functional to the implementation of S3 strategies”. The research was also supported by the Italian Ministry for Education, University, and Research under the grant PRIN-2017K4JZEE “Planning and flexible operation of micro-grids with generation, storage and demand control as a support to sustainable and efficient electrical power systems: regulatory aspects, modelling and experimental validation”.

Data Availability Statement

The data presented in this study are available on request from the author Marco Galici (email: marco.galici@unica.it).

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

AbbreviationMeaning
DGdistributed generation
RESrenewable energy sources
DERdistributed energy resources
LEClocal energy community
LEMlocal energy market
P2Ppeer-to-peer
DSOdistribution system operator
TSOtransmission system operator
IoTInternet of Things
RTDSreal-time digital simulator
SGAMsmart grid architecture model
OPFoptimal power flow
AC-OPFalternating current-OPF
SGsmart grid
DLdistributed ledger
ADMMalternating direction method of multipliers
M2Mmachine-to-machine
GAgenetic algorithm
DGAdecentralized genetic algorithm
HILhardware-in-the-loop
DMLdecentralized master ledger
SCSmart Contract
PCCpoint of common coupling

Appendix A. Genetic Algorithms

Genetic algorithms (GA) are algorithms able to solve a wide spectrum of optimization problems [52]. GA represents the variables of a problem with finite-length strings that are referred as chromosomes. Rather than working with direct parameters from an optimization problem, GA often works with parameter encoding. In order to progress to the optimal solutions, GA begins its search from a randomly generated population of designs that evolve over successive iterations. To perform its optimization-like process, GA employs different operators to propagate its population from one iteration to another. Several operators are proposed in the literature; however, in this study, four are considered and described in the following:
  • Parent selection: This procedure is going to select the best genomes (values contained within chromosomes). In order to understand which values are the best, the selection process takes into account the fitness function. This function represents the quality measure, which defines which results are better than others. For instance, the fitness function could be represented by a cost function; nonetheless, the quality measure depends on the physical system which must be optimized.
  • Crossover: Within this process, new genes are developed. According to the parent selection results, the current chromosomes are combined in order to obtain better values, which in average are characterized by a better fitness function value.
  • Mutation: This process promotes diversity in population characteristics. The mutation operator allows for global search of the design space and prevents the algorithm from getting trapped in local minima.
  • Selection: Throughout this procedure, new genomes are introduced into the population to create new generation (or iteration). Despite that different methods are implemented in the literature, one is of interest, the elitism. With traditional techniques, there is no guarantee that the best member of the population will survive the “generational change”. The elitism keeps track of this individual and copies it directly into the next generation. If this member is selected to be replaced and none of the children have a better fitness function, one of the children is going to be eliminated, and the parent chromosome will be maintained.

Appendix B. Optimal Power Flow

The widespread application of optimal power flow (OPF) allows for the efficient, secure operation and planning of power systems. OPF is used to control the active power outputs and voltages of generators and shunt capacitors and reactors, transformer tap settings, and other controllable variables that can reduce fuel costs. Additionally, it effectively controls the network active power loss while maintaining operational and secure restrictions for all other state variables, including load bus voltages, generator power outputs, network power flows, and other variables. A typical formulation of an OPF problem is as follows (Equation (A1)):
min f x subject   to : g i x = 0           i = 1 , , n h j x 0         j = 1 , , m
In most cases, the objective function for the OPF reflects the costs associated with generating power in the system due to the fact that the power injection of generators is more easily accessible and controllable. In Equation (A2) is represented the quadratic cost model for generation:
C p k , I k , i = I k , 0 + I k , 1 · p k + I k , 2 · p k 2
where p k is the production (per MWh) of generator k, and I k , i is the coefficient of the cost function. The objective function for the entire system can then be written as the sum of the quadratic cost model at each generator (Equation (A3)):
f x = i I i , 0 + I i , 1 · p i + I i , 2 · p i 2
The OPF equality constraints reflect the power flow equations. Therefore, g(x) (Equation (A1)) is as follows (Equation (A4)):
P i G P i L = j V i · V j · G i , j · cos θ i , j + B i , j · sin θ i , j Q i G Q i L = j V i · V j · G i , j · sin θ i , j B i , j · cos θ i , j  
where P i G ,   Q i G are the real and reactive power generations at bus i; P i L , Q i L the real and reactive power demands at bus i; V i is the voltage magnitude at bus i; V j is the voltage magnitude at bus j; θ i , j , is the voltage angle difference between buses i and j; and finally, G and B are the real and imaginary parts of the admittance matrix. The inequality constraints of the OPF (h(x) of Equation (A1)) reflect the limits on components in the power system. In a general framework, components that require enforcement of limits include not only generators and tap-changing transformers but also phase shifting transformers. On account of the above description, when GA and OPF are merged, two main issues must be addressed:
  • Variable representation;
  • Fitness function formation.
For the sake of simplicity, in this study, the variable representation was considered in the natural form of the control variables analyzed in the OPF problem. In particular, considered P i G and Q i G as control variables, these variables are estimated as real numbers in floating-point representation. There are several benefits to using floating-point numbers in the GA representation. As there is no need to convert the type of the solution variables, GA is more efficient. By discretizing to binary values, less memory is needed, and precision is not lost. With this representation, a typical OPF chromosome appears as follows (Figure A1):
Figure A1. GA chromosome example.
Figure A1. GA chromosome example.
Energies 15 07623 g0a1
Since GA searches for the optimal solution by maximizing (or minimizing) a given fitness function, an evaluation function that provides a measure of the quality of the problem solution must be provided. Several fitness functions are proposed in the literature, such as fitness function, which measure the execution time, the quality, or even the security of the solution. Although various studies have proposed fitness function different from the objective function, choosing the objective function may lead to good performance. Indeed, this choice is not complex and expresses a quality measure correlated with the system, instead of an unfathomable fitness function that is difficult to calculate and associate with the system physic.

Appendix C. Reinforcement Learning

Along with supervised learning and unsupervised learning, RL is one of the three fundamental machine learning paradigms. Reinforcement learning is a branch of machine learning that focuses on how an agent should behave in a given environment to maximize reward (RL). Each agent can have a distinct behavior that is tailored to a specific objective, thanks to the RL outcomes. The Roth–Erev method has been used in this study to model the platform users’ behavior. The Roth–Erev algorithm [53] has been widely used in the area of trading mechanisms. Every user is represented by a model called an agent, and the algorithm acts as a trading mechanism to direct the agent’s decisions.
In order to exploit the Roth–Erev algorithm, the approach introduced in [54] is implemented. Proposed in [55] and used in [56,57] for the simulation of the Italian electricity market, the Roth–Erev algorithm builds this method on the assumption that it is more likely to repeat an action if it had to for a positive outcome. Applying this concept to the study, each user adapts its behavior accordingly to its success (or failure) in the market. As a result, the platform agents acquire the ability to place bids through competitive auctions. By self-consistently adjusting the offer propensities of agents with the aim of maximizing individual profits, Roth–Erev algorithms model this learning process by simulating how participants learn about the market during the simulation and adjust their decisions accordingly. The agents must indicate how much they will inject into the system and at what price they will offer this excess production when placing offers. In this way, the agents develop a strategy to make offers, and in this article, the agent propensities concept was used to describe each agent’s desire to make a market bid at a specific price. Each participant’s propensities are expressed in terms of a discrete set of probabilities, where Q j h stands for potential bidding strategies (( I j , 0 h , I j , 1 h , I j , 2 h ); ( s j h )). The index h, ( 0 < h < N ), labels the strategy, N represents the number of possible strategies, and s j h is the jth operator’s propensity to make an offer at a given value ( I j , 0 h , I j , 1 h , I j , 2 h ). The amount of strategies is equal to the number of intervals that have been used to split the range of I j , i h . The authors of this work chose N = 50, requiring that one assign 50 propensities to values of I j , i h . According to Equation (A2), the terms determine the generating price by denoting the coefficients of each generator’s cost function I j , i h .
As a result, the behavior of the operators is stochastically represented. The normalized propensity gives the likelihood of submitting a bid at a specific price q j h = s j h h s j h with h = 1, …, N and j = 1, …, Nagent, where Nagent represents the number of agents. Each offering step is composed by three main phases. Having set all propensities s j h to the same value, the three steps are as follows:
  • Bid presentation. Every agent presents a bid ( I j , 0 h , I j , 1 h , I j , 2 h ).
  • Retrieving step. The best genomes are going to be retrieved from DL and used to update agent propensities.
  • Agent update. Each agent k updates his propensities in relation to the profit, which he made in the previous step. The agents’ propensities are updated as follows (Equation (A5)):
    s j h t = 1 r · s j h t 1 + E i t
    where r ∈ [0, 1] is a memory parameter, and E i t is evaluated by Equation (A6).
E i t = R t 1 · 1 e ,         if   the   bid   is   accepted R t 1 · e N 1 ,                                                       otherwise
where e ∈ [0, 1] is an experimental parameter that assigns a different weight to played and nonplayed actions, and R t 1 is the profit at the time t 1 .
Therefore, on the basis of the profit R t 1 , the update function E i t will change accordingly.

Appendix D. Blockchain

The blockchain is a collection of blocks that is created using the principles of cryptography. The blockchain, in essence, is a distributed ledger that effectively records transactions between two parties in a verifiable and permanent manner, without the need for a middleman service from third parties. Figure A2 displays the chain of blocks and, subsequently, the architecture of the blockchain. A header and a body make up each block. The prior block’s hash can be seen in the block header. The previous block header’s hash is used to produce this value. The blockchain is made up of blocks that are hashed together in order. The block body, on the other hand, keeps a record of every transaction’s details from the preceding time frame. Each transaction produces a hash value, and the hash algorithm is then continued by two adjacent hash values to produce a distinct Merkle root. The binary tree that is produced by the aforementioned procedure is known as the Merkle root, or Merkle tree. This data structure is helpful for determining the immutability of the information. Each transaction is inserted as a leaf to the Merkle tree [58].
The Merkle root links the block body and header together. The Merkle root value will change if the block’s transactional data are altered. This ensures decentralization, transaction nontampering, traceability, and transparency as the four main characteristics of the blockchain:
  • Decentralization: The blockchain network is based on the P2P framework. Nodes can conduct direct transactions with each other without the involvement of a central party. The blockchain network’s nodes all have equal positions and have the ability to verify data in blocks.
  • Transaction nontampering: Unless 51% of nodes’ computational power can be controlled by the same entity at the same time, a single- or multiple-node database update in the blockchain system does not influence the database of other nodes.
  • Traceability: As previously mentioned, each transaction in the blockchain is linked to two adjacent blocks via a cryptographic technique, making every transaction traceable.
  • Transparency: The system’s whole set of operating rules for the blockchain is transparent and open; the blockchain keeps track of information regarding multiple-node redundancy backups and updates it with information regarding multiple-node mutual authentication. Thus, all the certification process is open and verifiable by the public.
Figure A2. Blockchain architecture.
Figure A2. Blockchain architecture.
Energies 15 07623 g0a2

References

  1. Van der Schoor, T.; Scholtens, B. Power to the people: Local community initiatives and the transition to sustainable energy. Renew. Sustain. Energy Rev. 2015, 43, 666–675. [Google Scholar] [CrossRef] [Green Version]
  2. Hwang, J.; Choi, M.-I.; Lee, T.; Jeon, S.; Kim, S.; Park, S.; Park, S. Energy Prosumer Business Model Using Blockchain System to Ensure Transparency and Safety. Energy Procedia 2017, 141, 194–198. [Google Scholar] [CrossRef]
  3. Worku, M.Y.; Hassan, M.A.; Abido, M.A. Real Time Energy Management and Control of Renewable Energy based Microgrid in Grid Connected and Island Modes. Energies 2019, 12, 276. [Google Scholar] [CrossRef] [Green Version]
  4. Garau, M.; Ghiani, E.; Celli, G.; Pilo, F. Tecno-economic and environmental assessment of a full electric smart city eco-district. In Proceedings of the 2017 AEIT International Annual Conference: Infrastructures for Energy and ICT: Opportunities for Fostering Innovation, AEIT, Cagliari, Italy, 21 September 2017; pp. 1–6. [Google Scholar] [CrossRef]
  5. Koirala, B.P.; Chaves Ávila, J.P.; Gómez, T.; Hakvoort, R.A.; Herder, P.M. Local Alternative for Energy Supply: Performance Assessment of Integrated Community Energy Systems. Energies 2016, 9, 981. [Google Scholar] [CrossRef]
  6. Chen, S.; Mi, H.; Ping, J.; Yan, Z.; Shen, Z.; Liu, X.; Zhang, N.; Xia, Q.; Kang, C. A blockchain consensus mechanism that uses Proof of Solution to optimize energy dispatch and trading. Nat. Energy 2022, 7, 495–502. [Google Scholar] [CrossRef]
  7. Meloni, A.; Pegoraro, P.; Atzori, L.; Benigni, A.; Sulis, S. Cloud-based IoT solution for state estimation in smart grids: Exploiting virtualization and edge-intelligence technologies. Comput. Netw. 2018, 130, 156–165. [Google Scholar] [CrossRef]
  8. Jalali, F.; Vishwanath, A.; de Hoog, J.; Suits, F. Interconnecting Fog computing and microgrids for greening IoT. In Proceedings of the 2016 IEEE Innovative Smart Grid Technologies—Asia (ISGT-Asia), Melbourne, Australia, 28 November–1 December 2016; pp. 693–698. [Google Scholar] [CrossRef]
  9. CEN-CENELEC-ETSI Smart Grid Coordination Group. Smart Grid Reference Architecture; International Business: Brussels, Belgium, 2011; Volume 1, pp. 1–118. [Google Scholar]
  10. Sousa, T.; Soares, T.; Pinson, P.; Moret, F.; Baroche, T.; Sorin, E. Peer-to-peer and community-based markets: A comprehensive review. Renew. Sustain. Energy Rev. 2019, 104, 367–378. [Google Scholar] [CrossRef] [Green Version]
  11. Chen, S.; Zhang, L.; Yan, Z.; Shen, Z. A Distributed and Robust Security-Constrained Economic Dispatch Algorithm Based on Blockchain. IEEE Trans. Power Syst. 2021, 37, 691–700. [Google Scholar] [CrossRef]
  12. Wu, Y.; Wu, Y.; Cimen, H.; Vasquez, J.C.; Guerrero, J.M. P2P energy trading: Blockchain-enabled P2P energy society with multi-scale flexibility services. Energy Rep. 2022, 8, 3614–3628. [Google Scholar] [CrossRef]
  13. Pilo, F.; Jupe, S.; Silvestro, F.; Abbey, C.; Baitch, A.; Bak-Jensen, B.; Carter-Brown, C.; Celli, G.; El Bakari, K.; Georgilakis, P.; et al. Planning and Optimization Methods for Active Distribution Systems. CIGRÉ. 2014. Available online: https://www.forskningsdatabasen.dk/en/catalog/2398076368 (accessed on 27 June 2019).
  14. Wang, S.; Taha, A.F.; Wang, J.; Kvaternik, K.; Hahn, A. Energy Crowdsourcing and Peer-to-Peer Energy Trading in Blockchain-Enabled Smart Grids. IEEE Trans. Syst. Man Cybern. Syst. 2019, 49, 1612–1623. [Google Scholar] [CrossRef] [Green Version]
  15. Munsing, E.; Mather, J.; Moura, S. Blockchains for decentralized optimization of energy resources in microgrid networks. In Proceedings of the 1st Annual IEEE Conference on Control Technology and Applications, CCTA, Kohala, HI, USA, 27–30 August 2017; pp. 2164–2171. [Google Scholar] [CrossRef] [Green Version]
  16. Cheng, Z.; Duan, J.; Chow, M.-Y. To Centralize or to Distribute: That Is the Question: A Comparison of Advanced Microgrid Management Systems. IEEE Ind. Electron. Mag. 2018, 12, 6–24. [Google Scholar] [CrossRef]
  17. Gu, W.; Lou, G.; Tan, W.; Yuan, X. A Nonlinear State Estimator-Based Decentralized Secondary Voltage Control Scheme for Autonomous Microgrids. IEEE Trans. Power Syst. 2017, 32, 4794–4804. [Google Scholar] [CrossRef]
  18. Lu, X.; Guerrero, J.M.; Sun, K.; Vasquez, J.C. An Improved Droop Control Method for DC Microgrids Based on Low Bandwidth Communication with DC Bus Voltage Restoration and Enhanced Current Sharing Accuracy. IEEE Trans. Power Electron. 2013, 29, 1800–1812. [Google Scholar] [CrossRef] [Green Version]
  19. Burr, M.; Camilleri, J.; Lubkeman, D.; Long, Q.; Du, Y. Microgrid Optimized Resource Dispatch for Public-Purpose Resiliency and Sustainability. The Olney Town Center Microgrid Project. Available online: https://www.osti.gov/biblio/1415998 (accessed on 19 September 2022).
  20. Gopstein, A.; Nguyen, C.; O’Fallon, C.; Hastings, N.; Wollman, D. NIST Framework and Roadmap for Smart Grid Interoperability Standards, Release 4.0. 2021. Available online: https://doi.org/10.6028/nist.sp.1108r4 (accessed on 10 September 2022). [CrossRef]
  21. Forouzan, B.A. TCP/IP Protocol Suite; McGraw-Hill Higher Education: New York, NY, USA, 2003; p. 942. [Google Scholar]
  22. Inside Bluetooth Low Energy, Second Edition—Naresh Kumar Gupta—. Available online: https://books.google.it/books?hl=en&lr=&id=3nCuDgAAQBAJ&oi=fnd&pg=PR7&dq=bluetooth+low+energy&ots=rMY7x2ucqh&sig=GDSBqJ1zZj_a3mXpowDAPoQHrU4&redir_esc=y#v=onepage&q=bluetooth%20low%20energy&f=false (accessed on 19 September 2022).
  23. Zigbee Wireless Networking—Drew Gislason—. Available online: https://books.google.it/books?hl=en&lr=&id=up8Oa7456I8C&oi=fnd&pg=PP1&dq=zigbee&ots=IGHs91xPvu&sig=vnQw6Sbm0vtrCrEOhH6QGNnYviw&redir_esc=y#v=onepage&q=zigbee&f=false (accessed on 19 September 2022).
  24. LoWPAN: The Wireless Embedded Internet—Zach Shelby, Carsten Bormann—. Available online: https://books.google.it/books?hl=en&lr=&id=3Nm7ZCxscMQC&oi=fnd&pg=PT9&dq=6lowpan&ots=xrbqPb-CKP&sig=kQ--bg6bkeCIa03PZg_ML51GC_c&redir_esc=y#v=onepage&q=6lowpan&f=false (accessed on 19 September 2022).
  25. Amarsingh, A.A.; Latchman, H.A.; Yang, D. Narrowband Power Line Communications: Enabling the Smart Grid. IEEE Potentials 2014, 33, 16–21. [Google Scholar] [CrossRef]
  26. Einav, L.; Farronato, C.; Levin, J. Peer-to-Peer Markets. Annu. Rev. Econ. 2016, 8, 615–635. [Google Scholar] [CrossRef] [Green Version]
  27. Chen, S.; Shen, Z.; Zhang, L.; Yan, Z.; Li, C.; Wu, J. A trusted energy trading framework by marrying blockchain and optimization. Adv. Appl. Energy 2021, 2, 100029. [Google Scholar] [CrossRef]
  28. Ahl, A.; Yarime, M.; Tanaka, K.; Sagawa, D. Review of blockchain-based distributed energy: Implications for institutional development. Renew. Sustain. Energy Rev. 2019, 107, 200–211. [Google Scholar] [CrossRef]
  29. Andoni, M.; Robu, V.; Flynn, D.; Abram, S.; Geach, D.; Jenkins, D.; McCallum, P.; Peacock, A. Blockchain technology in the energy sector: A systematic review of challenges and opportunities. Renew. Sustain. Energy Rev. 2019, 100, 143–174. [Google Scholar] [CrossRef]
  30. Di Silvestre, M.L.; Gallo, P.; Guerrero, J.M.; Musca, R.; Sanseverino, E.R.; Sciumè, G.; Vasquez, J.C.; Zizzo, G. Blockchain for power systems: Current trends and future applications. Renew. Sustain. Energy Rev. 2020, 119, 109585. [Google Scholar] [CrossRef]
  31. Muhsen, H.; Allahham, A.; Al-Halhouli, A.; Al-Mahmodi, M.; Alkhraibat, A.; Hamdan, M. Business Model of Peer-to-Peer Energy Trading: A Review of Literature. Sustainability 2022, 14, 1616. [Google Scholar] [CrossRef]
  32. Mladenov, V.; Chobanov, V.; Seritan, G.C.; Porumb, R.F.; Enache, B.-A.; Vita, V.; Stănculescu, M.; Van, T.V.; Bargiotas, D. A Flexibility Market Platform for Electricity System Operators Using Blockchain Technology. Energies 2022, 15, 539. [Google Scholar] [CrossRef]
  33. Morstyn, T.; Teytelboym, A.; Mcculloch, M.D. Bilateral Contract Networks for Peer-to-Peer Energy Trading. IEEE Trans. Smart Grid 2019, 10, 2026–2035. [Google Scholar] [CrossRef]
  34. Morstyn, T.; Farrell, N.; Darby, S.J.; McCulloch, M.D. Using peer-to-peer energy-trading platforms to incentivize prosumers to form federated power plants. Nat. Energy 2018, 3, 94–101. [Google Scholar] [CrossRef]
  35. Mengelkamp, E.; Gärttner, J.; Rock, K.; Kessler, S.; Orsini, L.; Weinhardt, C. Designing microgrid energy markets: A case study: The Brooklyn Microgrid. Appl. Energy 2018, 210, 870–880. [Google Scholar] [CrossRef]
  36. Siano, P.; De Marco, G.; Rolan, A.; Loia, V. A Survey and Evaluation of the Potentials of Distributed Ledger Technology for Peer-to-Peer Transactive Energy Exchanges in Local Energy Markets. IEEE Syst. J. 2019, 13, 3454–3466. [Google Scholar] [CrossRef]
  37. Chen, S.; Xu, C.; Yan, Z.; Guan, X.; Le, X. Accommodating Strategic Players in Distributed Algorithms for Power Dispatch Problems. IEEE Trans. Cybern. 2021, 1–10. [Google Scholar] [CrossRef]
  38. Guerrero, J.; Chapman, A.C.; Verbic, G. Decentralized P2P Energy Trading Under Network Constraints in a Low-Voltage Network. IEEE Trans. Smart Grid 2018, 10, 5163–5173. [Google Scholar] [CrossRef] [Green Version]
  39. Erseghe, T. Distributed Optimal Power Flow Using ADMM. IEEE Trans. Power Syst. 2014, 29, 2370–2380. [Google Scholar] [CrossRef]
  40. Magnusson, S.; Weeraddana, P.C.; Fischione, C. A Distributed Approach for the Optimal Power-Flow Problem Based on ADMM and Sequential Convex Approximations. IEEE Trans. Control Netw. Syst. 2015, 2, 238–253. [Google Scholar] [CrossRef] [Green Version]
  41. Gong, Y.-J.; Chen, W.-N.; Zhan, Z.-H.; Zhang, J.; Li, Y.; Zhang, Q.; Li, J.-J. Distributed evolutionary algorithms and their models: A survey of the state-of-the-art. Appl. Soft Comput. 2015, 34, 286–300. [Google Scholar] [CrossRef] [Green Version]
  42. Jogunola, O.; Ikpehai, A.; Anoh, K.; Adebisi, B.; Hammoudeh, M.; Son, S.-Y.; Harris, G. State-Of-The-Art and Prospects for Peer-To-Peer Transaction-Based Energy System. Energies 2017, 10, 2106. [Google Scholar] [CrossRef] [Green Version]
  43. Boyd, S.; Parikh, N.; Chu, E.; Peleato, B.; Eckstein, J. Distributed optimization and statistical learning via the alternating direction method of multipliers. Found. Trends Mach. Learn. 2010, 3, 1–122. [Google Scholar] [CrossRef]
  44. Garau, M.; Anedda, M.; Desogus, C.; Ghiani, E.; Murroni, M.; Celli, G. A 5G cellular technology for distributed monitoring and control in smart grid. In Proceedings of the 2017 IEEE International Symposium on Broadband Multimedia Systems and Broadcasting (BMSB), Cagliari, Italy, 7–9 June 2017; pp. 1–6. [Google Scholar] [CrossRef]
  45. Galici, M.; Ghiani, E.; Pilo, F.; Ruggeri, S.; Troncia, M. Blockchain local markets for the distributed control of microgrid. In Proceedings of the 25th International Conference on Electricity Distribution, Madrid, Spain, 3–6 June 2019; pp. 3–6. [Google Scholar]
  46. Kuffel, R.; Giesbrecht, J.; Maguire, T.; Wierckx, R.P.; McLaren, P. RTDS—A Fully Digital Power System Simulator Operating in Real Time. In Proceedings of the Canadian Conference on Electrical and Computer Engineering, Calgary, AL, Canada, 26–29 May 1996; pp. 733–736. [Google Scholar]
  47. Mureddu, M.; Ghiani, E.; Pilo, F. Smart Grid Optimization with Blockchain Based Decentralized Genetic Algorithm. In Proceedings of the IEEE Power and Energy Society General Meeting, Virtual Event, 6 August 2020; pp. 1–5. [Google Scholar] [CrossRef]
  48. Buterin, V. A next-generation smart contract and decentralized application platform. White Pap. 2014, 3. [Google Scholar]
  49. Ethereum Foundation. Web3.py, software. Available online: https://github.com/ethereum/web3.py, (accessed on 19 September 2022).
  50. Thurner, L.; Scheidler, A.; Schafer, F.; Menke, J.-H.; Dollichon, J.; Meier, F.; Meinecke, S.; Braun, M. Pandapower—An Open-Source Python Tool for Convenient Modeling, Analysis, and Optimization of Electric Power Systems. IEEE Trans. Power Syst. 2018, 33, 6510–6521. [Google Scholar] [CrossRef] [Green Version]
  51. Truffle Ganache SuiteCLI, software. Available online: https://trufflesuite.com (accessed on 19 September 2022).
  52. Holland, J.H. Adaptation in Natural and Artificial Systems, 1st ed.; University of Michigan Press: Ann Arbor, MI, USA, 1975. [Google Scholar]
  53. Roth, A.E.; Erev, I. Learning in extensive-form games: Experimental data and simple dynamic models in the intermediate term. Games Econ. Behav. 1995, 8, 164–212. [Google Scholar] [CrossRef]
  54. Mureddu, M.; Meyer-Ortmanns, H. Extreme prices in electricity balancing markets from an approach of statistical physics. Phys. A Stat. Mech. its Appl. 2018, 490, 1324–1334. [Google Scholar] [CrossRef] [Green Version]
  55. Nicolaisen, J.; Petrov, V.; Tesfatsion, L. Market power and efficiency in a computational electricity market with discriminatory double-auction pricing. IEEE Trans. Evol. Comput. 2001, 5, 504–523. [Google Scholar] [CrossRef] [Green Version]
  56. Rastegar, M.A.; Guerci, E.; Cincotti, S. Agent-based model of the Italian wholesale electricity market. In Proceedings of the 6th International Conference on the European Society for Precision Engineering and Nanotechnology, Baden Bei Wien, Austria, 28 May–1 June 2006; pp. 1–7. [Google Scholar] [CrossRef]
  57. Nakamoto, S. Bitcoin: A Peer-to-Peer Electronic Cash System. 2008, p. 9. Available online: www.Bitcoin.Org (accessed on 10 September 2022).
  58. Kondratieva, V.; Seo, S.-W. Optimized Hash Tree for Authentication in Sensor Networks. IEEE Commun. Lett. 2007, 11, 149–151. [Google Scholar] [CrossRef]
Figure 1. Illustration of the different layers of the proposed tool.
Figure 1. Illustration of the different layers of the proposed tool.
Energies 15 07623 g001
Figure 2. Scheme of the decentralized algorithm.
Figure 2. Scheme of the decentralized algorithm.
Energies 15 07623 g002
Figure 3. Contract diagram of the implemented SC.
Figure 3. Contract diagram of the implemented SC.
Energies 15 07623 g003
Figure 4. The IoT hardware setup. In the figure, 3 RPi devices used for the simulation are shown. In this setup, RPis are physically connected through an Ethernet port, but Wi-Fi connection is possible.
Figure 4. The IoT hardware setup. In the figure, 3 RPi devices used for the simulation are shown. In this setup, RPis are physically connected through an Ethernet port, but Wi-Fi connection is possible.
Energies 15 07623 g004
Figure 5. An example of energy buy and sell prices into a LEC, compared with buying and selling energy to the main grid.
Figure 5. An example of energy buy and sell prices into a LEC, compared with buying and selling energy to the main grid.
Energies 15 07623 g005
Figure 6. Laboratory setup.
Figure 6. Laboratory setup.
Energies 15 07623 g006
Figure 7. The RTDS low-voltage network.
Figure 7. The RTDS low-voltage network.
Energies 15 07623 g007
Figure 8. Consumption user profile.
Figure 8. Consumption user profile.
Energies 15 07623 g008
Figure 9. Network node’s frequency and power generator outputs.
Figure 9. Network node’s frequency and power generator outputs.
Energies 15 07623 g009
Figure 10. User 3 randomized profile.
Figure 10. User 3 randomized profile.
Energies 15 07623 g010
Figure 11. Trading profile of user 1.
Figure 11. Trading profile of user 1.
Energies 15 07623 g011
Figure 12. Trading profile of user 3.
Figure 12. Trading profile of user 3.
Energies 15 07623 g012
Figure 13. Trading profile of user 5.
Figure 13. Trading profile of user 5.
Energies 15 07623 g013
Table 1. Load and generation data.
Table 1. Load and generation data.
NodeLoadGenerator
P (kW)Q (kVAr)P (kW)Q (kVAr)
131.4560
24.52.18--
331.4530
44.52.18--
531.4530
64.52.1850
762.91--
831.45--
94.52.18--
1031.45--
1131.45--
124.52.1830
1331.45--
1431.45--
154.52.1830
164.52.18--
Table 2. Network branch data.
Table 2. Network branch data.
BranchLength (m)Line Code
1–2301
2–3101
3–4301
4–5101
5–6101
6–7302
7–8102
6–9102
9–10102
10–11102
11–12103
12–13203
11–14202
14–15302
15–16203
Table 3. Conductor data.
Table 3. Conductor data.
Line CodeS (mm2) r   ( Ω / k m ) x   ( Ω / k m ) c   ( n F / k m ) Ampacity (A)
11500.1900.082710150
2950.2500.085640161
3950.3300.085620137
Table 4. Network branch data.
Table 4. Network branch data.
DGA Results (EUR)Deviation from Centralized Solution (%)
2.7750.909
2.7700.727
2.7690.691
2.7670.618
2.7560.218
2.7580.291
2.7590.327
2.7630.473
Table 5. Nodes base price parameters.
Table 5. Nodes base price parameters.
Node I k , 0   ( EUR ) I k , 1   ( EUR / MW ) I k , 2   ( EUR / MW 2 )
10300.2
30250.4
50350
60100.2
120450
150150.2
001000.5
Table 6. Comparison of the three users in the two scenarios.
Table 6. Comparison of the three users in the two scenarios.
UserTotal Cost (EUR)
First ScenarioSecond Scenario
1−2.245−5.078
32.9571.592
54.1722.501
Total cost for users 1, 3, and 54.884−0.985
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Galici, M.; Mureddu, M.; Ghiani, E.; Pilo, F. Blockchain-Based Hardware-in-the-Loop Simulation of a Decentralized Controller for Local Energy Communities. Energies 2022, 15, 7623. https://doi.org/10.3390/en15207623

AMA Style

Galici M, Mureddu M, Ghiani E, Pilo F. Blockchain-Based Hardware-in-the-Loop Simulation of a Decentralized Controller for Local Energy Communities. Energies. 2022; 15(20):7623. https://doi.org/10.3390/en15207623

Chicago/Turabian Style

Galici, Marco, Mario Mureddu, Emilio Ghiani, and Fabrizio Pilo. 2022. "Blockchain-Based Hardware-in-the-Loop Simulation of a Decentralized Controller for Local Energy Communities" Energies 15, no. 20: 7623. https://doi.org/10.3390/en15207623

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