Hierarchical Energy Management in Islanded Networked Microgrids

Networked microgrids have many advantages for consumers and small energy producers, including higher reliability than non-networked microgrids. However, energy transaction, network interconnection, the intermittent nature of renewable sources, and other problems lead to challenges in the practical implementation of networked microgrids. Despite its favorable use of space, a floating PV system presents challenges that differ from those associated with its land-based counterparts because it is prone to the motion of the surface of the water, resulting in an unpredictable power output. This work presents a hierarchical energy management system (EMS) to address these issues. In level 1 of the EMS, which is for the overall management thereof, a blockchain model is used to manage transactions among microgrids. A grid synchronization algorithm is implemented in level 2 of the EMS, which manages the interconnection of microgrids. Level 2 is activated when an energy transaction between microgrids is needed. An on-line recurrent neural network (RNN)-based controller for an energy storage system (ESS), which is designed specifically to mitigate the problem caused by a floating PV platform, is deployed in level 3 as a local controller. The results of a hardware-in-the-loop (HIL) simulation demonstrate that the EMS can properly coordinate the levels in the hierarchical scheme to interconnect and provide power support between the microgrids. Real-time simulation results show that the ESS controller responds well, proving the viability of the hardware controller. According to these findings, the hierarchical EMS that is proposed in this work can solve the considered problems.


