An Adaptive Virtual Impedance Method for Grid-Connected Current Quality Improvement of a Single-Phase Virtual Synchronous Generator under Distorted Grid Voltage

The proportion of distributed generation systems in power grids is increasing, leading to the gradual emergence of weak grid characteristics. Moreover, using voltage-sourced grid-connected inverters can enhance the stability of a weak grid. However, due to the presence of background harmonics in weak grids, the grid voltage can cause significant distortions in the grid-connected current, which adversely affects the quality of the grid-connected current. This paper begins by briefly introducing the principle of the virtual synchronous generator (VSG). Then, the output current of the voltage source inverter is analyzed to elucidate the mechanism of harmonic current generation. Considering the distortion in the grid-connected current of the voltage source grid-connected inverter caused by background harmonics in the grid voltage, a harmonic current suppression strategy based on an adaptive virtual harmonic resistor is proposed. The proposed strategy employs a signal separation module based on multiple second-order generalized integrators connected through a cross-feedback network. This module effectively separates the fundamental and harmonic currents from the grid-connected current, extracts the amplitudes of the fundamental and harmonic currents through coordinate transformation, and adaptively adjusts the virtual harmonic resistance magnitude through the negative feedback control of the harmonic content (the ratio of the harmonic current amplitude to the fundamental current amplitude). These measures are used to enhance the quality of the grid-connected current. Additionally, the stability of the system is analyzed using the root locus of the open-loop transfer function. Finally, the effectiveness of the proposed method is validated through a combination of MATLAB/Simulink simulations and experimental results.


Introduction
In recent years, to address the global energy crisis, distributed power generation, represented by photovoltaic and wind power generation, has experienced rapid development [1]. Acting as an intermediary between distributed generation systems and power grids, grid-connected inverters play a pivotal role in converting the power generated by distributed sources into the AC form for transmission to the grids. It is essential for ensuring the safe and stable operation of power grids [2]. However, distributed generation systems based on inverter interfaces face challenges regarding participating in grid regulation due to their low rotational inertia and fast response [3]. Moreover, the integration of a significant number of connected distributed generation systems can adversely impact the stability of power systems [4]. Virtual synchronous generator (VSG) technology has attracted considerable attention from both domestic and international scholars [5,6]. This technology can be used to emulate the external characteristics of traditional generators, This paper presents a novel approach based on adaptive virtual harmonic impedance to address the existing issues in the aforementioned methods. It does not require measuring the voltage at the point of common coupling (PCC). Instead, it utilizes the algebraic virtual impedance method shown in Reference [22] to obtain the total voltage drop of the virtual impedance, which is then introduced into the dual-loop control. This method does not involve differential operations, thereby avoiding the problem of high-frequency signal amplification. In practical systems, low-order harmonics dominate the grid voltage, while high-order harmonics contribute only to a small extent. Therefore, the primary focus is on improving the grid current when there are variations in the content of loworder harmonics (third, fifth, and seventh harmonics) in the grid voltage. The adaptive virtual harmonic impedance introduces the harmonic content (expressed as the ratio of the harmonic amplitude to the fundamental frequency amplitude) into the double closed-loop control for negative feedback control of the harmonic content. By adaptively adjusting the magnitude of the virtual impedance based on the harmonic content in the grid-connected current, introducing the total voltage drop of the virtual impedance into the dual-loop control is equivalent to connecting a virtual harmonic resistor in series with the gridconnected system's harmonic equivalent circuit. This reduces the harmonic current in the grid-connected current and thereby improves the quality of the grid-connected current. Figure 1 illustrates the main circuit topology and overall control block diagram of the single-phase VSG grid-connected inverter. The inverter-side inductor is denoted as L 1 , the filter capacitor as C, the grid-side inductor as L g , and the grid-side resistance as R g . The active power P and reactive power Q are calculated using instantaneous power theory [23]. However, due to the presence of secondary pulsations, a low-pass filter (LPF) is necessary to mitigate power oscillations and reduce disturbances.  Figure 1. Main circuit topology and overall control block diagram of a single-phase VSG grid-connected inverter.

Fundamental Principles of the VSG
The control algorithm for the VSG comprises active-frequency control and reactivevoltage control [24,25], and it can be expressed as follows: where Pm and Pe represent the mechanical and electromagnetic power of the VSG, respectively, while w and wref denote the angular frequency of the VSG and the grid angular frequency, respectively. J and D represent the rotational inertia and damping coefficient of the VSG, respectively, and Qref and Qo correspond to the reactive power reference and reactive power measured values, respectively. Similarly, Uref and Uo represent the rated voltage amplitude and the actual output voltage amplitude, respectively. kq denotes the reactive power-voltage coefficient, where Pe and Qo represent the instantaneous active and reactive powers obtained by the power calculation module. To more accurately simulate the characteristics of a synchronous generator, the primary frequency control is incorporated into the active power-frequency equation, as expressed in Equation (3). To enable the accurate tracking of the reactive power by the VSG inverter during grid connections, integral regulation is introduced to improve Equation (2), as shown in Equation (4). where Pref represents the active power reference value and ki is the integration coefficient.
The control block diagram of the VSG is derived from Equations (1), (3) and (4), as shown in Figure 2. From Figure 2, it can be observed that the active power-frequency equation generates the reference frequency and phase, while the reactive power-voltage The control algorithm for the VSG comprises active-frequency control and reactivevoltage control [24,25], and it can be expressed as follows: where P m and P e represent the mechanical and electromagnetic power of the VSG, respectively, while w and w ref denote the angular frequency of the VSG and the grid angular frequency, respectively. J and D represent the rotational inertia and damping coefficient of the VSG, respectively, and Q ref and Q o correspond to the reactive power reference and reactive power measured values, respectively. Similarly, U ref and U o represent the rated voltage amplitude and the actual output voltage amplitude, respectively. k q denotes the reactive power-voltage coefficient, where P e and Q o represent the instantaneous active and reactive powers obtained by the power calculation module. To more accurately simulate the characteristics of a synchronous generator, the primary frequency control is incorporated into the active power-frequency equation, as expressed in Equation (3). To enable the accurate tracking of the reactive power by the VSG inverter during grid connections, integral regulation is introduced to improve Equation (2), as shown in Equation (4).
where P ref represents the active power reference value and k i is the integration coefficient. The control block diagram of the VSG is derived from Equations (1), (3) and (4), as shown in Figure 2. From Figure 2, it can be observed that the active power-frequency equation generates the reference frequency and phase, while the reactive power-voltage equation

