Harmonic Resonance Mechanisms and Influencing Factors of Distributed Energy Grid-Connected Systems

: With the rapid development of global energy transformation and new power system, ensuring the stability of distributed energy grid connections is the key to maintaining the reliable operation of the whole power system. This paper constructs detailed impedance models of grid-following (GFL) and grid-forming (GFM) inverters using a harmonic linearization method and thoroughly investigates the mechanisms of resonance when inverters are connected to the grid, as well as the impact of model parameters on the stability of the grid system. This paper also briefly analyzes the scenario where distributed energy and electric vehicles are integrated into the grid simultaneously, demonstrating that grid system stability can be ensured in complex grid situations through reasonable parameter design. Lastly, the accuracy of the proposed impedance models and analysis is verified through MATLAB/Simulink simulations.


Introduction
Distributed energy mainly includes solar energy, wind energy, fuel cells and biological energy, which has the advantages of energy saving and cleaning.It plays a significant role in the global energy structure transition.As grid connection technology continues to improve, the penetration rate of distributed energy is continually increasing worldwide, especially in regions with rapidly growing electricity demands or weaker grid infrastructures.The integration of distributed energy contributes significantly to enhancing the operational efficiency of the grid, increasing the security of power systems, and promoting the development of environmentally friendly power systems.It has become a vital force in driving the transformation of modern power systems and achieving green development goals [1].However, the extensive integration of distributed energy can greatly affect the safety and stability of power system operations and the quality of electric power.Distributed energy is interfaced with the grid through inverters.At certain frequencies, the impedance of the grid matches the output impedance of the inverters, potentially causing resonance.This interaction between inverters and the grid can lead to severe distortions in grid voltage and current, significantly degrading the quality of electric power and even causing system instability.Therefore, the issues of power quality and system stability arising from the interaction between grid-connected inverters and the grid cannot be overlooked [2][3][4][5].With the proliferation of electric vehicles, the increasing number of charging stations will significantly impact the distribution network due to the harmonics they generate.Therefore, it is necessary to consider the harmonic impact of electric vehicle integration in grid-connected systems.
When analyzing the stability of grid-connected inverters, common methods include the state-space method [6,7] and impedance analysis method [8].The state-space method requires frequent updates of the system state-space model to reflect new system structures and parameter states.Due to this characteristic, using the state-space method for system analysis becomes particularly cumbersome [9].Consequently, some scholars have proposed the impedance analysis method, which separates the inverter and the grid into two independent subsystems for impedance modeling.The impedance analysis method simplifies the analysis of complex systems and can directly determine system stability via Bode plots.It also requires only the re-modeling of the changing components when parameters change, leaving the rest of the system unaffected [10].Moreover, when modeling the impedance of grid-connected inverters, traditional small-signal linearization methods are not applicable due to the periodic changes in their steady-state operating trajectories [11].Therefore, this paper employs the harmonic linearization method for impedance modeling of inverters during grid connection.
The mainstream control methods for inverters currently fall into two categories: gridfollowing (GFL) and grid-forming (GFM).Ref. [12] utilized the harmonic linearization impedance modeling method to construct the positive and negative sequence impedance models of GFL inverter with a phase-locked loop (PLL).However, it only considered a single L-filter, whereas the LCL-type GFL inverter, due to its superior filtering performance, is more widely used [13,14].Therefore, it is necessary to model the LCL-type GFL inverter.Reference [15] presented the sequence impedance models of two types of LCL-type gridconnected GFL inverters with different current sampling schemes.The proposed positive and negative sequence impedance models are applied to analyze the stability and resonance between the inverters and the grid.However, the effects of circuit parameters and PLL parameters on stability are not analyzed.In contrast to traditional GFL inverters, GFM inverters controlled by virtual synchronous generators (VSG) can emulate the behavior of conventional synchronous generators.By adjusting control strategies to simulate inertia and damping, these inverters can enhance grid stability and add system inertia during grid integration, increasingly becoming a focal point in grid-connected power generation technologies and widely adopted [16,17].Ref. [18] utilized the harmonic linearization method to model the impedance of GFM, and discusses the stability of a weak gridconnected system in detail according to the Nyquist criterion.The article points out that the impedance model of a single-phase VSG has resistive/inductive features at low frequencies, while it exhibits inductive-capacitive (LC) characteristics at high frequencies.However, these studies did not explore the stability of various types of inverters simultaneously connecting to the grid under complex conditions.Moreover, using impedance analysis for system parameter optimization is regarded as an effective approach to enhance grid system stability.Refs.[19,20] highlight that through meticulous parameter adjustments, system stability and adaptability can be significantly enhanced.Ref. [19] proposed a systematic design method of PLL controller parameters, which effectively reduce the negative effect of PLL on current control.Ref. [20] proposed a parameter design method for inverter connection to weak grids with a focus on stability margins.By using the Routh criterion and the impedance ratio between the grid impedance and the inverters impedance, the proportional gain of the DC bus voltage controller is designed to achieve the required gain margin (GM) for the system.
This paper aims to analyze the influence of distributed energy on power quality, especially the resonance problem.By modeling the impedance of GFL and GFM, the resonant characteristics of these inverters are analyzed when they are connected to the power grid.Initially, a detailed impedance modeling of GFL inverters is conducted in conjunction with the frequency characteristics of PLL, and the influence of PLL parameters on the stability of the grid-connected system is studied.Subsequently, a similar method is applied to model the impedance of voltage-controlled GFM inverters, investigating their interaction with the grid and proposing guidelines for parameter design.Finally, by choosing parameters wisely, the paper ensures that the connection of GFL inverter, GFM inverter and electric vehicles to the grid does not lead to resonances, thus ensuring the efficient and stable operation of the electrical power system.The theoretical analysis and design methods presented in this paper are validated through simulation.
The paper is arranged as follows.In Sections 2 and 3, impedance models of GFL and GFM are, respectively, established, followed by parameter analysis.Section 4 investigates the scenario where both inverters and electric vehicles are connected to the grid simultaneously.In Section 5, simulations are conducted to validate the proposed theories and analyses.

