An Integrated Seamless Control Strategy for Distributed Generators Based on a Deep Learning Artiﬁcial Neural Network

: One of the challenges of inverter-based distributed generators (DGs) is to keep the voltage and frequency at their speciﬁed limits during transitions between grid-connected and islanded modes of operation. This paper presents an integrated seamless control strategy for inverter-based DGs to ensure smooth transitions between the different modes of operation. The proposed strategy is based on a deep learning neural network (DL-ANN) Proportional-Integral- Derivative (PID) controller to regulate the terminal voltage of the DG interface system. A feed-forward loop is integrated with the proposed strategy to mitigate grid harmonics by controlling the DG inverter to feed the harmonics components of non-linear loads without exceeding its capacity. Results are provided to evaluate the dynamic performance of the proposed uniﬁed control strategy under different disturbances. Finally, to demonstrate the superiority of the DL-ANN controller, a comparison is carried out with the conventional Proportional-Integral (PI) controller and the set-membership afﬁne projection adaptive (SMAPA)-based PI controller.


Introduction
Distributed generator (DG) and microgrid [1,2] principles were first introduced due to excessive energy demand. The DG can be deployed in a distribution network to provide power for local loads or to act as a backup power source against utility outages. DGs operate as grid-connected generators or standalone generators with respect to their location [3][4][5]. The excess energy from DGs can supply the grid or can be stored in batteries during a grid-connection operation. However, the DGs in this mode of operation can be vulnerable to deliberate or unintended islanding. Deliberate islanding occurs when maintenance is performed. Unintended islanding happens when grid faults occur. Consequently, DG may be subjected to transience during transitions between different modes. Therefore, the load voltage and current may experience damaging spikes while switching from one mode to another. Thus, studying the transient behavior of these transitions is critical.
Most DGs are connected to the grid through the inverter, to guarantee smooth synchronism. The voltage source inverter (VSI) is the most frequently used inverter for DG connections. Various control mechanisms for these inverters have been proposed. The VSI is controlled through current and voltage controllers for the grid-connected mode and islanding operations, respectively. The current controller is used to regulate the active and reactive power, while the voltage controller regulates the voltage and frequency [6]. The control strategy must be adjusted when switching from one operating mode to another, which is a disadvantage as this may lead to transience.
Extensive research was conducted regarding the smoothing of DG operation mode transitions, as well as addressing DG power quality challenges. In a previous study [7], a voltage regulation loop, cascaded with a current loop, was implemented for indirect Sustainability 2022, 14, 13506 2 of 14 current control during grid connection. To complete an islanding operation, the voltage control loop regulates the load voltage profile. Thus, switching between different strategies is not needed. The main drawback is in neglecting the dynamics of the DC-link voltage. In an earlier work [8], VSIs are controlled using a predictive control strategy in several modes of operation. As there is just one cost function to optimize the performance for all modes of operations, the suggested control strategy is simple. The authors of [9] presented a control technique for an inverter that works in both grid and standalone modes, but without having any transitions between the grid connection and islanding operations. In the grid-connection mode, the inverter is operated as a current source by means of a current controller, while the voltage controller is triggered to adjust the voltage during standalone mode. A module to generate the VSI's direct-quadrature current reference is proposed, but the controller is not adaptive to disturbances.
Based on conventional phase-locked loop (PLL) [10,11] or adaptive phase angle estimation [12], some researchers have used two loops for controlling the DG inverter: a current control loop for controlling the active and reactive power, in the case of the grid-connected mode, and a voltage control loop to control the load voltage in the islanding mode. However, during the transition from one mode to another, the control loop needs to be changed; consequently, there will be a delay in the response to the change in mode, which may lead to transience during the mode change. A control strategy based on voltage-controlled VSI is proposed for both grid-connected and islanded modes [13]. However, this strategy uses a droop controller, which leads to slow dynamic performance. In an earlier study [14], an inverter topology and its control algorithm are used to achieve seamless transfer during intentional islanding. The main drawback of this method is that the inverter is not able to control instantaneous values in the grid-connected mode since the peak value of the inductor current is used for current control, which may result in inaccurate instantaneous values or the DC offset of the grid current during the transient state. A seamless transfer is achieved in [15] using an indirect current control algorithm that regulates the filter capacitor voltage in both grid-connected and islanded modes. The drawback of this method is the difficulty of controller design. A proportional resonant (PR)-based indirect current control algorithm is utilized for both grid-connected and islanded modes of operation [16].
In an earlier study [17], a control algorithm that considers the non-detection zone, where the inverter cannot sense changes in the magnitude and frequency of critical load, was proposed. The drawback of this strategy is that a repetitive controller is used, which works perfectly well in the case of periodic disturbances only. Voltage and power-sharing controllers are proposed to overcome voltage disturbances and power angle swings, thereby achieving a seamless transition [18]. In [19], a seamless transfer strategy is used for droopcontrolled DGs, from islanded to grid-connected mode. It consists of frequency synchronization and phase synchronization to overcome frequency and phase oscillations without impacting the power-sharing of droop control. However, the droop control has low dynamic performance and depends on achieving a smooth transition at the zero crossing of the voltage. A seamless control for the PV system, based on a sliding Fourier transform-based PLL for improved power quality level, is proposed in [20].
A seamless strategy is proposed in [21], based on the master/slave control technique, where the master DG is controlled by a combination of droop control and indirect current control, a group of slave DG units is controlled with PQ control, while the other group of slave DG units adopt a transition between PQ control and droop control. In an earlier study [22], a unified droop controller is proposed to achieve a smooth transition between modes of operation by changing the voltage reference, but the transition needs two fundamental cycles; a droop controller is used, which has its own drawbacks, as indicated before. Earlier researchers in [23] discussed a resynchronization method, based on a universal droop controller; however, the strategy is concerned only with the transition from the islanded to grid-connected mode.
From the above discussion, it is obvious that the DG interface with the grid has introduced new challenges, due to the transience that may occur during DG connection and disconnection with the grid. Thus, this paper proposes a unified seamless control strategy that ensures smooth transfer between the different modes of operation, without the need for switching between two different strategies.
Adaptive proportional-integral (PI) controllers are utilized to improve the DG's system performance during disturbances. A model reference adaptive controller (MRAC) is presented in [24], where the model parameters are unknown. The drawback of an MRAC is that it depends on the availability of the system. In [25][26][27], the tuning of the PI controller gains was carried out using a variety of optimization techniques. However, the PI controller's adaption is limited by heavy computations. Although they showed good performance of the fuzzy-based adaptive PI, it relies upon human knowledge and experience [28]. Adaptive filtering techniques are often utilized to control converters. For model-less systems, adaptive proportional-integral-derivative (PID) controllers with a neural network base are proposed in [29]. A PR controller [30] is proposed within a droopbased control strategy to improve the performance of an islanded microgrid. However, the PR controller introduces oscillations into the system response; the study has considered operation in islanded mode only.
In most of the literature, separate control strategies are used for different DG modes of operation. Consequently, the output voltage and current encounter transience while transitioning from one mode to another. On the other hand, some researchers have used a single control strategy for different modes; however, the strategy is based on droop control, which has a poor dynamic performance. Additionally, most of these strategies use a conventional PI controller or apply an adaptation technique to adjust the PI gains without taking into consideration the rise of artificial intelligence (AI) control techniques, which can be used instead of traditional controllers. Hence, a deep learning neural network (DL-ANN)-based PID controller, which does not depend on system details, is proposed in this paper, for a unified control strategy; it has the advantage of using a deep neural network that can address highly complex functions better than a shallow network [31].
The main advantages of the suggested scheme are that: • No transition between different control schemes is required.