I. INTRODUCTION
In recent years, electric power systems have been undergoing a major development that involves distributed generation (DG) [1]. This development has led to the increased penetration of alternative sources, such as photovoltaics (PV) and wind [2]. Aside from providing clean energy, DGs can form a microgrid, which can be isolated from the main power grid. One main advantage of such microgrids is that they can minimize power losses because they are close to consumers [3]. Islanded microgrids can provide voltage and frequency regulation without relying on the main grid [4]. Microgrids can also interconnect with one another to form a networked microgrid. Their interconnection increases the reliability of the network and yields performance similar to that of a large power grid [5]. Consequently, a new type of grid The associate editor coordinating the review of this manuscript and approving it for publication was Ning Kang . user, known as a prosumer, who can provide and consume electrical energy, has become common [6].
The use of a traditional centralized transaction system with such microgrids would be costly and time-consuming, negating their advantages. Centralized management/control cannot handle multiple and frequent transactions, discouraging the participation of DG by allowing for only low profits [7]. A decentralized peer-to-peer trading platform based on blockchain technology has been implemented to solve this problem [8]. Blockchain was developed by Satoshi Nakamoto in 2008 to provide a decentralized platform for the digital currency Bitcoin [9]. Since then, blockchain technology has had various applications, including energy transactions in power systems.
An effective energy management system (EMS) is required to realize the potential of the wide range of microgrid applications [10]. An EMS can be used to coordinate distributed energy resources (DERs) with their respective loads, and VOLUME 10, 2022 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ each DER has its own local controller [11]. An EMS can be established in a hierarchical manner such that each of its layers has a specific role. The first layer of an EMS directs the provision of power by a DG facility to a specific load on a predetermined schedule. Upon receiving the relevant command from the upper layer, controllers such as synchronization algorithms and power regulators become active. Various studies of the use of EMSs have been performed to solve different problems that arise in microgrids. Shen et al. scheduled various DERs in a microgrid to maximize profit, considering the uncertainties in the system [12]. Thirugnanam et al. [13] minimized the energy consumption cost using a peer-to-peer (P2P) approach. An EMS has also been used to minimize converter losses in battery systems [14]. Pannala et al. used an EMS-based strategy in a DC microgrid and thus improved the system performance by replacing a diesel generator with a hybrid energy storage system [15]. Rezaei et al. considered the frequency stability of a microgrid [16]. Liu et al. improved the security of an EMS using blockchain consensus algorithms [17]. Di Silvestre et al. established the possibility of load generation and aggregation using a blockchain [18]. Afzal et al. used the blockchain in energy management that involved load-side demand, smart homes and the internet of things (IoT) [19]. Sciume et al. deployed actual blockchain networks in a laboratory setting that simulated a realistic scenario to demonstrate the feasibility of the application of the technology [20]. Yang and Wang used the blockchain as a means to reduce each prosumer's cost and the overall cost of a system by developing a trading algorithm [21]. Ali et al. developed an energy trading system by creating an adaptive model such that prosumers can easily join the blockchain network [22]. Hamouda et al. created an efficient transaction framework allowing a fast billing cycle for a large number of market participants by using existing market models and blockchain technology [23]. Saxena et al. developed a blockchain network for a residential energy trading system that can reduce the peak demand of the community [24].
For a networked microgrid, the islanding and interconnection of individual microgrids must also be taken into account. Interconnecting microgrids requires synchronization. The conditions of microgrid synchronization include connection to the bulk power grid [25] and interconnection to other microgrids, involving imbalance and harmonics [26]. Escobar et al. developed a discrete-time frequency-lockedloop for a single-phase signal [26].
For use in the local controllers of a microgrid, different methods of stabilizing responses have been proposed. One method that is commonly used for voltage control is fuzzy control. Rai and Rai used a fuzzy logic controller (FLC)-based battery for regulating a PV farm in a standalone system [27]. Hong and Nguyen used a fuzzy type-2 system to regulate low voltages that are caused by faults [28]. Saroha et al. used adaptive neuro-fuzzy inference system (ANFIS)-based controllers to compensate for unbalanced voltages in microgrids [29].
The aforementioned works exhibit the following limitations.
(i) Some energy management schemes do not consider low level control in a hierarchical model [12], [13], [15], [18], [20]- [23]. (ii) The networking of some microgrids, which enhances the reliability of individual microgrids, often was not addressed [14], [16], [18], [20]- [24]. (iii) The synchronization methods may be only applicable to balanced and harmonic-free systems [25] or singlephase systems [26]. (iv) Although FLC or ANFIS-based controllers outperform conventional proportional-integral (PI) controllers [27]- [29], the parameters of these methods cannot be tuned on-line; thus, they have limited performance under highly unpredictable conditions, such as those associated with the pitch motion that is considered in this study. The purpose of this work is to construct a hierarchical EMS that is based on a blockchain network in a networked microgrid. It involves providing energy support to a floating PV system under the effects of pitch motion, which has not been very well-studied. The contributions concerning each level of the proposed hierarchical EMS scheme are as follows.
1) Level 1 of the EMS involves the use of an energy blockchain to manage inter-microgrid transactions. It is responsible for the overall coordination of the microgrids. In this work, the blockchain is used to implement energy transactions in a hierarchical EMS model, rather than for security or cost optimization as in earlier studies. 2) Level 2 involves a grid synchronization algorithm for interconnecting microgrids, considering the existence of unbalanced loads and harmonics in microgrids. This work focuses on networked microgrids with which islanded microgrids may interconnect and disconnect, whereas previous studies have not addressed such interconnection. 3) Level 3 involves an on-line RNN-based controller of a bidirectional DC-DC converter. This controller is designed to handle the effect of the pitch motion of a floating PV system in regulating the voltages of the system. This controller improves the performance of other intelligent controllers, such as type-2 FLC and ANFIS. 4) The feasibility of using an RNN controller in a bidirectional DC-DC converter circuit is verified by conducting a hardware-in-the loop (HIL) simulation to prove that the proposed controller can work in an actual circuit. The operation of the entire hierarchical EMS depends on the energy transactions that are carried out using blockchain in level 1 for networked microgrid operations. The interconnection of microgrids in level 2 can only occur with permission of the blockchain network. After microgrids interconnect, the local RNN controller in level 3 provides power support.
The rest of the paper is organized as follows. Section II defines the problem of interest. Section III briefly discusses the concept of the blockchain. Section IV presents the proposed method. Section V presents and discusses experimental results. Finally, Section VI draws conclusions.

II. PROBLEM DESCRIPTION
This section describes networked microgrids and the challenges with which they are associated, including control and synchronization. Floating PV systems and their possible effects on voltage fluctuations are considered.