Analysis of the Harmonic Current Mechanism in Grid-Connected Voltage-Source Inverters under Non-Ideal Voltage Conditions
The voltage-current dual-loop model of the VSG is illustrated in Figure 3. The outer loop, governed by the capacitor voltage, ensures voltage stability, while the inner loop, controlled by the inverter-side inductor current, achieves fast current tracking and enhances the system dynamic response speed. In this paper, the SPWM modulation strategy is adopted, with Kpwm representing the equivalent gain of the inverter, set to a value of 1. Control is implemented on the αβ axis, where the inner loop current controller Gi(s) employs proportional (P) control to track the current reference. Meanwhile, the voltage outer loop controller Gu(s) utilizes proportional-resonant (PR) control. The transfer function of the PR controller is as follows: where kp is the proportional gain, kf is the fundamental frequency gain, kh is the harmonic frequency gain, wc is the bandwidth of the controller, wo is the voltage fundamental corner frequency, and h represents the signal harmonic order. According to Figure 3, it can be observed that the relationship between the reference voltage U*(s) of the outer loop and the inverter output voltage Uc(s) and grid current Io(s) is given by Equation where Go(s) and Zo(s) are, respectively, where ZL1 = sL1 and Zc = 1/sc. According to Equation (6), the grid-connected inverter can be equivalently represented as a voltage source Go(s)U*(s) in parallel with an equivalent output impedance Zo(s), while the weak grid can be equivalently represented as a series

Analysis of the Harmonic Current Mechanism in Grid-Connected Voltage-Source Inverters under Non-Ideal Voltage Conditions
The voltage-current dual-loop model of the VSG is illustrated in Figure 3. The outer loop, governed by the capacitor voltage, ensures voltage stability, while the inner loop, controlled by the inverter-side inductor current, achieves fast current tracking and enhances the system dynamic response speed. In this paper, the SPWM modulation strategy is adopted, with K pwm representing the equivalent gain of the inverter, set to a value of 1. Control is implemented on the αβ axis, where the inner loop current controller G i (s) employs proportional (P) control to track the current reference. Meanwhile, the voltage outer loop controller G u (s) utilizes proportional-resonant (PR) control. The transfer function of the PR controller is as follows: 5,7 2k h w c s where k p is the proportional gain, k f is the fundamental frequency gain, k h is the harmonic frequency gain, w c is the bandwidth of the controller, w o is the voltage fundamental corner frequency, and h represents the signal harmonic order.

Analysis of the Harmonic Current Mechanism in Grid-Connected Voltage-Source Inverters under Non-Ideal Voltage Conditions
The voltage-current dual-loop model of the VSG is illustrated in Figure 3. The outer loop, governed by the capacitor voltage, ensures voltage stability, while the inner loop, controlled by the inverter-side inductor current, achieves fast current tracking and enhances the system dynamic response speed. In this paper, the SPWM modulation strategy is adopted, with Kpwm representing the equivalent gain of the inverter, set to a value of 1. Control is implemented on the αβ axis, where the inner loop current controller Gi(s) employs proportional (P) control to track the current reference. Meanwhile, the voltage outer loop controller Gu(s) utilizes proportional-resonant (PR) control. The transfer function of the PR controller is as follows: where kp is the proportional gain, kf is the fundamental frequency gain, kh is the harmonic frequency gain, wc is the bandwidth of the controller, wo is the voltage fundamental corner frequency, and h represents the signal harmonic order. According to Figure 3, it can be observed that the relationship between the reference voltage U*(s) of the outer loop and the inverter output voltage Uc(s) and grid current Io(s) is given by Equation where Go(s) and Zo(s) are, respectively, where ZL1 = sL1 and Zc = 1/sc. According to Equation (6), the grid-connected inverter can be equivalently represented as a voltage source Go(s)U*(s) in parallel with an equivalent output impedance Zo(s), while the weak grid can be equivalently represented as a series where G o (s) and Z o (s) are, respectively, where Z L1 = sL 1 and Z c = 1/sc. According to Equation (6), the grid-connected inverter can be equivalently represented as a voltage source G o (s)U*(s) in parallel with an equivalent output impedance Z o (s), while the weak grid can be equivalently represented as a series connection of the grid voltage U g and grid-side impedance Z g (s), where Z g (s) = sL g + R g . Hence, the equivalent circuit of the grid-connected system can be obtained as shown in Figure 4. Hence, the equivalent circuit of the grid-connected system can be obtained as shown in Figure 4. The expression of grid-connected current io(s) can be obtained from Figure 4 as follows According to Equation (9), the grid-connected current Io(s) is composed of two parts: the effect component from the outer loop reference voltage U*(s) and the disturbance component generated by the influence of the grid voltage Ug. When the grid voltage Ug contains low-order harmonics, the grid-connected current Io(s) will generate harmonics of the same order.

Adaptive Virtual Harmonic Resistance and Fundamental Reactance Algorithm
According to Equation (9), increasing the magnitude of Zo(s) + Zg(s) can suppress the influence of the grid voltage on the grid-connected current. However, Zg(s) represents the grid impedance, which is difficult to alter. Therefore, the improvement of the grid-connected current can only be achieved by changing the inverter output impedance Zo(s). By employing the method of virtual impedance, the magnitude of Zo(s) can be increased to reshape the inverter output impedance and suppress harmonic currents. In this paper, for the suppression of harmonic currents when the harmonic components of the grid voltage (third, fifth, and seventh harmonics) vary, an adaptive virtual harmonic resistance algorithm is proposed. It can adaptively adjust the size of the virtual harmonic resistance based on the changes in the harmonic content of the grid voltage. This adaptive approach improves the quality of the grid-connected current to meet the grid standards.

Adaptive Virtual Harmonic Resistor Implementation Method
In this paper, improving the quality of grid-connected currents and promoting sinusoidal waveform output when the grid voltage contains third, fifth, and seventh harmonic components are focused on by introducing a virtual impedance control strategy. Reference [18] discusses the selection of virtual impedance types and suggests that designing the virtual harmonic impedance as virtual harmonic resistance is more practical, since it provides damping effects on the harmonics. Virtual impedance can be categorized into three types: virtual resistance, virtual inductance, and virtual impedance R-L. To select the virtual impedance types, the virtual harmonic resistance and fundamental inductance According to Equation (9), the grid-connected current I o (s) is composed of two parts: the effect component from the outer loop reference voltage U*(s) and the disturbance component generated by the influence of the grid voltage U g . When the grid voltage U g contains low-order harmonics, the grid-connected current I o (s) will generate harmonics of the same order.