•
The strategy enables the DG to be a local load-follower. • It eliminates harmonics from the utility current in the case of a non-linear local load. • Moreover, using the DL-ANN controller allows the DG system to overcome sudden changes without the need to change the controller's parameters.
The remaining part of the paper is as follows. In Section 2, the system model and the control strategy are introduced. Section 3 discusses the proposed DL-ANN controller. Section 4 presents a discussion of the results, and finally, our conclusions are presented in Section 5. Figure 1 shows the main components of the DG system under study. The DG is represented by a 600 V DC source and is interfaced with the grid through a VSI. A simple LC filter of 8 mH and 15 µF is used to smooth the output current and filter out the highfrequency ripples. A local dynamic load is connected at the point of common coupling (PCC). Finally, a utility switch is responsible for the connection of the DG with the grid, which is represented as a three-phase voltage source and aggregated load, to test the system under different loading conditions.

Control Stage
The objective of the control strategy is to achieve a seamless transition for the DG, to eliminate harmonics from the utility current, and to enable the DG to follow the local load. The proposed unified seamless control strategy for the DG inverter is illustrated in Figure 1b. A PLL is used to track the grid voltage phase angle to null the grid voltage quadrature-axis projection, v Gq . The direct and quadrature projections of the VSI reference currents, i VSId * and i VSIq *, are the controlled variables that are transformed to the three-phase reference frame afterward. Eventually, the VSI gate signals are generated using the hysteresis current control (HCC) switching scheme, due to its fast dynamics and simplicity [32].  Figure 1. (a) DG system (b) Unified control scheme block diagram for the DG system. * Refers to reference value of the variable.