A. NETWORKED MICROGRIDS
Microgrids can be operated in a grid-tied mode or an isolated mode, or they can interconnect to each other in what are known as networked microgrids. Since no large generator regulates voltage and frequency, distributed sources must provide such regulation, usually through the use of droop control [30], which ensures that each power source in the system generates power in proportion to its total capacity.
In some instances, microgrids cannot maintain power balance or a constant voltage on their own so they must be supported by other microgrids. Such an interconnected setup is known as a networked microgrid. This configuration raises a new challenge, which concerns the energy transactions among microgrids. Recent works have involved the use of P2P methods, including the blockchain, to handle the energy transactions in real time so that the power support can be delivered when required [31].
Another challenge that is associated with networked microgrids is the need to establish a seamless interconnection when they transition from individual islanded modes. Microgrids typically have different voltages, frequencies and phases and interconnecting microgrids generates transients in the system. This problem can be solved using synchronization techniques [25]. Synchronization algorithms must also consider the fact that microgrids usually have harmonics and are unbalanced owing to the presence of inverters and singlephase loads. To do so, modified phase-locked loop (PLL) algorithms are required to ensure proper microgrid interconnections. Various studies have been carried out for this purpose. The present paper focuses on interconnecting two microgrids with both harmonics and unbalanced voltages.

B. FLOATING PV SYSTEMS
The construction of large PV arrays requires large amounts of land, which could otherwise be used for agriculture or residences, or be left in its natural state. This fact creates a problem that could outweigh the advantages of using renewables as an energy source. One solution to this problem is to move the generators offshore so that they do not occupy land. A further advantage of taking such an approach, specifically for photovoltaic arrays, is that the water on which the generators float can be used for cooling.
Offshore PV systems are also being introduced into microgrids. Installations of these systems, such as those in the USA [32], involve the integration of floating PV systems in the power grid. An ongoing project at an army base [33] reveals the advantages of a floating PV system in terms of both efficiency and feasibility.
Despite the above advantages, the use of floating PV arrays also has disadvantages. One disadvantage is the effect of pitch motion on a floating platform. This motion is the swinging of the platform in a manner that depends on the water waves. The consequent change of the angle between the PV array and the sun has a direct impact on the energy that is generated, because its power output depends on the alignment of the panel relative to the sun [34]. One possible solution to this problem is to purchase energy from nearby microgrids. Although doing so solves the problem of unstable power generation, interconnections among microgrids will cause voltage and frequency deviations throughout the grid. Accordingly, control strategies that differ from those for conventional power systems must be implemented.
Purchasing power support from other land-based sources (interconnected microgrids) requires the local controller of such sources to handle random changes in the power requirement of the system. Recent research papers on such unpredictable changes have used neural networks either to tune a PID controller [35], [36] or as controllers themselves [37].

III. BLOCKCHAIN
A blockchain is a decentralized transaction platform that is typically used for cryptocurrency such as Bitcoin and Ethereum. Although cryptocurrency represents the most common use of blockchain, blockchain has other applications that require decentralized trading platforms, such as energy systems. Blockchains are designed to operate in a peerto-peer manner, meaning that transactions are carried out directly between sellers and buyers, or sometimes between parties that both buy and sell, as prosumers do. Recent studies of blockchains, like that of Di Silvestre et al. [38], have involved the use of the blockchain to provide ancillary services within a microgrid.

A. BASIC CONCEPTS
A blockchain comprises records, called ''blocks'', that are arranged in chronological order, or a ''chain'', as shown in Fig. 1. Each block contains a timestamp and hash code to protect against tampering. Each block except the first, which is called the genesis block, uses the hash code of the preceding block to ensure the validity of its contents. The genesis block initiates the blockchain and typically contains data that are relevant to the date of creation, such as a news headline on that date [9]. These records are recorded on multiple computer systems known as a distributed ledger. If block information is altered without detection by a single system, other systems can compare their records and detect and correct the discrepancy.
Blockchains operate in various ways, and can be classified by permission and consensus. Public and private blockchains exist and consensus models include various types of proof of ownership in a blockchain, such as proof of work, proof of stake, proof of authority, and others [39]. Each of these proofs have their own advantages and disadvantages.