Adaptive Virtual Harmonic Resistance and Fundamental Reactance Algorithm
According to Equation (9), increasing the magnitude of Z o (s) + Z g (s) can suppress the influence of the grid voltage on the grid-connected current. However, Z g (s) represents the grid impedance, which is difficult to alter. Therefore, the improvement of the gridconnected current can only be achieved by changing the inverter output impedance Z o (s). By employing the method of virtual impedance, the magnitude of Z o (s) can be increased to reshape the inverter output impedance and suppress harmonic currents. In this paper, for the suppression of harmonic currents when the harmonic components of the grid voltage (third, fifth, and seventh harmonics) vary, an adaptive virtual harmonic resistance algorithm is proposed. It can adaptively adjust the size of the virtual harmonic resistance based on the changes in the harmonic content of the grid voltage. This adaptive approach improves the quality of the grid-connected current to meet the grid standards.

Adaptive Virtual Harmonic Resistor Implementation Method
In this paper, improving the quality of grid-connected currents and promoting sinusoidal waveform output when the grid voltage contains third, fifth, and seventh harmonic components are focused on by introducing a virtual impedance control strategy. Reference [18] discusses the selection of virtual impedance types and suggests that designing the virtual harmonic impedance as virtual harmonic resistance is more practical, since it provides damping effects on the harmonics. Virtual impedance can be categorized into three types: virtual resistance, virtual inductance, and virtual impedance R-L. To select the virtual impedance types, the virtual harmonic resistance and fundamental inductance need to be determined in this paper. The implementation method of adaptive virtual harmonic impedance consists of three main steps.
Step (i): Separation of fundamental current and harmonic currents. As depicted in Figure 2, the implementation of adaptive virtual harmonic resistance requires separating the fundamental and harmonic currents from the grid-connected current. In this paper, a signal separation module based on multiple second-order generalized integrators (SOGIs) [26] is utilized to extract the fundamental and harmonic currents from the grid-connected current. The signal separation module decouples the harmonic signals using cross-feedback networks to isolate the interaction between different harmonics in the current signal. Then, using a second-order generalized integrator D(s), the fundamental and harmonic current components are separated on the α-axis at different frequencies; when w represents the fundamental and odd harmonic frequencies and kw is a constant value, it is possible to isolate the fundamental and harmonic currents. Finally, by utilizing a secondorder generalized integrator Q(s), the fundamental and harmonic current components are obtained on the β-axis; when w represents the fundamental and odd harmonic frequencies, the αβ-axis components of the fundamental and harmonic currents can be constructed. The structure of the signal extraction is shown in Figure 5, and the second-order generalized integral structure is illustrated in Figure 6. need to be determined in this paper. The implementation method of adaptive virtual harmonic impedance consists of three main steps.
Step (i): Separation of fundamental current and harmonic currents. As depicted in Figure 2, the implementation of adaptive virtual harmonic resistance requires separating the fundamental and harmonic currents from the grid-connected current. In this paper, a signal separation module based on multiple second-order generalized integrators (SOGIs) [26] is utilized to extract the fundamental and harmonic currents from the grid-connected current. The signal separation module decouples the harmonic signals using cross-feedback networks to isolate the interaction between different harmonics in the current signal. Then, using a second-order generalized integrator D(s), the fundamental and harmonic current components are separated on the α-axis at different frequencies; when w represents the fundamental and odd harmonic frequencies and kw is a constant value, it is possible to isolate the fundamental and harmonic currents. Finally, by utilizing a secondorder generalized integrator Q(s), the fundamental and harmonic current components are obtained on the β-axis; when w represents the fundamental and odd harmonic frequencies, the αβ-axis components of the fundamental and harmonic currents can be constructed. The structure of the signal extraction is shown in Figure 5, and the second-order generalized integral structure is illustrated in Figure 6. As shown in Figure 6, the transfer function of the SOGI can be obtained as follows:  need to be determined in this paper. The implementation method of adaptive virtual harmonic impedance consists of three main steps.
Step (i): Separation of fundamental current and harmonic currents. As depicted in Figure 2, the implementation of adaptive virtual harmonic resistance requires separating the fundamental and harmonic currents from the grid-connected current. In this paper, a signal separation module based on multiple second-order generalized integrators (SOGIs) [26] is utilized to extract the fundamental and harmonic currents from the grid-connected current. The signal separation module decouples the harmonic signals using cross-feedback networks to isolate the interaction between different harmonics in the current signal. Then, using a second-order generalized integrator D(s), the fundamental and harmonic current components are separated on the α-axis at different frequencies; when w represents the fundamental and odd harmonic frequencies and kw is a constant value, it is possible to isolate the fundamental and harmonic currents. Finally, by utilizing a secondorder generalized integrator Q(s), the fundamental and harmonic current components are obtained on the β-axis; when w represents the fundamental and odd harmonic frequencies, the αβ-axis components of the fundamental and harmonic currents can be constructed. The structure of the signal extraction is shown in Figure 5, and the second-order generalized integral structure is illustrated in Figure 6. As shown in Figure 6, the transfer function of the SOGI can be obtained as follows: As shown in Figure 6, the transfer function of the SOGI can be obtained as follows: where k is the damping adjustment coefficient, determining the bandwidth, and w is the resonance angular frequency, determining the center angular frequency. Equation (10) is primarily used for separating the fundamental and harmonic currents from the gridconnected current. In contrast to three-phase signals that can be transformed into αβ-axis components using the Clarke transformation, single-phase signals lack this capability. However, the SOGI shown in Equation (11) can obtain an input signal orthogonal to the input signal itself [27]. Therefore, it is possible to construct the αβ-axis components using the second-order generalized integral Q(s).
Step (ii): Extraction of fundamental and harmonic current magnitudes. To achieve the adaptive variation of virtual harmonic impedance, it is necessary to extract the amplitude of the fundamental and harmonic currents from the grid current, defining the output voltage as The voltage signal is subjected to orthogonal transformation to obtain components on the αβ-axis.
The voltage signal is transformed using the Park transformation, where θ 1 is the voltage measurement angle value obtained from the SOGI-PLL phase-locked loop output. When U cq = 0, it ensures that θ − θ 1 equals zero, thereby guaranteeing that the measured angle value matches the actual value. Initially, the grid voltage is phaselocked using a second-order generalized integrator phase-locked loop (SOGI-PLL) [28], as illustrated in Figure 7, to obtain the fundamental angular frequency. Similarly, the angular frequencies of the third, fifth, and seventh harmonics can be obtained. The fundamental and harmonic currents on the αβ axis are then transformed into the dq axis through coordinate transformation. Based on the components on the d and q axes, the amplitudes of the fundamental and respective harmonic currents are determined.   (11) where k is the damping adjustment coefficient, determining the bandwidth, and w is the resonance angular frequency, determining the center angular frequency. Equation (10) is primarily used for separating the fundamental and harmonic currents from the grid-connected current. In contrast to three-phase signals that can be transformed into αβ-axis components using the Clarke transformation, single-phase signals lack this capability. However, the SOGI shown in Equation (11) can obtain an input signal orthogonal to the input signal itself [27]. Therefore, it is possible to construct the αβ-axis components using the second-order generalized integral Q(s).
Step (ii): Extraction of fundamental and harmonic current magnitudes. To achieve the adaptive variation of virtual harmonic impedance, it is necessary to extract the amplitude of the fundamental and harmonic currents from the grid current, defining the output voltage as The voltage signal is subjected to orthogonal transformation to obtain components on the αβ-axis.
The voltage signal is transformed using the Park transformation, where θ1 is the voltage measurement angle value obtained from the SOGI-PLL phaselocked loop output. When Ucq = 0, it ensures that θ − θ1 equals zero, thereby guaranteeing that the measured angle value matches the actual value. Initially, the grid voltage is phaselocked using a second-order generalized integrator phase-locked loop (SOGI-PLL) [28], as illustrated in Figure 7, to obtain the fundamental angular frequency. Similarly, the angular frequencies of the third, fifth, and seventh harmonics can be obtained. The fundamental and harmonic currents on the αβ axis are then transformed into the dq axis through coordinate transformation. Based on the components on the d and q axes, the amplitudes of the fundamental and respective harmonic currents are determined.
Δw θ Taking the extraction of the fundamental current amplitude as an example, the fundamental current extracted through the separation module can be denoted as ioα_f = Im_f cos(wt + θ). It can be inferred that the harmonic currents on the β-axis, obtained from the Taking the extraction of the fundamental current amplitude as an example, the fundamental current extracted through the separation module can be denoted as i oα_f = I m_f cos(wt + θ). It can be inferred that the harmonic currents on the β-axis, obtained from the signal separation module, lag the fundamental current on the α-axis by 90 degrees, i oβ_f = I m_f sin(wt + θ). The transformation matrix A from the αβ-axis to the dq-axis is given by The transformation process of the fundamental current from the αβ axis to the dq axis coordinates is shown in Equation (16), as follows From Equation (16), we know that Hence, by performing coordinate transformation, the amplitude of the fundamental current can be obtained. From Equation (17), it can be observed that the amplitude of the fundamental current is independent of the initial phase of the fundamental current. Similarly, the amplitudes of the third, fifth, and seventh harmonic currents can be obtained using the same approach.
Step (iii): Implementation of virtual harmonic resistors. To improve the quality of grid currents during variations in the harmonic content in grid voltages, it is necessary to achieve adaptive variations of the virtual harmonic impedance. This can be accomplished by introducing the harmonic content into the negative feedback control to achieve the desired objective. The block diagram of the adaptive virtual nth (n = 3, 5, 7) harmonic impedance construction is shown in Figure 8. First, the fundamental and harmonic currents are separated from the grid current. Then, the amplitude of the fundamental current and harmonic currents is extracted, and the nth (n = 3, 5, 7) harmonic content is obtained. Finally, the difference between the nth (n = 3, 5, 7) harmonic content and the reference value of the nth (n = 3, 5, 7) harmonic content is adjusted by a PI controller, and its output value represents the virtual nth (n = 3, 5, 7) harmonic impedance. The nth (n = 3, 5, 7) harmonic content is expressed by I n% , whose value is the ratio of the harmonic current amplitude to the fundamental current amplitude, and I n% * represents the reference value of the nth (n = 3, 5, 7) harmonic content. In Figure 6, i o_f , i o_3 , i o_5 and i o_7 represent the fundamental current, the third harmonic current, the fifth harmonic current, and the seventh harmonic current obtained through the signal separation module of the grid current io. I m_f , I m_3 , I m_5 and I m_7 denote the amplitudes of the fundamental current, the third harmonic current, the fifth harmonic current, and the seventh harmonic current obtained through the amplitude extraction module applied to the fundamental and harmonic currents. signal separation module, lag the fundamental current on the α-axis by 90 degrees, ioβ_f = Im_f sin(wt + θ). The transformation matrix A from the αβ-axis to the dq-axis is given by The transformation process of the fundamental current from the αβ axis to the dq axis coordinates is shown in Equation (16) From Equation (16), we know that Hence, by performing coordinate transformation, the amplitude of the fundamental current can be obtained. From Equation (17), it can be observed that the amplitude of the fundamental current is independent of the initial phase of the fundamental current. Similarly, the amplitudes of the third, fifth, and seventh harmonic currents can be obtained using the same approach.
Step (iii): Implementation of virtual harmonic resistors. To improve the quality of grid currents during variations in the harmonic content in grid voltages, it is necessary to achieve adaptive variations of the virtual harmonic impedance. This can be accomplished by introducing the harmonic content into the negative feedback control to achieve the desired objective. The block diagram of the adaptive virtual nth (n = 3,5,7) harmonic impedance construction is shown in Figure 8. First, the fundamental and harmonic currents are separated from the grid current. Then, the amplitude of the fundamental current and harmonic currents is extracted, and the nth (n = 3,5,7) harmonic content is obtained. Finally, the difference between the nth (n = 3,5,7) harmonic content and the reference value of the nth (n = 3,5,7) harmonic content is adjusted by a PI controller, and its output value represents the virtual nth (n = 3,5,7) harmonic impedance. The nth (n = 3,5,7) harmonic content is expressed by In%, whose value is the ratio of the harmonic current amplitude to the fundamental current amplitude, and In%* represents the reference value of the nth (n = 3,5,7) harmonic content. In Figure 6, io_f, io_3, io_5 and io_7 represent the fundamental current, the third harmonic current, the fifth harmonic current, and the seventh harmonic current obtained through the signal separation module of the grid current io. Im_f, Im_3, Im_5 and Im_7 denote the amplitudes of the fundamental current, the third harmonic current, the fifth harmonic current, and the seventh harmonic current obtained through the amplitude extraction module applied to the fundamental and harmonic currents.

