Modeling of Double Stage Photovoltaic Inverter System with Fast Delayed Signal Cancellation for Fault Ride-Through Control Application in Microgrids

This research presents a secondary control for a grid-supporting microgrid with photovoltaics sources to guarantee grid code compliance and ancillary services. The secondary control accomplishes the fault ride-through, which implements a delayed signal cancellation (DSC) algorithm for negative sequence detection. Without mode switching, the proposed control strategy meets grid code requirements and ensures voltage regulation at the secondary level, which is active and more salient throughout the transient period of host grid disturbances. This control also ensures a constant supply of the microgrid’s sensitive local load while adhering to grid code requirements. Similarly, active power injection into the main grid is limited by progressively altering the MPPT operating point dependent on the depth of voltage sag to optimize reactive power injection to sustain grid voltage sag. The recommended secondary control is triggered by utilizing the DSC process’s detection algorithm to identify the occurrence of a fault in a tiny fraction of a half-cycle in a grid fault. Consequently, while satisfying microgrid load needs, the devised technique guaranteed that increases in DC-link voltage and AC grid current were controlled. MATLAB Simscape ElectricalTM and OPAL-RT Lab are used to do time-domain simulations of the model using the recommended secondary control systems.


Introduction
According to current grid code standards, in response to a disturbance in the main grid causing voltage sags, grid-connected inverter-based microgrids must stop powering the microgrid loads. In addition, low-voltage microgrids must be disconnected from the host grid before 120 cycles of voltage sag between 0.5 and 0.9 per unit, according to the IEEE Std 929-2000 standard [1,2]. Previously, ancillary services, such as fault ride-through (FRT), were not considered part of the scope of microgrids and were not required [3]. However, isolating a microgrid with a high RES penetration from the main grid in response to disruptions or grid faults has a major impact on the utility system's power quality, operation, and stability [4,5]. Therefore, a utility grid's microgrid or DER reactive power supply can minimize overall grid instability while meeting sensitive load needs [6]. As a result of the rising DER integration, grid codes must be updated with their appropriate specifications, especially at active distribution systems. Existing investigations [7][8][9] have shown that DER may play a substantial role in overall system stability and that photovoltaic systems can provide ancillary services to ease grid and power electronics difficulties [10]. Furthermore, several studies are underway to ensure that microgrids can have qualities like FRT and inertia, even on low-voltage networks [11]. Similarly, the problems posed by substantial DER grid penetration, particularly PV systems, are anticipated and expected, thereby demanding improved control to address these potential issues. As a result, revising problems posed by substantial DER grid penetration, particularly PV systems, are anticipated and expected, thereby demanding improved control to address these potential issues. As a result, revising the existing grid code requirements is required to allow for a large-scale deployment of low-voltage DER with FRT capabilities [12].
As a result, some developed countries have amended their respective grid codes to improve RES efficiency. In 2004In , 2006In , and 2008, Spain, Germany, and Denmark were among the first countries that issued the FRT requirements for DERs connected to the grid [13,14]. The Spanish, Danish, and Chinese code requirements are displayed in Figure 1 accordingly [9,10]. In particular, when the grid-connected units are above the lines, they need to be connected to the grid instead of stopping power generation. Therefore, DER or Distributed Generator (DG) systems will remain connected if the voltage amplitude is above the lines. Nevertheless, in China, the voltage is also regulated, with DER/DG systems working in high voltage ride-through (HVRT) if the voltage magnitude is higher than the rated nominal value, nonetheless within limits [15]. It means that if the voltage level is too high, HVRT should be enabled. In the case of grid failures (voltage sags), gridsupporting schemes must resist disconnection and stay operational under fault duration. Even though these requirements are projected for the high-voltage network, they are valid for the low-voltage grid due to similar concepts [11] and increasing penetration at the lowvoltage level. Voltage sags resulting from fault and other transient disturbances are severe challenging events in grid-connected systems. Because of power line short circuits, lightning strikes, and load dynamics, the magnitude of the grid-voltage can momentarily drop to a particular point, including zero levels. In such situations, the abrupt shutdown of large DER/DG systems will trigger the collapse of power system distribution [15]. Henceforth, it is obligatory for grid-synchronous DER/DG units to momentarily ride-through grid voltage sags. Simultaneously, the DER/DG units should provide dynamic grid supports by contributing reactive power to aid the grid to withstand the transients. Aside from FRT, future inverter-based microgrid systems are expected to integrate grid support, grid fault resistance, dynamic power regulation, and smart ancillary service supply at the PCC [17,18]. Additionally, as soon as the grid voltage recovers or the fault is cleared, the PV system is required to function at its maximum active power point for a set time at a power factor of unity. Grid disturbances are unavoidable, resulting in periodic voltage sags and posing a considerable challenge to the power inverters. To enable seamless operational changes, traditional inverter control methods must be upgraded to handle these rigorous and important operating parameters. Although reactive power injection via interface inverters is an important issue in control design, reactive power injection is allowed without exceeding operational power restrictions. Dynamic grid voltage Aside from FRT, future inverter-based microgrid systems are expected to integrate grid support, grid fault resistance, dynamic power regulation, and smart ancillary service supply at the PCC [17,18]. Additionally, as soon as the grid voltage recovers or the fault is cleared, the PV system is required to function at its maximum active power point for a set time at a power factor of unity. Grid disturbances are unavoidable, resulting in periodic voltage sags and posing a considerable challenge to the power inverters. To enable seamless operational changes, traditional inverter control methods must be upgraded to handle these rigorous and important operating parameters. Although reactive power injection via interface inverters is an important issue in control design, reactive power injection is allowed without exceeding operational power restrictions. Dynamic grid voltage support is a critical necessity during different degrees of voltage sag in grids. During fault ridethrough operation, reactive current injection takes precedence. Furthermore, reactive power injection through interfacing inverters should be considered in controller design, and thus, Energies 2022, 15, 701 3 of 33 reactive power injection is permitted without exceeding the operational power limits [19,20]. In such a way, a microgrid's DER/DG systems, including PV systems, deliver dynamic supports to the grid. The reactive power injection requirements during different degrees of depth in voltage sag in Spain and Denmark grids are revealed in Figure 2. As shown, the priority is given to the reactive current injection during fault ride-through operation, and in such a situation, the active power generation and delivery may be preserved or varied, although it is not necessary. Considering the urgency and impact of prompt reactive power support, detecting voltage sags to ensure appropriate and suitable action under faults is critical.
Energies 2022, 15, x FOR PEER REVIEW 3 of 35 support is a critical necessity during different degrees of voltage sag in grids. During fault ride-through operation, reactive current injection takes precedence. Furthermore, reactive power injection through interfacing inverters should be considered in controller design, and thus, reactive power injection is permitted without exceeding the operational power limits [19,20]. In such a way, a microgrid's DER/DG systems, including PV systems, deliver dynamic supports to the grid. The reactive power injection requirements during different degrees of depth in voltage sag in Spain and Denmark grids are revealed in Figure  2. As shown, the priority is given to the reactive current injection during fault ridethrough operation, and in such a situation, the active power generation and delivery may be preserved or varied, although it is not necessary. Considering the urgency and impact of prompt reactive power support, detecting voltage sags to ensure appropriate and suitable action under faults is critical. Several strategies for FRT enhancement in grid-connected systems have been proposed in the literature through the deployment of devices such as energy storage systems [21], brake chopper [22][23][24], active crowbar systems, flexible alternating current transmission systems, dynamic voltage restorer (DVR), fault current limiters [25,26] and load tap changer. However, all of these external devices come with high upfront and ongoing expenditures and technical system difficulties. The ESSs are usually tied electrically to the DC-link via a DC-DC buck-booster [27]. The ESS absorbs surplus energy from the DC link when a DC overvoltage occurs-thus, AC grid fault. The DC-DC converter's duty cycle is altered in this period to reduce the power from the PV battery and, as a result, reduce DC link voltage. The ESS stored energy is released into the AC grid immediately after the grid fault is cleared, and thereby, the ESS enhances the FRT ability by regulating and guarding the DC side and DC-AC inverter from a high DC-link voltage. Furthermore, ESS implements power oscillation suppression, peak shaving, and time-shifting [28] apart from improving the FRT. However, ESS devices have high initial and servicing costs as the main disadvantages. Similarly, ESS also fluctuates DC parameters before and after a fault. While ESSs are used to suppress the DC link's excess energy and protect the DC-AC inverter by riding-through AC grid faults, reactive current injection to sustain the AC grid voltage is yet to be addressed.
The braking chopper protects the DC-AC inverter from rising DC link voltage culminating in an overvoltage resulting from the AC grid fault. The gate pulses of the IGBT only trigger the chopper under fault. Hence, the power resistor absorbs the excess energy generated. This braking chopper structure is beneficial as a result of its low cost and simple control scheme. In [23,29], the DC-chopper and current limiters are utilized to absorb Several strategies for FRT enhancement in grid-connected systems have been proposed in the literature through the deployment of devices such as energy storage systems [21], brake chopper [22][23][24], active crowbar systems, flexible alternating current transmission systems, dynamic voltage restorer (DVR), fault current limiters [25,26] and load tap changer. However, all of these external devices come with high upfront and ongoing expenditures and technical system difficulties. The ESSs are usually tied electrically to the DC-link via a DC-DC buck-booster [27]. The ESS absorbs surplus energy from the DC link when a DC overvoltage occurs-thus, AC grid fault. The DC-DC converter's duty cycle is altered in this period to reduce the power from the PV battery and, as a result, reduce DC link voltage. The ESS stored energy is released into the AC grid immediately after the grid fault is cleared, and thereby, the ESS enhances the FRT ability by regulating and guarding the DC side and DC-AC inverter from a high DC-link voltage. Furthermore, ESS implements power oscillation suppression, peak shaving, and time-shifting [28] apart from improving the FRT. However, ESS devices have high initial and servicing costs as the main disadvantages. Similarly, ESS also fluctuates DC parameters before and after a fault. While ESSs are used to suppress the DC link's excess energy and protect the DC-AC inverter by riding-through AC grid faults, reactive current injection to sustain the AC grid voltage is yet to be addressed.
The braking chopper protects the DC-AC inverter from rising DC link voltage culminating in an overvoltage resulting from the AC grid fault. The gate pulses of the IGBT only trigger the chopper under fault. Hence, the power resistor absorbs the excess energy generated. This braking chopper structure is beneficial as a result of its low cost and simple control scheme. In [23,29], the DC-chopper and current limiters are utilized to absorb excess DC voltage and minimize extreme AC grid current to mitigate DC-link overvoltage and AC overcurrent problems, respectively, that can cause disconnection or inverter damage. However, these braking choppers only dissipate power and possess no reactive power generation ability to support the AC grid voltage under fault. This is because all the generated power is dissipated at the expense of reactive power injection. The braking chopper is combined with other devices such as Fault Current Limiter (FCL) to enhance performance. This, unfortunately, increases the overall cost.
FACTS controllers are a valid alternative solution to ensure a sustained grid connection of inverter-based systems under grid faults and introduce reactive power as exigent. For instance, STATCOM can improve the FRT of fixed speed wind turbines, and SSSC can be used in FRT capability enhancement control and voltage stabilization. During fault situations, series terminal voltage mitigation using DVR is done by injecting series voltage to the grid voltage at the PCC to retain steady DFIG stator voltage [30]. DVR uses a threephase power converter tied through a transformer in series between WT and coupling points [31]. STATCOM's reactive output power under the voltage dip is more-substantial compared to SVC. Both devices can support the voltage recovery and inject reactive power, thereby increasing reactive power controllability for grid support to conform to grid code FRT stipulations. The coordination between the grid-connected inverter-based system and STATCOM has been proposed to suppress grid fault's impact at the PCC. The traditional STATCOM is limited to only one capacitor-based storage with limited energy storage ability; however, reactive currents are supplied to anticipate grid voltage recovery during faults or disturbances. Similarly, SVC injects reactive power to compensate for grid voltage sags, as discussed in [32]. These controllers are primarily utilized in compensating and injecting reactive power to boost the FRT capacity. DSTATCOM is a shunt compensation device generally used to solve power quality problems in distribution systems. The control strategy of the DSTATCOM plays a vital role in PCC voltage maintenance. Thus, [33] presents the application of a DSTATCOM to improve the power quality in a ship power system during and after pulse loads due to high energy demand. However, the system's entire cost and complexity are increased due to installing external FACTS hardware. For instance, installing devices such as DVR in the feeder line prevents the DC-AC inverter from sensing voltage drops in the AC grid. Furthermore, due to DVR's limited capacity, it is inappropriate for extreme AC grid voltage sag [34].
The FCL addresses the over-current when utilized between the microgrid and main grid as in reference [35][36][37][38]. This shields the grid-tied inverter from the AC grid overcurrent, thereby improving the FRT under faults. The FCL decreases the excessive current at the DC-AC inverter's AC grid side under fault on the AC grid. Reference [39] proposed a dynamic current curtailment scheme applied in autonomous inverter microgrid in enhancing FRT and presented the effectiveness in limiting current and voltage. FCLs are utilized to reduce the DGs' contribution to the fault's current level to enhance FRT [35]. References [40,41] suggested different types of FCL and modified versions of FCL to enhance the microgrids, wind turbines, solar photovoltaic, and other DGs FRT capabilities. The FCL potential to enhance FRT is well established in the literature [42,43]. The FCL is located between the microgrid and main network, and as such, FRT for all microgrids' DERs is commonly achieved [36,44]. The SDBRs are deployed in RES (PV and WT) systems to boost the FRT. The over-voltage concern is addressed by mitigating the excessive DC link voltage experienced under the AC grid fault. They are installed in series in between the RES, and the grid coupling point is short-circuited in steady-state and activated under fault conditions. As a result, researchers [16,45] have concentrated on creating modified, state-of-the-art techniques, and FRT can be performed at a low cost and without using any additional equipment. The purpose is to increase the host grid's performance and fault recovery services. For example, Shin et al. (Shin et al. 2015) provide state-of-the-art FRT approaches based on a low-pass notch phase-locked loop for smooth and rapid transient responses to unexpected imbalanced grid situations. Similarly, [45] presented a way to support voltage by increasing the difference between positive and negative sequence voltages, improving the grid-connected inverter system's stability and dependability. Furthermore, [46] used a modulated pulse width modulation to manage the stator phase voltage dynamic braking resistor for wind systems to limit the impact of grid failure types to achieve a certain degree of flexibility and robustness. To avoid disconnection during failures, Mirhosseini, Pou, and Agelidis [47] devised a control system for single and double PV inverters [48] that limits active power generation injecting reactive power to sustain the system. In [49], a nonlinear control for LVRT augmentation and post-fault recovery in a two-stage PV system is presented. In [50], a PV inverter control that decouples active and reactive power and smoothly switches between operating modes depending on the grid situation.
In the same way, many novel FRT management methods and schemes were suggested in [12,16,51]. Zamani et al. [44] recommend inverter-interfaced RES regulating strategies to enhance the host grid's dynamic performance during disturbances and faults. In Kou and Wei [51], some observations were made regarding the specific grid code requirements for interconnection and operation of microgrids, which suggest LVRT functionality for microgrids and the provision of additional fault recovery services. As expressed in the FRT voltage profile, these recommendations expect a grid-connected microgrid to ride through balanced and unbalanced sags in grid voltage. Interruption, followed by a transition to autonomous operation, is only allowed if the fault persists [2].
A complementary controller for voltage is suggested in [52] for inverters-based DGs for the FRT control. This controller is expected to superimpose with minimum adjustments with numerous available voltage control schemes. These modifications, therefore, do not necessarily need to alter the initial configuration of these existing controllers. A hierarchical control has been proposed in the literature [53,54] towards realizing the numerous microgrid control and operation requirements. These propositions are with fundamental control goals, including voltage control, local power allocation among distributed energy units, frequency regulation, and power control (active and reactive) under synchronization with the host grid [55]. A rapid fault detection system plays a crucial role in enhancing the effects of these several strategies.
The voltage sags detection to guarantee proper and acceptable response under failures is crucial, given the urgency and importance of quick reactive power assistance and active power limiting. Detecting voltage sag is critical to the overall performance of the FRT capability control during a grid fault to switch between operating modes quickly and adequately [56][57][58][59]. As a result, built-in fault detection algorithms are used to safely disconnect grid-connected inverter-based equipment during grid outages. As a result, several voltage-sag detection techniques have been proposed; including the positive sequence technique [60], the root means square (RMS) technique [61], the peak value technique [62], the missing voltage method [58], and the wavelet transform technique [61]. In terms of detection speed, design complexity, and efficacy, all of these strategies offer advantages and disadvantages. Most of these methods are based on transforming the AC signal into an equivalent DC signal, which provides ease of processing and analysis. Similarly, several detection methods express voltage sags in terms of RMS; however, the RMS method represents one cycle historical average value, not an instantaneous value, which may lead to a long detection time when voltage sag has occurred [63]. RMS values are continuously calculated for a moving window of the input voltage samples. This convenient magnitude measurement is expressed in the signal's energy content. A continuously moving window has n samples per cycle, assuming the window contains n samples per cycle (or half cycle). The sag is detected after the data for a window period has been processed. The concept observes the shifts in voltage during the fault phenomenon as near as possible. The closer the fault event is displayed, the more RMS values are measured. The voltage drop is proportional to the sag level [64]. Despite this, the detection approach that is most often utilized is RMS due to the RMS technique's design simplicity and few complexities. Inverter-based microgrid topologies and control systems must be devised and implemented to fulfill expected FRT requirements.
This study aims to provide a secondary control strategy that uses a fast delayed signal cancellation (DSC) for reactive power injection and faults current limiting to improve grid inverter-based microgrids with solar PV sources. The secondary FRT control specifies primary control references [65]. The primary and secondary FRT control levels create a hierarchical control system, and there is no mode switch in the technique. This controller This study's contributions are: a fast DSC technique is introduced that detects the issue promptly in less than 0.1515 ms to ensure dependability and rapid reaction to disturbance or fault in the system. The DSC has a shorter convergence time and better separates positive and negative sequences. Using DSC, the voltage sag detection activates reactive power injection and restricts the fault current, thereby avoiding oscillations in the power and DC-link voltage. This research presented a method for limiting the active power reference generated by the MPPT by shifting the operating point, which may be used in a two-stage PV system. To avoid activating the DC-link overvoltage protection system, a particular control action is performed to reduce DC-source power production and equip the interface converters with FRT capabilities. This is accomplished without the converter's voltage boosting activity being turned off. During the sag cycle of the AC grid voltage, the voltage at the DC bus between the DC-DC and DC-AC converter is controlled. As a result, the recommended solutions in this study reduced the typical momentary DC voltage rise on the DC bus during the transient process. While fulfilling local load needs, the secondary level of control improves the fulfilment of the upcoming grid code FRT standards. This suggested technique eliminates mode switching and allows the PV system to withstand grid failures and transient disturbances. As with a smooth transition approach, continuous grid resynchronization is avoided after a failure, reducing local load shedding. Finally, an adequate power quality for local sensitive loads is obtained during fault duration regardless of grid status. The secondary control, which guides electricity export and import per the grid code, improves the traditional primary control.
The remainder of the paper is structured as follows. Section 2 describes how the active power in a PV system is reduced by altering the operating point of the MPPT in response to grid voltage sags using the suggested secondary level control utilizing the DSC algorithm. Section 3 presents the simulation findings, and Section 4 concludes this article.