Control Stage
The objective of the control strategy is to achieve a seamless transition for the DG, to eliminate harmonics from the utility current, and to enable the DG to follow the local load. The proposed unified seamless control strategy for the DG inverter is illustrated in Figure  1b. A PLL is used to track the grid voltage phase angle to null the grid voltage quadratureaxis projection, vGq. The direct and quadrature projections of the VSI reference currents, i VSId * and i VSIq *, are the controlled variables that are transformed to the three-phase reference frame afterward. Eventually, the VSI gate signals are generated using the hysteresis current control (HCC) switching scheme, due to its fast dynamics and simplicity [32].
The load voltage is regulated by the utility in the grid-connection mode. Thus, the referenced-direct axis projection of the capacitor voltage vcd* is set to the highest permitted load voltage, Vmax, which is much higher than the real voltage, vcd. Consequently, the proposed controller, based on the DL-ANN, will force the limiter to generate iGd*, the The load voltage is regulated by the utility in the grid-connection mode. Thus, the referenced-direct axis projection of the capacitor voltage v cd * is set to the highest permitted load voltage, Vmax, which is much higher than the real voltage, v cd . Consequently, the proposed controller, based on the DL-ANN, will force the limiter to generate i Gd *, the upper setting of the limiter. Hence, the deactivation of the outer voltage loop occurs. In addition, by setting the reference quadrature-axis voltage v cq * to zero, where v cq is made zero by the PLL, it causes a zero output from the P compensator. Figure 2 illustrates that only the inner current loop will be responsible for generating the reference currents of the VSI, i VSId * and i VSIq *, to demonstrate grid-following during the grid-connection mode. The local load is fed from the DG, which is represented as a current source, while the grid receives the rest of the generated power. The injected powers to the grid, P g and Q g , are given by: where i Gd and i Gq are the grid current projections in the d-q axes. i Gd should be positive and i Gq should be negative, according to (1) and (2), to supply power to the grid.