Typical GFL Inverter Impedance Modeling
Figure 1 presents the structural block diagram of a typical GFL inverter.It includes the DC input voltage U dc , the voltage at the point of common coupling (PCC), represented as u gabc , the inverter-side inductance, L 1 , and the grid-side inductance, L 2 .Additionally, the diagram features a filter capacitor C f and a series damping resistor R d , alongside the grid impedance Z g .The current control loop regulator is denoted as Gi(s).The output phase angle signal from the PLL θ PLL is used for coordinate transformation.The references for the d-axis and q-axis currents are indicated as i dr and i qr , respectively.The three-phase voltage reference signal u mabc is modulated through PWM to achieve the duty cycle that controls the modulation of the GFL inverter.GFL inverter, GFM inverter and electric vehicles to the grid does not lead to resonances, thus ensuring the efficient and stable operation of the electrical power system.The theoretical analysis and design methods presented in this paper are validated through simulation.
The paper is arranged as follows.In Sections 2 and 3, impedance models of GFL and GFM are, respectively, established, followed by parameter analysis.Section 4 investigates the scenario where both inverters and electric vehicles are connected to the grid simultaneously.In Section 5, simulations are conducted to validate the proposed theories and analyses.

Typical GFL Inverter Impedance Modeling
Figure 1 presents the structural block diagram of a typical GFL inverter.It includes the DC input voltage Udc, the voltage at the point of common coupling (PCC), represented as ugabc, the inverter-side inductance, L1, and the grid-side inductance, L2.Additionally, the diagram features a filter capacitor Cf and a series damping resistor Rd, alongside the grid impedance Zg.The current control loop regulator is denoted as Gi(s).The output phase angle signal from the PLL θPLL is used for coordinate transformation.The references for the d-axis and q-axis currents are indicated as idr and iqr, respectively.The three-phase voltage reference signal umabc is modulated through PWM to achieve the duty cycle that controls the modulation of the GFL inverter.The GFL inverter utilizes the PLL to continuously track the phase of the grid voltage.Therefore, any disturbance in the grid voltage initially impacts the phase angle of the PLL, subsequently affecting the current regulator.Thus, it is essential to model and analyze the frequency characteristics of the PLL first.This paper employs a synchronous reference frame phase-locked loop (SRF-PLL) [21], and its control diagram is depicted in Figure 2.  The GFL inverter utilizes the PLL to continuously track the phase of the grid voltage.Therefore, any disturbance in the grid voltage initially impacts the phase angle of the PLL, subsequently affecting the current regulator.Thus, it is essential to model and analyze the frequency characteristics of the PLL first.This paper employs a synchronous reference frame phase-locked loop (SRF-PLL) [21], and its control diagram is depicted in Figure 2.
World Electr.Veh.J. 2024, 15, 287 3 of 16 GFL inverter, GFM inverter and electric vehicles to the grid does not lead to resonances, thus ensuring the efficient and stable operation of the electrical power system.The theoretical analysis and design methods presented in this paper are validated through simulation.
The paper is arranged as follows.In Sections 2 and 3, impedance models of GFL and GFM are, respectively, established, followed by parameter analysis.Section 4 investigates the scenario where both inverters and electric vehicles are connected to the grid simultaneously.In Section 5, simulations are conducted to validate the proposed theories and analyses.