Primary Control with Droop
The created time-domain models of DC-AC inverter-based microgrids with a DC-DC converter and maximum power point tracking incorporate photovoltaic-based distributed energy resources have a circuit and control diagram. The droop control is applied between the outer and inner loops of the control to ensure that the two-stage PV system can participate in grid frequency and voltage regulation [66]. As a result, droop is introduced between the DC link voltage control outer loop and the inner current control, as shown in Figure 3. The goal is to create active and reactive power control based on droop control to meet the overall control scheme of an inverter-based microgrid with a DC-DC converter. This is true for the PV system. As demonstrated in Figure 3, the control is based on output power regulation at a lower value to MPPT extracted power P mpp per grid frequency and voltage variation. The variation of ω from ω* is used to control the output power. P mpp is typically estimated using MPPT control. [ ] where vdc is the measured value of the DC link voltage The actual first reference of the power p*, which will serve as the input for the integrated droop, is calculated by Equation (2) The active power output of the inverter is determined by p-ω droop control, which mimics the inertial response of synchronous generators, whereas the reactive power output of the voltage source inverter is determined by Q-E droop control given in Equation (3): where kpdroop and kqdroop are the coefficients of the inverter's frequency and voltage droops, respectively. p* and Q* are also active and reactive power references, respectively. Furthermore, the droop generates new references for active and reactive power, which are denoted by p* and Q*, respectively. In addition, ω* denotes the set-point frequency, whereas E* denotes the voltage's rated set-point amplitude. The outer loop controls the DC-link voltage; hence, the difference between the measured and reference DC-link voltages in this loop is the controller's input. The controller's output determines the first reference per unit power P * pu as given in Equation (1). The reference per unit power Q * pu is set at zero for the unity power factor.
where v dc is the measured value of the DC link voltage The actual first reference of the power p*, which will serve as the input for the integrated droop, is calculated by Equation (2): The active power output of the inverter is determined by p-ω droop control, which mimics the inertial response of synchronous generators, whereas the reactive power output of the voltage source inverter is determined by Q-E droop control given in Equation (3): where k pdroop and k qdroop are the coefficients of the inverter's frequency and voltage droops, respectively. p* and Q* are also active and reactive power references, respectively. Furthermore, the droop generates new references for active and reactive power, which are denoted by p* and Q*, respectively. In addition, ω* denotes the set-point frequency, whereas E* denotes the voltage's rated set-point amplitude.

