Adaptive Grid Impedance Shaping Approach Applied for Grid-Forming Power Converters

This paper proposes an adaptive grid impedance shaping approach, implemented through a variable structure virtual impedance control strategy (VS-VIS), to improve the power ﬂow control of grid-forming power converters (GF-PC). In this strategy, an equivalent grid impedance estimator (EGIE) evaluates the feeder X/R ratio to determine the required virtual impedance to reach the grid shaping objective. Besides, the virtual impedance deﬁnition also considers the converter power rating to ensure the system’s feasibility. A virtual negative resistance series interconnected with a positive virtual reactance implements the virtual impedance. Moreover, the required virtual impedance is only updated when the X/R ratio extrapolates deviation limits determined by allowed grid voltages boundaries speciﬁed by the standards. Besides, the virtual reactance is split into two parts that use the conventional and sliding mode (SMC) approaches. The ﬁrst implements the main part of required virtual reactance, while the second provides a ﬁne-tuning action matching the X/R control objectives and compensating grid impedance uncertainties. This grid-shaping method provides a smooth compensation increasing the GF-PC resilience under grid impedance variation. These features constitute a novelty compared to the shaping methods presented in the literature. Experimental tests obtained from a GF-PC laboratory setup demonstrate the effectiveness and robustness of the proposed grid impedance shaping method.