The Proposed DL-ANN-Based PID Controller
The advantage of using deep neural networks (DNN) rather than their shallow counterparts is that the DNN gives a more powerful model due to the increased number of hidden layers. Machine learning and deep learning are popular subfields. There are several types of machine learning techniques, such as supervised learning, unsupervised learning, and reinforcement learning [35]. Supervised learning is used in regression, classification problems, and function approximations, while unsupervised learning is During islanding mode, the grid current is dropped to zero due to fault-clearing operations. Consequently, the reduction of i Gd and i Gq to zero will occur. Moreover, v cd rises due to an increase in i Ld and a reduction in i Lq , according to the load voltage equations, as follows: Furthermore, by moving the selector in Figure 1b to position 2, v cd * is set to the maximum rated phase voltage, that is, roughly 0.3 KV. During islanding, the outer voltage loop is activated to regulate the load voltage at v cd *, while i Gq * is set to zero, as illustrated in Figure 3. The frequency is fixed at its value when islanding is initiated and the PLL is not working in this mode. Thus, the local load is supplied from the DG, which can be represented as a voltage source that is grid-forming in this mode. It is clear that this approach guarantees a smooth and seamless transfer between the different modes of operation, without the need for a control strategy switching between two different control schemes.
After fault-clearing, the PLL starts working again and the system voltages will recover to their nominal values. As a result, synchronization is carried out between the DG and the utility. Moreover, the non-linear local load problem is overcome by measuring the load currents, i Ld , and i Lq , and feeding these measurements through a forward loop to form the VSI reference current, allowing the DG to become a local load follower. Thus, the harmonics from the utility current are mitigated and the reference tracking is much more accurate.
The DL-ANN-based PID controller is proposed for the d-axis voltage control loop of the unified strategy. The DL-ANN is trained using MathWorks software MATLAB 2016b neural network toolbox (nntool) with the data obtained from the system model simulated on PSCAD/EMTDC, Version 4.2 [33,34].

The Proposed DL-ANN-Based PID Controller
The advantage of using deep neural networks (DNN) rather than their shallow counterparts is that the DNN gives a more powerful model due to the increased number of hidden layers. Machine learning and deep learning are popular subfields. There are several types of machine learning techniques, such as supervised learning, unsupervised learning, and reinforcement learning [35]. Supervised learning is used in regression, classification problems, and function approximations, while unsupervised learning is used mainly in clustering problems. Reinforcement learning is essential in cases where the controller is needed to interact online with the environment and will receive a reward with positive or negative values, depending on the agent's actions. Thus, the controller learns online; the fitness function is to maximize the total reward, which is comparable to minimizing error in the controller's scenario [36].
In supervised learning, the controller is given a training data set containing the inputs and the outputs of the controller. This learning method is used in this paper, whereby a DNN with five layers is presented as the controller. A DL-ANN-based PID controller is