Secondary Control with Fast DSC
The PCC voltage magnitude control is set up to buffer and prevent surpassing the grid code maximum defined and needed voltage range (0.9-1.1 pu) in order to avoid exceeding the limit. To implement an effective unbalanced grid voltage adjustment, the values of its symmetrical components are collected. To detect the presence of symmetrical components and retrieve their values, delayed signal cancellation (DSC) is used. For the grid frequency of 50 Hz, a time of 5 ms is employed. This is determined as N d = fs/(4 f 1 ), where fs is the sampling frequency, and f 1 is the fundamental frequency, which in our instance is 50 Hz grid frequency.
The DSC algorithm measures three-phase voltages and then decomposes them into their symmetrical components [67]. Voltages recorded in phase are principally indicated in the stationary reference frame by the Clarke (abc-∝β) transformation. Two opposite rotations are performed following the above-mentioned resulting stationary reference frame using the host grid voltage's phasor measured angle (θ and −θ). This angle corresponds to the one presented at the phase-locked loop's output. The positive factor suggests that the negative component values for v p αβ and v n αβ are then stored in two distinct data buffers for half a time.
Finally, the positive and negative component final samples are produced and instantly stored in the two buffers for half a length of time. Equation (4) expresses the components and their additions. In Equations (4) and (5), the second term samples are equal to the components of the first term; however, a fourth duration is displaced, and a multiple of the second terms expresses this change. For the LVRT application, the negative and positive sequence components of voltage and current signals must be acquired. Traditional DSC approaches published in the literature are used to separate the positive-sequence component v p αβ and negative-sequence components v n αβ using Equation (4). The signal is delayed within a fourth of the fundamental frequency throughout this precise sequence separation operation.
The typical DSC approach is shown in Figure 4a, where two components of t 1 and t 2 of v αβ (t) are rotated counter-clockwise. Following that, in Figure 4b, the fundamental delay cycle v αβ t − f s /4 · f g is used to extract components t 1 . As a result, component t 1 now has a phase shift delay of −π. As a result, a −2π phase shift delay is applied to the component t 2 . As a result, the backward rotation clock will wisely adjust by adding +π to the phases of the two components. As a result, t 1 is rotated back to its original position. With the superimposition of Figure 4a,b, the component t 1 is doubled in length, and t 2 is decreased to zero (b). Figure 4c depicts the result.  The fast DSC utilized in this work differs from the traditional DSC used in [6] due to the significant delay (5 ms for 50 Hz) incurred from employing and , which is a significant shortcoming. Similarly, the ratios 4 ⋅ ⁄ must be an integer, which is not feasible in practice. Another disadvantage of and is that the vector − 4 ⋅ ⁄ will necessitate a large amount of memory. Figure 5 depicts the Fast DSC used for sequence component separation, with a shorter settling time. The fast DSC utilized in this work differs from the traditional DSC used in [6] due to the significant delay (5 ms for 50 Hz) incurred from employing v p αβ and v n αβ , which is a significant shortcoming. Similarly, the ratios f s /4 · f g must be an integer, which is not Energies 2022, 15, 701 9 of 33 will necessitate a large amount of memory. Figure 5 depicts the Fast DSC used for sequence component separation, with a shorter settling time.
phase shift caused by introduced delay, and (c) half-cycle phase shift in an original rotating direction.
The fast DSC utilized in this work differs from the traditional DSC used in [6] due to the significant delay (5 ms for 50 Hz) incurred from employing and , which is a significant shortcoming. Similarly, the ratios 4 ⋅ ⁄ must be an integer, which is not feasible in practice. Another disadvantage of and is that the vector − 4 ⋅ ⁄ will necessitate a large amount of memory. Figure 5 depicts the Fast DSC used for sequence component separation, with a shorter settling time. The voltage vector consists of both positive and negative components as expanded by: where ϕ 1 and ϕ 2 are chosen as random angles depicting negligible phase shifts. Thus, Equation (5) can be expanded as a result of Equation (6): Hence, the filtered version of the v αβ (t) is expressed as v(t)where: where θ d is the delay angle expressed as in Equation (8): The voltage vector v is derived by applying Equations (5) and (6) to Equation (7) as expressed in Equation (9): Hence, the negative sequence component is cancelled out in Equation (9), as further expressed in Equation (10): Therefore, the negative component cancelled out is expressed by Equation (11): Energies 2022, 15, 701 10 of 33 The positive and negative sequence components are similar to that of traditional DSC, provided the delay angle in Equations (10) and (11) approaches zero, as expressed in Equation (8). Hence, a time delay of f s /N s, which corresponds to the θ d as given in Equation (8) is realized. Thus, at the exact delay angle θ d = π/2, the output of the traditional DSC is achieved. Suppose: Therefore, the sequence component estimates in the stationary reference frame are given as: This proposed fast DSC is deployed for the secondary control is given in Figure 5. Therefore, a transformation from αβ0 stationary reference frame to dq0 rotating reference frame is performed using:

Dynamic Voltage Support
The positive and negative component voltage-independent control is done according to their respective sequence references expressed in Equation (18): where k pp and k pn are the PI control's proportional gains for the positive sequence while k ip and k in are the integral gains in the negative sequence. The control technique uses the DSC to independently change both positive and negative components in accordance with their respective sequence references to regulate the microgrid voltage at the local load point of connection with the PCC. As a result, the microgrid voltage of the DERs and local sensitive loads increases compared to the voltage sag experienced in the main grid. As a result, active power is given continuously to the microgrid sensitive load while providing ancillary voltage support to the main grid. Equations (19) and (20) express the separate controls of the voltage at the point of common coupling of the microgrid to the main grid. where k pp and k pn are the PI control's proportional gains for the positive sequence while k ip and k in are the integral gains in the negative sequence. The aggregate reactive power injection from the microgrid through the PCC to the utility grid for ride-through and reactive power support implies Equation (21) using Figure 6.
where Q p and Q n are the reactive powers obtained from the PCC voltage's independent control, as in Equations (19) and (20). Q req is estimated using the Spanish grid code LVRT requirement based on the depth of voltage sag, as shown in Figure 6. Therefore, the microgrid voltage at the local load point of contact with the PCC is regulated by the control device using the DSC to change both the positive and negative components individually in compliance with their corresponding sequence references. Thus, the voltage within the microgrid common to the DER and local loads improves reasonably independent of the voltage decrease in the main grid. Active power is then continuously supplied to the microgrid-sensitive load, thus offering ancillary voltage support operation to the main grid. Thus, ensuring the independent voltage controls at the microgrid's common coupling point to the main grid are demonstrated in Equations (19) and (20).
Consequently, the required reactive power injection under fault in the main grid is guided by Equation (22) in accordance with the depth of voltage sag. Accordingly, dynamic grid voltage support is not required within 90-110% of the nominal grid voltage. Therefore, in Equation (11), Qreq is the required reactive power stipulated by the grid code, while VG and VN are the instantaneous and nominal grid voltages.

