An integrated control algorithm of power distribution for islanded microgrid based on improved virtual synchronous generator

Virtual synchronous generator technology can effectively improve the anti-interference characteristics of the system frequency and bus voltage in the microgrid, and solve the problems of insufﬁcient damping and low inertia of the system. However, in an islanded microgrid with multiple distributed generation, the difference in line impedance will cause local voltage deviations, which in turn leads to a series of problems, such as reducing power distribution accuracy and increasing bus voltage drop. Therefore, for the island-type microgrid multi-inverter distributed power generation parallel system, in order to solve the problem of low power distribution accuracy and large frequency oscillation caused by system parameters in virtual synchronous generator control, an improved virtual synchronous generator control algorithm based on adaptive droop coefﬁcient is proposed in this paper, which not only eliminates the resistance component of the line impedance, makes the system impedance characteristic present a purely inductive nature, but also realises real-time adjustment of active and reactive power.


INTRODUCTION
Microgrid is an effective form of distributed generation (DG) efficiency and important means to solve the problem of largescale renewable energy access in future smart grid systems, which is conducive to improving social and economic benefits [1,2]. Since the synchronous generator has the advantage of being naturally friendly to the power grid, its self-balancing capability, droop characteristics, large rotational inertia and other characteristics are conducive to the stable operation of the power system and the reasonable distribution of load power. Therefore, virtual synchronous generator (VSG) technology came into being [3], which can not only make the microgrid inverter have the steady-state characteristics of droop control, but also can make it exhibit dynamic frequency response characteristics similar to synchronous motors, effectively improve the anti-disturbance characteristics of the system frequency and bus voltage in the microgrid and solve the problems of underdamping and low inertia of traditional droop control [4].
At present, VSG control is mostly used in grid-connected inverters of traditional distribution networks, and direct current control based on the principle of phase-locked loop synchronization is used to achieve voltage tracking and power transmission of the power grid [5][6][7][8][9][10]. However, with the increase of the scale of new energy grid connection and the transmission distance, the grid connection point gradually shows a weak grid state, which affects the dynamic tracking performance of the phase locked loop, reducing the stability of current and power control [11,12]. Because the microgrid VSG control inherits the advantages of traditional droop control and provides inertial support for the system to maintain the stability of active power [13,14], VSG control technology has gradually begun to be applied to microgrids in recent years. Ref. [15,16] proposed a virtual capacitance algorithm, which only requires the output voltage amplitude and reactive power of each inverter, and does not need to detect the line impedance value and other parameters, so it has the advantages of simple implementation and strong applicability. However, although this virtual capacitor value-setting algorithm can improve the accuracy of reactive power sharing, it cannot achieve accurate reactive power sharing. In the study of parallel operation control of islanded microgrid using VSG technology, ref. [17] combines the advantages of virtual impedance strategy and virtual capacitor strategy, and through reasonable configuration of virtual impedance and virtual capacitor parameters, which achieved the control purpose of reducing the error of steady-state reactive power distribution, improving the accuracy of voltage control, and the stability of the system. Ref. [18] realised that the VSG power of different capacities was distributed in proportion to the capacity based on the improved droop control and virtual complex impedance by adjusting the PI controller parameters, and eliminated the influence of power coupling, and could accurately distribute the active and reactive power at the same time. Ref. [19] proposed an improved VSG control method. The stator reactance regulator and reverse droop control were developed through state space analysis, respectively, which achieved accurate distribution of active power and reactive power without being affected by line impedance and power coupling. However, this method does not consider the deviation caused by the bus voltage. Ref. [20] proposed a new VSG control strategy that combines improved governor control and coupling compensation to further enhance the inertia of the angular frequency and reduce the governor control difference from the diesel generator. The influence of uncontrollable coupling of DG unit on power regulation is reduced, the steady-state characteristics and power distribution accuracy are better than the basic VSG controlled microgrid. Ref. [21] established a virtual diesel generator unit, which solved the problem of uneven transient power distribution caused by the inconsistency of the transient characteristics of the inverter controlled by the traditional VSG and the diesel generator unit, which effectively improve the transient stability of the independent power supply system including diesel generators and inverters. Ref. [22] studied the microgrid containing VSG and ordinary synchronous generator (SG), and the dynamic behaviour of VSG and standard SG was compared in the islanded microgrid by establishing a parallel operation model of multiple VSGs, furthermore, the dynamic response is compared under the average distribution and proportional distribution of load demand.
In summary, this paper proposes an improved VSG control strategy based on adaptive droop coefficient and frequency compensation. By dynamically adjusting the droop coefficient and frequency compensation amount, accurate active and reactive power distribution can be achieved while suppressing frequency oscillation. Compared with the existing VSG control algorithm, the improved control algorithm proposed in this paper not only achieves high-precision power distribution, but also maintains the stability of the frequency under changing operating conditions, and improves the virtual inertia caused by The rest of this article is divided into the following sections. First, the traditional VSG control algorithm and its shortcomings are analysed. Secondly, an improved VSG control algorithm based on fuzzy rule system is proposed. By introducing adaptive droop coefficient and frequency compensation, real-time adjustment of active power and reactive power can be realised, which improves the frequency oscillation of the system. Finally, simulation and experiment verify the effectiveness of the control strategy proposed in this paper.