Typical GFL Inverter Impedance Modeling
Figure 1 presents the structural block diagram of a typical GFL inverter.It includes the DC input voltage Udc, the voltage at the point of common coupling (PCC), represented as ugabc, the inverter-side inductance, L1, and the grid-side inductance, L2.Additionally, the diagram features a filter capacitor Cf and a series damping resistor Rd, alongside the grid impedance Zg.The current control loop regulator is denoted as Gi(s).The output phase angle signal from the PLL θPLL is used for coordinate transformation.The references for the d-axis and q-axis currents are indicated as idr and iqr, respectively.The three-phase voltage reference signal umabc is modulated through PWM to achieve the duty cycle that controls the modulation of the GFL inverter.The GFL inverter utilizes the PLL to continuously track the phase of the grid voltage.Therefore, any disturbance in the grid voltage initially impacts the phase angle of the PLL, subsequently affecting the current regulator.Thus, it is essential to model and analyze the frequency characteristics of the PLL first.This paper employs a synchronous reference frame phase-locked loop (SRF-PLL) [21], and its control diagram is depicted in Figure 2.  The process begins with sampling the voltage at the PCC of the grid, which, after undergoing an abc/dq transformation, outputs u d and u q .In this paper, a PI controller is utilized for the PLL with the transfer function K p_PLL + K i_PLL /s.After passing through the PI section, the u q generates a grid frequency signal.Integrating this frequency signal yields the phase lock angle.Hence, the transfer function of the PLL is expressed as H PLL (s) = (K p_PLL + K i_PLL /s)/s.This paper applies the harmonic linearization method for small-signal modeling of the SRF-PLL.The introduction of a small signal voltage disturbance at the PCC induces a disturbance ∆θ in the phase lock angle, which can be expressed as θ PLL = θ 1 + ∆θ.θ 1 is the steady-state phase lock angle under no voltage disturbance.The coordinate transformation module depicted in Figure 2 can be described as follows.
In the described system, T(θ 1 ) represents the transformation module for the steadystate phase lock angle, and T(∆θ) denotes the transformation module for the phase angle disturbance.Taking phase A voltage as an example, if a positive sequence small-signal voltage disturbance is introduced at the PCC and transformed into the frequency domain, the expression can be derived as follows: . .
V 1 represents the fundamental wave voltage expression in the frequency domain, .
and V 1 is the peak voltage of the grid. .V p is the expression for the positive sequence disturbance voltage in the frequency domain, .
V p = V p 2 e ±jφ vp , and V p is the positive-sequence disturbance voltage peak value.φ vp is the phase of the positive sequence disturbance voltage, and f p is the frequency of the positive sequence disturbance voltage.Assuming By applying the T(θ 1 ) transformation module, the three-phase voltage is converted into u dq1 in the frequency domain. .
After the first coordinate transformation, u dq1 (t) undergoes a second transformation by T(∆θ) to obtain u dq (t), which is expressed as follows: Since the disturbance in the PLL is minor, ∆θ is approximately zero, implying that cos(∆θ) ≈ 1, sin(∆θ) ≈ 0. When transformed into the frequency domain, the result can be expressed as follows: . V p , it can be specifically described as in Equation (8).
At the frequency f p and because ∆ .
we can derive the following expression From this, the closed-loop transfer function T p (s) of cos(θ PLL ) with .
V p can be determined as Similarly, the transfer function T n (s) of cos(θ PLL ) with .
V n can be determined as After completing the analysis of the PLL frequency characteristics, we can derive the output impedance model of the GFL considering the PLL.The grid current is sampled and transformed into the dq-axis, with its frequency domain expression given below: . .
In this analysis, T p (s) and T n (s) represent the PLL transfer functions for positive and negative sequence disturbances, respectively.I n are those for the positive and negative sequence current disturbances.f p , and f n denote the frequencies of the positive and negative sequence voltage disturbances, and φ i1 is the phase of the fundamental voltage.As shown in Figure 1, by employing a closed-loop current control G i (s) on i dq , the frequency domain expression for u mdq can be obtained.
Transforming this into the abc-axis and inserting it into the frequency domain expression of the main circuit's average model, and by utilizing the relationship between small-signal voltage stimulation and the output current response, the positive and negative sequence output impedances of the GFL, Z p (s) and Z n (s) can be derived, respectively shown as Equation (16) and Equation (17).