Signal Extraction
Magnitude Extraction The virtual nth (n = 3, 5, 7) harmonic impedance is obtained through PI regulation by taking the difference between the harmonic content I n% and the reference value I n% *. The underlying principle is as follows: when the difference between the feedback I n% and I n% * is greater than 0, the PI regulation increases the PI output. The PI output value represents the virtual nth harmonic impedance, and the voltage across the virtual nth harmonic impedance is introduced into the outer voltage loop through negative feedback. This is equivalent to serially connecting a virtual nth harmonic impedance in the harmonic equivalent circuit of the grid-connected system shown in Figure 4c. In the equivalent circuit of the gridconnected system, it acts as if the grid-side impedance is in series with the virtual nth harmonic impedance, increasing the magnitude of Z o (s) + Z g (s) and thus reducing the nth harmonic current while keeping the fundamental current unchanged. Consequently, the nth harmonic current decreases, leading to a reduction in the nth harmonic content. Through multiple feedback iterations, the difference between the feedback I n% and I n% * approaches zero, ultimately achieving stability. As a result, the harmonic content approaches the reference value, thereby accomplishing the goal of adaptive improvement in the grid current quality.

Introduction of the Virtual Harmonic Impedance and Fundamental Reactance into the Equivalent Model
Based on the previous analysis, it is evident that the algorithm for adaptive virtual harmonic resistance is not applicable to virtual fundamental reactance. The design of the fundamental reactance parameters is primarily achieved through system stability analysis, as elaborated in Section 4.3. In this study, the algebraic virtual impedance method proposed in References [22,29] is employed to obtain the voltage across the virtual impedance. This voltage on the virtual impedance is then incorporated into the voltage-current dual-loop control to achieve regulation of the output current by the virtual impedance. The voltage on the fundamental and harmonic impedances on the αβ axis is expressed as follows: According to Section 4.1, the virtual fundamental inductance and virtual harmonic impedance are selected in this study. Therefore, in Equations (18)-(21), R v_f , L v_3 , L v_5 and L v_7 are all set to zero, while w* represents the fundamental angular frequency. By summing the components of each frequency on the αβ axis, the total voltage of the virtual impedance on the αβ axis can be obtained, as shown in Equation (22). The total voltage on the αβ axis is introduced into the voltage-current dual-loop control in the form of negative feedback. It is subtracted from the reference voltage of the power outer loop to simulate the influence of the actual impedance. The introduction of the voltage on the virtual impedance into the voltage-current dual-loop control does not involve differentiation operations, thereby avoiding the problem of amplifying high-frequency noise.
The introduction of the voltage on the virtual impedance into the voltage-current dual-loop equivalent model is depicted in Figure 9a. The model can be simplified by moving the comparison and extraction points, as illustrated in Figure 9b, which shows a simplified equivalent model.
The introduction of the voltage on the virtual impedance into the voltage-current dual-loop equivalent model is depicted in Figure 9a. The model can be simplified by moving the comparison and extraction points, as illustrated in Figure 9b, which shows a simplified equivalent model.