I. INTRODUCTION
The distributed generators (DGs) are interconnected to microgrids (MG) through active front-end converters, controlled to provide the required power-sharing under grid-connected or islanded operation modes. These converters operate as grid-forming power converters (GF-PC), providing voltage and frequency support to the networks. On the other hand, those inverters are controlled as voltage sources, parallel connected to the MG in islanded conditions. Both conditions demand active and reactive powers to afford suitable power-sharing and guarantee the required MG stability [1].
The associate editor coordinating the review of this manuscript and approving it for publication was Jiefeng Hu .
Ideally, each DG must operate independently without communication for practical and economic aspects.
The most common control strategy employed to fulfill the proper power flow regulation uses droop control approaches, mimicking the behavior of standard synchronous generators [1], [2]. Those control approaches require a feeder with an inductive profile, directly correlating the active power with the system frequency and reactive power with the system voltage. However, these conditions refer to medium or high voltage microgrids (i.e., high X /R ratio) [3]. On the other hand, low voltage microgrids depict line impedance with small X /R ratios, resulting in active and reactive power coupling conditions, which deteriorates the system's dynamic response and stability [4]. In this case, modified droop control methods associated with power decoupling approaches have 83096 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ VOLUME 10,2022 been proposed to improve the power-sharing accuracy of those networks [5].
Generally, the power decoupling approaches can be divided into two categories [6]: open-loop [6]- [12] or closed-loop [11], [13]- [18] power decoupling strategies (i.e., OL-PDS or CL-PDS, respectively). OL-PDS schemes are more straightforward to implement than the CL-PDS approaches and can be divided into virtual impedance decoupling strategies (VI-DS) [7]- [9], [11] and Q-V modified droop control (QV-MDC) [6], [10], [11]. The VI-DS incorporates a virtual impedance by inserting a feed-forward control scheme to reshape the DG output impedance to depict inductive or resistive characteristics, allowing it to independently control active and reactive powers. In this direction, the implementation of a virtual impedance composed of the series connection of negative resistance and inductance reshapes the equivalent impedance between a virtual power source (VPS) and the point of common coupling (PCC) [11], making it being inductive and permitting a suitable power-sharing. In general, VI-DS methods are based on the explicit recognition of the microgrid structure to provide accurate power-sharing, which is no longer valid when those structural changes [9], [19]. It is possible to mitigate these inaccuracies by estimating the DG equivalent impedance using the DG output currents, voltages, and feeder nameplate impedance, as proposed in [8]. However, it still has uncertainties due to possible parameter variations, which could be circumvented using an adaptive virtual impedance [8]. Consensus-based controllers could also adjust the virtual impedance adaptively, overcoming possible mismatches provoked by grid impedance variation [20]- [22]. However, this methodology utilizes many control loops, increasing the complexity of implementation and producing large values of the virtual impedance, resulting in undesired power quality issues.
Unlike the VI-DS methods, the QV-MDC approach improves the reactive power-sharing accuracy by using a voltage restoration mechanism without modifying the DG output impedance [6]. The main drawback of this control approach is the necessity of defining different set-points based on the DG characteristics, which could make the QV-MDC ineffective [10]. Therefore, a modified voltage restoration based on local information was proposed in [12] to overcome the set-point deviation. Nevertheless, despite QV-MDC being effective under an inductive profile, its performance degrades when the feeder equivalent impedance is complex. In this sense, a virtual complex impedance based on the P-V droop method applied for low-voltage microgrid powersharing, composed of a VI-DS and QV-MDC association, was proposed in [23]. This methodology employed an extra parameter to accelerate the dynamic regulation and active power-sharing.
The CL-PDS can be classified as follows: small-signal injection [13]- [16], PCC voltage detection [11], [18], load changing detection [15], impedance droop estimation [17], or virtual power source [11], [18]. The small-signal injection methods [16] employ an ac low-voltage signal added to the voltage reference to provoke a controlled disturbance at the PCC. This procedure can extract the required grid information but depicts a relatively complex implementation. PCC voltage detection approaches [13], [14] are unsuitable for practical applications since most DGs are installed dispersedly. The load change detection scheme can be implemented through signal processing approaches like wavelet transform as proposed in [15], [24], but its use in closed-loop control schemes is inappropriate. The impedance droop estimation permits the local loads compensation, providing suitable power-sharing in grid-connected and islanded modes [17]. However, its accuracy depends on the system operating condition, which can be essential. The virtual power source control scheme decouples the active and reactive powers by rotating the reference frame by the impedance phase angle [11]. However, this method fails in sharing the actual power when the distribution line impedance of each DG is different. This drawback could be mitigated if the rotation is implemented through an optimal angle obtained from system stability analysis [18]. Nevertheless, non-identical frequency in the DGs power converters could occur, resulting in asynchronous controller operation, leading to instability issues.
Most of the grid-shaping methods presented in the literature depend on the knowledge of grid impedance parameters, making them ineffective under uncertainties caused by grid impedance variations. They generally employ compensation mechanisms that provide grid-shaping actions inside an expected grid parameters range. Besides, they use virtual reactive components to achieve the X/R control objective, and their implementation can cause voltage oscillations under abrupt grid impedance variations.
This paper proposes an adaptive grid shaping approach, implemented through a variable structure virtual impedance strategy (VS-VIS), to improve the power flow regulation of GF-PC under uncertainties caused by grid impedance variations. In this method, an equivalent grid impedance estimator (EGIE) evaluates the feeder X/R ratio to determine the required virtual impedance profile and components to reach the grid shaping objective. Besides, the chosen virtual impedance also considers the converter power rating to ensure the system's feasibility. This work employs a series association of virtual negative resistance with a positive virtual reactance, in which their values consider the network damping condition and the required X/R control objective. Unlike the implementation of virtual resistance, the insertion of reactive elements causes oscillations in the GF-PC terminal voltages. Because of this, the proposed methodology employs an updating scheme to define the value of reactance that will be implemented. Thus, despite the continuous EGIE estimation, the value of virtual reactance that will be employed is only updated when X/R extrapolates deviations thresholds imposed by the allowed power grid voltage boundaries specified by the standards. This procedure introduces an X/R dead zone, where grid impedance variation occurrences do not update the value of virtual reactance. For that reason, the VOLUME 10, 2022 implementation of the required virtual reactance is split into two parts that use both a conventional and a sliding mode (SMC) [25] approaches. The first is responsible for compensating most of the required virtual reactance, and the second provides a fine-tuning action matching the control objectives and compensating uncertainties inside the X /R dead-zone. This grid-shaping approach provides a smooth compensation increasing the GF-PC resilience under grid impedance variation. These features comprise a novelty compared to the grid-shaping methods presented in the literature. Experimental tests are obtained from a GF-PC laboratory setup, operating under different operational conditions, demonstrating the effectiveness and robustness of the proposed grid shaping method.
The rest of this paper is organized as follows. First, section II describes the proposed system, modeling, and control strategies employed in the proposed GF-PC. Next, section III deals with the adaptive grid impedance shaping approach, based on variable structure virtual impedance strategy and the system stability analysis. Then, in section IV, experimental results obtained from a GF-PC functioning under different operational scenarios demonstrate de feasibility of the proposed method. Finally, Section V the conclusions on the contributions of the paper. Fig. 1 depicts the configuration of the laboratory setup employed to evaluate the proposed adaptive grid shaping strategy. It comprises a GF-PC, interconnected to the PCC through a line transmission emulated by a three-phase RL branch (z s = r s + jωl s ). In addition, a three-phase RL load (z l = r l + jωl l ), with configurable parameters, is also interconnected to the PCC to evaluate the system's performance with load change. Furthermore, the controlled switch S w1 connects a three-phase resistive load (r lext ) with the RL load, which can provoke a controlled load change. Also, external resistors (r ext ) are used to modify the grid impedance parameters through the controlled switch S w2 . Besides, a power grid emulator (PGE) commanded by a digital real-time simulator (DRTS) implements the power grid. The implementation of the GF-PC comprises a voltage source converter interconnected to the PCC through an LC filter, controlled by the voltage regulator and synchronous power controller, according to Fig. 1. In addition, the proposed adaptive grid impedance shaping approach comprises an equivalent grid impedance estimator, decision logic system, and variable structure virtual impedance system, represented by blocks EGIE, DLS, and VS-VIS in Fig. 1. Finally, a dSPACE fast prototyping system executes both algorithms of the GF-PC control system and the adaptive grid shaping approach. The modeling and control approaches used in the proposed method are detailed below.