BASIC VSG PRINCIPLE ANALYSIS
In the traditional droop control, the inverter has a fast response speed, almost no rotational inertia, and is difficult to participate in the grid adjustment. It cannot provide the necessary voltage and frequency support for the active power distribution network with distributed generation, nor can it provide a relatively poor stability. The grid provides the necessary damping effect. Therefore, on the basis of droop control, this article adds the virtual inertia link and adopts the virtual synchronous generator technology to make the microgrid inverter have frequency characteristics similar to the synchronous generator, which can effectively increase the system frequency and the frequency in the microgrid. The anti-disturbance capability of the bus voltage solves the problems of underdamping and low inertia in the microgrid system. Figure 1 is the control block diagram of VSG [23]. It can be seen that the active control loop of VSG simulates the primary frequency regulation characteristics and inertia of the synchronous generator, and the reactive control loop simulates the primary voltage regulation characteristics. The equations of the VSG active and reactive control loops are as follows: Where P set and Q set are the given active and reactive power; T set is the given torque; T e is the electromagnetic torque; D P is the active-frequency droop coefficient; D Q is the reactive-voltage droop coefficient; ω is VSG Angular frequency; ω n is the rated angular frequency; U o is the effective value of the output voltage; U n is the effective value of the rated voltage; J is the virtual rotational inertia of VSG.
Because the output power of the inverter type DG is generally not large and the load capacity is small, it is often necessary to supply power to the load in parallel. Therefore, the parallel operation of multiple inverter power supplies in the islanded microgrid has become the key point of the research. Therefore, the parallel system of two VSGs considering the line impedance can be equivalent to the circuit diagram shown in Figure 2.
As shown in Figure 2, the excitation electromotive forces of the two VSGs are E 1 ∠δ 1 , E 2 ∠δ 2 , and the output voltages of the two VSGs are u o1 , u o2 , and the phase angle difference between u o1 and the common load Z L terminal voltage u o is φ 1 , u o2 The phase angle difference with the load Z L terminal voltage u o is φ 2 . The line impedances connecting the output terminals of the two inverters and the load Z L are Z l1 = R l1 + jX l1 , Z l2 = R l2 + jX l2 , and their impedance angles are θ 1 and θ 2 , respectively. Each VSG output active power P k and reactive power Q k are respectively: Among them, k represents the number of VSGs. In general, R ≪ X, so the resistance part of the line impedance can be ignored and sinφ k ≈ φ k , cosφ k ≈ 1 can be taken. So, Equations (6) and (7) can be further simplified as From Equations (8) and (9), it can be seen that the output active power and reactive power of each VSG are affected by the line impedance, resulting in the power cannot be divided equally. When studying the parallel operation of multiple VSGs, this paper discusses the situation of two VSGs with the same capacity. Since the voltage closed-loop control strategy based on the virtual impedance of VSG proposed in this paper can adjust the value of the virtual impedance to adjust the size of its output resistance, therefore, ignoring the influence of the line resistance, the active and reactive power output by the ith DG can be further reduced to Equations (8) and (9) as It can be seen from Equations (10) and (11) that the active power P mainly depends on the voltage phase, and the reactive power Q mainly depends on the voltage amplitude. Therefore, P-f and Q-U can be described as the droop characteristics described by the following equations.
It can be seen from Equation (12) that if the frequency difference and voltage difference of the two inverters are required to be equal, then Equation (13) only needs to be satisfied, that is, the droop coefficient of active power and reactive power is inversely proportional to the power allocated by the power supply capacity. { When the idling frequency ω * and the no-load voltage U * are the same, if Equation (13) is to be satisfied, it is necessary to satisfy ω A = ω B , U oA = U oB , then adjust the frequency of the two inverters at the same time to make the output voltage equal, and finally distribute the power reasonably according to the capacity. Substituting Equation (10) into Equation (12), we can get Where ω n (s) is the angular frequency under Laplace transform. According to the final value theorem and Equation (14), the frequency difference is In the formula, e ω is the frequency difference in the time domain; E(s) is the frequency difference under the Laplace transform. Substituting Equation (11) into Equation (12), we get It can be drawn from Equations (14) and (15) that due to the existence of the integration link, despite m A U A /X A ≠ m B U B /X B , the frequency of the two inverters will also be pulled into synchronisation, and the active power P can be calculated according to the active-frequency. The droop coefficient is distributed inversely proportionally, so the control of active power is decoupled from the impedance. However, as can be seen from Equation (16), since there is no integral link in voltage control, when X A /n A = X B /n B is satisfied, output voltage of each inverter is equal, and the reactive power is inversely proportional to the voltage droop coefficient, and there is no coupling between active power and impedance. Therefore, in order to improve the reactive power control strategy, this paper proposes an improved VSG control method based on adaptive droop coefficient, which can realise real-time adjustment of active power and reactive power, and overcome the influence of line impedance on output power.

Inverter output impedance analysis and power decoupling design
The system impedance contains the line impedance Z Line in addition to the equivalent impedance of the inverter itself, which can be expressed as Therefore, the equivalent output impedance of the inverter is Among them, Z InvE is approximately pure inductive, Z Line is approximately purely resistive. When the parallel inverters are far apart, R s and X s may have the same value, even greater than X s , which not only increases the degree of power coupling, but also increases the bus voltage drop. At the same time, the line impedance is also approximated as inductive in the second section of the analysis process, and the line from VSGs to the load is a transmission line, and the line impedance should be approximately purely inductive. Therefore, keeping the line impedance at inductive or purely inductive is essential for the simulation verification and system operation in this article. Based on the above analysis, in order to maintain the original line impedance inductive, this section sets the virtual resistance to a negative value −R v to offset the resistance component in the original line, thereby reducing the actual resistance value in the system impedance. After that, by analysing the dominant poles and using Bode diagrams to analyse the system impedance characteristics, reasonable line impedance and virtual impedance parameters are set, so that the line impedance is close to a purely inductive state, and the power coupling of the system is reduced.
The inverter control block diagram with the introduction of virtual negative resistance is shown in Figure 3. The expression of virtual negative resistance is Where R v is the virtual resistance value set in this article. By taking a negative value, the original line resistance can be offset to change the nature of the original line impedance.
The system impedance Z includes the equivalent output impedance and line impedance of the inverter including the virtual negative resistance. Therefore, Z can be written as The system structure of the capacitor current feedback control inverter with virtual inductance is shown in Figure 3 [24]. The dotted line is the added virtual resistance, R v is the virtual resistance value; L, C and r are the circuit filter inductance, capacitance and the equivalent series resistance of the circuit; k e is the current loop regulator scale factor; k p and k i are the ratio and integral coefficient of the voltage loop, respectively; G Inv (s) and Z Inv (s) are the closed-loop transfer function and equivalent output impedance of the inverter. When considering power decoupling and reducing voltage drop, the resistance R of the system impedance at the fundamental frequency should be much smaller than the inductance X. Therefore, the virtual resistance R v = R Line . However, in the actual operation of the system, accurate measurement of the line impedance is difficult to achieve, and the line resistance will inevitably drift. Therefore, the value of R v needs to determine the stable range through bode diagram and root locus analysis [25]. Figure 4(a) is bode diagram of the system impedance after adding a virtual negative resistance. It can be seen that after adding R v , the impedance of the fundamental system decreases and changes from biased to resistive to more biased to inductive. The impedance angle goes from the first quadrant (0-π/2) to the second quadrant (π/2-π). In Figure 4(b), the root locus of the system admittance under the virtual negative resistance is drawn. According to the parameters in [25] and Table 2 of this paper, R v increases from 0.4 to 0.6 Ω, and the distribution of the dominant poles of the system can be get from Figure 4(b). Therefore, combined with the stability domain displayed by the root locus, this paper selects the virtual negative resistance R v = 0.5 Ω. That is, when the value of the virtual negative resistance is −0.5 Ω, the resistance component in the original line impedance can be cancelled, and the line impedance is close to pure inductance. Therefore, the closed-loop control strategy based on the virtual impedance of VSG proposed in this paper realised the property of adjusting the output impedance of the system by adjusting the value of the virtual impedance, that is, by introducing a virtual negative resistance, the original resistive component of the system is effectively offset, so that the system impedance works in the inductive part. Therefore, in the analysis process and experiment process in this paper, the line impedance can be approximated as purely inductive, and the influence of line resistance on the system can be ignored.

Design of adaptive droop coefficient power distribution
Although the above values of R v have been improved and the power coupling of the system has been improved, the droop coefficient has not been reasonably improved, the reactive power is still difficult to reasonably allocate and it is difficult to deal with the dynamic characteristics of the system. In this paper, an adaptive droop coefficient is generated based on a fuzzy logic algorithm, and the real-time adjustment of the droop coefficient is realised by detecting unbalanced reactive power and voltage fluctuations of the system, thereby reducing the influence of line impedance.
In this paper, the reference value of the bus voltage of the microgrid is 220 V, and the bus voltage U o range is set to ±105%, that is, ∼210-230 V; The determination of the reactive power offset in the ΔQ i range in the DG needs to be based on the maximum load power and power supply capacity in the microgrid. The maximum deficit power of the system designed in this paper is 1 kvar, and there are at least two distributed generations, with a margin of 1 kvar, so ΔQ i ∈ (−2, 2) kvar; fuzzy logic output x i is set to x i ∈ (−0.5, 0.5). Considering the adjustment accuracy, the amount of change of the droop coefficient D Q is set to be an order of magnitude lower than the actual droop coefficient value, so this paper takes the integral coefficient k = 0.1.
The fuzzy control output x i is used as the adjustment value of the droop coefficient after integration, and the updated droop coefficient is Determine the input and output membership function of the controller as shown in Figure 5. The voltage U o contains a total of 7 fuzzy subsets with AG adjustment range from small to large; the reactive power offset ΔQ i and the output x i contain  [26].
The establishment of fuzzy logic rules depends on the logical relationship between output and input. The integral of the output quantity x i is the adjustment amount of the droop coefficient. Therefore, when the reactive power Q i increases or the bus voltage U o increases, the droop coefficient needs to be increased; when the reactive power Q i decreases or the bus voltage U o decreases, the reduction needs to be reduced small droop coefficient. When the bus voltage stabilises near 220V and the reactive power approaches the standard value, the droop coefficient is no longer adjusted. According to the above logic, the fuzzy logic rules shown in Table 1 can be established, and then the fuzzy logic inference results shown in Figure 6 can be obtained [26].
Finally, the characteristic curves of P-ω and Q-U in VSG control before and after the improvement are shown in Figure 7.

Inverter output voltage and frequency recovery
Since the virtual inertia in the virtual synchronous generator will cause the oscillation of the system frequency, it is particularly important to ensure the frequency quality of the common bus Inference result of fuzzy logic for an AC microgrid system with island operation. Therefore, this paper introduces the secondary frequency adjustment based on fuzzy logic algorithm to compensate the output frequency. The proposed fuzzy logic controller has a total of two inputs, including active power errors ΔP, as well as frequency deviation Δω, which can be obtained from the local measurement of DG [27]. Among them, the frequency deviation Δω are defined by the following formula: The active power errors ΔP are defined as follows: In the fuzzy controller, this paper uses three triangular membership functions to define Δω, and one triangle and two trapezoidal membership functions to define ΔP as shown in Figure 8(a,b). The input range is [−1, 1]. The output of the fuzzy rule system is shown in the Figure 8(c).
Under the secondary voltage regulation in this article, the fuzzy controller has two outputs: dω. Among them, Δω determines the sign of dω: when Δω is "positive", dω is greater than zero, otherwise, dω is less than zero. The size of dω is determined by ΔP, where "negative" and "positive" of ΔP correspond to "little positive" and "positive" of dω, and "positive" and "negative" of ΔP correspond to "little negative" and "negative" of dω. Finally, output dω to the VSG controller as the compensation amount for frequency adjustment.

Integrated control strategy of islanded microgrid based on improved VSG
In the system model established in this paper, the microgrid is connected to the 380-VRMS rated low-voltage grid through a circuit breaker (CB) and the main transmission line. The CB can operate during disturbances, allowing the microgrid to continue to operate in island mode. The load is connected to the point of common coupling (PCC). The DG interface inverter is controlled by the proposed control algorithm. The overall control block diagram and flow chart of the proposed control scheme are shown in Figure 9.

SIMULATION RESULTS
The parameter design of the system is shown in Table 2.

Case 1: Load switching and power decoupling
This paper uses a microgrid structure with two distributed generations connected in parallel for simulation. Among them, DG1 and DG2 have the same capacity, so the power distribution ratio of DG1 and DG2 is 1: 1, the simulation time is set to 1.5 s, and the system parameters are shown in Table 2. The microgrid load is a constant power load, the initial active power is 6000 W, and the reactive power is 8000 var. When t = 0.5 s, the adaptive droop coefficient control proposed in this paper is The simulation results are shown in Figure 10.
As shown in Figure 10(a,b), under the basic VSG control, the power distribution accuracy is poor, and the fluctuation is more obvious. After t = 0.5 s is put into the control strategy mentioned in this paper, the precision of power distribution is significantly improved, and the active load of 1.0 s is increased, and stable power distribution can still be achieved during this period, and the fluctuation of reactive power is small, indicating that the coupling degree of the power loop is low, so the virtual negative resistance and droop coefficient introduced in this article can be effectively used for power distribution and decoupling.
As shown in Figure 10(c,d), compared with the traditional droop control and basic VSG control, the voltage and frequency compensation module based on fuzzy logic algorithm proposed in this paper can effectively shorten the frequency oscillation time and reduce the voltage drop, and maintain the stability of voltage and frequency.
In order to demonstrate the superior performance of the control algorithm proposed in this paper in the current research, the improved control algorithm proposed in this paper is now compared with the current existing control strategies, and the power distribution accuracy achieved in [28] and [29] is cited and compared as a comparison. Also, the power distribution accuracy in Figure 10 is calculated, and the comparison results are shown in Table 3.
It can be concluded from Table 3 that compared with the power distribution accuracy under the control algorithm in [28] and [29], the improved control algorithm proposed in this paper significantly improves the distribution accuracy of active and Control strategy proposed in [28] 0.192 0.408 Control strategy proposed in [29] 0.09 0.23 reactive power, and has a better level power sharing effect, which has certain advantages in the current research.

Case 2: Line Parameter Mutation
In this section, the simulation of the line parameter mutation is carried out to verify the effectiveness of the proposed control strategy. When t = 0.5 s, the impedance of the DG1 line is reduced to half of the original, and the impedance of the DG2 line is unchanged. Figures 11 and 12 show the simulation results of active and reactive power when the line parameters change suddenly under basic VSG control and improved VSG control strategy, respectively. As shown in Figure 11, when the line parameters are abrupt, under the basic VSG control, both active power and reactive power will change due to the line parameter abrupt change. Among them, the reactive power is more affected by the line parameters than the active power, leading to a decrease in the accuracy of active and reactive power distribution.
As shown in Figure 12, when the system line parameters change suddenly, under the improved VSG control strategy, the deviation between the active power and reactive power between the two DGs is basically zero. When the line impedance changes suddenly, the active and reactive power can be restored to sta-  bility in a short time after a short fluctuation, and the accuracy of power distribution is effectively maintained. Therefore, the improved virtual synchronous machine control proposed in this paper can ensure the accurate distribution of reactive power at all times, and significantly reduce the impact of line parameter mutation on the power distribution accuracy.

Case 3: Plug and play of distributed generation
Plug and play is the basic function of a microgrid system with multiple DGs. In this section, the simulation of DG switching is conducted to verify the effectiveness of the proposed control strategy. The system runs under the improved VSG control strategy. When t = 0.7 s, DG2 is cut off. When t = 1.1 s, DG2 is put in. During this process, DG1 and other parameters remain unchanged. Figure 13 shows the simulation results when the improved control strategy is used when DG2 fails.
It can be drawn from Figure 13 that at the beginning of the simulation, the system operates under the proposed control strategy, which can ensure the accurate distribution of reactive power. When DG2 is separated from the microgrid system, the output power of DG2 quickly decreases to zero. After a short adjustment, DG1 provides the required power to the load and reaches a new stable point. When DG2 is re-incorporated into the system, after a short adjustment process, the system will be stabilised again, realising the plug and play function of multiple DGs.

EXPERIMENT RESULTS
In order to further verify the effectiveness of the proposed control strategy, a hardware-in-the-loop experiment based on RT-LAB real-time simulation platform was built. The host computer built the main circuit part. The control program was written in the control board, and the output I/O port was utilised by the oscilloscope to observe the waveform. The experimental platform is shown in Figure 14. The system Experimental results before and after improved VSG control is applied (a) active power, (b) reactive power parameters are the same as the simulation platform, and the experimental waveform is shown in Figures 15 and 16. Figure 15 shows the power allocation before and after applying the improved VSG control strategy. Initially, DG used traditional VSG control to supply power to public loads. Due to the difference of line parameters, the distribution of active power and reactive power is not accurate. Then, put the algorithm proposed in this paper into t = 0.5 s to adjust the power distribution error. After a short adjustment time, the power distribution ratio of the two DGs tends to stabilise, which is consistent with its rated capacity. Figure 16 shows the experimental results when the system performs load switching under the improved virtual synchronous machine control strategy. The load is put on at t = 0.5 s, as shown in the above simulation. The results show that in the whole process, both active and reactive power can achieve a good distribution effect.

CONCLUSION
An improved VSG control algorithm based on fuzzy logic algorithm is proposed. By introducing a fuzzy rule system, the droop coefficient and frequency compensation are dynamically adjusted to improve the power distribution accuracy and frequency oscillation in real time, so that distributed generation can distribute power output in a balanced manner according to its own capacity. Simulation and experimental results show that the proposed strategy realises the real-time interaction between the fuzzy logic algorithm and the VSG control module, which can greatly improve the power distribution accuracy while maintaining the stability of the bus voltage and system frequency, and improve the dynamic performance and stability of the system effectively.