Active Power Curtailments
Active and reactive power references are fixed according to control goals and grid transient conditions. Before a fault, the dynamic power reference is governed by MPPT control at the unity power factor. The active and reactive power references are recomputed as soon as the DSC detects the fault. Typically, in direct-quadrature equivalent for the three-phase grid parameters, p and Q are computed as: Therefore, the microgrid voltage at the local load point of contact with the PCC is regulated by the control device using the DSC to change both the positive and negative components individually in compliance with their corresponding sequence references. Thus, the voltage within the microgrid common to the DER and local loads improves reasonably independent of the voltage decrease in the main grid. Active power is then continuously supplied to the microgrid-sensitive load, thus offering ancillary voltage support operation to the main grid. Thus, ensuring the independent voltage controls at the microgrid's common coupling point to the main grid are demonstrated in Equations (19) and (20).
Consequently, the required reactive power injection under fault in the main grid is guided by Equation (22) in accordance with the depth of voltage sag. Accordingly, dynamic grid voltage support is not required within 90-110% of the nominal grid voltage. Therefore, in Equation (11), Q req is the required reactive power stipulated by the grid code, while V G and V N are the instantaneous and nominal grid voltages.

Active Power Curtailments
Active and reactive power references are fixed according to control goals and grid transient conditions. Before a fault, the dynamic power reference is governed by MPPT control at the unity power factor. The active and reactive power references are recomputed as soon as the DSC detects the fault. Typically, in direct-quadrature equivalent for the three-phase grid parameters, p and Q are computed as: The corresponding direct-quadrature grid currents are: According to Equation (25) and with , the reference grid current as the active power and reactive power are required to be modified under FRT mode.
where the current reference I* g is the direct-quadrature equivalent of the three-phase AC grid current, and G P (s) and G Q (s) are the p and Q, proportional-integral controller. The DERs are permitted to feed in active power during the voltage sags, although limited to the grid. For this purpose, the inverter injects a smaller amount of power into the grid for the duration of voltage sag, unlike the pre-fault condition capacity while sidestepping DC-link overvoltage. Figure 7 depicts the p−V curve of a solar module where P MPP and V MPP represent the maximum power point power and voltage of the PV source, which is assumed to be the pre-fault values at the MPP.
The corresponding direct-quadrature grid currents are: According to Equation (25) and with ( ) v , the reference grid current as the active power and reactive power are required to be modified under FRT mode.
where the current reference I*g is the direct-quadrature equivalent of the three-phase AC grid current, and GP(s) and GQ(s) are the p and Q, proportional-integral controller.
The DERs are permitted to feed in active power during the voltage sags, although limited to the grid. For this purpose, the inverter injects a smaller amount of power into the grid for the duration of voltage sag, unlike the pre-fault condition capacity while sidestepping DC-link overvoltage.  FRT mode adjustments are applied to limit this active power injection under grid voltage sag caused by faults [68]. The proposed technique matches the DC generated power with the AC grid injected to preserve a moderately constant DC-link voltage. The DC and AC power balance is maintained at a value other than zero. As a result, the AC grid receives a simultaneous injection of active power and reactive power.
The DC-DC converter's goal under the proposed method is no longer to enforce MPP operations but to control power produced by the PV system to match the instantaneous permissible active power. The converter is regulated to determine the optimal VPV value that attains power balance. Therefore, the operating point could also shift from point X in Figure 7 to a lower control point, i.e., be it point Y or point Z. Thus, a negative voltage value ΔVPV is added to the pre-fault VMPP value, as follows: FRT mode adjustments are applied to limit this active power injection under grid voltage sag caused by faults [68]. The proposed technique matches the DC generated power with the AC grid injected to preserve a moderately constant DC-link voltage. The DC and AC power balance is maintained at a value other than zero. As a result, the AC grid receives a simultaneous injection of active power and reactive power.
The DC-DC converter's goal under the proposed method is no longer to enforce MPP operations but to control power produced by the PV system to match the instantaneous permissible active power. The converter is regulated to determine the optimal V PV value that attains power balance. Therefore, the operating point could also shift from point X  Figure 7 to a lower control point, i.e., be it point Y or point Z. Thus, a negative voltage value ∆V PV is added to the pre-fault V MPP value, as follows: The strategy proposed will enable the controller to achieve FRT using the current reference directly derived from the active and reactive power references, according to Equation (25). The linear droop is used in determining the voltage value ∆V PV. This droop relationship implements the FRT, which involves a curve-programmed active power decrease during the FRT operation. Hence, the characteristic linear droop relationship between PV voltage and PV power, according to Figure 2, is approached by: where k PV is the constant factor of p-V droop, and this relationship is irradiance-and temperature-dependent.
The FRT strategy requires that the depth of the grid voltage drop is commensurate to the level of regulated active power injection into the AC grid to make way for the injection of reactive power in supporting the voltage drop. Consequently, another droop-based correlation in the active power generated with respect to the grid voltage V G is proposed as: where V G is the grid voltage magnitude, P G is the grid injected active power, k d shows the droop coefficient of the relationship, and V * G and p * G are the corresponding initial values for grid voltage and active power just before transients. In a lossless DC-AC conversion system, the MPPT extracted power is equal to the injected AC power. Consequently: Thus, applying the relation in Equation (29) to Equations (27) and (28) and combining the two equations yields Equation (30), which indicates an inverse proportionality between the voltage grid changes and PV voltage changes as: Hence, the PV voltage is maintained at maximum power point voltage with the nominal grid voltage under normal grid conditions. However, the PV voltage is systematically adjusted by Equation (29) under fault. This occurs as a result of grid voltage drop lower than the grid nominal voltage. Consequently, a smooth switch is ensured between MPP and FRT operating modes and vice versa. The FRT voltage for the PV is dependent on the depth of the grid voltage sag, as shown in Equation (20), where ratio k PV : k d is the proportional control gain: Hence, voltage value ∆V PV is given as: Therefore, the implementation of the FRT scheme, as depicted in Equation (31) depicted in the DC-DC control of Figure 7 with the maximum power point tracking control gain.