The Proposed DL-ANN-Based PID Controller
The advantage of using deep neural networks (DNN) rather than their shallow counterparts is that the DNN gives a more powerful model due to the increased number of hidden layers. Machine learning and deep learning are popular subfields. There are several types of machine learning techniques, such as supervised learning, unsupervised learning, and reinforcement learning [35]. Supervised learning is used in regression, classification problems, and function approximations, while unsupervised learning is used mainly in clustering problems. Reinforcement learning is essential in cases where the controller is needed to interact online with the environment and will receive a reward with positive or negative values, depending on the agent's actions. Thus, the controller learns online; the fitness function is to maximize the total reward, which is comparable to minimizing error in the controller's scenario [36].
In supervised learning, the controller is given a training data set containing the inputs and the outputs of the controller. This learning method is used in this paper, whereby a DNN with five layers is presented as the controller. A DL-ANN-based PID controller is utilized for controlling linear and non-linear systems [37]. The PID controller can be represented by (5): where U c (k) is the action of the PID controller, e(k) is the signal of error at time-instant k, ∆T is the sampling time, k p is the proportional gain, k i is the integral gain, and k d is the derivative gain. The proposed DL-ANN is controlling the d-axis projection of the PCC voltage, as in Figure 1. One input layer with three inputs, three hidden layers with ten neurons each, and one output layer with one output build up the proposed DNN. The DNN is tuned to represent the PID controller, given by Equation (5), where the input data is the signal of error e(k), which is the difference between v cd * and v cd ., the error accumulation ]. The training data is sampled from a system model from the PSCAD/EMTDC software [33], where an adaptive PI controller, based on (SMAPA) [34], is used in place of the proposed DL-ANN. The training process flowchart is presented in Figure 4.   To train the neural network after initializing its weights, feedforward propagation for the sampled inputs is first conducted, then the neural network output,ŷ i , is calculated. Consequently, the difference between the output (ŷ i ) and target (y i ) desired control action values is determined. In the feedforward step, the input to each neuron is the weighted sum of the previous layer neuron outputs. The function of activation is utilized for the non-linear processing of each neuron's input signal. There are several types of activation functions: linear, tangent hyperbolic, sigmoid, and ReLU functions. In this paper, the sigmoid activation function, which is given by (6), is used: The mean square error (MSE) is used for the performance function J(k), as expressed in a previous work (7), and the training function is from Levenberg-Marquardt: A backpropagation algorithm updates the weights that link the neurons in each layer to the neurons in the following layer. The DL-ANN is trained using the MathWorks software MATLAB neural network toolbox (nntool). The dataset used for training comprises 65,000 samples and is obtained through different loading conditions and scenarios to which the system may be subjected. The performance of the training algorithm is measured using the MSE; the optimal weights of the ANN are obtained when the MSE is smaller than a predetermined value. Figure 5 shows the statistical analysis of the DL-ANN's performance. It is clear that the MSE is 6.9 × 10 −10 ; the coefficient of correlation (R) is near unity, verifying that the DL-ANN is well-trained.

Simulation Results
Validation of the proposed DG system, based on the DL-ANN-based PID controller, is carried out through several modes of operation. The simulation is run in the PSCAD/EMTDC simulation environment. The system parameters under investigation are given in Table 1. The simulation time is split into spans, where a local load is switched on from 0.3 s to 0.4 s, a grid load is introduced in the time span from 0.5 s to 0.6 s, the DC is islanded in the interval from 0.7 s to 0.9 s, and a non-linear load is connected to the system during the time span from 1.1 s to 1.2 s. Eventually, the proposed controller is compared

Simulation Results
Validation of the proposed DG system, based on the DL-ANN-based PID controller, is carried out through several modes of operation. The simulation is run in the PSCAD/EMTDC simulation environment. The system parameters under investigation are given in Table 1. The simulation time is split into spans, where a local load is switched on from 0.3 s to 0.4 s, a grid load is introduced in the time span from 0.5 s to 0.6 s, the DC is islanded in the interval from 0.7 s to 0.9 s, and a non-linear load is connected to the system during the time span from 1.1 s to 1.2 s. Eventually, the proposed controller is compared to a traditional PI controller, where an adaptive PI controller based on SMAPA is used to prove its superiority.