A. VOLTAGE CONTROL STRATEGY
The voltage control strategy employs a cascaded regulator approach in which the inner loop controls the LC filter input current, and the outer loop controls the GF-PC output voltage (i.e., blocks R i (s) and R v (s) in Fig. 1). In this approach, the inner loop employs a simple proportional controller (P), while a proportional-resonant regulator (PR), tuned at the fundamental frequency, implements the outer loop [26].
The implementation and design of the voltage regulator follow the pole placements and tracking objectives as proposed in [27], which can be described by the following control laws where Q m (s) is the internal model of reference voltages v * gαβ (s), P(s) and L(s) are polynomials, with L(s) being monic.
The choice of Q m (s) must satisfy Q m (s)v * gαβ (s) = 0, resulting in the following controller transfer function The voltage-current transfer function of the LC filter on the stationary reference frame can be described as Considering that the transfer function of (3), and the implementation of the voltage control algorithm on the stationary reference frame, the choice of the controller polynomials are Q m (s) = s 2 +ω 2 g , L(s) = 1 and P(s) = a 2 s 2 +a 1 s+a o , which results in the following transfer function [27] R v (s) = a 2 s 2 + a 1 s + a 0 where a 2 , a 1 , and a 0 are the controller gains, and ω g is the nominal frequency of the power grid. The use of the proposed voltage regulator determines the following characteristic polynomial for the GF-PC output voltage Based on this approach, the suitable closed-loop poles of GF-PC voltage control loop can be assigned to those of the Hurwitz polynomial A * v (s), expressed by where ξ v and ω nv are the design damping ratio, and natural frequency of the standard second-order system and −κξ v ω nv is the position of a non-dominant pole. The polynomial of (6) can be rewritten as in which λ * nv . By solving the Diophantine equation for the Hurwitz polynomial A * v (s), the gains of the voltage controller can be determined as 83098 VOLUME 10, 2022 FIGURE 1. Block diagram of the GF-PC laboratory setup including; power grid, testing setup, GF-PC control system, and adaptive grid-shaping approach.
When a P controller regulates the LC input currents, the GF-PC output voltages (v gαβ (s)) can be expressed in terms of i * gαβ (s) as [26] v gαβ (s) = k pi c g l g s 2 + c g (r g + k pi )s where c g , l g , and r g are the parameters of the LC filter depicted in Fig. 1, and k pi is the proportional gain of the current regulator. From (9), the damping factor and natural frequency can be given by ξ i = c g (r g + k pi )/(2 c g l g ) and ω ni = 1/(c g l g ), respectively. The LC filter determines the natural frequency, while the gain k pi can be used to adjust the required system damping. Better damping conditions can be achieved with a higher k pi value, which increases the system phase shift [26]. Because of this, an interactive tuning procedure is employed to achieve the control objectives. In this method, the definition of the desired characteristic polynomial A * v (s) accomplishes the compensation of the phase shift of the current control loop at the operating frequency [26].

B. ACTIVE AND REACTIVE POWER CONTROL LOOPS
The implementation of the proposed grid-forming converter's active and reactive power control strategies follows the synchronous power controller (SPC) proposed in [28], according to the block diagram in Fig. 1. The SPC control strategy regulates the delivered active and reactive powers by adjusting the amplitude and the phase angle of GF-PC output voltage, similar to the synchronous generator. Moreover, the SPC employs a virtual impedance approach to achieve the required X /R ratio with an inductive profile.
Conventionally, the exchange of active and reactive power that occurred between two voltage sources, v g and v s , can be written as where V g and V s are the root-mean-square (RMS) of instantaneous voltages of the grid-forming converter v g , and the power grid v s , Z φ s is the interconnection impedance, and θ g is the phase angle between v g and v s . When the interconnection impedance has an inductive profile with a small value of θ g , (10) and (11) become where , and X s is the reactance related to Z s . Figs. 2(a) and 2(b) present the block diagrams of the linear model of the active and reactive power control loops. In this diagram, firstorder low-pass filters (LPF) with cutoff frequency ω f are employed in the system power measurements, and controllers R p (s) and R q (s) regulate the active and reactive powers.

1) ACTIVE POWER CONTROL LOOP
The active power control loop employs a configurable natural droop regulator (CNDR) proposed in [28], implemented based on a standard proportional-integral (PI) controller, with the inclusion of a parallel branch for providing the system P − f droop slope. The transfer function of the CNDR controller is given by where k pp , k ip , and k gp are the controller gains, with k gp being used to configure the system P − f droop behavior. Substituting the CNDR controller in Fig. 2(a) by using Eq. (14), the resulting closed-loop transfer function can be expressed as in which the damping coefficient ξ p and natural frequency ω np are given by The pole inserted by LPF used in power measurements can be considered as non-dominant due to the conventional criteria for setting its cutoff frequency ω f [29]; for that reason, it is neglected in Eq. (15).
The P − f droop response for the active power control loop can also be obtained from the analysis of the dynamic model depicted in Fig. 2(a) and can be expressed as in which the steady-state value of (18) depicts the controller the P − f droop slope that is given by where the ω g is the nominal angular speed of the power grid and S r is the nominal power of the grid-forming converter. Different design criteria can be employed to set up the CNDR's controller gains to perform the system's required dynamic behavior. According to [28], the integral gain k ip can be determined in terms of suitable inertia needed for application as given where H is inertia constant. Since (20) has given the criterion to determine k ip , the droop slope will only be determined by k gp once k ip has been fixed (i.e., according to Eq. (19)). Then the criterion to determine k gp can be expressed as Finally, the proportional gain k pp can be defined by substituting (20) and (21) in (16), which results in The control parameters k pp , k ip , and k gp , can be set up according to the input of D p , H , and ξ p . Thus, a suitable design procedure can be performed if the link between the controller gains and the characteristic parameters has been established.