Adaptive Virtual Impedance Signal Extraction
where Gx1(s) and Gx2(s) can be expressed by Equations (20) and (21)

System Stability Analysis
The implementation of the adaptive virtual harmonic impedance and fundamental reactance requires first meeting the stability requirements of the system. The root locus plot can be generated based on the open-loop transfer function in Equation (23) to determine the parameter ranges for the virtual harmonic impedance and fundamental reactance variations. The stability of the system can be analyzed using the root locus plot.
The root locus plot with varying parameters Lv_f, Rv_3, Rv_5 and Rv_7 is shown in Figure  10, Figure 11, Figure 12 and Figure 13, respectively. The open-loop transfer function of the system can be obtained from Figure 9 as where G x1 (s) and G x2 (s) can be expressed by Equations (20) and (21)

System Stability Analysis
The implementation of the adaptive virtual harmonic impedance and fundamental reactance requires first meeting the stability requirements of the system. The root locus plot can be generated based on the open-loop transfer function in Equation (23) to determine the parameter ranges for the virtual harmonic impedance and fundamental reactance variations. The stability of the system can be analyzed using the root locus plot.
The root locus plot with varying parameters L v_f , R v_3 , R v_5 and R v_7 is shown in Figures 10-13 The design of the fundamental impedance parameters should first satisfy the stability requirements of the system. Figure 10 shows the root locus plot with varying parameters of the virtual fundamental inductance Lv_f, where the parameters are varied in integer form. Figure 10a,b represent the root locus plots with Lv_f ranging from 0 to 1 mH and 0 to 2 mH, respectively. Figure 10c,d is an enlarged view of the critical region (indicated by the red arrow) near the stability boundary, different colored points represent different root locus plot. The root locus of the open-loop transfer function depicts the distribution of poles on the s-plane. When there are poles in the right half of the s-plane, the system is unstable. The black arrow indicates the direction in which the root locus changes. From Figure 10a, it can be observed that the poles changing in the direction of the black arrows do not cross the right-half plane. Similarly, Figure 10c indicates that there are no poles crossing the right-half plane near the critical point. The root locus of Lv_f within the parameter range of 0-1 mH does not cross the right half-plane, indicating system stability. On the other hand, from Figure 10b, it can be observed that the poles changing in the direction of the black arrows cross the right-half plane. Similarly, Figure 10d indicates that there are no poles crossing the right-half plane near the critical point. The root locus for Lv_f ranging from 0 to 2 mH partially crosses the right half-plane, indicating system instability. Based on the above analysis, it can be concluded that the system remains stable within the range of 0-1 mH for the virtual fundamental harmonic inductance Lv_f. The design of the fundamental impedance parameters should first satisfy the stability requirements of the system. Figure 10 shows the root locus plot with varying parameters of the virtual fundamental inductance L v_f , where the parameters are varied in integer form. Figure 10a,b represent the root locus plots with L v_f ranging from 0 to 1 mH and 0 to 2 mH, respectively. Figure 10c,d is an enlarged view of the critical region (indicated by the red arrow) near the stability boundary, different colored points represent different root locus plot. The root locus of the open-loop transfer function depicts the distribution of poles on the s-plane. When there are poles in the right half of the s-plane, the system is unstable. The black arrow indicates the direction in which the root locus changes. From Figure 10a, it can be observed that the poles changing in the direction of the black arrows do not cross the right-half plane. Similarly, Figure 10c indicates that there are no poles crossing the right-half plane near the critical point. The root locus of L v_f within the parameter range of 0-1 mH does not cross the right half-plane, indicating system stability. On the other hand, from Figure 10b, it can be observed that the poles changing in the direction of the black arrows cross the right-half plane. Similarly, Figure 10d indicates that there are no poles crossing the right-half plane near the critical point. The root locus for L v_f ranging from 0 to 2 mH partially crosses the right half-plane, indicating system instability. Based on the above analysis, it can be concluded that the system remains stable within the range of 0-1 mH for the virtual fundamental harmonic inductance L v_f .  Figure 11 illustrates the root locus plot with varying parameters of the virtual third harmonic resistor Rv_3, where the parameters are varied in integer form. Figure 11a shows the overall trend of the root locus curves, while Figure 11b,c display the root locus diagrams for Rv_3 within the ranges of 0-60 Ω and 0-65 Ω, respectively. The red arrow-indicated regions in Figure 11a are the magnified root locus curves. The black arrow indicates the direction in which the root locus changes. From Figure 11b, it can be observed that the poles changing in the direction of the black arrows do not cross the right-half plane. The root locus curves for Rv_3 within the parameter range of 0-60 Ω do not cross the right-half plane, indicating system stability. However, from Figure 11c, it can be observed that the poles changing in the direction of the black arrows cross the right-half plane. The root locus curves for Rv_3 within the range of 0-65 Ω cross the right-half plane, indicating system instability. Based on the above analysis, it can be concluded that the system remains stable within the range of 0-60 Ω for the virtual third harmonic resistor Rv_3.  Figure 11 illustrates the root locus plot with varying parameters of the virtual third harmonic resistor R v_3 , where the parameters are varied in integer form. Figure 11a shows the overall trend of the root locus curves, while Figure 11b,c display the root locus diagrams for R v_3 within the ranges of 0-60 Ω and 0-65 Ω, respectively. The red arrow-indicated regions in Figure 11a are the magnified root locus curves. The black arrow indicates the direction in which the root locus changes. From Figure 11b, it can be observed that the poles changing in the direction of the black arrows do not cross the right-half plane. The root locus curves for R v_3 within the parameter range of 0-60 Ω do not cross the right-half plane, indicating system stability. However, from Figure 11c, it can be observed that the poles changing in the direction of the black arrows cross the right-half plane. The root locus curves for R v_3 within the range of 0-65 Ω cross the right-half plane, indicating system instability. Based on the above analysis, it can be concluded that the system remains stable within the range of 0-60 Ω for the virtual third harmonic resistor R v_3 .  Figure 12 shows the root locus plot with varying parameters of the virtual fifth harmonic resistor Rv_5, where the parameters are varied in integer form. Figure 12a shows the overall trend of the root locus, while Figure 12b,c present the root locus diagrams for Rv_5 within the ranges of 0-85 Ω and 0-90 Ω, respectively. The red arrow in Figure 12a indicates the magnified view of the root locus. The black arrow indicates the direction in which the root locus changes. From Figure 12b, it can be observed that the poles changing in the direction of the black arrows do not cross the right-half plane. The root locus for Rv_5 in the parameter range of 0-85 Ω does not cross the right-half plane, indicating system stability. However, from Figure 12c, it can be seen that the poles changing in the direction of the black arrows cross the right-half plane. The root locus for Rv_5 in the range of 0-90 Ω partially crosses the right-half plane, indicating system instability. Based on the above analysis, it can be concluded that the system remains stable within the range of 0-85 Ω for the virtual fifth harmonic resistor Rv_5.  Figure 12 shows the root locus plot with varying parameters of the virtual fifth harmonic resistor R v_5 , where the parameters are varied in integer form. Figure 12a shows the overall trend of the root locus, while Figure 12b,c present the root locus diagrams for R v_5 within the ranges of 0-85 Ω and 0-90 Ω, respectively. The red arrow in Figure 12a indicates the magnified view of the root locus. The black arrow indicates the direction in which the root locus changes. From Figure 12b, it can be observed that the poles changing in the direction of the black arrows do not cross the right-half plane. The root locus for R v_5 in the parameter range of 0-85 Ω does not cross the right-half plane, indicating system stability. However, from Figure 12c, it can be seen that the poles changing in the direction of the black arrows cross the right-half plane. The root locus for R v_5 in the range of 0-90 Ω partially crosses the right-half plane, indicating system instability. Based on the above analysis, it can be concluded that the system remains stable within the range of 0-85 Ω for the virtual fifth harmonic resistor R v_5 .  Figure 13 illustrates the root locus plot with the virtual seventh harmonic resistor Rv_7 varying as parameters in integer form. Figure 13a represents the overall trend of the root locus, while Figure 13b,c display the root locus diagrams for Rv_7 within the ranges of 0-70 Ω and 0-75 Ω, respectively. The red arrow in Figure 13a indicates the magnified view of the root locus. The black arrow indicates the direction in which the root locus changes. From Figure 12b, it can be observed that the poles changing in the direction of the black arrows do not cross the right-half plane. The root locus for Rv_7 in the parameter range of 0-70 Ω does not cross the right-half plane, indicating system stability. However, from Figure 12c, it can be seen that the poles changing in the direction of the black arrows cross the right-half plane. The root locus for Rv_7 in the parameter range of 0-75 Ω partially crosses the right-half plane, indicating system instability. Based on the above analysis, it can be concluded that the system remains stable within the range of 0-70 Ω for the virtual seventh harmonic resistor Rv_7.
From the above analysis, we see that it is necessary to limit the virtual nth (n = 3,5,7) harmonic impedance to ensure system stability. The virtual fundamental virtual inductance is restricted to the range of 0-1 mH, and the virtual third, fifth, and seventh harmonic impedances are limited to 0-60 Ω, 0-85 Ω, and 0-70 Ω, respectively.
The open-loop transfer function expression shown in Equation (23) does not include the grid voltage; hence, the variation in grid harmonic content is irrelevant to system stability. This paper considers the stability analysis when there are slight changes in the line  Figure 13 illustrates the root locus plot with the virtual seventh harmonic resistor R v_7 varying as parameters in integer form. Figure 13a represents the overall trend of the root locus, while Figure 13b,c display the root locus diagrams for R v_7 within the ranges of 0-70 Ω and 0-75 Ω, respectively. The red arrow in Figure 13a indicates the magnified view of the root locus. The black arrow indicates the direction in which the root locus changes. From Figure 12b, it can be observed that the poles changing in the direction of the black arrows do not cross the right-half plane. The root locus for R v_7 in the parameter range of 0-70 Ω does not cross the right-half plane, indicating system stability. However, from Figure 12c, it can be seen that the poles changing in the direction of the black arrows cross the right-half plane. The root locus for R v_7 in the parameter range of 0-75 Ω partially crosses the right-half plane, indicating system instability. Based on the above analysis, it can be concluded that the system remains stable within the range of 0-70 Ω for the virtual seventh harmonic resistor R v_7 .
From the above analysis, we see that it is necessary to limit the virtual nth (n = 3, 5, 7) harmonic impedance to ensure system stability. The virtual fundamental virtual inductance is restricted to the range of 0-1 mH, and the virtual third, fifth, and seventh harmonic impedances are limited to 0-60 Ω, 0-85 Ω, and 0-70 Ω, respectively.
The open-loop transfer function expression shown in Equation (23) does not include the grid voltage; hence, the variation in grid harmonic content is irrelevant to system stability. This paper considers the stability analysis when there are slight changes in the line impedance. The virtual fundamental virtual inductance is set to 1 mH, and the virtual third, fifth, and seventh harmonic impedances are set to 60 Ω, 85 Ω, and 70 Ω, respectively. In the simulation and experimental parameters, the line inductance is 5 mH. Based on Equation (23), the Bode plot of the open-loop transfer function when the line inductance increases is shown in Figure 14. impedance. The virtual fundamental virtual inductance is set to 1 mH, and the virtual third, fifth, and seventh harmonic impedances are set to 60 Ω, 85 Ω, and 70 Ω, respectively. In the simulation and experimental parameters, the line inductance is 5 mH. Based on Equation (23), the Bode plot of the open-loop transfer function when the line inductance increases is shown in Figure 14. As can be seen from Figure 14, when Lg = 5 mH, the amplitude margin and phase angle margin are both positive, indicating that the system is stable at this time. When Lg is slightly reduced, the amplitude margin and phase angle margin are greater than 0, and the system remains stable. When Lg is slightly increased, the amplitude margin and phase angle margin are greater than 0, and the system remains stable. It can be seen that the system can maintain stability when the line impedance is slightly disturbed. The combination of an LC filter with the line impedance can form an LCL-type filter, which may introduce resonance peaks and potentially lead to system instability. This issue can be addressed by employing the active damping method through capacitor current feedback [30].

