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.