B. PROOF OF STAKE
The most common consensus algorithm in blockchain is the proof of work (PoW). In this setup, anyone can generate blocks in the blockchain, which is therefore public. Such a blockchain is used in cryptocurrencies such as Bitcoin and Ethereum. Creating blocks involves adding coins to the account of a user. Each user must solve a complex cryptographic puzzle for a valid hash code to be able to add a block. This process of solving requires computational effort and is known as mining. The process is very complex and is not suitable for energy trading, which requires the lowest possible energy consumption. Another disadvantage of using proofof-work is its lack of security relative to other consensus algorithms, especially in public blockchains such as those used in cryptocurrency.
Another more viable type of consensus, which can be used in energy trading, is the proof of stake (PoS) consensus [40], in which validation replaces mining. Validators may add blocks to a blockchain and must own a share in the network to do so [41]. For an energy blockchain, the participants who validate a transaction are energy vendors that have permission to do so. Other entities in the network that only buy electricity cannot participate in the validation process. Figure 2 presents the basic process of a PoS blockchain.
Advanced metering infrastructure (AMI) is implemented using smart meters that automatically collect electricity usage data from customers as part of the transition to smart grids [42]. Smart meters can be installed at the locations of energy prosumers in the microgrids to provide two-way real-time transaction information to the blockchain. Sciume et al. [20] presented an example of using a blockchain with smart meters to deliver demand response services.
Various papers have addressed the use of blockchain technology to provide a P2P framework for energy trading between prosumers [40]. Some have focused on improving security [43], while others have focused on specific applications, such as multi-microgrid transactions [44] or electric vehicles [45].

IV. PROPOSED METHOD
The system that is considered in this paper is a modified IEEE 34-bus system that is disconnected from the bulk grid and divided into three microgrids, as displayed in Fig. 3. This particular system was chosen because of its imbalance, which is one of the factors that is investigated herein. A total of three PVs, two energy storage systems (ESSs), and a diesel generator make up the DERs. Three DC loads and three single-phase loads are connected, causing the system to be unbalanced and exhibit harmonics, which are limited according to the IEEE-specified standards for microgrids. (Total harmonic distortion < 5% and voltage unbalance factor < 2%). Figure 3 displays the parameters of each DG and load, also the parameters of each DG and load.
This section details each level in the proposed hierarchical EMS. Specifically, level 1 deals with energy transactions among three microgrids. Level 2 involves synchronization between microgrids A and B (MG_A and MG_B) and between microgrids A and C (MG_A and MG_C). A local controller in a microgrid in level 3 is developed to regulate the voltage of the ESS. Figure 4 graphically depicts the proposed method.

A. LEVEL 1 -ENERGY BLOCKCHAIN
The blockchain program manages the energy transactions among microgrids and gives permissions to those who can connect to the blockchain network. The blockchain network herein is managed by a distribution system operator (DSO) but is not connected to the microgrid. The main function of the DSO is to provide access for distributed generators (DGs) to enable them to participate in transactions. Hence, only providers that are permitted by the DSO can trade energy within the network.
The blockchain code commands level 2 of the EMS to interconnect two microgrids, based on which microgrid was chosen to provide power support. It also specifies which microgrids may interconnect and provide power support to each other. Each transaction generates blocks that contain transaction details, such as the seller, buyer, timestamp, energy, power, and duration of power support.
The validator of each transaction is selected at random with a probability that is given by (1).
where s i is the staked amount and c i is the coin age which is the time for which the current stake is held for microgrid i. The coin age of a microgrid that is not chosen as a validator increases each day to ensure that even a microgrid (participant) with a low stake can participate in the validation process.
The blockchain code uses a private PoS consensus, as shown in Fig. 2, that is developed in Python. This code is interfaced with a Simulink program, which runs the microgrid model. In this work, PoS is adopted instead of the commonly used PoW consensus because PoS uses less computational power. The program presented here also uses a private permission model wherein only certified users are allowed to add records to the blockchain network. These considerations in choosing the consensus algorithm are based on the comparisons that were made by Musleh et al. [40].