2) REACTIVE POWER CONTROL LOOP
A proportional-integral (PI) controller is employed in the reactive power control loop to properly adjust the grid-forming output voltage [30]. Different from the conventional droop, an integral controller is adopted for assuring the zero steady-state reactive power tracking in grid-tied operation. Furthermore, when the grid-forming operates under islanding conditions, the integral gain of the PI controller should be fixed to zero [30].
The closed-loop transfer function of the reactive power can be obtained from Fig. 2(b), substituting in R q (s) block the standard PI controller transfer function, which results in in which, the damping coefficient ξ q and ω np are given by where k pq and k iq are the controller gains. Unlike the active power control strategy, the LPF used in the power measurements is considered in the reactive power control loop modeling. Its insertion provides more freedom degrees to set up the PI controller parameters to achieve suitable transient and steady-state performance [31]. 83100 VOLUME 10, 2022 In summary, the PI controller operates as a droop + integral controller, in which the proportional gain (k pq ) configures the Q − V droop slope, and the integral part (k iq /s) mitigates the steady-state error for grid-connected operation [32]. First, the network standards associated with the power converter characteristics are used to determine the suitable droop coefficient k pq . Then, the integral gain k iq can be defined considering the required transient and steady-state performance and the LPF filter cutoff frequency ω f .

III. ADAPTIVE GRID IMPEDANCE SHAPING APPROACH
The synchronous power control (SPC) control employed in this work requires a feeder impedance with an inductive profile to provide its main features. Because of this, an adaptive virtual impedance shaping approach is proposed based on a variable structure virtual impedance strategy (VS-VIS). Its implementation comprises the following modules: • Equivalent grid impedance estimator, • Decision logic system, and • Variable structure virtual impedance strategy. These modules are implemented by the blocks EGIE, DLS, and VS-VIS in Figs. 1. Their functionalities and how their integration adaptively shapes the system's equivalent grid impedance with the required X/R ratio to perform an inductive profile are described next.

A. EQUIVALENT GRID IMPEDANCE ESTIMATION -EGIE
The standard power flow equations estimate the feeder equivalent impedance when PCC voltage and power parameters are known. However, GF-PC control strategies only employ output voltage and power information to provide the required power flow control, making it impossible to estimate the PCC equivalent impedance. Nonetheless, the insertion of PCC current sensors (i.e., PCC current sensors i oαβ in Fig. 1) can provide the required power information, enabling the PCC equivalent impedance estimation [8]. Although, this calculation procedure does not include the virtual impedance insertion. For that reason, in this work, the reference voltages of GF-PC's control system (v * gαβ ) are also included for providing the required equivalent impedance estimation with the virtual impedance implementation. To achieve this required estimation procedure considers that the system's overall power, composed of local measurements and control set-points, can be calculated as follows where P c and Q c are the GF-PC's overall power, δv cαβ = v * gαβ − v gαβ is the voltage difference between the reference and GF-PC output voltages, and i oαβ is the PCC current measurement. Low-pass filters mitigate the switching frequency in the P c and Q c power calculations. Considering that the system is symmetrical and balanced, the module of their equivalent impedance can be estimated by where V * gαβ and I oαβ are the root-mean-square (RMS) values of the GF-PC reference voltages (v * gαβ ) and PCC currents (i oαβ ) respectively. The resistance and reactance components of the equivalent impedance ( z e ) refer to its real and imaginary parts that can be determined as where S c = P 2 c + Q 2 c is the apparent power related to the system equivalent impedance.
The block EGIE in Fig. 1 estimates z e by using the Eqs. (26)- (29). Then, it is decomposed into resistive and inductive parts ( r e and x e ), allowing the evaluation of the X/R feeder ratio. This procedure is only suitable for gridconnected operations. When the GF-PC operates on islanded conditions, the grid impedance approach is disabled.

B. DECISION LOGIC SYSTEM -DLS
The decision logic scheme (Block DLS in Fig. 1) defines the virtual impedance profile and its components values to reach the desired X /R ratio based on the grid impedance estimation ( z e = r e + j x e ) and converter power availability. The virtual impedance implementation employs an RL branch composed of a virtual negative resistance, which is series connected with a virtual inductance. The value of virtual resistance is determined by using a reduction factor γ , given as follows where γ is constrained in 0 ≤ γ ≤ 1. The maximum value of γ can be determined considering the suitable damping condition of the network that interconnects the application. The value of the virtual inductive reactance is calculated as a function of r * v and the desired X /R ratio (specified by the parameter xr * ), which can be expressed as considering the condition xr * ≥ 10 for guaranteeing the power decoupling, from the analysis of (10) and (11), considering X s = 10R s , which results in the approximation depicted by (12) and (13).
The maximum value of the virtual reactance is restricted to the power availability of the grid-connected power converter to assure the feasibility of the grid shaping procedure, which is given by where P g is the converter power delivery, and V g is the RMS value of the power grid nominal voltage. Therefore, to guarantee the feasibility of the proposed grid shaping approach, the virtual reactance must be restricted to x * v < x va . The DLS also employs an updating mechanism to mitigate transients during the virtual reactance implementation. In this procedure, the estimates r e (t) and x e (t) as well as the virtual reactance setpoint x * v (t) of two subsequent sampling times (t k−1 and t k ) are stored. The estimations of grid impedance components are employed to evaluate the X /R deviation, which can be calculated as follows This deviation is compared with the maximum allowed X /R variation defined as where µ is a constant restricted in 0 ≤ µ ≤ 1. The value of xr max must be chosen based on the allowed PCC voltage variation, considering the standard specifications [33]. The value of x v that must be implemented to reach the desired X /R can be defined as where x * v (t k−1 ) and x * v (t k ) are the virtual reactance setpoints determined according to (31) for the sampling times t k−1 and t k , stored previously.
This procedure generates a dead zone delimited by ( x e / r e )(t k ) − xr max and ( x e / r e )(t k ) + xr max , in which X /R variations inside this interval do not update the value of reactance to be implemented. Inside this dead zone, a finetuning procedure based on a non-linear control approach is employed to match the required X /R for promoting the PQ decoupling. Besides, this mechanism avoids transients provoked by abrupt virtual impedance control actions to compensate for sudden grid impedance deviations.