Results
In this work, grid support is required to aid grid voltage recovery by the reactive power injection, especially during faults in the grid. Furthermore, this injection will, in turn, contribute to the overall stability and reliability of the system. The mandatory reactive power injection (dynamic grid support) in meeting the grid code requirements is summarized in Equation (22), according to the Spanish network code [6]. Consequently, the required reactive current injection under fault in the AC grid is guided by the given expression. Once the PCC voltage sequence components are obtained in direct-quadrature coordinates when grid failure occurs using Equation (18), broken down into Equations (19) and (20), the two PCC voltage-independent control systems restore normal sequence references. Positive sequence control aims to bring the PCC voltage's positive sequence level back to its rated value. Therefore, the error is used to regulate the reactive power Q p injected into the grid while considering the electronic power switch thresholds. Likewise, the PCC voltage's negative sequence regulation restores the quadrature portion to zero normal condition references. This balances and buffers the further unbalance in PCC voltage introduced by reactive power injection into the grid.
The monitoring of grid voltage is crucial to the FRT operation of grid-supporting systems. The DSC algorithm accurately tracks the grid voltage level and promptly activates immediately fault is detected. The DSC detects the grid restoration after fault clearance, and the system switches back to the normal MPPT operating condition, as shown in Figure 8, compared with the other fast Fourier transform, synchronous rotating techniques reference frame, peak, and root means square (RMS) technique. The dynamic grid-supporting regulation is primarily linked to prompt reactive power injection control. The responses of the detection schemes and the proposed DSC at the inception of fault and fault clearance are presented in Figure 8a,b, respectively. required reactive current injection under fault in the AC grid is guided by the given expression. Once the PCC voltage sequence components are obtained in direct-quadrature coordinates when grid failure occurs using Equation (18), broken down into Equations (19) and (20), the two PCC voltage-independent control systems restore normal sequence references. Positive sequence control aims to bring the PCC voltage's positive sequence level back to its rated value. Therefore, the error is used to regulate the reactive power Qp injected into the grid while considering the electronic power switch thresholds. Likewise, the PCC voltage's negative sequence regulation restores the quadrature portion to zero normal condition references. This balances and buffers the further unbalance in PCC voltage introduced by reactive power injection into the grid. The monitoring of grid voltage is crucial to the FRT operation of grid-supporting systems. The DSC algorithm accurately tracks the grid voltage level and promptly activates immediately fault is detected. The DSC detects the grid restoration after fault clearance, and the system switches back to the normal MPPT operating condition, as shown in Figure 8, compared with the other fast Fourier transform, synchronous rotating techniques reference frame, peak, and root means square (RMS) technique. The dynamic gridsupporting regulation is primarily linked to prompt reactive power injection control. The responses of the detection schemes and the proposed DSC at the inception of fault and fault clearance are presented in Figure 8a,b, respectively. At the inception of fault, the time taken for the various techniques to reach the voltage sag's actual depth is given in Table 1. Similarly, the time taken for these methods to recover to the nominal system voltage value is also shown in Table 1. The DSC method showed superior performance in early detection of fault and the quality of value signal evaluation at the fault instance. The SRRF method also displayed a faster detection in a way similar to DSC; however, the sag detection went beyond the actual system sag, and the overshoot is experienced with a longer settling time of 0.0699 s after the fault instance and 0.071 s after fault clearance. Moreover, the FFT, PEAK, and RMS methods have similar performance with a significant delay in identifying the fault inception and fault clearance.  At the inception of fault, the time taken for the various techniques to reach the voltage sag's actual depth is given in Table 1. Similarly, the time taken for these methods to recover to the nominal system voltage value is also shown in Table 1. The DSC method showed superior performance in early detection of fault and the quality of value signal evaluation at the fault instance. The SRRF method also displayed a faster detection in a way similar to DSC; however, the sag detection went beyond the actual system sag, and the overshoot is experienced with a longer settling time of 0.0699 s after the fault instance and 0.071 s after fault clearance. Moreover, the FFT, PEAK, and RMS methods have similar performance with a significant delay in identifying the fault inception and fault clearance. Under substantial balanced fault at the time of 1.3 s, as shown in Figure 9 with a 50% sag in the grid voltage, the fault is cleared in 1.8 s. The corresponding product of the output of the delayed signal cancellation and a typical pulse generator generates positive and negative pulses. Ordinarily, the Pulse Generator generates square wave pulses at regular intervals in which waveform parameters, such as the amplitude, phase delays, and pulse duration, determine the pulse output. These pulses generated are cancelled out by multiplying them with the DSC output in Figure 8. Consequently, Figures 10-12 show the pulses generated in the three-phase system with all the faults detected in less than 0.1515 ms. In addition, the corresponding sag detection is shown for the pulses generated in each phase. These show that the fault is detected within 0.1515 ms in all phases to activate the FRT scheme for reactive power compensation and active power curtailment. Under substantial balanced fault at the time of 1.3 s, as shown in Figure 9 with a 50% sag in the grid voltage, the fault is cleared in 1.8 s. The corresponding product of the output of the delayed signal cancellation and a typical pulse generator generates positive and negative pulses. Ordinarily, the Pulse Generator generates square wave pulses at regular intervals in which waveform parameters, such as the amplitude, phase delays, and pulse duration, determine the pulse output. These pulses generated are cancelled out by multiplying them with the DSC output in Figure 8. Consequently, Figures 10-12 show the pulses generated in the three-phase system with all the faults detected in less than 0.1515 ms. In addition, the corresponding sag detection is shown for the pulses generated in each phase. These show that the fault is detected within 0.1515 ms in all phases to activate the FRT scheme for reactive power compensation and active power curtailment.  Under substantial balanced fault at the time of 1.3 s, as shown in Figure 9 with a 50% sag in the grid voltage, the fault is cleared in 1.8 s. The corresponding product of the output of the delayed signal cancellation and a typical pulse generator generates positive and negative pulses. Ordinarily, the Pulse Generator generates square wave pulses at regular intervals in which waveform parameters, such as the amplitude, phase delays, and pulse duration, determine the pulse output. These pulses generated are cancelled out by multiplying them with the DSC output in Figure 8. Consequently, Figures 10-12 show the pulses generated in the three-phase system with all the faults detected in less than 0.1515 ms. In addition, the corresponding sag detection is shown for the pulses generated in each phase. These show that the fault is detected within 0.1515 ms in all phases to activate the FRT scheme for reactive power compensation and active power curtailment.   The FRT approach proposed is simulated on a grid supporting the inverter-based microgrid model with a DC-DC converter. A typical example of this is a double-stage PV system with DC-DC and DC-AC converters. Therefore, the grid code FRT compliance of the system is evaluated while simultaneously solving the unique challenges introduced as a result of a PV source. Table 2 gives the PV and DC-DC Converter Simulation Parameters. Table 3 gives the critical system parameters at uniform 25 °C temperature and 1000 W/m 2 irradiance. The system is connected to a medium voltage level with a nominal voltage of 11 kV. The system consists of PV-based DERs and local load, as depicted in Figure   Figure 11. Pulses generated in all line 2 of the three-phase system (a) all through the fault occurrence, (b) at fault inception, and (c) at fault clearance. The FRT approach proposed is simulated on a grid supporting the inverter-based microgrid model with a DC-DC converter. A typical example of this is a double-stage PV system with DC-DC and DC-AC converters. Therefore, the grid code FRT compliance of the system is evaluated while simultaneously solving the unique challenges introduced as a result of a PV source. Table 2 gives the PV and DC-DC Converter Simulation Parameters. Table 3 gives the critical system parameters at uniform 25 °C temperature and 1000 W/m 2 irradiance. The system is connected to a medium voltage level with a nominal voltage of 11 kV. The system consists of PV-based DERs and local load, as depicted in Figure   Figure 12. Pulses generated in all line 3 of the three-phase system (a) all through the fault occurrence, (b) at fault inception, and (c) at fault clearance.
The FRT approach proposed is simulated on a grid supporting the inverter-based microgrid model with a DC-DC converter. A typical example of this is a double-stage PV system with DC-DC and DC-AC converters. Therefore, the grid code FRT compliance of the system is evaluated while simultaneously solving the unique challenges introduced as a result of a PV source. Table 2 gives the PV and DC-DC Converter Simulation Parameters. Table 3 gives the critical system parameters at uniform 25 • C temperature and 1000 W/m 2 irradiance. The system is connected to a medium voltage level with a nominal voltage of 11 kV. The system consists of PV-based DERs and local load, as depicted in Figure 2-the grid-connected inverter-based microgrid with DC-DC converter interfacing the PV. The fault is simulated on the main grid to cause 50%, 60%, and 70% voltage sags at the PCC, switched at time t = 1.3 s and assumed to be automatically cleared at t = 1.8 s.