Simulation and Experimental Results
In this section, the effectiveness of the harmonic current suppression strategy based on the adaptive harmonic virtual resistance was validated through simulations and experimental results. The detailed system parameters are listed in Table 2.  As can be seen from Figure 14, when L g = 5 mH, the amplitude margin and phase angle margin are both positive, indicating that the system is stable at this time. When L g is slightly reduced, the amplitude margin and phase angle margin are greater than 0, and the system remains stable. When L g is slightly increased, the amplitude margin and phase angle margin are greater than 0, and the system remains stable. It can be seen that the system can maintain stability when the line impedance is slightly disturbed.
The combination of an LC filter with the line impedance can form an LCL-type filter, which may introduce resonance peaks and potentially lead to system instability. This issue can be addressed by employing the active damping method through capacitor current feedback [30].

Simulation and Experimental Results
In this section, the effectiveness of the harmonic current suppression strategy based on the adaptive harmonic virtual resistance was validated through simulations and experimental results. The detailed system parameters are listed in Table 2.

Simulation Results
To simulate the impact of the harmonic voltages on the grid current quality, third, fifth, and seventh harmonics were injected into the grid voltage using MATLAB/Simulink. Two operating conditions were designed. Condition 1 included a background harmonic with 8% of the third harmonic, 7% of the fifth harmonic, and 5% of the seventh harmonic. Condition 2 involved a change in the harmonic content of the grid voltage after 2 s, with 10% of the third harmonic, 8% of the fifth harmonic, and 7% of the seventh harmonic. The reference value of the third harmonic content is set to I 3% * = 2.0%, the reference value of the fifth harmonic content is set to I 5% * = 1.7%, and the reference value of the seventh harmonic content is set to I 7% * = 1.5%.
The voltage waveform under grid voltage distortion is shown in Figure 15. The grid current waveform and total harmonic distortion (THD) without the inclusion of the virtual harmonic impedance under distorted grid voltages are illustrated in Figure 16. The grid current waveform and total harmonic distortion with the inclusion of virtual harmonic impedance under Condition 1 and Condition 2 are shown in Figures 17 and 18, respectively. Based on the simulation results from Figures 16-18, the harmonic content and THD of the grid current under different scenarios are presented in Table 3.
fifth, and seventh harmonics were injected into the grid voltage using MATLAB/Simulink. Two operating conditions were designed. Condition 1 included a background harmonic with 8% of the third harmonic, 7% of the fifth harmonic, and 5% of the seventh harmonic. Condition 2 involved a change in the harmonic content of the grid voltage after 2 s, with 10% of the third harmonic, 8% of the fifth harmonic, and 7% of the seventh harmonic. The reference value of the third harmonic content is set to I3%* = 2.0%, the reference value of the fifth harmonic content is set to I5%* = 1.7%, and the reference value of the seventh harmonic content is set to I7%* = 1.5%.
The voltage waveform under grid voltage distortion is shown in Figure 15. The grid current waveform and total harmonic distortion (THD) without the inclusion of the virtual harmonic impedance under distorted grid voltages are illustrated in Figure 16. The grid current waveform and total harmonic distortion with the inclusion of virtual harmonic impedance under Condition 1 and Condition 2 are shown in Figure 17 and Figure  18, respectively. Based on the simulation results from Figures 16-18, the harmonic content and THD of the grid current under different scenarios are presented in Table 3.    Furthermore, Figure 15 shows that the presence of harmonics in the grid voltage leads to distortions in the grid current, significantly impacting the quality of the grid current and preventing it from meeting the grid standards. The comparison between Figures  16-18 reveals that the incorporation of an adaptive virtual harmonic resistor effectively   Furthermore, Figure 15 shows that the presence of harmonics in the grid voltage leads to distortions in the grid current, significantly impacting the quality of the grid current and preventing it from meeting the grid standards. The comparison between Figures  16-18 reveals that the incorporation of an adaptive virtual harmonic resistor effectively  Furthermore, Figure 15 shows that the presence of harmonics in the grid voltage leads to distortions in the grid current, significantly impacting the quality of the grid current and preventing it from meeting the grid standards. The comparison between Figures 16-18 reveals that the incorporation of an adaptive virtual harmonic resistor effectively reduces the THD of the grid-connected current and enhances the waveform quality. In Condition 1, as observed from the comparison of Figures 16 and 17, the introduction of an adaptive virtual resistor results in a significant reduction in the content of the third harmonic from 26.3% to 1.97%, the fifth harmonic from 14.2% to 1.61%, and the seventh harmonic from 6.8% to 1.43%. The levels of the third, fifth, and seventh harmonics are closely aligned with the set reference values of I 3% * = 2.0%, I 5% * = 1.7% and I 7% * = 1.5%, indicating a small margin of error. In the case of Condition 2, the third, fifth, and seventh harmonic contents are I 3% = 2.08%, I 5% = 1.74% and I 7% = 1.54%, respectively. These values exhibit minimal deviation from the set harmonic content reference values. The detailed comparison of grid current harmonic content and total harmonic distortion (THD) under different operating conditions is presented in Table 3. By comparing Figures 17 and 18, it can be observed that the adaptive harmonic virtual resistor can effectively improve the quality of the gridconnected current in the presence of increased background harmonics in the grid voltage.

