Distributed generation (DG) resources are gaining a rapid growth connection to the utility grid, due to many factors including economics profits, environmental problems, global warming, gas emission, and tax encouragements . Microgrids are reliable, due to their capability to island. It provides their customers with the power source to be supplied when the main ac grid is disconnected. Moreover, the microgrid should be adopted to be added to another microgrid sources and functions appropriately without any exceptional proposal . Stability analysis for PWM-inverter microgrid is one of the apprehensions to function at the distribution level of the utility grid     . Although, active-power/frequency and reactive-power/voltage drop controls have been introduced to permit the microgrid sources to share power and preserve stability without the necessity for fast communications .
Phase locked loop (PLL) is used for synchronization . There are some challenges in designing these PLLs. Some of them are: tuning the PLL gain parameters, its negative effects on the controller response, and coupling effects and interaction between itself and the system impedance  . PLLs regularly engage a P or PI controller as the loop filter . The classical controller has a limited potential to alleviate disturbance in PLL control loop which may exist due to a weak design or polluted grid. To develop the disturbance rejection ability of PLLs, cascading extra filters such as the moving average filter (MAF)  and the notch filters  may improve their functioning. But those filters diminish the dynamic performance of PLL as their target is to minimize their bandwidth. Another method is anticipated in  , which uses a lead compensator, an effective approach to obtain both high dynamic performance and excellent disturbance rejection. Adaptive Fuzzy is proposed in  to obtain fast and robust PLL system.
Evolutionary computations with stochastic search techniques assured to be a more brilliant method which affords a robust technique to resolve the controller parameters problem. The evolutionary computation for controller parameters identification is applied in many applications. Genetic algorithm (GA) is used to find out the controller parameters of the BLDC motor . An evolutionary algorithm based on Particle Swarm Optimization (PSO) with weighting factors has been introduced for induction motor controllers’ parameters . It should be noted that even the most successful nature-inspired optimization techniques, such as GA and PSO, are also sensitive to the increase of the problem difficulty and dimensionality, due to their stochastic type . In previous years, more awareness is provided to bacterial foraging optimization (BFO) which has a powerful foundation for engineering applications. A few models have been achieved to signify bacterial foraging performances and use it for solving different challenges . It solved these engineering challenges effectively.
In this paper, the simulating annealing (SA) technique is used to select the PLL PI-controller gains with a minimal percentage overshoot, rising time and settling time. These control parameters are having sensitive values that affect the dynamic performance of the autonomous microgrid. They have to be optimally adjusted to assure great improvement in the overall system stability. It organized as follows: Section 2 introduces the microgrid proposed system description. The problem formulation is given in Section 3. It includes inverter-main grid model, PLL model and system control methodology. In Section 4, the SA proposed technique is introduced. Results are given in Section 5. Finally, conclusions are presented in Section 6.
2. System Description
The overall block diagram for proposed autonomous microgrid system is given in Figure 1. It is consisting of two dc microgrids each is feeding a PWM inverter. Both are connected to the load and the main ac grid through transmission lines, transformers and circuit breaker. The two microgrids is connected to the main grid through circuit breaker, therefore it is certainly islanded by opening this circuit breaker (CB). In the islanding mode, the microgrids will continue serving the loads without any interruption. The two microgrids are able to resynchronize with the main grid when the islanding condition is cancelled.
3. Problem Formulation
The proposed control block diagram is shown in Figure 2. The idea is based on frequency and phase detection using the phase-locked loop (PLL) combined with the traditional control for active power to frequency drop and reactive power to voltage drop of the microgrid systems.
a) Inverter-main grid model
The inverter-main grid model is illustrated in Figure 3. The phase ac voltages at the terminal of the PWM inverter is and the terminal bus that is connected to the main ac grid is . Their phase angles are calculated with respect to the main grid sinusoidal waveform at the nominal frequency. The two busses are connected via a transformer and a transmission line, the overall impedance for them will .
b) Phase-locked loop model
The Block diagram for the PLL is illustrated in Figure 4. The concept is: the three-phase voltage (abc) are transformed into two phase-voltage (αβ) and then into two dc voltages (dq). The d-voltage component is the input to the PLL loop. The angle is the estimate output of the phase angle given by the PLL loop. The Vd can be expressed by:
Figure 1. The microgrid proposed system.
Figure 2. Block diagram for controlling the proposed system.
Figure 3. PWM Inverter-main grid model.
Figure 4. The PLL block diagram.
As is too small, Equation (1) can be rewritten:
The PLL frequency can be also expressed as:
The loop filter for the PLL can be represented either by a P  controller or PI controller .
c) System control methodology
The main control goals are to adjust the terminal bus voltage magnitude and the active power provided to the ac main grid PGen. The mathematical model describes the control idea of the autonomous microgrid system is given in . Which can be summarized by the following equations and described in Figure 5:
: the modulation index of the PWM inverter
: PWM inverter constant for integral control
: voltage constant follow a droop characteristic that is function on the grid power
: the phase angle difference between the inverter angle and the PLL angle
: active power constant for integral control
: active power depend on droop characteristic
: nominal active power output of the microgrid
: droop constant
: dc voltage output from the PWM inverter
: PWM inverter output current
: per-unit base voltage for the dc bus and PWM inverter
: per-unit base active power for the dc bus and PWM inverter
In  the mathematical model in Equation (4) is used and implemented as seen in Figure 5. The loop filter employed in method (1) was P-controller as illustrated in Figure 5. In the second method the loop filter used was PI-controller and the block diagram is simplified as shown in Figure 6 .
4. Proposed Control Technique
In Figure 6, there are two controllers one for the PLL and the other for the active power. A PI controller is used for the PLL loop, while a P controller is used for the active power loop. The gains for both controllers are tuned via evolutionary methods based on simulating annealing techniques. The tuned gains are guaranteed high-quality control responses for these controllers in regard of optimizing the control response parameters; minimum over-shot, rise-time and settling time control.
Figure 5. PLL and active power controllers block diagram, method (1) .
Figure 6. PLL and active power controllers block diagram, method (2) .
a) Simulating Annealing
Simulated Annealing (SA) is a straightforward efficient optimization technique presented in . The function to be optimized in SA is called the energy, E(x), of the state x, and at the same point, the computational temperature (T), is dropped throughout the process. SA is an iterative trail algorithm that preserves a single candidate solution at any time . Moreover, the main benefit of using SA is its capability to prevent being stuck in local optima. SA has been examined and showed a well performance in a variety of single-objective and multi-objective optimization application  .
The SA is used to optimize P and PI controller parameters of the active power and the PLL respectively. It is a multi-objective optimization problem as three step response parameters are simultaneously adjusted. In the proposed system, SA will accept a transition that leads to a decrease in all objectives (overshoot, rise time and settling time) or a decrease in one of the objectives if other objectives are not changed. SA will also accept a transition from state S1 to S2 if S2 does not dominate S1 with a probability of , where , and T is the temperature parameter which is being reduced over time during the process in order to decrease the possibility of accepting such transitions. The SA proposed approach for the PI-controller gains selection is summarized in flowchart shown in Figure 7.
The microgrid proposed system in Figure 1 is used to demonstrate and test the dynamic behavior of the components of this system. All the ac quantities used in this system is articulated in per-unit values. The base values are given in Table 1.
In the proposed system, the set values for different elements are shown in Table 2.
Figure 7. The SA proposed approach for the PI-controller gains selection.
Table 1. Base value used in the proposed system.
Table 2. Set values of the proposed system.
The main test is implemented as given in  on the proposed system, the test scenario is as follows:
1) The CB connected to the grid is initially closed.
2) The two microgrids plants supply 1.3 pu of the active power demand by the load.
3) The remaining 0.4 pu active power is drawn from the main grid.
4) At t = 1 sec, the CB is opens and the total load has to be supplied by the two-microgrids plants.
5) At t = 7 sec, the CB is signaled to close, but closing is prevented until the voltage magnitude across the CB contacts reduces to the threshold pu3.
6) At t = 13.01 sec, the CB contacts are closed.
This test scenario is done for three PLL cases, case (1) is for PLL P-controller as in  and case two for PLL PI-controller designed by Ziegler and Nichols, and the proposed technique in case (3) is for PLL SAPI-controller in which the maximum overshot, rising time, and settling time parameters of the controlled parameter response is minimized.
Tuning the PLL controller parameters is a vital process in autonomous microgrid plants as it will reflects on many parameters response in these systems, as power, current and voltage. In this paper, the up given test scenario is done, and the results are given in Figures 8-11. Figure 8 shows the power delivered by each PWM inverters in the three-cases. In Figure 8(a) it shows the power delivered by the two plants, up is plant 1 and down is plant 2. Note that, Plant 1 has a higher set point than Plant 2. Therefore, the overshoot in Plant 1 for case (1) and case (2) is higher than in Plant 2 as shown in Figure 8(b) and Figure 8(c). Although, in the proposed technique (case (3)), the both plants have dead beat responses. Based on Figure 8 result, a comparison between overshoot, rise-time and settling-time parameters for the three-cases are given in Table 5. Based on this comparison the proposed technique case is the best compared to the other two cases.
Table 3. PWM inverters and PLL parameters.
Table 4. SA controllers’ parameters for PLL and active power.
Table 5. Control index-parameters comparison based on Figure 8.
The PLL frequency deviation for the two microgrid PWM inverters in the three cases is illustrated in Figure 9. The PLL SAPI-controller gives the best response from the three selected control parameters (percentage of maximum overshoot, rise time and settling time).
Moreover, the proposed technique in Figure 8, and Figure 9 are characterized by a deadbeat response which reflects the effectiveness realization of the proposed SAPI-controller designed in this paper.
Figure 8. Active Power output from the two microgrid PWM inverter plants during open and reclose of CB, (a) overall, (b) CB open, and (c) CB reclose.
Figure 10 presents the microgrid Plant 1 PWM inverter angle with respect to synchronous reference in the three cases. It also shows that the PLL angle strictly tracks the terminal bus angle. The differences between these quantities is provides obviously in Figure 11. It has been shown that the PLL SAPI-controller is the best and the fast to derive this difference to zero. Although, when the CB is closes, the subsequent phase shift in the PWM inverter terminal bus voltage
Figure 9. The PLL frequency deviation for the two microgrid PWM inverters in the three cases. (a) PLL P-controller, (b) PLL PI-controller, and (c) PLL SAPI-controller.
Figure 10. Microgrid Plant 1 PWM inverter angle with respect to synchronous reference in the three cases. (a) PLL P-controller, (b) PLL PI-controller, and (c) PLL SAPI-controller.
produces a spike in the angle difference across the PWM inverter and the transformer. That spike in angle difference is similar to spike in active power Pgen detected in Figure 8. In practice, the transformer inductance would limit most of these spikes.
Autonomous microgrid is being rapidly connected to the utility grid at the distribution level. For enhancing and improving the microgrid dynamic performance,
Figure 11. Microgrid Plant 1 PWM inverter angle differences in the three-cases. (a) for PLL P-controller, (b) for PLL PI-controller, and (c) for PLL SAPI-controller.
the active load needs to be synchronized with it. The phase locked loop (PLL) is used for this purpose. The main challenge in designing the PLL is tuning the gains for PLL active loop filter. In this paper, an example of two microgrids connected to the utility grid and the load is proposed. The dynamic model of the proposed system is given. The interaction between the dynamics of PWM inverter of any of the microgrid and the PLL can introduce oscillations. The gain selection of the PLL PI control is done by simulating annealing (SA) technique that granted minimal overshoot, rise time and settling time. The proposed PLL SAPI-controller provides and extraordinary response with these features. Results confirm the effectiveness of the proposed PLL controller to enrich the system dynamics and acts as a platform for autonomous microgrid systems.