Stability Analysis
Upon acquiring the positive and negative sequence output impedances of the GFL inverter, the stability during grid integration can be evaluated using an impedance-based stability criterion.Let f i be the intersection frequency of the magnitudes of grid impedance and inverter impedance, and define the phase margin φ pm as Here, φ zg_ f i , φ inv_ f i are the phase angles of the grid impedance and inverter impedance at fi, respectively.If φ pm < 0 • , it indicates that the system is unstable.If 0 • < φ pm < 30 • , it suggests that the system has a small stability margin and poor robustness, making it susceptible to resonance when disturbed by harmonic sources.Engineering practices often require maintaining a phase margin of 30 • to ensure stable operation of grid-connected systems.Next, we analyze the interaction between the GFL inverter and the grid based on this criterion.The parameters for the GFL inverter are presented in Table 1. Figure 3 shows the impedance curves for the GFL inverter and the grid with grid impedances of 2 mH and 12 mH, respectively.From Figure 3, it is evident that the positive and negative sequence impedances of the GFL inverter differ only in the low frequency range, while they align in the mid to high frequency range.The GFL inverter exhibits capacitive characteristics in the low-to mid-frequency range, whereas the grid shows distinctly inductive characteristics.As the grid impedance increases, making the grid weaker, the GFL inverter is more likely to interact unstably with the grid, leading to resonance.With a grid impedance of 12 mH, the grid impedance curve intersects the positive sequence output impedance of the GFL at 154 Hz, where the phase margin is only 16.05 • , which does not meet the stability conditions required for engineering practice and is likely to lead to resonance.When the grid impedance is 2 mH, the intersection with the GFL positive sequence output impedance occurs at 1858 Hz; due to insufficient phase margin, the system is unstable, leading to high-frequency resonance.Thus, it is necessary to take measures to increase the phase margin at high frequencies, one of which is increasing R d , a simple and effective measure.High-frequency Z p (s) and Z n (s) curves being identical, the effect of R d on the Z p (s) curve is studied uniformly.As shown in Figure 4, R d has no impact on the Z p (s) curve in the low-to mid-frequency range, but as R d increases, the phase angle curve rises in the high-frequency range, providing sufficient phase margin to avoid the risk of high-frequency resonance.
resonance.With a grid impedance of 12 mH, the grid impedance curve intersects the positive sequence output impedance of the GFL at 154 Hz, where the phase margin is only 16.05°, which does not meet the stability conditions required for engineering practice and is likely to lead to resonance.When the grid impedance is 2 mH, the intersection with the GFL positive sequence output impedance occurs at 1858 Hz; due to insufficient phase margin, the system is unstable, leading to high-frequency resonance.Thus, it is necessary to take measures to increase the phase margin at high frequencies, one of which is increasing Rd, a simple and effective measure.High-frequency Zp(s) and Zn(s) curves being identical, the effect of Rd on the Zp(s) curve is studied uniformly.As shown in Figure 4, Rd has no impact on the Zp(s) curve in the low-to mid-frequency range, but as Rd increases, the phase angle curve rises in the high-frequency range, providing sufficient phase margin to avoid the risk of high-frequency resonance.resonance.With a grid impedance of 12 mH, the grid impedance curve intersects the positive sequence output impedance of the GFL at 154 Hz, where the phase margin is only 16.05°, which does not meet the stability conditions required for engineering practice and is likely to lead to resonance.When the grid impedance is 2 mH, the intersection with the GFL positive sequence output impedance occurs at 1858 Hz; due to insufficient phase margin, the system is unstable, leading to high-frequency resonance.Thus, it is necessary to take measures to increase the phase margin at high frequencies, one of which is increasing Rd, a simple and effective measure.High-frequency Zp(s) and Zn(s) curves being identical, the effect of Rd on the Zp(s) curve is studied uniformly.As shown in Figure 4, Rd has no impact on the Zp(s) curve in the low-to mid-frequency range, but as Rd increases, the phase angle curve rises in the high-frequency range, providing sufficient phase margin to avoid the risk of high-frequency resonance.

Influence of PLL Bandwidth on GFL Impedance Curve
First, the T PLL(s) transfer function can be defined as When substituted into H PLL (s) = (K p_PLL + K i_PLL /s)/s, we obtain Here, ζ represents the damping ratio and ω the natural frequency.As a typical second-order system, considering overshoot and settling time, a damping ratio of ζ = 0.707 is selected.The bandwidth of the PLL, denoted as ω BW , can be derived as A lower PLL bandwidth results in poorer tracking performance of the fundamental frequency voltage, whereas a too-high bandwidth may cause instability in the grid-connected system.Balancing dynamic performance and system stability, the PLL bandwidth is ideally set between 100 Hz to 250 Hz. Figure 5 illustrates the impact of PLL bandwidth on the positive and negative sequence impedances, respectively.It is evident that as the PLL bandwidth increases, the impedance magnitude of the GFL within 1 kHz increases, and the phase angle decreases, enlarging the capacitive region.Consequently, there is an increased likelihood of resonance occurring with the grid.
A lower PLL bandwidth results in poorer tracking performance of the fundamental frequency voltage, whereas a too-high bandwidth may cause instability in the gridconnected system.Balancing dynamic performance and system stability, the PLL bandwidth is ideally set between 100 Hz to 250 Hz. Figure 5 illustrates the impact of PLL bandwidth on the positive and negative sequence impedances, respectively.It is evident that as the PLL bandwidth increases, the impedance magnitude of the GFL within 1 kHz increases, and the phase angle decreases, enlarging the capacitive region.Consequently, there is an increased likelihood of resonance occurring with the grid.