Mode of Grid Connection
A local load of 60 Ω is supplied by the DG. At t = 0.3 s, a disturbance is created by connecting another local load of 30 Ω that is disconnected at t = 0.4 s. To feed the additional load, while keeping the current of the grid constant, the DG supplies more power, as in Figure 6. This happens in a seamless and unobtrusive manner. The results have proven the superiority of the proposed control strategy in tracking the load changes, as the strategy enables the DG to follow the local load. load, while keeping the current of the grid constant, the DG supplies more power, as in Figure 6. This happens in a seamless and unobtrusive manner. The results have proven the superiority of the proposed control strategy in tracking the load changes, as the strategy enables the DG to follow the local load.
A 2 Ω grid-side load is added as another large disturbance at the zero-voltage crossing at t = 0.5 s, as well as at the time of the voltage peak, t = 0.505 s. In both cases, the load is disconnected for a period of 0.6 sec. When the connected grid-load requires a current greater than 10 A, which is the DG and inverter limit, as in Figure 7a,b, the grid feeds the load by more than the rating of DG, without changing the inverter current, as in Figure 7c. Furthermore, because iGq* is set to zero, a unity power factor is achieved. According to Figure 7, the current was initially supplied to the grid from the DG; the grid immediately participated in feeding the additional grid load once the grid load exceeded the inverter limit, with fast dynamics and tight tracking. A 2 Ω grid-side load is added as another large disturbance at the zero-voltage crossing at t = 0.5 s, as well as at the time of the voltage peak, t = 0.505 s. In both cases, the load is disconnected for a period of 0.6 sec. When the connected grid-load requires a current greater than 10 A, which is the DG and inverter limit, as in Figure 7a,b, the grid feeds the load by more than the rating of DG, without changing the inverter current, as in Figure 7c. Furthermore, because i Gq * is set to zero, a unity power factor is achieved.
According to Figure 7, the current was initially supplied to the grid from the DG; the grid immediately participated in feeding the additional grid load once the grid load exceeded the inverter limit, with fast dynamics and tight tracking.

Islanding Transition
A grid outage occurs at t = 0.7 s, causing the utility switch to open, resulting in the DG islanding operation. Figure 8a,b demonstrate the seamless transition of the current and voltage drawn by the load, as there are no spikes or transients in either load voltage or current; hence, the load is secured. During islanding, the suggested unified controller succeeds in regulating the load voltage peak to a fixed value of 300 V, which solves the problem highlighted by the authors of [9]. The load voltage v cd will also follow its reference voltage, v cd *, within the permitted tolerances, as in Figure 8c. The voltage regulation error, which is the input to the DL-ANN controller, is displayed in Figure 8d

Grid-Connected Transition
After fault-clearing at t = 0.9 s, the PLL is enabled again, and the system voltage will be recovered to its nominal values. Synchronism is also carried out between the DG and the utility. Moreover, the voltage's seamless transition and the continuity of current are demonstrated in Figure 8. A smooth transition is achieved, which proves the reliability of the proposed DL-ANN-based PID controller in several operating modes.
Furthermore, the robustness of the load current feedforward loop is proved by connecting a non-linear load at the time interval of t = 1.1 s to t = 1.2 s. The feedforward loop forces the DG interface system to feed the harmonic current needed by the non-linear local load and keeps the grid current sinusoidal, as indicated in Figure 9. This action consequently makes the grid current waveform free from harmonics.

Islanding Transition
A grid outage occurs at t = 0.7 s, causing the utility switch to open, resulting in the DG islanding operation. Figure 8a,b demonstrate the seamless transition of the current and voltage drawn by the load, as there are no spikes or transients in either load voltage or current; hence, the load is secured. During islanding, the suggested unified controller succeeds in regulating the load voltage peak to a fixed value of 300 V, which solves the problem highlighted by the authors of [9]. The load voltage vcd will also follow its reference voltage, vcd*, within the permitted tolerances, as in Figure 8c. The voltage regulation error, which is the input to the DL-ANN controller, is displayed in Figure 8d.

Grid-Connected Transition
After fault-clearing at t = 0.9 s, the PLL is enabled again, and the system voltage will be recovered to its nominal values. Synchronism is also carried out between the DG and the utility. Moreover, the voltage's seamless transition and the continuity of current are demonstrated in Figure 8. A smooth transition is achieved, which proves the reliability of the proposed DL-ANN-based PID controller in several operating modes.
Furthermore, the robustness of the load current feedforward loop is proved by connecting a non-linear load at the time interval of t = 1.1 s to t = 1.2 s. The feedforward loop forces the DG interface system to feed the harmonic current needed by the non-linear