C. VARIABLE STRUCTURE VIRTUAL IMPEDANCE STRATEGY -VS-VIS
The grid impedance shaping scheme is based on a VS-VIS composed of the association of a standard linear approach and a sliding-mode control (SMC) strategy developed from the methodology proposed in [25]. In this scheme, the virtual resistance r * v implementation employs a linear approach while the virtual reactance x v uses a variable structure composed of linear and SMC techniques, in which x v is decomposed into two parts, given by where x v is implemented using a linear approach and x v employs an SMC scheme. The definition of µ is based on the expected grid impedance deviation, which results in x v > x v , making x v dominant to match the X /R control objectives. Therefore, x v provides the major part of the required reactance, and x v produces a fine-tuning action inside the dead zone depicted by (35) by using the SMC main features for compensating unmodeled disturbances [25].

1) SLIDING-MODE VIRTUAL IMPEDANCE APPROACH
The sliding mode methodology employed for implementing the virtual impedance x v . According to the block diagram of Fig. 2, the relationship between the reactive power (Q g ) and the voltage deviation ( v g ) can be established as follows where ω f is the cutoff frequency of the low-pass filter employed in the GF-PC power measurement. Defining the state-variable x 1 = Q * g − Q g , with x 2 = · x 1 , and introducing a control input u eq , the state-space system related to the sliding mode virtual impedance (SM-VI), can be derived from Eq. (38), which results in with u eq given by: where β 0 = x v + x v0 , in which x v0 > 0 is the initial value of reactance that assures the required reaching time to the sliding surface, LPF(·) is a first-order low-pass filter used to mitigate the SMC chattering, and sgn(·) is a signum function that is defined as follows and σ is the sliding manifold given by where a is the SMC controller gain. The value of x v to assure the SM-VI stability and guaranteeing the required reactive power-sharing must satisfy the following inequality The analysis of Eq. (43) is effectuated by considering the inequality upper bound addresses the following simplification where Q v is the amount of reactive power required to provide the fine-tuning inside the dead zone defined in (35). Admitting that the system is under convergence 83102 VOLUME 10, 2022 (i.e., |σ | = 0), the trajectories must reach the sliding manifold in the finite time determined by where |σ (0)| is the upper bound of the system's initial condition. Therefore, the suitable value of x v0 is designed to compensate for the bounded disturbance of grid impedance (i.e., estimated as xr max ), and SMC controller gain a is responsible for determining the sliding surface reaching time t r .

D. IMPLEMENTATION OF ADAPTIVE GRID IMPEDANCE SHAPING APPROACH
The implementation of the proposed adaptive grid shaping approach is depicted in Fig. 3, in which the following steps summarize the main control actions: 1) The module EGIE estimates r e and x e , in real-time, using (26)- (29). 2) Given the estimates r e and x e , the DLS calculates r * v and x * v using (30) and (31), based on the setups γ and xr * , suitable to perform the desired X /R ratio of the grid feeder.

3) Then, DLS evaluates if the implementation of x *
v is feasible considering the GF-PC power availability defined by x * v < x va , in which x va is defined by (32).

4) The SAT block in the DLS module limits the maximum
values of x * v in x va when the condition x * v < x va is infringed. 5) The estimates r e (t) and x e (t) as well as the virtual reactance setpoint x * v (t) of two subsequent sampling times (t k−1 and t k ) are stored, and the feeder X/R deviation is evaluated using (33). 6) The UMS compares xr(t k ) with the maximum allowed X /R variation xr max that is defined in (34) and implements the updating rule depicted in (35) to define x v , using the stored values of x * v (t) in samples t k−1 and t k . 7) According to (36) and (37), the VS-VIS decomposes x v into two parts, resulting in x v and x v . 8) Virtual impedance components r v and x v are implemented using the standard linear approach according to the block diagram in Fig. 3 to synthesize the major part of the virtual impedance required to reach the X /R control objectives. 9) Simultaneously with step 8, the x v is implemented through the SMC approach (40) and added to r v + jx v to reach the X /R control objectives that provided the required PQ decoupling. The steps above depict the algorithm to execute the control actions required to implement the proposed adaptive grid shaping strategy. They comprise simple mathematical and logical operations, significantly reducing implementation complexity and computational burden.