Typical GFM Inverter Impedance Modeling
Figure 6 depicts a typical GFM inverter control circuit.In the diagram, Udc represents the DC input voltage, ugabc denotes the voltage at the PCC, Lf is the filter inductor, Rf is the accompanying resistance, Cf and Rd are, respectively, the filter capacitor and the series damping resistor, and Zg is the grid impedance.Power calculations are performed by sampling the three-phase voltage ugabc and current igabc at the PCC to obtain the real power Pe and reactive power Qe.These measurements, along with the set values for real power Pset and reactive power Qset, are input into the PQ control loop to determine the excitation internal potential Em and the output phase signal θ.The specific PQ control loop is shown in Figure 7, where J represents virtual inertia; Dp is the droop coefficient; ω0 is the standard angular frequency of the grid, ω is the angular frequency generated by the GFM inverter; K is the integral coefficient of the excitation regulator; Dq is the voltage regulation coefficient; Vr and Vm are, respectively, the set voltage amplitude and the voltage amplitude output by the VSG.Power calculations are performed by sampling the three-phase voltage u gabc and current i gabc at the PCC to obtain the real power P e and reactive power Q e .These measurements, along with the set values for real power P set and reactive power Q set , are input into the PQ control loop to determine the excitation internal potential E m and the output phase signal θ.The specific PQ control loop is shown in Figure 7, where J represents virtual inertia; D p is the droop coefficient; ω 0 is the standard angular frequency of the grid, ω is the angular frequency generated by the GFM inverter; K is the integral coefficient of the excitation regulator; D q is the voltage regulation coefficient; V r and V m are, respectively, the set voltage amplitude and the voltage amplitude output by the VSG.The values of θ and E m are used in three-phase modulation to compute u mabc , and the inverter's closed-loop control is completed via PWM.Power calculations are performed by sampling the three-phase voltage ugabc and current igabc at the PCC to obtain the real power Pe and reactive power Qe.These measurements, along with the set values for real power Pset and reactive power Qset, are input into the PQ control loop to determine the excitation internal potential Em and the output phase signal θ.The specific PQ control loop is shown in Figure 7, where J represents virtual inertia; Dp is the droop coefficient; ω0 is the standard angular frequency of the grid, ω is the angular frequency generated by the GFM inverter; K is the integral coefficient of the excitation regulator; Dq is the voltage regulation coefficient; Vr and Vm are, respectively, the set voltage amplitude and the voltage amplitude output by the VSG.The values of θ and Em are used in three-phase modulation to compute umabc, and the inverter's closed-loop control is completed via PWM.Similar to the impedance modeling for GFL inverter, a harmonic linearization technique is used to establish the GFM inverter impedance model.By injecting positive and negative sequence voltage disturbances of different frequency at the PCC, the corresponding small-signal currents are generated.The relationship between these disturbances can be used to derive the positive and negative sequence output impedances Zp(s) and Zn(s) of the GFM inverter.Zp(s) and Zn(s) considering reactive loop dynamics are shown below.Similar to the impedance modeling for GFL inverter, a harmonic linearization technique is used to establish the GFM inverter impedance model.By injecting positive and negative sequence voltage disturbances of different frequency at the PCC, the corresponding small-signal currents are generated.The relationship between these disturbances can be used to derive the positive and negative sequence output impedances Z p (s) and Z n (s) of the GFM inverter.Z p (s) and Z n (s) considering reactive loop dynamics are shown below.

Typical GFM Inverter Impedance Modeling
V 1 represents the amplitude of the fundamental voltage, and φ is the phase difference between the bridge potential and the inverter output voltage, set as φ e = φ + π/2.I 1 and φ i,1 are the amplitude and initial phase angle of the fundamental frequency current, respectively.The transfer function N(s) is defined as N(s) = s(Js + D p ), where T(s) = 1/Ks, and R(s) is expressed as This section uses the GFM inverter impedance model to analyze its grid interconnection stability.Specific parameters of the GFM inverter are listed in Table 2, with the grid impedance Z g = 6 mH.
As shown in Figure 8, the GFM inverter impedance characteristics are predominantly inductive at low to mid frequencies, which prevents resonance with the similarly inductive grid, hence offering stronger stability at these frequencies compared to the GFL inverter.However, with increasing frequency, the phase angle of the GFM inverter impedance exhibits a sudden shift of 180 • , becoming capacitive and introducing the risk of resonance.At 559 Hz, the impedance magnitude curves of the GFM inverter and the grid intersect, and the phase margin is a mere 8.06 • , indicating a susceptibility to instability.It is noteworthy that the grid typically carries 11th background harmonics.Resonance at these frequencies could lead to significant resonant currents at the PCC.Additionally, with the increasing prevalence of electric vehicles (EVs) and the expansion of charging infrastructure, the impact of EV charging stations on the grid is significant [22].Commonly, EV chargers use 12-pulse uncontrollable machines, which inject harmonics of the form 12k ± 1 into the grid [23].If these chargers operate during a resonance condition, they could cause substantial harmonic voltages at the PCC, leading to system instability.Therefore, it is crucial to design the GFM inverter parameters carefully to avoid resonance phenomena.