Experimental Results
In this section, the effectiveness of the harmonic current suppression strategy based on the adaptive harmonic virtual resistors was further validated using the DSPACE SCALEXIO experimental platform (DSPACE, Paderborn, Germany). The parameters of each component in the system and the main parameters are consistent, as shown in Table 2. The experimental platform of the 1.5 kW single-phase voltage-source inverter is set up in this paper, as shown in Figure 19. A 14-bit analog-to-digital converter (ADC DS6221) (DSPACE) was used to sample the output voltage, inductance current and grid-connected current signals at a sampling frequency of 20 kHz. The I/O board (DS6202) (DSPACE) is configured as a PWM module with a switching frequency of 20 kHz. The voltage and current signals that need to be used in the control structure in the main circuit topology are collected by the ADC sampling module, and the sampled signals are sent to the DSPACE controller. PWM signal generated by DSPACE controller is used to control the single-phase voltage source grid-connected inverter. The output digital current and voltage signals are converted into analog signals by the DAC conversion module, and the output grid-connected current and current signal waveform are observed by oscilloscope (YOKOGAWA-DLM2024) (YOKO-GAWA, Tokyo, Japen). The THD of the grid-connected current under different conditions is presented in Table 4. To simulate the impact of the background harmonics on the quality of the grid-connected current, 8% of the third harmonic, 7% of the fifth harmonic, and 5% of the seventh harmonic were injected into the grid voltage.  Figure 20 illustrates the grid voltage and grid current waveforms without an adaptive virtual harmonic resistor in a full-load steady state. The grid current waveform exhibits significant distortion, and it does not comply with the grid requirements. In contrast, Figure 21 shows the grid voltage and grid current waveforms with the introduction of an adaptive virtual harmonic resistor during the transition from the full-load steady state to half-load steady state. The grid current waveform exhibits a higher sinusoidal content and better waveform quality. It can be concluded that the addition of an adaptive virtual harmonic resistor can suppress harmonic currents and improve the quality of the grid-connected current.   Figure 20 illustrates the grid voltage and grid current waveforms without an adaptive virtual harmonic resistor in a full-load steady state. The grid current waveform exhibits significant distortion, and it does not comply with the grid requirements. In contrast, Figure 21 shows the grid voltage and grid current waveforms with the introduction of an adaptive virtual harmonic resistor during the transition from the full-load steady state to half-load steady state. The grid current waveform exhibits a higher sinusoidal content and better waveform quality. It can be concluded that the addition of an adaptive virtual harmonic resistor can suppress harmonic currents and improve the quality of the gridconnected current.