E. IMPEDANCE-BASED STABILITY ANALYSIS
The impedance-based analysis follows the methodology proposed in [34], [35], in which the Nyquist stability criterion is applied to the minor loop gain defined by the internal impedance ratio between the GF-PC and the PCC (i.e., Z g (s)/Z s (s)), similarly to the loop gain of the feedback control system [35]. Fig. 4(a) and 4(b) present the equivalent circuit of the interconnection of the GF-PC (represented by the voltage source v * g series connected with Z g ) with the PCC (represented by the load Z s ) and the block diagram of the feedback control system, respectively.
According to the Nyquist theory, the stability criterion requires that the number of the counterclockwise encirclement of open-loop transfer function locus to the point −1 + j0 must be equal to the number of the right-half-plane (RHP) poles of the minor loop gain. Also, Middlebrook [36] reported a sufficient but more than necessary condition for the system stability that Z g (s)/Z s (s) 1. According to the Fig. 1, the dynamic behavior of GF-PC output voltage can be described as follows where G v (s) is the closed-loop transfer function of the GF-PC output voltage, and Z g (s) is the GF-PC output impedance. The VOLUME 10, 2022 transfer function G v (s), considering the controller R v (s) in (4), is given by in which Z g (s) without the virtual impedance implementation is expressed as When the virtual impedance is implemented, the original reference voltage V * gαβ (s) is modified by the following a droop function where Z v (s) is the virtual impedance to be implemented.
with z 3 = a 2 l vt , z 2 = a 2 r v + a 1 l vt + 1, z 1 = a 1 r v + a 0 l vt , and z 0 = a 0 r v + ω 2 g , where a 2 , a 1 , and a 0 are the gains of the controller R v (s) according to (4); r v , and l vt are the values of virtual resistance and virtual inductance.
The value of l vt is associated with the virtual reactance (i.e., l vt = x vt /ω g ) composed of two parcels (x vt = x v + x v ), defined using (36) and (37). The implementation of the SMC virtual impedance employs the control law of (40), implemented using a relay that switches between ±β 0 = x v + x v0 , commanded by the signum function sgn(·) defined in (41). In addition, a first-order low-pass filter mitigates the SMC chattering, resulting in the control input u eq .
It is necessary to obtain the minor loop gain defined by the impedance ratio Z g (s)/Z s (s) to apply the Nyquist impedance-based stability to the proposed GF-PC. Considering that the output impedance of the PCC is Z s (s) = r s + jl s , the impedance ratio Z g (s)/Z s (s) can be expressed as where w 4 = l s c g , w 3 = r s [c g + l s (w 2 g c g + a 2 )], w 2 = r s l s a 1 + w 2 g c g + a 2 , w 1 = r s (a 1 + l s a 0 ), and w 0 = r s a 0 . The transfer function (51) keeps the same numerator of (50) but presents a characteristic polynomial with an increased order due to the PCC output impedance insertion.
The impedance-based analysis uses the following operational scenarios: (i) Compensation of grid resistance increasing, and (ii) Compensation of grid inductance reduction.
The R v (s) controller gains employed in both operational scenarios follow the design methodology of Section II-A, while the grid-shaping approach is configured to reach X /R = 10. Besides, the maximum values of the SMC switching function (i.e., ±β 0 = x v + x v0 ) are used to increase its implementation severity. Therefore, two polar plots related to +β 0 and −β 0 are presented in each study.

1) SCENARIO 1 -COMPENSATION OF GRID RESISTANCE
INCREASING WITH X /R = 10 Fig. 5 presents the polar plot of Nyquist analysis of the minor loop gain of Scenario 1, in which the grid resistance is increased from r s = 0.4 to r s = 0.8 , keeping the grid inductance in l s = 3.6 mH. As a result, the grid reactance is x s ≈ 1.31 , considering the network nominal f g = 50 Hz, corresponding to X /R ≈ 1.635. According to grid-shaping design criteria, the equivalent resistance must be reduced by 50%, resulting in r v = −0.4 . Therefore, it is necessary a virtual reactance of x v ≈ 2.69 (i.e., l v = 8.6 mH) to reach X /R = 10. According to the proposed methodology, the value of x v is decomposed into x v ≈ 2.152 and x v = 0.538 , respectively.
The insertion of the SMC behavior in the Nyquist analysis is performed using x vt = x v ± x v , in which x v ≈ 0.726 for accomplishing the insertion of the initial value x v0 . These two conditions are more severe than the SMC implementation since its output u eq corresponds to x v average value due to the use of the LPF filter in the SMC control law (40).
Analyzing the two polar plots of Fig. 5, described by the red and blue lines (i.e., x v,max and x v,min in Fig. 5), it is possible to observe that both graphs do not encircle the point −1 + j0, which guarantees the system stability for these operational conditions.

2) SCENARIO 2 -COMPENSATION OF GRID INDUCTANCE REDUCTION WITH X /R = 10
In this case, the grid resistance returns to r s = 0.4 (standard value), and the grid inductance is reduced from l s = 3.6 mH to l s = 2.4 mH, reaching the X /R ≈ 1.885. The required virtual reactance to achieve the control objective X /R = 10 is x vt ≈ 1.246 (i.e., which corresponds to l vt ≈ 4 mH for f g = 50 Hz.). Similar to the previous study, the virtual reactances is split into x v = 0.996 and x v = 0.242 , and the reactances 83104 VOLUME 10, 2022 employed in the stability study are defined as Fig. 6 depicts the polar plots of the Nyquist stability analysis related to this operational scenario. Like the previous study, the two polar plots do not encircle the point −1 + j0, ensuring the system stability through the compensation of grid reactance reduction.
Finally, the Nyquist stability studies demonstrated that the design criteria adopted to set up the gains of the voltage regulator, associated with the design criteria applied for the proposed grid-shaping approach, assure the stability of the proposed method up to the physical limits of the power converter.