Influence of Parameters on GFM Inverter Impedance Curve
This section investigates the effects of the circuit parameters Lf, Cf, and Rd on the impedance curve of the GFM inverter, specifically focusing on Zp(s) since the curves for Zp(s) and Zn(s) align beyond 100 Hz.As shown in Figure 9, increasing Lf or Cf results in a decrease in the frequency at which a sudden phase shift occurs in Zp(s), and simultaneously increases the corresponding magnitude.To prevent resonance between the GFM inverter and the common background harmonics present in the grid, it is advisable not to excessively increase Lf or Cf.This avoids shifting the resonance peak into lower frequency bands, or they should be adjusted appropriately to ensure that the resonance peak does not coincide with common harmonic frequencies.According to Figure 9c, increasing Rd significantly enhances the phase angle of Zp(s) at higher frequencies, thereby improving the robustness of the grid-connected system.Consequently, increasing Rd is an effective strategy to avoid system resonance, ensuring greater stability and integrity of the grid interconnection.

Influence of Parameters on GFM Inverter Impedance Curve
This section investigates the effects of the circuit parameters L f , C f , and R d on the impedance curve of the GFM inverter, specifically focusing on Z p (s) since the curves for Z p (s) and Z n (s) align beyond 100 Hz.As shown in Figure 9, increasing L f or C f results in a decrease in the frequency at which a sudden phase shift occurs in Z p (s), and simultaneously increases the corresponding magnitude.To prevent resonance between the GFM inverter and the common background harmonics present in the grid, it is advisable not to excessively increase L f or C f .This avoids shifting the resonance peak into lower frequency bands, or they should be adjusted appropriately to ensure that the resonance peak does not coincide with common harmonic frequencies.According to Figure 9c, increasing R d significantly enhances the phase angle of Z p (s) at higher frequencies, thereby improving the robustness of the grid-connected system.Consequently, increasing R d is an effective strategy to avoid system resonance, ensuring greater stability and integrity of the grid interconnection.lower frequency bands, or they should be adjusted appropriately to ensure that the resonance peak does not coincide with common harmonic frequencies.According to Figure 9c, increasing Rd significantly enhances the phase angle of Zp(s) at higher frequencies, thereby improving the robustness of the grid-connected system.Consequently, increasing Rd is an effective strategy to avoid system resonance, ensuring greater stability and integrity of the grid interconnection.

Analysis of Concurrent Grid Integration of Inverters and Electric Vehicles
In this section, we analyze the scenario where both GFL and GFM inverters are connected to the grid simultaneously.Based on the principles of parameter adjustment previously discussed, the Rd in the three-phase synchronous grid-following inverter is set to 6 Ω, while in the GFM inverter, Rd is adjusted to 2 Ω and the Cf to 30 μF.The remaining parameters are consistent with those listed in Tables 1 and 2. Under these settings, the combined impedance curve of GFL and GFM inverters when paralleled in the grid is shown in Figure 10.When interacting with the grid impedance, the system maintains a

Analysis of Concurrent Grid Integration of Inverters and Electric Vehicles
In this section, we analyze the scenario where both GFL and GFM inverters are connected to the grid simultaneously.Based on the principles of parameter adjustment previously discussed, the R d in the three-phase synchronous grid-following inverter is set to 6 Ω, while in the GFM inverter, R d is adjusted to 2 Ω and the C f to 30 µF.The remaining parameters are consistent with those listed in Tables 1 and 2. Under these settings, the combined impedance curve of GFL and GFM inverters when paralleled in the grid is shown in Figure 10.When interacting with the grid impedance, the system maintains a minimum phase margin of 36.59 • .Notably, at this time, the 12k ± 1 order harmonic generated by electric vehicles connected to the grid will also not pose a resonance risk.This analysis confirms the system's stability and operational safety when both inverters and electric vehicles are concurrently connected to the grid.minimum phase margin of 36.59°.Notably, at this time, the 12k ± 1 order harmonic generated by electric vehicles connected to the grid will also not pose a resonance risk.This analysis confirms the system's stability and operational safety when both inverters and electric vehicles are concurrently connected to the grid.

Simulations
This paper utilizes MATLAB/Simulink R2023b simulations to validate the accuracy of the impedance modeling method proposed.The parameters for both GFL and GFM inverters are selected according to Tables 1 and 2.
Initially, the GFL impedance model is validated.With the grid impedance Zg set to 2 mH, as shown in Figure 11a, there is a significant harmonic current near 1858 Hz, and the grid current waveform is illustrated in Figure 11b.This confirms that high-frequency resonance occurs when GFL is connected to the grid, aligning with theoretical analyses.