DC Side Analysis
The drop in the PCC voltage due to a fault caused the proposed secondary control to re-evaluate the primary control references provided the voltage drop is within the FRT curve envelope. As a result of this drop, the PV power generated, power in the DC link, and power delivered to the AC grid is unbalanced. Consequently, this imbalance portends an unwarranted transient voltage at the PV side and DC link while excessive current is witnessed at the AC side, as shown in Figures 13-15 and interpreted in Tables 4-6. The exponential increment in the voltage at the DC link is due to the capacitor's energy buildup [69].  Table 4. The corresponding values of the DC-link Voltage under normal conditions and 50%, 60% and 70% voltage sags are given in Table 5. The corresponding values of the Average DC Current under normal conditions and 50%, 60% and 70% voltage sags are given in Table 6.     The MPPT function is deactivated, and the operating point is transitioned to the FRT mode, as seen in Figures 13c, 14c and 15c when a disturbance is sensed in the grid. Immediately upon the fault detection, the PV system starts reactive power injection into the grid per the voltage sag demands and grid code requirements. Similarly, the active power generation is limited in compliance with the ratings and complex power requirements imposed. Furthermore, Figure 14 shows that the PV voltage, DC bus voltage, and average DC link current flow under fault with and without the proposed secondary control under 60% voltage sags.
The limitation of active power is not necessarily the requirement of grid codes; however, it is done out of concern in simultaneously fulfilling the critical objective of the grid-supporting schemes of fault ride-through (by remaining in grid connection mode), providing grid support services to expedite grid recovery. Thus, reactive power injection without a commensurate drop in the active power generation triggers the system to activate overcurrent protection for safe disconnection. As a result, the active power is limited under FRT operation, as shown in the average DC flow in the DC link.
The fault is cleared under the Spanish grid code as soon as the voltage level rises to 90% of the nominal grid voltage value. Hence, the system is recognized to have returned to the normal operation mode. Consequently, the PV system immediately returned to its MPPT mode and tracked the PV panels' maximum output power. However, it took a short period for the incremental conductance MPPT to adjust to the transients caused by the AC grid fault, which is evident in the responses reported. Furthermore, PV module voltage and current, PV diode current, DC link voltage, average DC link current, and DC-link power require a considerable period to regain the pre-fault stable value. However, the proposed secondary control significantly mitigated the increase in voltage at the DC link. The developed models and the FRT control have demonstrated that the active power and reactive power regulation can facilitate the FRT capability of the three-phase gridsupporting converter when the operating mode of MPPT is shifted to minimize the generation of active power throughout the fault period. The secondary control developed for the system shifted the operating point hinge on the voltage-sag depth, reducing the PV power generated and DC power delivered at the DC link. This, in the long run, provided adequate protection for the inverter/converter switches from potential damage, which could be caused by the excessive AC grid current and hike in DC voltage. Without the proposed secondary control, the increasing DC link voltage causes the operating point to shift and limit DC link current. As a result, the DC bus voltage failed to be maintained at the reference even after fault clearance, thereby hampering power delivery.
Furthermore, the control of DC generated power by the PV, and, by extension, the AC grid active power transmitted is associated with the depth of voltage dip the AC grid. Therefore, the active power control is based on a droop relationship between these two parameters, and the inverse proportionate relationship and requirements are exploited to develop the proposed strategy. Hence, the AC grid voltage was closely monitored with the DSC algorithm. The information obtained is directly utilized in the converter's MPPT for alternation between the MPP and FRT operations. Figure 16 illustrates the voltage drop's depth on the main grid, which also compels a consequent rise in the current magnitude as in Figure 17. The immediate current magnitude limitation is created by the secondary power reference integrated into the proposed  Figure 17. At fault inception, the active and reactive current references are changed instantly. Correspondingly, all references are preserved automatically after fault clearance with suitable tuning. Figure 16 demonstrates a seamless transition from pre-fault to a fault and then from fault to post-fault. Therefore, the LC filter's current output from the PV system is adequately constrained, as seen in Figure 17. The 50% voltage drop rate detected at the PCC to the grid is enhanced within 93.32% of the microgrid. The grid voltage sag is detected at 0.1515 ms at the PCC, less than half of the first fault incidence cycle. This indicates that the fault is observed in 1.3001515 s as revealed in the positive half cycle and in the negative half cycle 1300 on the point. Consequently, the FRT scheme fault mode operation is activated with simultaneous switching of the IGBT-diode switched reactor in series with all the phases for balanced transient conditions and series with only the affected phase in unbalanced conditions. Implementing the FRT solutions for PV source in the microgrid application meant that the microgrid voltage would be compensated for in the microgrid's efficient operation independent of the specific transient grid state.

AC Grid and Microgrid Current
Based on its kVA rated values, the fault current restricting this secondary control's potential contributes to the main grid voltage support using reactive power injected. Figure 17 illustrates the corresponding PV based DER current output waveforms with and without the secondary control under 50% voltage sags at the PCC. The current output within the microgrid is appropriately constrained with no substantial distortion in the PV-DER current signals than when the proposed secondary control is not present. Thus, it is clear that the inverter currents are appropriately limited in the first cycle after fault inception at 1.3 s. Consequently, the inverter currents are at 1.3 s, adequately constrained within the first cycle after fault commencement. The 0.00016 delay after the proposed control activation fault is small and negligible. Nevertheless, the inverter semiconductor switches cannot be affected by overcurrent generated between 1.30000 and 1.30016 s. In particular, ages, the excellent signal quality confirms the satisfactory performance of the FRT strategy. As examined, the microgrid voltage display significant-quality waveforms, PV system voltage output, and current. Regarding the output current harmonics, the voltage harmonics are relatively negligible. The reported low THD indicates high efficiency, significant power factor, and low peak current. Tshis demonstrates the efficacy of this proposed FRT approach for secondary control and IEC 61000-3-2 standard compliance [71]:

AC Grid and Microgrid Current
Based on its kVA rated values, the fault current restricting this secondary control's potential contributes to the main grid voltage support using reactive power injected. Figure 17 illustrates the corresponding PV based DER current output waveforms with and without the secondary control under 50% voltage sags at the PCC. The current output within the microgrid is appropriately constrained with no substantial distortion in the PV-DER current signals than when the proposed secondary control is not present. Thus, it is clear that the inverter currents are appropriately limited in the first cycle after fault inception at 1.3 s. Consequently, the inverter currents are at 1.3 s, adequately constrained within the first cycle after fault commencement. The 0.00016 delay after the proposed control activation fault is small and negligible. Nevertheless, the inverter semiconductor switches cannot be affected by overcurrent generated between 1.30000 and 1.30016 s. In particular, grid faults occur practically around the filter capacitor, and the transient current peak at fault commencement disappears almost immediately and thus is overlooked. It should be stated that the excess current in the event of transient interruption is absolutely attenuated where the converters are connected to an electrically weak grid far from the inverter stem placement.

PV Inverter Current and Voltage Harmonics
Following the EN50160 standard for all the phases, the THD of any generating unit's output voltage waveforms shall not exceed 8% [70]. Subsequently, the THDs (before fault, during the fault, and after fault clearance for different fault types causing 50% and 60% voltage sags) of PV voltage signals and output current waveforms are revealed in Table 7 and Figure 18. The THD is evaluated in MATLAB using a quick analysis of the fast Fourier transformation. As reflected in the low THDs of the PV system output current and voltages, the excellent signal quality confirms the satisfactory performance of the FRT strategy. As examined, the microgrid voltage display significant-quality waveforms, PV system voltage output, and current. Regarding the output current harmonics, the voltage harmonics are relatively negligible. The reported low THD indicates high efficiency, significant power factor, and low peak current. Tshis demonstrates the efficacy of this proposed FRT approach for secondary control and IEC 61000-3-2 standard compliance [71]:

Power Generation and Delivery
Following the grid codes, the FRT control structures ensure that comparable reactive power is delivered to support grid voltage sag, thus performing a PV system ride through disturbances. Therefore, the system seamless switch from grid synchronous to an isolated service mode is prevented. The rise in reactive power requirement restricts active power generation for the PV inverters to comply with the FRT approach's apparent power threshold and inverter ratings. The active power curtailment under 50%, 60%, and 70% voltage sag are shown in Figures 19a, 20a and 21a. The reactive power injected supports the voltage recovery within the microgrid and at the PCC through the active power generation and reactive power injection per the depth of voltage sag at the PCC. The improved reactive power production ensures the microgrid voltage is controlled to an appropriate voltage magnitude during the fault duration. At the moment t = 1.8 s, the FRT system automatically detects the rise in the main grid voltage to an allowable point of 0.90-1.10 at the PCC. The reactive power injection is thus limited according to the extent of voltage increase, as shown in Figures 19b, 20b and 21b. Figures 19-21 indicate the rise in injected reactive capacity and a sharp proportional decrease in active power. This FRT regulation's deployment with the DSC algorithms monitors the main grid disruption using the voltage sag sensed at the PCC. The FRT technique restricts active and reactive references in the PV system as needed to trigger microgrid voltage change without major distortion to the DER output current and voltage waveforms. The active power generated by the PV system under 50%, 60%, and 70% voltage sags are summarized in Table 8. Similarly, the PV's reactive power under 50%, 60%, and 70% voltage sags are shown in Table 9.
0.90-1.10 at the PCC. The reactive power injection is thus limited according to the extent of voltage increase, as shown in Figures 19b, 20b and 21b. Figures 19-21 indicate the rise in injected reactive capacity and a sharp proportional decrease in active power. This FRT regulation's deployment with the DSC algorithms monitors the main grid disruption using the voltage sag sensed at the PCC. The FRT technique restricts active and reactive references in the PV system as needed to trigger microgrid voltage change without major distortion to the DER output current and voltage waveforms. The active power generated by the PV system under 50%, 60%, and 70% voltage sags are summarized in Table 8. Similarly, the PV's reactive power under 50%, 60%, and 70% voltage sags are shown in Table  9.       As a result of the voltage sag induced by grid fault, the PV system's total active power supply is reduced. The PV system is controlled to initially inject an active power quantity that satisfies local load demand and thus lessens the active power injection into the faulty main grid, as shown in Figures 22a, 23a and 24a. The amplitude of the system voltage declined during voltage sags. The fault current's intensity is reduced, and the microgrid voltage is enhanced to transmit the active power to the local load. The active power generated is limited to the rated value of the local load under severe voltage sag. Each time an over-generation happens, the excess is transmitted to the failed system. Nevertheless, no active power can be generated for the local microgrid and main grid loads in the severe occurrence voltage sag. Subsequently, according to Spanish grid codes, the PV system reactive power output maximizes host system voltage. The microgrid voltage is regulated within the operating range (0.9-1.1 Spanish grid code) to ensure continuous active power delivery to local sensitive loads, as seen in Figures 22-24. an over-generation happens, the excess is transmitted to the failed system. Nevertheless, no active power can be generated for the local microgrid and main grid loads in the severe occurrence voltage sag. Subsequently, according to Spanish grid codes, the PV system reactive power output maximizes host system voltage. The microgrid voltage is regulated within the operating range (0.9-1.1 Spanish grid code) to ensure continuous active power delivery to local sensitive loads, as seen in Figures 22-24.   The active and reactive power consumptions in the local load are summarized in Tables 10 and 11, respectively. To summarize the proposition implemented in this work, Figure 25 appropriately depicts a grid-supporting solar PV system's trajectories interfaced with the main grid via DC-DC and DC-AC converters during a fault in the grid. Seamlessly switching is achieved between the MPPT (normal operating condition) and FRT (fault operating condition) operating modes with fast dynamics.  Figure 25 appropriately depicts a grid-supporting solar PV system's trajectories interfaced with the main grid via DC-DC and DC-AC converters during a fault in the grid. Seamlessly switching is achieved between the MPPT (normal operating condition) and FRT (fault operating condition) operating modes with fast dynamics.  The primary and the proposed secondary control for the double stage PV sourced microgrid implements an FRT using the DSC fault detection algorithm. Strategic amendments to the traditional primary control system of a grid-supporting system are made. This controller is designed as per the Spanish grid codes stipulations for reactive power injection to achieve a secondary voltage control with a valid and significant operation in the transient fault period. The injected reactive power complies with the required reactive currents based on the percentage voltage drop specified in the emerging grid codes under different voltage sags caused by faults. This scheme prevents the transient AC overcurrent in the microgrid and DC link overvoltage during the AC grid fault. Simultaneously, the DC side over-voltage and AC side over-current are mitigated through active power decrease and current amplitude curtailing strategies in compliance with the complex/apparent power ratings. The DSC algorithms allow for separating the sequence components for dual control at the PCC of the positive-sequence and negative-sequence components during the primary grid disturbance.
The continuous supply to microgrid local sensitive load is ensured while meeting the grid code FRT requirement. Furthermore, the control of DC generated power and, by extension, the AC grid active power transmitted is linked to the depth of voltage dip the AC grid. The active power control is based on a droop relationship between these two parameters, and the inverse proportionate relationship and requirements are exploited in developing the proposed shift in the operating point of the MPPT from MPP to FRT operation. To identify negative sequences and instances of fault in 0.1515 ms, the DSC's sequence identification algorithm is applied to enable the proposed secondary FRT scheme to conform to the grid code stipulations. The DSC detects the grid restoration after fault clearance, and the system switches back to the normal MPPT operating condition.

Conclusions
The secondary control developed involves the calculation of active and reactive power references to determine the amount to generate and inject. The injected reactive power must comply with the required reactive currents based on the percentage voltage drop stipulated in the emerging grid codes under different voltage sags caused by faults. This scheme prevents the transient AC overcurrent in the microgrid and DC link overvoltage during the grid fault. Simultaneously, the active power decrease and current amplitude limiting strategies in compliance with the complex/apparent power ratings mitigate the DC side overvoltage and AC side overcurrent. The DSC algorithms allow for separating the sequence components for dual control at the PCC of the positive-sequence and negativesequence components during a disturbance in the main grid. The developed scheme guarantees inverter protection by ensuring that the current does not exceed the inverter current rating under grid fault conditions. Thus, the converter-based system operates in two non-switching modes of transient and steady-state FRT. The simulation results affirm the good performance of the proposed strategy and its effectiveness. The monitoring of grid voltage is crucial to the FRT operation of the grid-supporting systems. The DSC algorithm accurately tracks the grid voltage level and promptly activates immediately fault is detected. However, the reference current generated at any time, especially under the FRT operation, does not comprise the inverter system protections for both overvoltage and overcurrent by incessant triggering. The DSC detects the grid restoration after fault clearance, and the system switches back to the normal MPPT operating condition.
This active power curtailment is implemented on a PV system assuming uniform irradiance and temperature. Future work is recommended on applying the proposed strategy to a double-stage PV inverter system operating under a variation of irradiance and temperature. Thus, several characteristic linear droop relationships between PV voltage and PV power at different values of irradiance and temperature are created within which the operating points of the system could be shifted.