B. LEVEL 2 -GRID SYNCHRONIZATION
Initially, three microgrids (MG_A, MG_B and MG_C) are separated and exhibit energy transactions. Level 2 mainly deals with microgrid interconnections to form a networked microgrid whenever an energy transaction between any two microgrids occurs. As stated earlier, the voltage and phase angle of two interconnected microgrids must be matched. The proposed synchronization algorithm can only be activated by the blockchain code in level 1. One of the two possible points (between nodes 834 and 858; between nodes 828 and 830) of VOLUME 10, 2022 connection in Fig. 3 is chosen, depending on the transaction output from level 1.
Because the method of Hong et al. [25] is only applicable in a three-phase balanced and harmonics-free system and the method of Escobar et al. [26] is only valid in a single-phase system, this work proposes a new synchronization process that involves three steps. The first step extracts the fundamental frequency using a low-pass filter whose transfer function is given by (2).
where ω n denotes the natural frequency (2πf n ) and ζ is the damping ratio. The next step determines the per unit amplitude of the three-phase waveform. Instead of obtaining the RMS voltage of all three phases, each RMS voltage for every phase is determined using (3).
where V rms(ph) and V rms(nom) represent the RMS voltage of one phase and the nominal RMS line-to-neutral voltage, respectively. The final step yields the phase difference between the voltage waveforms of the two microgrids. The equations involved are (4) and (5).
Equation 4 is the Clarke transform for one microgrid. Equation 5 is the relationship between the obtained values of the Clarke transforms of two microgrids (denoted as 1 and 2) and the phase difference [25]. Voltages V 1 and V 2 are close to unity p.u. ω 1 and ω 2 have equal values because both microgrids are maintained at 60 Hz. Taking the arcsine of the right-hand side of (5) yields the phase difference θ.

C. LEVEL 3 -RNN CONTROLLER FOR DC-TO-DC CONVERTER
When a varying amount of power from the ESS is drawn as a result of the pitch motion of floating PV arrays, the voltage output of the battery changes. To solve this problem, an on-line tuned RNN controller, presented herein, causes the stepped-up voltage from the ESS to remain constant, in turn causing the inverter voltage input to be constant, avoiding voltage fluctuations when this input is converted to AC. The motivation for using an RNN-based controller is that the weighting factors of an RNN can be tuned on-line in response to changes in operating conditions. However, the traditional FLC [27], [28] and ANFIS controller [29] can only be designed off-line. Another reason for adopting an RNN-based controller in level 3 of the hierarchical EMS is that only a few computations are required in the TI F28335 DSP chip (see (8)-(12) below) embedded in the TI TMS320F28335 board, which is similar to an edge computing device and provides communication ports linked to levels 1 and 2 of the hierarchical EMS. Thus, the computational efforts in the central computer is reduced.
The on-line tuned RNN controller has three inputs -the battery input voltage, the boost converter reference voltage, and the boost converter measured voltage. The output is the duty cycle, and differs from that of other RNN-based controllers, whose outputs are the proportional, integral, and derivative gains of a PID controller. During the initial training stage, the only input is the battery voltage. The measured voltage and reference voltage are added later for online tuning. Figure 5 presents the tuned RNN structure.
The RNN controller is tuned on-line using a backpropagation algorithm to determine the weights and bias of the output neuron. The activation function is tan-sigmoid (6); its derivative is given by (7).
The backpropagation algorithm updates the weights and bias of the output neuron by firstly calculating the partial derivative of the mean squared error (MSE, denoted as E) using (8). Y T and Y P are the true and predicted values, respectively. In this controller, the term Y T -Y P is the difference between the desired and measured voltages. Let h n and N be the output of the n-th hidden neuron and the number of hidden neurons, respectively. The symbol α is the learning rate. Equations (9) and (10) update the weight w 1 (t) and (11) and (12) update the bias b at the t-th iteration.

D. HARDWARE-IN-THE-LOOP SETUP
The proposed method was implemented using an OPAL-RT digital real-time simulator and a hardware-in-the-loop simulation, as shown in Fig. 6. The OPAL-RT simulator runs the Simulink models of networked microgrids, excluding the bidirectional DC/DC converter and the RNN controller at node 828 (ESS 1). The programmable voltage source is used to amplify the voltage signal from the ESS at node 828, modeled in the OPAL-RT, while the programmable load is connected to the output of the DC/DC converter. The bidirectional DC/DC converter takes its input from the ESS at node 828 in the Simulink model that provides power support. Its output is sent back to the Simulink model through the OPAL-RT device using voltage sensors. The voltage sensors use a differential operational amplifier to reduce the signal and allow it to be fed back to the OPAL-RT. The RNN controller is burnt directly onto a TMS320F28335 chip to control the DC-DC converter. Figure 7 shows the interconnection between the OPAL-RT digital real-time simulator and the test hardware.

V. RESULTS AND DISCUSSIONS
The proposed EMS system is tested on a Simulink model of the modified IEEE 34-bus system in an OPAL-RT digital realtime simulator. It is interfaced to the blockchain program in Python via a TCP/IP connection.