Simulations
This paper utilizes MATLAB/Simulink R2023b simulations to validate the accuracy of the impedance modeling method proposed.The parameters for both GFL and GFM inverters are selected according to Tables 1 and 2.
Initially, the GFL impedance model is validated.With the grid impedance Z g set to 2 mH, as shown in Figure 11a, there is a significant harmonic current near 1858 Hz, and the grid current waveform is illustrated in Figure 11b.This confirms that high-frequency resonance occurs when GFL is connected to the grid, aligning with theoretical analyses.
of the impedance modeling method proposed.The parameters for both GFL and GFM inverters are selected according to Tables 1 and 2.
Initially, the GFL impedance model is validated.With the grid impedance Zg set to 2 mH, as shown in Figure 11a, there is a significant harmonic current near 1858 Hz, and the grid current waveform is illustrated in Figure 11b.This confirms that high-frequency resonance occurs when GFL is connected to the grid, aligning with theoretical analyses.Next, the accuracy of the GFM impedance model is verified.With the grid impedance set to 6 mH, as displayed in Figure 12a, significant harmonic currents are observed around 557 Hz, and the corresponding grid current waveform is shown in Figure 12b.The system experiences resonance and poor current quality.To simulate the operational scenario of an electric vehicle charging station, 5 A of 11th and 13th harmonic currents are injected at the PCC. Figure 13 indicate that upon injecting a small amount of harmonic current, significant harmonic voltages arise at the coupling point, leading to system resonance and instability.These simulations validate the correctness of the impedance model and theoretical analysis established in this study.Finally, the stability of complex systems is verified through simulation.GFL and GFM are simultaneously connected to the grid, and parameters from Section 2 are employed.At the PCC, 10% of the 5th and 7th harmonic background voltages are injected, along with 5 A of 11th and 13th harmonic currents induced by the EV charging stations.The simulation results, as shown in Figure 14, demonstrate that the system remains stable and does not experience resonance even in the presence of multiple harmonics.This To simulate the operational scenario of an electric vehicle charging station, 5 A of 11th and 13th harmonic currents are injected at the PCC. Figure 13 indicate that upon injecting a small amount of harmonic current, significant harmonic voltages arise at the coupling point, leading to system resonance and instability.These simulations validate the correctness of the impedance model and theoretical analysis established in this study.To simulate the operational scenario of an electric vehicle charging station, 5 A of 11th and 13th harmonic currents are injected at the PCC. Figure 13 indicate that upon injecting a small amount of harmonic current, significant harmonic voltages arise at the coupling point, leading to system resonance and instability.These simulations validate the correctness of the impedance model and theoretical analysis established in this study.Finally, the stability of complex systems is verified through simulation.GFL and GFM are simultaneously connected to the grid, and parameters from Section 2 are employed.At the PCC, 10% of the 5th and 7th harmonic background voltages are injected, along with 5 A of 11th and 13th harmonic currents induced by the EV charging stations.The simulation results, as shown in Figure 14, demonstrate that the system remains stable and does not experience resonance even in the presence of multiple harmonics.This Finally, the stability of complex systems is verified through simulation.GFL and GFM are simultaneously connected to the grid, and parameters from Section 2 are employed.At the PCC, 10% of the 5th and 7th harmonic background voltages are injected, along with 5 A of 11th and 13th harmonic currents induced by the EV charging stations.The simulation results, as shown in Figure 14, demonstrate that the system remains stable and does not experience resonance even in the presence of multiple harmonics.This validates the correctness of the theoretical approach and the rationality of the parameter design presented in this study.

Conclusions
This paper investigates the resonance issues associated with the integration of distributed energy into the grid.By utilizing harmonic linearization techniques, impedance models for both GFL and GFM inverters were systematically constructed, and the specific impacts of various model parameters on the stability of the grid-connected system were thoroughly analyzed.The correctness of the theoretical analysis presented in this study is validated through simulations.
It was found that the GFL inverter exhibits capacitive characteristics at mid-to-low frequencies, making it more susceptible to resonance phenomena in weak, inductive grid environments.At higher frequencies, resonance can be avoided by increasing the series damping resistance.Furthermore, this study also detailed the significant impact of the bandwidth of the PLL on the impedance characteristics of GFL inverter, noting that increased PLL bandwidth decreases system stability.
The impedance model of GFM inverter, in contrast to the GFL inverter, shows inductive characteristics at mid-to-low frequencies, making it less likely to resonate with an inductive grid.However, at higher frequencies, GFM inverter impedance curve undergoes a sudden phase shift, which may resonate with the grid, posing a risk of system instability.To address this issue, the paper proposes reasonable parameter adjustment strategies to effectively reduce the risk of resonance.
This paper simulates the complex scenario of GFL and GFM inverters along with an EV charging station simultaneously connected to the grid.By designing the parameters appropriately, the stability of the system is ensured.
In future research, there will be a deeper exploration into the impact of advanced structures and control methods of GFL and GFM on impedance models and stability.Specifically, we aim to address preventive measures against potential harmonic resonance issues that may arise.By delving into these areas, we anticipate enriching and expanding the current understanding of how advanced structural configurations and control strategies can enhance the overall robustness and efficiency of power grid systems.This investigation holds promise for advancing the field and contributing to the development of more resilient energy networks capable of meeting future demands.