Islanding Transition
A grid outage occurs at t = 0.7 s, causing the utility switch to open, resulting in the DG islanding operation. Figure 8a,b demonstrate the seamless transition of the current and voltage drawn by the load, as there are no spikes or transients in either load voltage or current; hence, the load is secured. During islanding, the suggested unified controller succeeds in regulating the load voltage peak to a fixed value of 300 V, which solves the problem highlighted by the authors of [9]. The load voltage vcd will also follow its reference voltage, vcd*, within the permitted tolerances, as in Figure 8c. The voltage regulation error, which is the input to the DL-ANN controller, is displayed in Figure 8d.

Grid-Connected Transition
After fault-clearing at t = 0.9 s, the PLL is enabled again, and the system voltage will be recovered to its nominal values. Synchronism is also carried out between the DG and the utility. Moreover, the voltage's seamless transition and the continuity of current are demonstrated in Figure 8. A smooth transition is achieved, which proves the reliability of the proposed DL-ANN-based PID controller in several operating modes.
Furthermore, the robustness of the load current feedforward loop is proved by connecting a non-linear load at the time interval of t = 1.1 s to t = 1.2 s. The feedforward loop forces the DG interface system to feed the harmonic current needed by the non-linear local load and keeps the grid current sinusoidal, as indicated in Figure 9. This action consequently makes the grid current waveform free from harmonics.

Comparison
The dynamic response of the proposed DL-ANN controller is compared with the conventional PI controller and an adaptive PI, based on SMAPA. The DG is subjected to islanding at t = 0.7 s and resynchronization at t = 0.9 s. It can be observed from Figure 10 that the proposed DL-ANN controller succeeds in keeping the voltage at its regulated

Comparison
The dynamic response of the proposed DL-ANN controller is compared with the conventional PI controller and an adaptive PI, based on SMAPA. The DG is subjected to islanding at t = 0.7 s and resynchronization at t = 0.9 s. It can be observed from Figure 10 that the proposed DL-ANN controller succeeds in keeping the voltage at its regulated level. The voltage profile suffers from under-voltage in the case of the SMAPA-based adaptive PI controller, while the classical PI controller with fixed gains (Kp = 100 and Ki = 1000) results in overvoltage during islanding. Even if the gains of the classical PI controller are set to enhance the performance more in this case, it cannot track the changes in the system.

Comparison
The dynamic response of the proposed DL-ANN controller is compared with the conventional PI controller and an adaptive PI, based on SMAPA. The DG is subjected to islanding at t = 0.7 s and resynchronization at t = 0.9 s. It can be observed from Figure 10 that the proposed DL-ANN controller succeeds in keeping the voltage at its regulated level. The voltage profile suffers from under-voltage in the case of the SMAPA-based adaptive PI controller, while the classical PI controller with fixed gains (Kp = 100 and Ki = 1000) results in overvoltage during islanding. Even if the gains of the classical PI controller are set to enhance the performance more in this case, it cannot track the changes in the system.

Conclusions
This paper presents a unified control strategy for an inverter-based DG interface with the grid. The proposed strategy, based on a DL-ANN, is used to enhance the dynamic performance of the system during different modes of operations and ensure seamless transitions between modes. The robustness of the control strategy under different

Conclusions
This paper presents a unified control strategy for an inverter-based DG interface with the grid. The proposed strategy, based on a DL-ANN, is used to enhance the dynamic performance of the system during different modes of operations and ensure seamless transitions between modes. The robustness of the control strategy under different operating conditions is demonstrated under sudden local and grid loading. In addition, the proposed unified strategy, based on DL-ANN, achieves safe islanding and synchronization for the DG. Moreover, the ability of the feedforward loop integrated with the proposed strategy to mitigate the harmonics from the grid current, due to nonlinear loading, is illustrated. Furthermore, the superiority of the proposed DL-ANN controller is demonstrated by a comparison with a classical PI controller and an adaptive PI controller. In future work, the seamless control of AC microgrid clusters can be investigated by applying the proposed control strategy; hardware in the loop implementation will be considered.