A. SCENARIO DESCRIPTION
Two scenarios that involve floating PV arrays (DG 3) at node 864 in MG_A are considered. The PV power is varied based on data from a study of offshore PVs [34]. The scenarios of interest are as follows. 1) Severe pitch motion is applied to the floating PV. Power support is obtained from the ESS at node 828, which is located in the neighboring microgrid (MG_B). The ESS at node 890 in MG_A is set to a 20% state-of-charge and so cannot provide power support. A 10s simulation is performed, in which pitch motion is applied from 3s to 7s. The floating PV array is stable at 0s -3s and 7s -10s. The power output, synchronization performance, and RNN controller performance are investigated. 2) A random pitch motion is applied to the floating PV, resulting in an unpredictable variance in PV power. This and the preceding scenario are used to examine the  performance of the RNN controller and synchronization. The total duration of the simulation and the pitch motion are the same as in scenario 1. In order to test each level of the microgrid, the blockchain program for each event in the simulation is monitored. The simulation begins with MG_A sending a request for power support. Other microgrids are able to receive the request and send their own price offers. In this case, MG_B is chosen to provide power support because it contains the battery that has the hardware to be tested. The power output of each DG is monitored using oscilloscopes that are connected to the OPAL-RT digital real-time simulator, which is scaled down to 1/10 5 . The synchronization is monitored in MATLAB, in which the AC voltage waveforms of the two microgrids that will interconnect are displayed. The RNN controller is tested VOLUME 10, 2022 using a simulated circuit in MATLAB and implemented in an actual converter circuit using a TMS320F28335 chip.

B. BLOCKCHAIN OUTPUT AND POWER MEASUREMENTS
The main function of the blockchain is to initiate and record transactions and to command microgrids to interconnect. Figure 8 shows a sample transaction record in the blockchain using private PoS consensus. The data include the maximum power, energy purchased, duration of power support, source microgrid, and destination microgrid. Other details that are required in the blockchain, such as the index, timestamp, and hash, are also included. As presented in Fig. 8, MG_A needs 0.031284kWh in 4s owing to the pitch motion of the floating PV arrays at node 864, which is supported by the ESS at node 828 in MG_B. Figures 9 and 10 present the results of the Opal-RT HIL simulations that were recorded using an oscilloscope. The waveforms show the measured power of each DG and ESS, and the power that flows through the nodes where the microgrids interconnect. Figure 9(a) shows the 500kW floating PV power output in MG_A. The effect of the pitch motion is evident from 3s to 7s in the simulation as the power becomes unstable. Two PVs in MG_B are set to PQ control, meaning that they output the maximum power throughout the simulation. Their maximum outputs are both 100kW. The power measurement between nodes 828 and 830, where MG_A and MG_B interconnect, is also shown in the figure. Initially, the two microgrids are islanded so no power reading is generated. When the pitch motion occurs, the microgrids interconnect and power flows from MG_B to MG_A. The graph shows that a decrease of power from the floating PV corresponds to an increase of power that flows from MG_B for compensation, ensuring that the system remains stable. Figure 9(b) plots the diesel generator output from MG_C. This generator is a possible source of power support for the floating PV, but since it was not chosen for energy transactions in the blockchain, its output depends only on the connected loads within its own microgrid. The power through nodes 834 -838 is also measured, showing that MG_A and MG_C never interconnect and so no power flows between them. The ESS in MG_A charges at a constant rate of 200kW. In the scenarios presented here, this ESS is unable to provide power support as it is set at a low state-of-charge of 20%. The power shown is negative, indicating that ESS is charging. The ESS in MG_B is the one that was selected earlier in the blockchain program and provides power support. Initially, the ESS in MG_B provides a constant power output for the loads within its own microgrid. When the pitch motion occurs, the ESS in MG_B provides additional power to compensate for the power decrease in MG_A. Figure 10 plots the power outputs for 10 s of random pitch motion. As in the previous scenario, these outputs prove that the ESS can compensate for the power variations of the floating PV.