Conclusions
This paper investigates the resonance issues associated with the integration of distributed energy into the grid.By utilizing harmonic linearization techniques, impedance models for both GFL and GFM inverters were systematically constructed, and the specific impacts of various model parameters on the stability of the grid-connected system were thoroughly analyzed.The correctness of the theoretical analysis presented in this study is validated through simulations.
It was found that the GFL inverter exhibits capacitive characteristics at mid-to-low frequencies, making it more susceptible to resonance phenomena in weak, inductive grid environments.At higher frequencies, resonance can be avoided by increasing the series damping resistance.Furthermore, this study also detailed the significant impact of the bandwidth of the PLL on the impedance characteristics of GFL inverter, noting that increased PLL bandwidth decreases system stability.
The impedance model of GFM inverter, in contrast to the GFL inverter, shows inductive characteristics at mid-to-low frequencies, making it less likely to resonate with an inductive grid.However, at higher frequencies, GFM inverter impedance curve undergoes a sudden phase shift, which may resonate with the grid, posing a risk of system instability.To address this issue, the paper proposes reasonable parameter adjustment strategies to effectively reduce the risk of resonance.
This paper simulates the complex scenario of GFL and GFM inverters along with an EV charging station simultaneously connected to the grid.By designing the parameters appropriately, the stability of the system is ensured.
In future research, there will be a deeper exploration into the impact of advanced structures and control methods of GFL and GFM on impedance models and stability.Specifically, we aim to address preventive measures against potential harmonic resonance issues that may arise.By delving into these areas, we anticipate enriching and expanding the current understanding of how advanced structural configurations and control strategies can enhance the overall robustness and efficiency of power grid systems.This investigation holds promise for advancing the field and contributing to the development of more resilient energy networks capable of meeting future demands.
f ] is the frequency domain expression of the phase angle disturbance ∆θ, and ⊗ represents the convolution process.Assuming G PLL represents the relationship between ∆ .θ[ f ] and . .
V p and .V n are the frequency domain expressions for the positive and negative sequence voltage disturbances, while .I p and .

Figure 4 .
Figure 4. Impact of parameter Rd on the Zp(s) curve.

Figure 4 .
Figure 4. Impact of parameter Rd on the Zp(s) curve.Figure 4. Impact of parameter R d on the Zp(s) curve.

Figure 4 .
Figure 4. Impact of parameter Rd on the Zp(s) curve.Figure 4. Impact of parameter R d on the Zp(s) curve.

Figure 6 Figure 6 .
Figure 6 depicts a typical GFM inverter control circuit.In the diagram, U dc represents the DC input voltage, u gabc denotes the voltage at the PCC, L f is the filter inductor, R f is the series resistor, C f and R d are, respectively, the filter capacitor and the series resistor, and Z g is the grid impedance.World Electr.Veh.J. 2024, 15, 287 9 of 16

Figure 6 .
Figure 6.GFM Structure and control circuit diagram.

Figure 6 .
Figure 6.GFM Structure and control circuit diagram.

Figure 8 .
Figure 8. Interaction of GFM inverter with grid.

Figure 8 .
Figure 8. Interaction of GFM inverter with grid.

Figure 9 .
Figure 9. Impact of parameters on the Zp(s) Curve: (a) the impact of the parameter Lf; (b) the impact of the parameter Cf; (c) the impact of the parameter Rd.

Figure 9 .
Figure 9. Impact of parameters on the Z p (s) Curve: (a) the impact of the parameter L f ; (b) the impact of the parameter C f ; (c) the impact of the parameter R d .

Figure 10 .
Figure 10.Combined positive and negative sequence impedances curve.

Figure 10 .
Figure 10.Combined positive and negative sequence impedances curve.

Figure
Figure GFL inverter grid-connected current result: (a) FFT analysis; (b) current waveform.

Figure 11 .Figure 12 .
Figure 11.GFL inverter grid-connected current result: (a) FFT analysis; (b) current waveform.Next, the accuracy of the GFM impedance model is verified.With the grid impedance set to 6 mH, as displayed in Figure12a, significant harmonic currents are observed around 557 Hz, and the corresponding grid current waveform is shown in Figure12b.The system experiences resonance and poor current quality.World Electr.Veh.J. 2024, 15, 287 13 of 16

16 Figure 14 .
Figure 14.FFT analysis of grid current in complex situations result.

Figure 14 .
Figure 14.FFT analysis of grid current in complex situations result.