Software Systems
Single Phase VSG Oscilloscopes Figure 19. Experimental platform. Figure 20 illustrates the grid voltage and grid current waveforms without an adaptive virtual harmonic resistor in a full-load steady state. The grid current waveform exhibits significant distortion, and it does not comply with the grid requirements. In contrast, Figure 21 shows the grid voltage and grid current waveforms with the introduction of an adaptive virtual harmonic resistor during the transition from the full-load steady state to half-load steady state. The grid current waveform exhibits a higher sinusoidal content and better waveform quality. It can be concluded that the addition of an adaptive virtual harmonic resistor can suppress harmonic currents and improve the quality of the grid-connected current.   Figure 20 illustrates the grid voltage and grid current waveforms without an adaptive virtual harmonic resistor in a full-load steady state. The grid current waveform exhibits significant distortion, and it does not comply with the grid requirements. In contrast, Figure 21 shows the grid voltage and grid current waveforms with the introduction of an adaptive virtual harmonic resistor during the transition from the full-load steady state to half-load steady state. The grid current waveform exhibits a higher sinusoidal content and better waveform quality. It can be concluded that the addition of an adaptive virtual harmonic resistor can suppress harmonic currents and improve the quality of the grid-connected current.    This experiment only separated the fundamental, third, fifth, and seventh harmo currents. Due to the lower content of higher-order harmonics and the increased compu tional effort required for their separation, harmonics above the seventh order were n separated. To further reduce harmonic content, it is necessary to isolate higher-order h monics, which also represents a limitation of this method. The conclusion section has be added.

Conclusions
In this paper, control strategies are investigated to improve the grid-connected c rents in single-phase grid-tied inverters operating in weak power grids. First, the mech nism of harmonic current generation is explained. Then, an inhibitory strategy usi adaptive virtual harmonic resistors is proposed, highlighting the implementation meth of adaptive virtual harmonic resistors. Stability analysis of the system is performed examining the root locus. Finally, the effectiveness of the proposed adaptive virtual h monic resistor strategy is validated through simulation and experimental results, demo strating an improvement in the grid-connected current quality.
However, when the proposed adaptive virtual impedance method is implement for high-order harmonic current compensation, the strategy needs to separate each h monic current and construct the adaptive virtual harmonic impedance, which increa the complexity of the system and the calculation burden of the control system. Therefo on the premise of meeting the quality of grid-connected current, this paper only carr out the impedance reshaping method on the low harmonic current to reduce the low h monic current content. How to further reduce the high harmonic current without sign cantly increasing the calculation amount will be a future research direction.
Author Contributions: C.Z.: conceptualization, formal analysis, investigation, methodology, fu ing acquisition, writing-original draft. Z.Z.: conceptualization, formal analysis, investigati methodology, writing-original draft, project administration, supervision. A.Z.: conceptualizati investigation, writing-original draft. B.L.: conceptualization, formal analysis, investigation, me odology, writing-editing, writing-review. All authors have read and agreed to the published v sion of the manuscript.  This experiment only separated the fundamental, third, fifth, and seventh harmonic currents. Due to the lower content of higher-order harmonics and the increased computational effort required for their separation, harmonics above the seventh order were not separated. To further reduce harmonic content, it is necessary to isolate higher-order harmonics, which also represents a limitation of this method. The conclusion section has been added.

Conclusions
In this paper, control strategies are investigated to improve the grid-connected currents in single-phase grid-tied inverters operating in weak power grids. First, the mechanism of harmonic current generation is explained. Then, an inhibitory strategy using adaptive virtual harmonic resistors is proposed, highlighting the implementation method of adaptive virtual harmonic resistors. Stability analysis of the system is performed by examining the root locus. Finally, the effectiveness of the proposed adaptive virtual harmonic resistor strategy is validated through simulation and experimental results, demonstrating an improvement in the grid-connected current quality.
However, when the proposed adaptive virtual impedance method is implemented for high-order harmonic current compensation, the strategy needs to separate each harmonic current and construct the adaptive virtual harmonic impedance, which increases the complexity of the system and the calculation burden of the control system. Therefore, on the premise of meeting the quality of grid-connected current, this paper only carries out the impedance reshaping method on the low harmonic current to reduce the low harmonic current content. How to further reduce the high harmonic current without significantly increasing the calculation amount will be a future research direction.

Data Availability Statement:
The data that support the findings of this study are available from the corresponding author upon reasonable request.