IV. EXPERIMENTAL RESULTS
The validation of the proposed control strategy employs a GF-PC laboratory setup implemented according to the block diagram depicted in Fig. 1. Table 1 presents the system parameters. A fast prototyping system, dSPACE1202, executes the control system and the adaptive grid impedance shaping algorithms, with a sampling rate of T s = 100 µs. Using antialiasing filters with a cutoff frequency of F c = 2.5 kHz, Hall-effect sensors provide the system voltage and current measurements. This control scheme uses two sets of current sensors to estimate the required grid impedance (i.e., one set for measuring the LC filter inductors currents and another for the GF-PC output currents). The second set can be substituted by a simple estimation scheme based on the LC filter model and output voltage measurements. The proposed method was tested in the following scenarios: • System operation without grid shaping system, • Operation with adaptive grid impedance shaping, • Step variations of virtual resistance and reactance. • Compensation for grid impedance variation, and • Operation under PCC load variation.   Figs. 8(a)-8(e) present the experimental results related to the system startup procedure. First, the GF-PC is synchronized to the power grid with reference powers of P * g = 70 W and Q * g = 100 VAr. Then, when the system reaches the steady-state VOLUME 10, 2022 condition, active and reactive power steps of P g = 830 W and Q g = 200 VAr are added to the P * g and Q * g setpoints at t ≈ 2.3 s and t ≈ 6.8 s, respectively. Figs. 8(a) and 8(b) present the controlled active and reactive power graphs during the startup procedure. These figures also present PCC voltage snapshots during the active and reactive power steps.
In this experiment, the block EGIE initiates the estimation the equivalent grid impedance simultaneously with the synchronization process, but their values are only used when the GF-PC delivers active power. Figs. 8(c) and 8(d) present the system equivalent resistance r e and reactance x e estimations. Without the grid shaping implementation, the equivalent system impedance depicts the average values of r e = 0.38 and x e = 1.4 . Fig. 8(f) presents the X /R system ratio obtained from the grid impedance estimation corresponding to a power coupling condition, with x e / r e ≈ 3.5. This ratio increases when the control system implements a reactive power step but keeps a similar coupling condition. The coupling condition produces overshoots when the active and reactive power steps are implemented, as demonstrated in Figs. 8(a) and 8(b).

B. OPERATION WITH ADAPTIVE GRID IMPEDANCE SHAPING
Figs. 9(a)-9(f) show the experimental results of the proposed adaptive impedance shaping approach. After the beginning of active power injection, both conventional and SMC techniques implement the virtual impedance strategy with the adaptation technique depicted in Fig. 3. Figs. 9(a) and 9(b) illustrate the experimental results of the controlled active and reactive powers under the same conditions as the previous experiment. The overshoot occurrences due to the power step insertions are reduced compared with the test realized before, denoting the effectiveness of the proposed adaptive grid impedance shaping method.
Figs. 9(c) and 9(d) show the equivalent resistance and reactance obtained with the grid shaping procedure, which average values are r v ≈ 0.18 and x v ≈ 2 , respectively. In this experiment, the X/R reference value of xr * ≈ 14 is adopted. As a result, the implemented virtual impedance depicts an estimated x e / r e of approximately 13.8, as shown in Fig. 9(e). Furthermore, unlike the test before, with the implementation of the grid impedance shaping approach, the increase of system reactance is not verified during the reactive power step implementation. Finally, Fig. 9(f) presents the SMC virtual reactance x v superimposed by its average value, in which the amplitude of the switching function is fixed β 0 = 0.4 for attending to the constraints of the stability condition (44) and reaching time (45).

C. STEP VARIATION OF VIRTUAL RESISTANCE AND SMC REACTANCE
Figs. 10(a) and 10(d) show the experimental results of the proposed VS-VIS using the virtual impedance components introduced separately. In this experiment, the system starts up without the virtual impedance and grid estimation schemes. Then, when the GF-PC starts delivering active power, both methods are implemented. During the startup procedure, the average values of the grid equivalent resistance, reactance, and X /R ratio are r e ≈ 0.32 , x e ≈ 1.4 , and x e / r e ≈ 4.4, respectively. At t ≈ 3.2 s, the VS-AVI inserts the fixed virtual reactance of x v = 0.8 and the SMC reactance with switching function amplitude of β 0 = 0.4 , as depicted in Figs. 10(b) and 10(d). The system X /R ratio increases from 4.1 to approximately 6.2, as presented in Fig. 10(c). Besides, a transient in the equivalent grid resistance estimation r e is observed, as shown in Fig. 10(a). At t ≈ 6.9 s, the virtual resistance of r v = −0.2 is implemented, reducing the grid equivalent value to r e ≈ 0.14 , as shown in Fig. 10(a), increasing the system X /R ratio from 6.2 to approximately 14.2. Fig. 10(d) shows the SMC reactance implementation superimposed by its average value. 83106 VOLUME 10, 2022 These graphs demonstrate VS-VIS actuation to assure the X /R control objectives during the resistance and reactance variations. However, it is crucial to observe that the insertion of x v results in an overshoot in r e that can affect the GF-PC power delivery. On the contrary, inserting a step variation of r v does not provoke overshoot in the system's equivalent reactance. For that reason, an updating mechanism is employed in the proposed VS-VIS to avoid undesired transients caused by sudden virtual reactance modification.