C. GRID SYNCHRONIZATION OUTPUT
The performance of the synchronization algorithm is evaluated by comparing the voltage waveforms and the phase difference between the microgrids that must interconnect. Figure 11 plots two voltage waveforms of two interconnecting microgrids without synchronization. The out-of-phase waveforms generate transients. In Fig. 12, a conventional synchronization algorithm that is based on the work of Hong et al. [25] is used. The algorithm does not consider harmonics or unbalanced voltages, resulting in an incorrect phase difference. A closure of the tie switch still produces a transient during interconnection. As shown  in Fig. 13, once the phase difference is reduced using the proposed method, the tie-switch between node 830 in MG_A and node 828 in MG_B is closed, resulting in a smooth waveform with small distortions.

D. ON-LINE TUNED RNN CONTROLLER
The varying power generated by a floating PV system undergoing pitch motion directly influences the ESS that will compensate for it. In the case considered herein, the power FIGURE 12. Voltage waveforms and phase difference of two interconnecting microgrids using a conventional synchronization algorithm [25]. that is drawn from the ESS at node 828 varies, changing its voltage. Figures 14 and 15 compare the performances of a conventional PI controller, a type-2 FLC [28], an ANFIS controller [29] and the proposed on-line RNN controller. The voltage is increased by the converter to 750V DC , which is suitable for conversion to 380V AC (line-to-line). The PI controller cannot maintain the required voltage output because it cannot rapidly change the duty cycle of the converter. Increasing the PI controller gains yields an unstable output. The fuzzy controllers are able to follow the reference voltage and maintain stability throughout the simulation. However, zooming in on the waveforms reveals that the two fuzzy controllers produce oscillations. The on-line-tuned RNN controller can maintain the required 750V with minimal oscillations. Figures 16 and 17 respectively present the HIL results of using the RNN controller and a bi-directional DC/DC converter that is controlled by a TMS320F28335 chip under severe and random pitch motions. The input voltages are those used in the computer simulations and are set to 375V at the start of the simulation. The oscilloscope outputs are offset by 375V and 750V for the converter input and output, respectively, so that the behavior of the waveforms can be observed in detail. The converter hardware outputs exhibit more deviations than the computer-simulated outputs but are  still very close to the desired DC bus voltage. This HIL testing confirms the effectiveness of the proposed on-line RNNbased controller that uses a bi-directional DC/DC converter, a programmable AC source and a DC load, as shown in Figs. 6 and 7.

E. DISCUSSIONS OF SIMULATION RESULTS
From the above simulation results, it can be found that the proposed method shows some advantages, compared with previous methods: the PoS consensus requires less computation than the commonly used PoW consensus; Fig. 13 shows the proposed synchronization method can deal with harmonics and imbalance conditions while the method in [25] cannot deal with such situations, as shown Fig. 12. Moreover, the  proposed on-line tuned RNN-based controller obtains a more stable response, compared with those obtained by the traditional type-2 FLC [28] and ANFIS controller [29], as shown in Figs. 14 and 15.
Several factors are not currently considered in the proposed method: The blockchain program was only implemented in Python and was not tested on an online blockchain network. Also, the errors resulting from measurements and the possible latency caused by communication networks were not considered in the above simulations.

VI. CONCLUSION
This paper proposes a hierarchical EMS for islanded networked microgrids. The considered scenarios involve a large floating PV field under pitch motion, resulting in a varying power output. Each level in the hierarchical EMS is explored: the blockchain manages the energy transactions in level 1; the synchronization interconnects the microgrids seamlessly in level 2; the local on-line RNN controller of the ESS provides power support in level 3. The contributions of the proposed method can be summarized as follows. The blockchain is demonstrated to be able to provide a transaction platform and gives proper commands to the lower levels of the hierarchical model. The PoS consensus is more suitable than the commonly used PoW in a real-time transaction platform because of less computational time required. The proposed synchronization algorithm performs as intended, since it is able to properly interconnect two microgrids despite the presence of harmonics and imbalance in the system. Finally, the local on-line tuned RNN-based controller is able to maintain the voltage level of the DC bus even when an unpredictable variation of power is caused by the pitch motion of the floating PV; however, the waveforms obtained by two traditional fuzzy controllers produce oscillations. Based on the obtained results, each level of the EMS can effectively coordinate with the others and is effective in maintaining microgrid stability throughout an HIL simulation. Future studies will investigate a blockchain that involves the use of cryptocurrency test networks as well as the possible implementation of a digital twin. Also, the errors resulting from measurements and the possible latency caused by communication networks will be studied.