D. COMPENSATION FOR GRID IMPEDANCE VARIATION
In this experiment, the performance of the grid impedance shaping approach under grid impedance variation is evaluated. The controlled switch S w1 is opened to interconnect external resistors (r ext ) with the PCC feeder impedance (z s = rs s + jx s ), according to Fig. 1, to provoke an X /R deviation inside the UMS dead-zone. The feeder impedance is composed of r s = 0.4 and l s = 3.6 mH (see Table 1), which leads to X /R ≈ 2.827 for the nominal frequency of 50 Hz. Figs. 11(a) presents the experimental results for the controlled active and reactive powers in their respective setpoints P * g = 900 W and Q * g = 300 Var. The VS-VIS implements a virtual impedance composed of r v ≈ −0.13 and x v ≈ 1.569 for reaching r e ≈ 0.27 and x e ≈ 2.7 , leading to X /R ≈ 10 according to Figs. 11(b)-11(d).
At t ≈ 3 s, the switch S w1 interconnects r ext , increasing the equivalent resistance to approximately 0.31 , as shown in Fig. 11(b), which results in X /R ≈ 8.71, corresponding to VOLUME 10, 2022 a deviation of | xr(t k )| ≈ 1.29, according to Fig. 11(d). The maximum X /R deviation is fixed in xr max ≈ 1.5, which means that the UMS will not update the virtual reactance x v . As a result, the SMC virtual reactance approach increases the average values of x σ (i.e., x σ = β 0 sgn(σ ), the SMC switching control law of u eq in the Eq. (40) to reach the desired X /R = 10, as it can be verified in Figs 11(c)-11(e). These experimental results demonstrate that the proposed SMC virtual impedance can compensate for mismatches provoked by grid impedance variations inside the X /R dead zone.

E. OPERATION UNDER LOAD VARIATION
This test evaluates the performance of the grid impedance shaping scheme under load variation, which can indirectly cause grid impedance ranges, affecting power flow control schemes. An RL three-phase load (z l = r l + jx l ) is connected to the PCC in this operational scenario. The controlled switch S w2 interconnects a three-phase resistive load (r lext ) parallel with the z l , provoking a load variation that results in an X /R ratio change inside the dead zone.
Figs. 12(a) presents the experimental results of the controlled active and reactive powers regulated in the same setpoints of the test before. With the inclusion of the load, the VS-VIS implements a virtual impedance composed of r v ≈ −0.18 and x v ≈ 1.069 for reaching r e ≈ 0. 22 and x e ≈ 2.2 , leading to X /R ≈ 10 according to Figs. 12(b)-12(d).
At t ≈ 4 s, the switch S w2 interconnects the r lext parallel with the z l , reducing the equivalent resistance r e = 0.16 , as shown in Fig. 12(b). The load variation changes the grid impedance parameters, resulting in x e / r e ≈ 8.82, as depicted in Fig. 12(d), which corresponds to a deviation of | xr(t k )| ≈ 1.18. Like the test before, the maximum X /R deviation is fixed at 1.5, restraining x v updating. As a result, the SMC virtual reactance x v decreases its average values to achieve the X /R control objective, as observed in Figs 12(c)-12(e). The controlled active and reactive powers depict a slight transient 83108 VOLUME 10, 2022 during the load change but quickly converge to their setpoints. These experimental results demonstrate the capabilities of the proposed grid shaping approach in dealing with load change occurrences.

V. CONCLUSION
This paper proposes an adaptive grid impedance shaping approach to enhance the power flow control of GF-PC. In this system, a decision logic system determines the required virtual impedance based on the X/R ratio provided by the grid impedance estimator, network damping condition, and GF-PC power availability. The present solution employs a virtual impedance composed of negative virtual resistance in series connected with a positive reactance. The resistive component is calculated and implemented continuously using a standard methodology, while the reactance employs a VS-VIS. In this scheme, the required virtual reactance is determined in each sampling time, but the implemented value is only updated when the X/R variations cause PCC voltage deviations that extrapolate the limits imposed by the standards. Furthermore, the virtual reactance is split into standard virtual and SMC reactances for assuring the grid shaping objectives. The first implements the main part of the required virtual reactance, and the second provides a fine-tuning control action to match the necessary virtual reactance. Also, the modeling and design concepts of the proposed method are fully detailed. Besides, the implementation algorithm employs only basic mathematical and logical operations, making it simple to be embedded into the GF-PC systems. Also, Nyquist stability studies demonstrated that the design criteria adopted to set up the voltage controller gains and define the parameters of the proposed grid-shaping approach assure the system's stability up to the physical limits of the power converter. Moreover, the proposed method provides a grid-shaping action with smooth transients, which improves the resilience of the GF-PC system. Finally, the experimental results obtained from a GF-PC laboratory setup demonstrated the effectiveness of the proposed solution with different operational conditions.