Abstract
Worsening power quality driven by non-linear and converter dominated loads poses a significant challenge in renewable integrated microgrids. This paper develops and evaluates a coordinated source-filter control framework that (i) determines the optimal pairing of sources (PV, BESS, or grid) with either a Shunt Active Power Filter (SAPF) or a hybrid filter (SAPF + passive LC) employing load current based inverter referencing, and (ii) optimizes power quality via hourly selection of the lowest THD source. The study models a 100 kW three-phase grid-tied solar PV array, a 60 kWh BESS (bi-directional DC-DC interfaced), a three-phase H-bridge inverter, utility grid connection, and PQ devices (SAPF and hybrid filter). Linear (10–60 kW) and non-linear (0–50 kW) loads are applied across four modes: grid-tied PV (no BESS), grid-tied PV + BESS charging, BESS discharge (islanded), and grid only supply. An hourly Genetic Algorithm first selects the lowest THD source without filtering, then escalates only non-compliant hours to SAPF or hybrid filtering, ensuring IEEE 519–2014 THD compliance with minimal intervention. Results show BESS + SAPF maintains sub 5% THD even under heavy non-linear loads; PV requires SAPF + load-current referencing at moderate distortion levels; and the grid under ≥ 50% non-linear loading demands hybrid filtering to reduce THD from over 24% to below 3%. This optimization framework secures full hourly THD compliance, enhances microgrid power quality, and supports reliable renewable integration, thus advancing UN SDG-7.
Similar content being viewed by others
Introduction
Among the numerous challenges confronting humanity in the twenty–first century, climate change stands out as one of the most significant. Rising global temperatures, more frequent extreme weather events, and shifting ecosystems are direct consequences of increasing emissions of heat-trapping gases, largely driven by the combustion of fossil fuels for energy.
According to the Intergovernmental Panel on Climate Change, there is an urgent need to begin the sustained reduction of carbon dioxide and other greenhouse gases so that global warming is contained to 1.5 °C above the pre-industrial era1. The United Nations Sustainable Development Goal 7 (SDG7) also calls for providing access to affordable, reliable, sustainable, and modern energy to achieve sustainability goals2. Transitioning to cleaner energy sources would help reduce climate change’s impacts and achieve certain SDGs.
Among all RES technologies, solar photovoltaic systems draw wide attention due to their scalability, declining costs, and abundance of solar energy. Solar PV-based microgrids will be especially viable for decentralized power generation in off-grid or remote areas. Combined with other energy sources like wind or BESS, these systems will form hybrid microgrids that ensure better energy reliability and flexibility3. While hybrid microgrids facilitate the world toward sustainable energy on one side, they support the reduction of greenhouse gas emissions by offsetting conventional reliance on fossil fuel-based energy generation. However, integrating solar PV systems and hybrid microgrids presents several technical challenges, particularly regarding power quality. Non-linear loads, very common in the modern grid due to the wide use of power electronics, present serious power quality problems4. These loads draw non-sinusoidal currents, creating harmonic distortions that increase system losses, overheating equipment, and reduce efficiency. Addressing these power quality challenges is important to ensure smooth operation for solar PV and hybrid microgrids since these systems are expected to deal with increasingly variable loads.
Some of the advanced filtering techniques used to mitigate THD are Shunt Active Power Filters and hybrid filters5,6. Integrating BESS with solar PV systems allows for balancing energy supply and demand more effectively under fluctuating load conditions. It describes the need to develop a framework for a grid-tied 100 kW solar photo-voltaic system integrated with a BESS, followed by assessing its performance against various operational modes. Accordingly, the paper aims to determine the non-linear load impacts on the power quality and find optimum solutions for mitigating the same contribution to the sustainability and reliability of renewable energy-based microgrids.
Notwithstanding the increased research on integrating renewable energy sources, a proper critical analysis of various topics still shows several gaps that need to be targeted. The research gaps identified are discussed herein.
-
Limited exploration of the impact of Battery Energy Storage Systems integration on total harmonic distortion levels, especially under varying nonlinear loads.
-
Lack of comprehensive analysis of hybrid filters when using solar photovoltaic (PV) systems, BESS, and utility grids.
-
Inadequate recommendations exist for energy management mechanisms in a solar-based system during periods of low irradiance under high nonlinear loads.
-
Lack of clarity on the optimal utilization of BESS or the utility grid during periods of low solar irradiance.
-
There is limited research on comparing BESS and Shunt Active Power Filter performance for THD reduction against standalone solar PV and utility grid supply.
-
Insufficient analysis of the THD levels within the grid under various situations to find effective methods of THD mitigation.
-
Inadequate assessment of the effectiveness of hybrid filters for reducing THD levels under conditions of maximum nonlinear load, which is particularly important when compared with stand-alone solar PV systems.
Literature review
Filtering techniques
Yuan et al.7 studied the harmonic losses in low-voltage distribution networks with integrated distributed PV systems. The results reflect that harmonic losses are around 0.6% of the overall network loss to develop good voltage quality with smaller harmonic distortion and reduce line loss. Ahsan et al.8 investigated the power quality issues in an LV network with integrated PV and concluded that the total harmonic distortion in the current and voltage at the PCC are within the IEEE benchmarks for LV, with values of 5% and 10.2%, respectively, for 50% PV penetration. Al-Sharif et al.9 detailed the harmonics and voltage fluctuations for grid-connected PV rooftops and the development of a single-tuned filter for harmonic reduction of a 9570 kW PV microgrid. The findings show that the suggested filtration method improves power quality for grid-connected PV systems, meeting the IEEE standards for an LV network. Djeghader et al.10 proposed a passive filtering approach for nonlinear loads that cause harmonics in the grid: a case study about a nonlinear load with ratings of 11.8 kW is provided. The simulation testing results indicate that different passive filtering schemes reduce the THD significantly, lying in the range of 10.1% to 4.23%. Mishra et al.11, on the other hand, proposed a two-stage, three-phase grid-connected solar photo-voltaic system using an LCL filter, which provides power quality improvement at the front end with THD coming out as low as 1.70% to the maximum allowable of 5%. Zaro et al.12 investigated a SAPF to enhance the power quality issues in an industrial smart grid, usually caused by photovoltaic inverters and other nonlinear loads. The results indicate that using SAPF reduced the THD in the supply current and can further correct the reactive power compensation and improve the power factor. It was concluded that the SAPF may be one of the solutions to Power Quality Management, system efficiency improvement, and real-time change responses over the grid, mainly due to renewable energy systems. Imam et al.13 developed an active power filter with a shunt for power quality enhancement, showing a significant improvement in current THD from 17 to 2.4%, thus meeting IEEE standards. Devassy et al.14 proposed a system containing a shunt and a series of active filters connected back-to-back with a common DC link. The idea was to solve the integration of power quality improvement with clean energy generation. This system provides continuous power supply to critical loads irrespective of grid availability. Successful operation of the system under various dynamic conditions is demonstrated. Reguieg et al.15 designed a smart controller integrating series and shunt active filters in a PV-based UPQC to address power quality issues under dynamic nonlinear loads. Their system reduced source current THD to 1.35% and source voltage THD to 1.12%, ensuring compliance with IEEE standards. The hybrid approach demonstrated strong adaptability and performance in maintaining grid stability. Salem et al.16 studied the integration of solar PV and conventional networks and the power quality issues arising from intermittency in solar and grid-related aspects. A case study was proposed on a 5.5 kW grid-connected PV system, with the investigation of four harmonic mitigation measures. The study attained a current harmonic limitation of 1.5%, which kept the total harmonic distortion below the threshold of 5%. Reguieg et al.17 proposed a Unified Power Quality Conditioner (UPQC) to mitigate harmonics in grid-integrated PV and wind systems under nonlinear loads. The system achieved a reduction in current THD from over 55% to 1.66–2.23%, and voltage THD from 9.8 to 1.07%. Their dual-control UPQC design ensures improved power quality and grid stability even in extreme conditions.
Inverter control strategies
Lipták et al.18 discussed the operational problems of large photovoltaic systems connected to utility networks, considering total harmonic distortion with variable solar irradiance levels. Results indicated that, at 820 W/m2 irradiances, the total harmonic distortion of the current was 5%, while at lower irradiance of 350 W/m2, it increased to 15%, suggesting the need for better inverter control to meet the IEEE 519-2014 standard. Tandon et al.19 developed a harmonic current controller and an appropriate corrective gating sequence for the IGBT inverter, which resulted in mitigation of the harmonic components and compensation for reactive power. The instantaneous active and reactive power theory-based simulation results showed a considerable reduction of harmonics from the SAPF, reflecting better system performance, especially in networks characterized by nonlinear loads. Souza et al.20 further generalized the MPC concept with FS to SAPFs that enable sinusoidal grid current for high power factors. Experimental results show improved total harmonic distortion levels, conduction, switching, and DC-link loss reduction, demonstrating good response during transients caused by load removal. Chauhan et al.21 integrated BESS with a microgrid for rural electrification. Digital filters were utilized to alleviate harmonics in load voltage, achieving sustained voltage and frequency for non-linear loads with PR control. Results demonstrated a total harmonic distortion of load voltage below 5%, meeting the IEEE 519-2014 standard. Reguieg et al.22 proposed a robust Direct Power Control (DPC) strategy combined with a PV-powered shunt APF. Their simulations show that, under varying loads, the scheme—using P&O-MPPT for energy extraction and adaptive harmonic compensation—significantly reduces THD while maintaining stability in grid-connected renewable systems.
Storage and energy management strategies
Apeh et al.23 discussed that PV systems are growing at an increasing rate and reached a capacity of 37.6 GW in 2017, reaching 600 GW by 2030 and 4500 GW by 2050. Tax credits and subsidies underline the role of government policies in this development. The results suggested that solar energy would create about 10 million permanent jobs per year while considerable investments and policy support could unfold various opportunities regarding the full environmental and financial value of such technologies. Bashiru et al.24 presented the imperative need for transitioning towards renewable energy sources concerning global energy demands and environmental sustainability. RES are emphasized not only for its contribution to emission reduction and energy security but also for pinpointing the challenges: market failures and material constraints. This conclusion was made after policy recommendations that call for a collaborative approach to overcoming such barriers toward attaining sustainable development goals. Basit et al.25 analyzed the environmental and economic viability of RES and their application in microgrid systems. Their study demonstrates that integrating RES into microgrids can achieve colossal savings in GHG emissions and peak energy costs, tame fluctuation of load demands, and reduce losses on the load side. Kar et al.26 assessed the on-grid BESS opportunity for the efficiency and stability of modern electrical power grids. BESS helps balance demand and supply by absorbing excess electricity whenever demand is low and releasing it during the peak or when the generation of variable renewable sources is low. The simulation results prove that BESS is functional and important for sustainability, carbon emission reduction, and grid reliability. Ensuring supply quality within its standard limit is a critical challenge nowadays due to the vast integration of PV systems in low-voltage networks. Mansor et al.27 examined the use of a Unified Power Quality Conditioner (UPQC) supported by a PV system and a Battery Energy Storage System (BESS) to mitigate power quality problems in the grid. Results indicated that the hybrid PV-BESS system is more reliable than a standalone PV-UPQC system. Chapala et al.28 simulated a grid-connected solar PV system with a UPQC-integrated battery. The operation, carried out in various surrounding situations, improved the grid current’s total harmonic distortion from 28.6% to 3.7% under unbalanced load conditions with the PV-battery-integrated UPQC system. Jain et al.29 proposed an improved control strategy for a PV-based UPQC integrated with BESS to enhance power quality under nonlinear and unbalanced load conditions. Their hybrid Hysteresis-MPPT approach achieved a reduction in current THD to 1.86% and voltage THD to 0.91%. The system proved effective in maintaining voltage stability and mitigating harmonics during dynamic disturbances.
In order to solve the above-mentioned research gaps, the following contributions have been made to the proposed study:
Three key extensions to existing PV-BESS and THD-control knowledge are provided by this research. First, a unified two-stage Genetic-Algorithm framework is developed that simultaneously optimizes hourly source allocation (PV, BESS, grid) and the minimum required filter deployment (SAPF versus hybrid) to guarantee IEEE 519 compliance, whereas in prior work these tasks are treated separately. Second, a comprehensive set of non-linear load mixes and operating modes (grid-tied PV, PV + BESS charging, BESS-only, grid-only) is evaluated, and the influence of dynamic load profiles on harmonic generation is quantified; it is shown that BESS paired with SAPF alone maintains sub-5% THD under conditions that defeat conventional PV or grid supply. Finally, the “best source-filter pairing” is identified across all scenarios, demonstrating that BESS + SAPF suffices, PV requires SAPF with load-current referencing, and the grid demands hybrid filtering, thereby providing actionable design guidelines that have not previously been codified.
-
Investigates the impact of Battery Energy Storage Systems (BESS) integration on total harmonic distortion (THD) levels, particularly under varying non-linear loads.
-
Provides a comprehensive analysis of the hybrid filters when using solar-photovoltaic (PV) systems, BESS, and utility grids.
-
Presents recommendations on energy management during low solar radiation where nonlinear loads are high.
-
Explores the best utilization strategies for either BESS or the utility grid during periods of low solar irradiance.
-
Compares the performance of BESS with Shunt Active Power Filters for reducing THD against standalone solar PV systems or utility grid supply.
-
It evaluates the levels of THD within the grid with respect to different scenarios in quest of effective methods for the mitigation of THD.
-
Assesses the performance of hybrid filters at maximum nonlinear load for mitigating THD levels, with particular emphasis on a standalone solar PV system.
The rest of the paper is organized as follows: Section “Materials and methods” briefly describes the materials and methodology used by the proposed study. Section "Results and discussion" discusses the study results and analysis based on the outcome of the studies. Section "Conclusion" concludes the paper.
Materials and methods
In the proposed study, the modelling of a hybrid microgrid is considered, and the Power Quality Improvement is implemented by designing a Passive Filter and a Shunt Active Power Filter using the MATLAB/Simulink R2023b environment. The filters will be implemented in MATLAB to improve total harmonic distortion in the microgrid’s current, as needed.
PV
A Photovoltaic (PV) cell is an electronic component that produces electricity when exposed to the irradiance and temperature of sunlight intensity. When different PV cells are combined, they form a solar panel utilized in different applications to produce electrical energy. The PV is set to give maximum power using a boost converter and MPPT controller. The boost converter is a static converter that acts as an adapter between the PV generators and the load to collect the maximum power generated and transfer it to the load. The MPPT controls the boost converter to achieve maximum efficiency30. Equations 1 and 2 are used for modelling the PV cell. The solar PV with utilized system parameters has shown in Table 1.
Battery energy storage system
Lithium-ion batteries have been utilized in the proposed study as they have better efficiency and reliability than other battery models. The Battery Energy Storage System (BESS) is a backup agent that balances the supply and demand ratio. The BESS model comprises a Li-ion battery connected to a bi-directional DC to DC-buck-boost converter and a PID controller. The buck-boost converter is a bi-directional DC-DC converter that can provide the power flow between the microgrid and battery. In the case of charging, the battery acts as a load, while in the case of the discharging state, the battery acts as a DC source31. A PID controller that regulates the charging-discharging can manage the balance between BESS and microgrid power infrastructure.
Inverter
In the proposed research, a three-phase H-bridge inverter, shown in Fig. 1, is designed to have precise output voltage and frequency control32. The inverter’s control structure may refer to grid or load current. The approaches used in the proposed study are fundamental when determining how inverter control affects power quality and again highlight the importance of an optimized control system design to achieve higher performance. When grid current is used as a reference, the inverter regulates its output based on the grid to supply voltage and frequency regulation, reactive power compensation, and power factor correction. This may result in underestimating the real load variations in some applications.
On the other hand, taking load current as a reference makes the inverter respond directly to the demands of the load with high efficiency and performance, especially for those systems with fluctuating loads33. This may require more careful coordination with the grid control mechanisms to maintain stability and comply with the grid regulations. The choice between grid and load current references depends on the system design, control objectives, and load characteristics. In some cases, both can be used together to reach an optimum between grid support and load responsiveness.
Utility grid
The utility grid in the proposed study is connected to a 60-kW load, comprising both linear and non-linear loads. The utility grid allows the load demand to be uninterrupted.
Passive and active power filter
Unlike linear loads, non-linear loads draw a non-sinusoidal current from a sinusoidal voltage supply. The distortion to the normal incoming sinusoidal current wave can be considered to result from the load emitting harmonic currents that distort the incoming current. The filters utilized in the proposed are classified into passive and shunt active filters.
Passive filters
Passive filters have easy design, simple structure, low cost, and high efficiency. These generally consist of banks of tuned LC filters that suppress the current harmonics produced by nonlinear loads34, as depicted in Fig. 2.
Shunt active power filter
Shunt Active Power Filters are applied to compensate for current harmonics to reduce THD and improve the input power factor to overcome the disadvantages of Passive Filters. A three-phase SAPF consists of a bridge converter and control circuitry, as shown in Fig. 3. The SAPFs are connected in parallel with nonlinear loads and inject harmonic current of the same amplitude but opposite phase with respect to the load harmonics. Due to this, sinusoidal line currents are obtained with a unity power factor35.
Shunt active power filter compensation36.
In Fig. 4, SAPF employs a PWM voltage source inverter to sense the harmonics in the source current and generate the compensating current injected through the PCC. It reduces harmonics, eliminates unwanted frequencies, compensates for reactive power, and corrects waveforms. The SAPF is connected parallel between the load and filter using a DC source37.
The control strategies calculate the compensating current based on waveform, frequency, and time domain analysis. Some techniques, such as the PQ method, operate SAPFs in transient and steady states. In the Hysteresis Current Control feedback PWM method, the actual current tracks the command current within a hysteresis band to ensure dynamic response, ease of implementation, and low cost38.
The PQ theory is utilized to determine active and instantaneous reactive current components. This strategy uses the first Clarke Transform shift current load and source voltage. The two-phase calculation method converts the three-phase measurements into a two-phase model (α & β) using the Clarke transform39.
Both instantaneous real power (P) and instantaneous reactive power (Q) can be calculated by:
where:
P and Q are the average components of real and reactive powers, respectively. The reference compensating currents Ia* and Ib* in a two-phased model can be calculated by:
Compensating current in a three-phased model is mandatory for a three-phased inverter and can be evaluated by applying inverse Clarke transformation:
The basic working principle of the HCC technique is illustrated in Fig. 5. The Hysteresis Current Control (HCC) technique is an instantaneous feedback current control method of PWM, where the current continually tracks the command current within a hysteresis band40.
Hysteresis controller’s band41.
Figure 6 shows a six-pulse generation scheme for driving the inverter switches. The inverter output current follows the reference current through pulses generated by the hysteresis controller. In phase-a, if ica exceeds the upper hysteresis limit, the comparator output is 0; if below the lower limit, the output is 1. The current deviates within the hysteresis band around the reference current.
Microgrid power system and its control
System architecture
The microgrid consists of a 100 kW three-phase grid-tied PV array, a 60 kWh Li-ion BESS, a common DC bus, a three-phase voltage source inverter (VSI) interfacing the PCC with the utility grid, and Power Quality (PQ) devices: a Shunt Active Power Filter (SAPF) and (where needed) a hybrid filter (SAPF + tuned passive LC). Mixed loads include: (i) aggregated linear loads PLL∈[10,60] kW and (ii) a three-phase uncontrolled diode bridge rectifier feeding an RL load (PNLL∈ [0,50] kW) generating current harmonics. The PV array feeds the DC bus via its DC/DC MPPT stage; the BESS connects through a bi-directional DC/DC converter enabling controlled charge/discharge. The SAPF is a current-controlled shunt VSI tied in parallel at the PCC (or embedded logically within the main inverter with separated control layers if a single hardware platform is assumed).
Voltage levels DC bus nominal \({\text{V}}_{\text{dc}}^{\text{ref}}\)(700–800 V) selected to ensure modulation index margin at worst-case AC line voltage sag and to accommodate SAPF current injection headroom.
Operating modes and power flow
Let PPV, PdcBESS, PGrid, PLoad (PLL + PNLL), and PLoss denote instantaneous active powers (positive from source perspective). Power balance on the DC bus (neglecting small capacitor ripple) is:
Modes:
-
i.
Grid-tied PV (no BESS charge) PPV supplies load; surplus exported: PGrid < 0.
-
ii.
PV + BESS charging
$$P_{PV} = P_{Load} + P_{BESS}^{ch} + P_{Grid}^{exp}$$(19) -
iii.
BESS discharge (Island)
$$P_{BESS}^{dis} = P_{Load} + P_{Loss} \cdot \left( {\text{grid absent}} \right)$$(20) -
iv.
Grid only
$$P_{Grid} = P_{Load} \cdot \left( {\text{PV irradiance low and BESS unavailable}} \right)$$(21) -
v.
Hybrid with filters SAPF / hybrid injects harmonic and (optionally) reactive currents: \({P}_{SAPF}\approx 0\) (ideally only reactive/ harmonic compensation) while maintaining its DC link.
PV subsystem and MPPT control
A DC/DC boost converter regulates PV array operation. The Perturb & Observe (P&O) MPPT updates duty ratio DPV based on incremental power change ΔPPV and voltage step ΔVPV:
-
If \(\Delta {P}_{PV}/\Delta {V}_{PV}>0\), continue perturb direction, else reverse. A low-pass filtered PV current IPV and voltage VPV provide power \({P}_{PV}={V}_{PV}{I}_{PV}\). MPPT bandwidth is set lower than DC bus regulation loop to avoid interaction (e.g. MPPT update every few milliseconds vs DC bus loop at kHz).
BESS bi-directional converter control
The BESS DC/DC (half-bridge or full-bridge) enforces commanded charge/discharge current \({I}_{BESS}^{ref}\) derived from SoC control and system power balance:
SoC update:
A cascaded loop: outer DC bus or SoC regulator sets power/current reference, inner fast current loop (PI/PID) controls inductor current. PID gains Kp, Ki, Kd were selected via:
-
1.
Small-signal linearization of converter around nominal current.
-
2.
Fine tuning to achieve less than 5% overshoot and less than 10 ms settling time under ± 20% rated current steps.
Main inverter (grid / load interface)
A three-phase VSI with Sinusoidal PWM or Space Vector Modulation regulates grid currents. Two reference generation modes:
-
Grid Current Referencing Set \({i}_{abc}^{ref}\) to deliver scheduled active power \({P}^{ref}\) (and optionally zero reactive) aligning d-axis current.
$$i_{d}^{ref} = 2P^{ref} /\left( {3V_{d} } \right)$$(24)$$i_{q}^{ref} = 0$$(25) -
Load Current Referencing Measure load current \({i}_{L,abc}\), and extract fundamental positive sequence component \({i}_{L,abc}^{fund}\) (via synchronous reference frame (SRF) PLL). Command inverter to supply that fundamental portion: \({i}_{abc}^{ref}={i}_{L,abc}^{fund}\), shifting harmonic/residual components to SAPF or grid depending on mode, lowering grid-side THD.
A PLL estimates grid angle θ. Following shows the dq current control equations:
Similarly for q-axis, feedforward of grid voltage accelerates dynamic response.
Adaptive reference mode switching To enhance inverter performance under varying harmonic distortion, a supervisory scheme dynamically switches between reference modes:
-
1.
Measure THD Compute current THD over a sliding window (e.g., 100 ms).
-
2.
Mode decision
-
a.
THD ≤ 3%: use grid-current referencing
-
b.
THD ≥ 5%: use load-current referencing
-
c.
3% < THD < 5%: hold current mode
-
a.
-
3.
Smooth transition Blend references over 20 ms to avoid transients.
This adaptive logic minimizes unnecessary filter activation and ensures IEEE 519–2014 compliance under dynamic loads.
Shunt active power filter (SAPF) control
The SAPF measures load (or grid) currents \({i}_{L,abc}\) . Harmonic reference extraction uses p–q theory or SRF method (describe chosen one):
-
SRF method Transform \({i}_{abc}\to {i}_{dq}\) using PLL angle. Low-pass filter fundamental components \(\widetilde{{i}_{d}}\), \(\widetilde{{i}_{q}}\). Harmonic components: \({i}_{d}^{h}={i}_{d}-\widetilde{{i}_{d}}\) , \({i}_{q}^{h}={i}_{q}-\widetilde{{i}_{q}}\). Inverse transform yields harmonic current reference \({i}_{h,abc}^{ref}\). SAPF commands injection \({i}_{f,abc}^{ref}=-{i}_{h,abc}^{ref}\).
-
A DC link voltage regulator ensures SAPF internal DC capacitor voltage \({V}_{dc,f}\approx {V}_{dc,f}^{ref}\):
$$i_{dc}^{ref} = K_{pv} \,\left( {V_{dc,f}^{ref} - V_{dc,f} } \right) + K_{iv} \,\smallint \left( {V_{dc,f}^{ref} - V_{dc,f} } \right)\,{\text{d}}t$$(27)
Its fundamental active current component is superimposed to compensate internal losses.
Hybrid filter (SAPF + passive LC)
When high, concentrated harmonic orders (e.g. 5th, 7th) dominate and SAPF current rating would be exceeded or residual THD > 5%, a tuned LC branch provides low-impedance paths for selected orders. The SAPF then focuses on residual/uncharacteristic harmonics and dynamic components, lowering its current stress and switching losses. Following are the Passive filter reactances:
Coordination and decision logic (optimization layer)
A two-stage Genetic Algorithm (GA) provides hourly decisions over a 24-h horizon.
Chromosome structure
For each hour t, gene pair (St, Ft) where St ∈ {PV, BESS, Grid}, Ft {0 = No Filter, 1 = SAPF, 2 = Hybrid}. Stage 1 fixes Ft = 0, to obtain minimal raw THD schedule; hours where THDt > 5% are flagged. Stage 2 releases Ft only for flagged hours, allowing escalation to SAPF or Hybrid while possibly re-selecting source St to reduce total filter hours.
Fitness function
The GA is configured with a population size of 50 and allowed to run for 100 generations, which is sufficient for convergence in the proposed study. Tournament selection has been in the GA (tournament size = 3), single-point crossover with probability pc = 0.8, and bit-flip mutation with probability pm = 0.02. The fitness function was defined to minimize three key objectives:
maximum hourly THD, average THD, and total filter usage, while penalizing source switching.
where Nswitch penalizes source transitions; HSAPF; HHybrid are total activated hours; wi chosen (e.g. w1 > w2) to enforce IEEE 519 constraint priority.
GA operators
Tournament selection, single-point crossover (prob. pc ), mutation on gene pairs (prob. pm ) with feasibility repair (enforcing PV availability window and BESS SoC bounds). Convergence when maxt \(THDt\le 5\%\) and improvement < ε over N generations.
Sequence of control execution (within each hour)
-
1.
Update irradiance & load forecast → availability constraints.
-
2.
GA schedule selects St; dispatch command sent to PV/BESS/grid.
-
3.
Determine reference mode (grid-current or load-current) based on StS_tSt and expected harmonic profile.
-
4.
Measure instantaneous THD (sliding FFT / IEC window). If > 5% and Ft = 0, escalate per GA plan to SAPF; if still > 5%, activate hybrid.
-
5.
Update SoC and DC bus control loops; ensure SAPF DC link regulation.
-
6.
Log THD, filter status, energy flows for next GA refinement (if adaptive variant used).
Protection and constraints
-
SoC limits SoCmin prevents over-discharge; SoCmax prevents over-charge during high irradiance.
-
Current limits Inverter and SAPF reference magnitudes saturated to rated currents to avoid over-modulation.
-
Filter resonance avoidance Damping resistor Rd or active damping control included in hybrid LC design to mitigate parallel resonance with grid impedance.
Performance metrics
Primary: Hourly current THD, maximum daily THD, total filter activation hours, energy not served (if any), switching count. Secondary: DC bus voltage deviation, BESS SoC trajectory, SAPF average current utilization, as shown in Fig. 7.
Microgrid power quality optimization strategy
Genetic Algorithms are nature-inspired optimization techniques inspired by the process of natural selection. The method first generates a population of candidate solutions to a problem, with every individual solution termed a chromosome. These undergo an iterative evolution through selection, crossover, and mutation cycles, as depicted in Fig. 8. In each generation, the fittest individuals, evaluated by a fitness function, are chosen to produce offspring for the next generation so that after some time, the algorithm will converge to the optimal or near-optimal solution. Genetic algorithms are especially effective in solving complex, multi-variable optimization problems for which classical analysis methods may be inefficient or impracticable.
In terms of power quality, using GA, power sources and filter configurations are encoded so that different power sources generate different combinations as chromosomes while the fitness function makes each such combination evaluate for its best performance in minimizing THD. Such algorithms are iterative and converge for a blend of power sources and filtering devices to yield optimum microgrid performance. The adaptive approach puts the power quality at its best while keeping system efficiency at its maximum by dynamically acting upon the changing load condition and source availability. Genetic algorithms have proven viable solutions for managing power quality in the microgrid environment through automation of source allocation and filter selection, and hence, they contribute toward grid stability with sustainable energy integration.
In the proposed study, the genetic algorithm has played a significant role in achieving optimal power quality with a minimum THD for the microgrid and analyzing various power sources, such as Solar PV, BESS, and the Grid, operating under widely changing load conditions. In this respect, using GA, the system dynamically chooses the most appropriate power source at every hour of the day and prioritizes the one with the minimum THD. It ensures that standards regarding IEEE 519–2014 are accomplished, where a 5% maximum is allowed on THD. When the THD exceeds the permitted limit, the algorithm will start corrective actions, such as filter reconfiguration or load redistribution, to recover the power quality.
Framework of study
The flowchart illustrated in Fig. 9 is based on a structured methodology for analyzing and attenuating THD in the configuration of a microgrid with various power sources and filtering devices, concerning IEEE 519–2014. This starts with the initialization and parameterization of the microgrid to test different configurations such as Solar PV only, Grid, or both in this case. Its framework branches into three pathways: Battery Energy Storage System, Power Quality-PQ devices such as filters, and BESS with PQ devices. Each configuration is subjected to linear and nonlinear loads, with distribution determined by percentage parity.
Solar PV charges the BESS in the left branch, which feeds the combination of loads. Then, it is subjected to the THD analysis to see whether it is within the IEEE standard’s limit. If it is within the limit, then the process gets successfully terminated. If it is out of limit, then corrective measures like redistribution of load and filter reconfigurations are performed. The middle branch combines solar PV with either Grid or their combination and integrates with PQ improvement devices so that it can mitigate power quality problems brought about by the presence of non-linear loads that could increase the THD by as many folds. These filters are to minimize such distortions and comply with the standards of power quality. BESS in the rightmost branch is interfaced with PQ devices to feed the complex loads. This hybrid configuration leverages the energy storage benefits while ensuring that THD levels are managed by applying filters. In this regard, THD analysis is an important process in which continuous assessment and iterative improvements are performed until the system meets the required power quality standards.
Only upon the completion of the THD analysis for all the configurations, the successful scenarios pass through the Power Quality check to identify how good the mitigation strategies are when applied. The results are later systematically tabulated and compiled into an integrated dataset, showing THD evaluation results for each tested scenario. The above-structured approach delivers a set of comprehensive evaluations from different configurations; therefore, an optimum configuration combination may come out as one to enhance microgrid power quality.
Results and discussion
Grid-tied solar PV system without bess charging
In the grid-tied mode, the microgrid utilizes a 100-kW solar PV system as its primary source to supply loads and feed surplus energy back into the grid, with no charging of the battery occurring. This study examines four scenarios to assess solar PV’s power quality in grid-tied operation, as shown in Table 2. Additionally, it utilizes data from these scenarios to evaluate total harmonic distortion and determine the necessity of implementing a Shunt Active Power Filter or Hybrid Filter.
A 100 kW PV system is integrated with a utility grid. The PV system supplies 60 kW of power to the Linear & Non-Linear Load and the rest of the 40 kW of power to Grid. The system is tested with different Linear & Non-Linear load values, and %THD of grid current is checked when PV operates under normal inverter operation (without load’s reference in its control) and with the load-controlled inverter. If the %THD of grid current becomes more than 5%, i.e., the rated IEEE 519–2014 power quality standard, then the shunt Active Power Filter caters to those harmonics. If the %THD still does not get into the required range of harmonics, then a hybrid filter (combination of Shunt APF and tuned Passive filter) is used to lower those harmonics and make sure that the system follows the IEEE 519–2014 standard so that the power quality does not get compromised. The improvement of power quality between SAPF, passive Filter, and hybrid filter (combination of SAPF and passive filter) is also compared. The THD analysis and results for four different percentages of loads have been discussed as follows:
Scenario-1: 100% linear load
In Figs. 10, 11, 12, Active Power of all the sources, Grid current, and Load currents are shown respectively. As the 60-kW load comprises a Linear Load, no non-linearity is observed while performing the FFT analysis of the grid current as shown in Fig. 13a–c, where the PV side inverter does not use load current for generating current reference, total harmonic distortion comes out to be 1.23%, whereas, in Fig. 13d, THD comes out to be 0.3%. As the grid current’s THD is well below 5%, there is no need to use active power filters, passive filters, or hybrid filters.
Scenario-2: 75% linear load, 25% non-linear load
In this scenario, 60 kW of total load is divided into 45 kW of linear load and 15 kW of non-linear load, as shown in Fig. 14. The non-linear load draws a non-sinusoidal current, making the current going into the grid non-linear, as shown in Figs. 15, 16, respectively. FFT analysis of the grid current is performed to observe the total harmonic distortion that the 15-kW non-linear load adds to the system. Figure 17a, b shows grid current comparison under different Inverter control’s reference conditions. In Fig. 17c, where the PV side inverter does not use load current for generating current reference, total harmonic distortion comes out to be 7.49%, more than 5%. Hence, it violates the IEEE 519–2014 standard. Meanwhile, in Fig. 17d, where the load current’s reference is generated, THD comes out to be 4.03%. No filter is used in this case, as the grid current’s THD in Fig. 17d is still below 5%.
Scenario-3: 50% linear load, 50% non-linear load
In this scenario, a 60-kW load is divided into 30 kW of linear load and 30 kW of non-linear load, as shown in Fig. 18. The non-linear load draws a non-sinusoidal current, making the grid current non-linear, as shown in Fig. 19. The difference between the sine waves of Grid Current in different scenarios is illustrated in Fig. 20. FFT analysis of the grid current is performed to observe the amount of THD that the 30-kW non-linear load adds to the system. In Fig. 21a, where the PV side inverter does not use load current for generating current reference, total harmonic distortion comes out to be 24.86%, more than 5%. Hence, it violates the IEEE 519–2014 standard. Meanwhile, in Fig. 21b, where the load current’s reference is generated, THD comes out to be 13.19%. As the grid current’s THD in Fig. 21b is still above the threshold of 5%, so there is a need to use a filter to mitigate the excess harmonics of the system. Thus, the Shunt Active Power Filter (SAPF) is used in Fig. 21c. SAPF successfully reduces the THD of grid current to 3.87%, under the threshold value.
Scenario-4: 20% linear load, 80% non-linear load
In this scenario, 60 kW load is divided into 12 kW of linear load and 48 kW of non-linear load, as shown in Fig. 22s. The difference in the waveform of Grid Current in different scenarios is depicted in Fig. 23. FFT analysis of the grid current is performed to observe the amount of THD that the 48-kW non-linear load adds to the system. In Fig. 24a, where the PV side inverter does not use load current for generating current reference, total harmonic distortion comes out to be 45.79%, more than 5%. Hence, it violates the IEEE 519–2014 standard. Meanwhile, in Fig. 24b, where the load current’s reference is generated, THD comes out to be 26.68%. As the grid current’s THD in Fig. 24b is still above the threshold of 5%, a filter is needed to mitigate the excess harmonics. In Fig. 24c SAPF mitigates the harmonics. The THD comes out to be 8.16%, violating the IEEE 519–2014 standard. So, Hybrid Filter is used in Fig. 24d. It successfully reduces the THD of the grid current to 4.76%, which is under the threshold value.
Special scenario: effect of different irradiance levels on %TDD (linear load = 75%, non-linear load = 25%)
In this scenario, the linear load is 45 kW, and the non-linear load is 15 kW. When solar irradiance reduces, the fundamental current component decreases correspondingly, rendering total harmonic distortion (%THD) ineffective for measuring power quality. Hence, Total Demand Distortion (%TDD) is employed during this period. Despite the consistency in overall demand, TDD does exhibit a slight variation, shifting from 4.03 to 3.73%, as shown in Fig. 25.
Grid-tied solar PV system with bess charging
In this case, BESS is added to the 100-kW grid-tied solar PV system. The microgrid utilizes solar PV as its primary power source to supply loads, charge BESS with the surplus energy and feed the rest of surplus energy, if present, back into the grid. This study examines four scenarios to assess solar PV’s power quality in grid-tied operation with BESS as an additional load, as shown in Table 3. Additionally, it utilizes data from these scenarios to evaluate total harmonic distortion and determine the necessity of implementing a Shunt Active Power Filter or Hybrid Filter.
Scenario-1: 100% linear load
Of the 100 kW of solar PV power that is available, 60 kW is used by linear loads, and 10 kW of power is used by the battery to charge it. The remaining 30 kW of power is fed into the grid, as in Fig. 26. Different control strategies for the Inverter are illustrated in Fig. 27. When the grid current is analyzed using the FFT analysis, no non-linearity is found because the 60-kW load is entirely composed of linear load. Total harmonic distortion (THD) is found to be 0.54% in Fig. 28a, when the PV side inverter does not employ load current to provide current reference, and 0.39% in Fig. 28b. There is no need to use hybrid, passive, or active power filters because the grid current’s THD is far below 5%.
Scenario-2: 75% linear load, 25% non-linear load
In this case, a 60-kW load is split into a 45-kW linear load and a 15-kW non-linear load. 10 kW of the total PV power is supplied to the battery for charging. The remaining 30 kW of power is fed into the grid, as shown in Fig. 29. The behavior of Grid current in different scenarios is illustrated in Fig. 30. To see how much THD is added to the system by the 15 kW non-linear load and battery charger, an FFT analysis of the grid current is carried out. The total harmonic distortion in Fig. 31(a), where the PV side inverter does not use load current for generating current reference, is 8.89%, above the 5% threshold. As a result, it violates the IEEE 519–2014 standard. Whereas in Fig. 31(b), THD equals 7.53%, where the load current reference is generated. The grid current’s THD in Fig. 31(b) is still higher than the 5% threshold. Therefore, Shunt Active Power Filter (SAPF) is used in Fig. 31(c). Grid current’s THD is successfully lowered by SAPF to 1.6%, well below the limit.
Scenario-3: 50% linear load, 50% non-linear load
In this scenario, 60 kW load is divided into a 30-kW linear load and a 30-kW non-linear load. The battery receives 10 kW of the total PV power for charging. 30 kW of the remaining power is supplied to the grid, as shown in Fig. 32. The difference in the waveforms of Grid current in various scenarios is shown in Fig. 33. An FFT analysis of the grid current is performed to determine how much THD is added to the system by the 30 kW non-linear load and the battery charger. When the PV side inverter does not use load current to provide current reference, as in Fig. 34a, the total harmonic distortion comes out to be 23.59%, which is higher than the 5% standard. It thereby transgresses the IEEE 519–2014 standard. Whereas in Fig. 34b, when the load current reference is generated, it has a THD of 21.79%. The THD of the grid current in Fig. 34b is significantly greater than the 5% cutoff. As a result, Fig. 34c uses a Shunt Active Power Filter. SAPF successfully reduces the THD of grid current to 4.68%, hence satisfies the standard limits.
Scenario-4: 20% linear load, 80% non-linear load
A 60-kW load in this case is split into a 12-kW linear load and a 48-kW non-linear load, as shown in Fig. 35. The different waveforms of Grid Current in different scenarios are depicted in Fig. 36. The total harmonic distortion in Fig. 37(a), where the PV side inverter does not employ load current for generating current reference is at 46.66%, greater than 5% limit. As a result, it defies IEEE 519–2014. In contrast, THD is found to be 41.47% in Fig. 37b, where the load current’s reference is generated. Filters must be used to reduce the surplus harmonics because the grid current’s THD in Fig. 37b is still higher than the 5% standard. SAPF is utilized in Fig. 37c to reduce the harmonics. THD comes out to be 10.48%, violating the IEEE 519–2014 standards. Thus, hybrid filters are being used in Fig. 37d. Grid current’s THD is successfully lowered to 4.79%, which is below the threshold. The 48-kW non-linear load and the battery charger as shown in Fig. 38, contribute a certain amount of THD to the system, which is observed by FFT analysis of the grid current.
Special scenario: effect of different irradiance levels on %TDD with SAPF (L.L = 50%, N.L.L = 50%)
In this scenario, the linear load is 30 kW, and non-linear load is 30 kW, and a Shunt Active Power Filter (SAPF) is connected with it. When solar irradiance level reduces from 1000 to 800 W/m2, the fundamental component of current decreases correspondingly, rendering total harmonic distortion (%THD) ineffective for measuring power quality. Hence, Total Demand Distortion (%TDD) is employed during this period. Despite the consistency in overall demand, TDD does exhibit a slight variation, shifting from 20.44 to 18.79%, as shown in Fig. 39.
Bess discharge mode
In this case, BESS is used as a primary power source to supply the loads while solar PV system and grid are absent. This study examines four different scenarios to assess the power quality of the input power of the BESS’s inverter, which ultimately feeds the loads as shown in Table 4. Additionally, it utilizes data from these scenarios to evaluate total harmonic distortion and determine the necessity of implementing Shunt Active Power Filter or Hybrid Filter.
Scenario-1: 100% linear load
In this case, neither PV nor grid power is available. The 60-kW linear load is supplied by a 60-kWh battery energy storage system (BESS). Unlike in prior cases, where the grid was connected to the system, no power is sent to the grid. The BESS delivers dc power, which is converted to ac power using an h-bridge inverter. The input voltage and current of this inverter are analyzed using FFT. There is no nonlinearity observed as the 60-kW load is fully linear. The total harmonic distortion (THD) of voltage is 0.64%, and the THD of current also comes out to be 0.64%, as in Fig. 40. Hence, the power quality standard is being observed.
Scenario-2: 75% linear load, 25% non-linear load
In this scenario, the 60-kW load is divided into 45 kW of linear load and 15 kW of nonlinear load. The entire load is supplied by a 60-kWh battery energy storage system (BESS). Therefore, no power is transferred to the grid. The input voltage and current of BESS-connected inverter are analyzed using FFT. Total harmonic distortion (THD) of input voltage comes out to be 5.06%, which is less than the 8% limit of the IEEE 519–2014 power quality standard for voltage, and current THD is 3.73%, as in Fig. 41, which is less than the 5% limit of the IEEE 519–2014 power quality standard for current. Consequently, the power quality requirement is being followed.
Scenario-3: 30% linear load, 30% non-linear load
In this scenario, the 60-kW load is divided into 30 kW of linear load and 30 kW of nonlinear load. A 60-kWh battery energy storage system (BESS) supplies the whole load. Thus, no electricity is fed into the grid. The output voltage and current waveforms are shown in Fig. 42. FFT is used to analyze the input voltage and current of the BESS-connected inverter. The results show that the input voltage’s total harmonic distortion (THD) is 10.82% higher than the standard voltage limit and the current THD is 7.72% higher than the standard current limit. To reduce these high harmonics, Shunt Active Power Filter (SAPF) is employed. The input voltage and current’s %THD after connecting SAPF are 2.63% and 1.96%, respectively, as in Fig. 43. As a result, the criteria for power quality is being met.
Scenario-4: 20% linear load, 80% non-linear load
In this case, the 60-kW load is split into a linear load of 12 kW and a nonlinear load of 48 kW. The entire load is supplied by a 60-kWh battery energy storage system (BESS). The input voltage and current of the inverter, as in Fig. 44 linked to the BESS are analyzed using FFT. The total harmonic distortion (THD) of the input voltage is 16.01%, greater than the standard voltage limit, and the THD of the current is 11.43% (Fig. 45), higher than the standard current limit, according to the IEEE 519–2014 standard. The use of SAPF lowers these high harmonics. After connecting SAPF, the input voltage and current have %THD values of 3.05% and 2.62%, respectively, as in Fig. 45. Consequently, the requirements for power quality are being fulfilled with BESS working in the discharge mode, as shown in Fig. 46.
Standalone grid mode
In this case, Grid is the only active power source in the microgrid supplying the loads. The solar PV system and BESS are considered absent. This study examines four different scenarios to assess the power quality supplied by the grid with both linear and non-linear loads. Additionally, it utilizes data from these scenarios to evaluate total harmonic distortion and determine the necessity of implementing Shunt Active Power Filter or Hybrid Filter as shown in Table 5.
Scenario-1: 100% linear load
A utility grid provides 60 kW of linear load in this case. The system exhibits no non-linearity since the load consists entirely of linear loads. FFT analysis of grid current is also performed to determine the quantity of harmonics, if any. Total harmonic distortion comes out to be zero as in Fig. 47, indicating that load is completely linear, and hence meets the IEEE 519–2014 standard.
Scenario-2: 75% linear load, 25% non-linear load
In this case, the 60-kW load is split into 45 kW of linear load and 15 kW of non-linear load. The non-linear load draws non-sinusoidal current, making the grid current non-linear as in Fig. 48a, b. FFT analysis of grid current is used to determine how much overall harmonic distortion the 15 kW non-linear load adds to the system. Total harmonic distortion of grid current comes out to be 7.70%, which exceeds the 5% limit as in Fig. 49a. As a result, it violates the IEEE 519–2014 standard. To reduce the harmonics, SAPF is connected. After applying SAPF, the %THD is reduced to 1.99% as in Fig. 49b, indicating that the standard is now being met.
Scenario-3: 50% linear load, 50% non-linear load
In this scenario, the 60-kW load is divided into 30 kW of linear and 30 kW of nonlinear load. The 30-kW non-linear load draws non-sinusoidal current, causing the grid current to be nonlinear. Waveforms of the actual grid current and with different filters are shown in Fig. 50. FFT analysis of grid current is performed to estimate how much overall harmonic distortion the 30-kW non-linear load introduces into the system (Fig. 51). The total harmonic distortion of grid current is 15.33%, hence goes against the IEEE 519–2014 standard. To decrease harmonics, a Shunt Active Power Filter (SAPF) is installed. After applying SAPF, the %THD is lowered to 5.60%, however it remains above the 5% threshold. As a result, a hybrid filter consisting of a SAPF and an LC filter is currently utilized to reduce the harmonics caused by SAPF alone. After applying the hybrid filter, the %THD equals 0.99%, indicating that the standard has been satisfied.
Scenario-4: 20% linear load, 80% non-linear load
In this case, the 60-kW load is separated into 12 kW of linear and 48 kW of non-linear loads. The 48-kW non-linear load draws non-sinusoidal current, resulting in non-linear grid current. The actual grid current and with different filters applied, is illustrated in Fig. 52. An FFT analysis of grid current is performed to determine how much total harmonic distortion the 48-kW non-linear load puts into the system as in Fig. 53. The total harmonic distortion of grid current is 24.43%, which contradicts the IEEE 519–2014 standard. To reduce harmonics, a Shunt Active Power Filter (SAPF) is implemented. After using SAPF, the %THD is reduced to 11.24%, however it still exceeds the 5% requirement. As a result, a hybrid filter made up of a SAPF and an LC filter is now used to decrease the harmonics faced by the SAPF alone. After using the hybrid filter, the %THD is 2.85%, indicating that the criteria is now met.
Power quality optimization in microgrid operation modes
The graph shown in Fig. 54, shows the variation in THD for three power sources, namely Solar PV, BESS, and the Grid, while supplying a non-linear load over a period of 24 h. This is because of two most prominent peaks existing at the non-linear load at around the 12th hour with a peak close to 45 kW and another near the 20th hour about 35 kW. Also, these peak load conditions of sources make a crucial bearing on the levels of the THD.
The grid usually shows the highest values of THD in general during the day and particularly at peak load hours. The distortion further increases steadily, reaching its maximum in the high-demand period of the grid, providing evidence of its inability to handle non-linear loads. In contrast, BESS has the lowest THD, maintaining minimum THD levels even at peak load. This shows how efficiently the BESS can provide clean power to non-linear loads. Solar PV operates at a medium scale, with its THD always below the grid and above BESS. The THD of all sources is drastically reduced during low-load periods, such as between the 12th and 14th hours.
At certain hours, there exist intersections of the THD levels for the different sources when their performances have seemed similar for a particular load level. For example, the early morning 2nd hour, the grid and Solar PV have almost the same THD value due to low demand for load. In the 14th hour, the levels of distortion in the grid and BESS are similar; such another intersection is observed about the 20th hour, wherein during the load peak, the THD of the grid and Solar PV seems almost to meet each other.
This analysis gives the inference that, during peak non-linear load conditions, priority should be given to the BESS for minimum THD, while Solar PV can be utilized effectively under moderate load conditions. As the grid has a higher THD, it should be reserved for periods of low demand. This source allocation strategy agrees with the usage of genetic algorithms for the dynamic selection of sources by taking real-time THD levels and variations in loads as an input to improve power quality in microgrid systems.
The graph illustrated in Fig. 55, represents THD levels of Solar PV, BESS, and the Grid over 24 h under the influence of non-linear loads. This will serve as a basis for comparison and for determining the best source to be allocated at each hour based on the lowest THD level. The analysis also considers the unavailability of Solar PV after the 19th hour, i.e., 7 PM and BESS is unavailable between 11 and 16th hour, i.e., 11 AM to 4 PM, as it is being charged during this time. The non-linear load profile peaks around 12th and 20th hour, which influences the THD levels of the sources considerably. It has been observed that, in all sources, the THD increases steadily with the increase in load during the early hours of the day.
During the first peak load period around the 12th hour, BESS is not available. At that moment, the Grid, having a little less THD compared to Solar PV, became the most favorable source. Beyond the 16th hour, again, BESS started to become available with continuous low THD hence becoming the most suitable source of the period for power allocation. From the 19th hour (7 PM) onwards, Solar PV is not available and there will be a need to choose between BESS and Grid. The second load peak occurs around the 20th hour. Regarding power quality, BESS exhibits the lowest THD compared to Grid. The lower the THD while the load decreases after the 21st hour, the better the performance of BESS and the Grid. The graph shows obvious periods where each source has the least THD and should guide the allocation strategy.
For example, the BESS selection provides the minimum THD during its availability, especially at late afternoon and evening hours. Otherwise, the Grid selection is done whenever Solar PV and BESS are not available, normally under peak load conditions. The higher the THD, the worse the power quality. This comparison underlines the importance of choosing the source with a minimum THD in order to have high-quality power in the microgrid systems with nonlinear loads.
The graph depicted in Fig. 56 compares the THD levels for three sources: Solar PV, Battery Energy Storage System (BESS), and the Grid, each interfaced through a Shunt Active Power Filter. In this work, a Shunt Active Power Filter has been deployed to damp harmonic distortions caused by highly nonlinear loads, thus making such loads compliant with the IEEE 519–2014 standard with its limit of 5% maximum total harmonic distortion.
Accordingly, THD is significantly reduced from the precedent cases for all three sources with the implementation of the SAPF. Over the full 24 h, the best performance of BESS has a THD level way below the threshold at 5% even when under peak loading conditions. The result represents that BESS is therefore very effective in ensuring a fine performance in power quality by mitigating or eliminating harmonics with a proper combination with SAPF. However, Solar PV has also recorded better performance at the installation of a SAPF-increased from 6 to an average below 3 percent, and during peak-load hours-such as every 10th and 20th hour-it largely exceeds its THD, which amounts to more than 5%. Grid supplied with active filtering benefits while still exceeding THD at higher percentages compared to that emitted by either Solar PV or the BESS. Its own THD reaches beyond 10% during every peak period.
The results obtained depict that the Shunt Active Power Filter significantly enhances power quality for all sources. However, BESS, along with SAPF, performs the best in reducing harmonic distortion and maintaining THD levels within acceptable limits set by IEEE 519–2014. This shows that in microgrid systems with nonlinear loads, BESS is the best source when optimal power quality is to be achieved.
In Fig. 57, the graph illustrates the THD levels of Solar PV and the grid after the application of the Hybrid Filter, which consists of both SAPF and Passive Filter, applied selectively, to meet the IEEE 519–2014 standard. When the THD was less than 5%, just with the SAPF, Hybrid Filter was not used and therefore zero THD level is shown in the graph during those periods. In the case of Solar PV, %THD has a peculiar peak at the 9th and 10th hours of values exceeding 4.5%; it is where Hybrid Filter is used for mitigation of such distortions.
Therefore, for the periods other than mentioned, the THD is kept to zero. That means for this period, SAPF is enough to maintain THD below its acceptable limit. Similarly, for the grid, there is a surge in the THD values between 8 to 13 h, having its peak about 3%, where the application of a Hybrid Filter can be seen. For other ranges, it shows zero harmonic distortions regarding the grid current. The effectiveness of SAPF comes into play because during these intervals, it worked effectively. The graph shows that the Hybrid Filter is used only in the case of high distortion caused by nonlinear loads. This ensures better quality of power at optimal usage of filtering resources. BESS is not used in this graph, as it maintained THD below 5% with SAPF alone in the previous case. This is the strategy of selective filtering to ensure efficient compliance with the standards of power quality.
Table 6 summarizes the extreme THD values seen in each operating mode and quantifies the effectiveness of SAPF and hybrid filters in driving all cases below the 5% IEEE 519 limit. Overall, BESS with SAPF achieves a 76% reduction in worst-case THD (16.01 to 2.62%), and grid-only with hybrid filtering delivers an 88% reduction (24.43 to 2.85%
Conclusion
Challenging issues related to climate change and the increasing demand for power presents a critical need for a transition in energy sources from conventional to renewable. The effective integration of renewable energy sources, including wind and PV, into existing power grids faces several challenges, particularly regarding grid stability and power quality under the influence of non-linear loads. This research carries out a comprehensive and deep-embedded study on the integration of a 100-kW three-phase grid-tied solar PV system with a Battery Energy Storage System (BESS) under non-linear loads. Four cases are analyzed to enhance grid stability and improve the energy management strategy. The simulation results illustrate that the THD levels of the BESS-supplied loads decrease significantly compared to other cases.
This study shows that changes in solar irradiance reflectively cause the sun’s variation or directly affect the occurrence of issues emanating from poor power quality in grid-connected solar photovoltaic (PV) systems. For instance, in the case of dropping solar irradiance with a 75% linear load and a 25% non-linear load, when the irradiance level drops from 1000 to 800 W/m2, the %THD of grid current rises from 4.05% to 8%, and then THD starts to fluctuate at 7%. Meanwhile, with BESS-connected loads, the %THD remains at 3.68%. Thus, the quality of power from these solar photovoltaic systems is likely to be degraded—a source of grid stability concerns. The findings of this study further demonstrate the reduction of harmonics in loads operated by BESS. Employing load current as a reference in inverter control results in a lower THD level, indicating the need for robust control strategies to enhance power quality and reduce harmonic distortion levels. This research emphasizes the need to utilize BESS or the utility grid at low solar irradiance, especially for increased non-linear loads. The results show that BESS, with the proposed SAPF has the lowest %THD of total harmonic distortion compared to a stand-alone solar PV system or a utility grid supply.
Notably, the grid exhibits a high current THD of 12% even with SAPF, the highest among all sources. When a hybrid filter is applied, grid THD under maximum non-linear loading falls to 3.2%, outperforming the solar PV system’s 4.97% THD. These results define optimal source–filter pairings: BESS requires only SAPF; solar PV needs SAPF combined with enhanced inverter control; and grid supply benefits most from hybrid filtering to suppress higher-order harmonics. This framework advances sustainable energy integration and supports the clean-energy transition in alignment with UN SDG-7.
Future perspectives
Looking ahead, several avenues can extend and deepen the impact of this work. First, real time Hardware in Loop (HIL) testing can validate and refine the proposed source-filter control strategies under realistic dynamics and communication latencies. Implementing the microgrid control framework on an HIL platform would enable direct integration with physical inverters, converters, and filters, facilitating rapid prototyping and robustness verification before field deployment.
Second, incorporating adaptive and learning based controllers, such as model predictive control (MPC) augmented with machine learning for load and generation forecasting could further enhance performance under highly variable renewable and load conditions. These intelligent algorithms would allow the system to predict upcoming distortion events and preemptively adjust source allocation or filter settings, reducing reliance on reactive filtering.
Finally, scaling the framework to multi-agent architectures could distribute decision-making across numerous converters and storage units, improving resilience against component failures and communication faults. Integrating cybersecurity measures and advanced grid-forming control techniques will be crucial for future microgrids that must operate reliably in the presence of both physical disturbances and cyber threats. Collectively, these developments will drive the transition toward more flexible, robust, and sustainable renewable-integrated power networks.
Data availability
All data generated and analyzed during this study are included in this published article and its supplementary information files.
Abbreviations
- RES:
-
Renewable energy sources
- SDG:
-
Sustainable development goals
- BESS:
-
Battery Energy Storage System
- PV:
-
Photovoltaic
- Li-ion:
-
Lithium-ion
- LV:
-
Low voltage
- PCC:
-
Point of common coupling
- THD:
-
Total harmonic distortion
- SAPF:
-
Shunt Active Power Filter
- UPQC:
-
Unified power quality conditioner
- FS-MPC:
-
Finite set-model predictive control
- \({P}_{PV}\) :
-
Instantaneous active power from the photovoltaic array
- \({P}_{BESS}^{dc}\) :
-
DC-side power exchanged with the BESS
- \({P}_{inv}\) :
-
AC power output of the inverter
- \({P}_{dc,loss}\) :
-
Power losses on the DC bus
- \({P}_{Load}\) :
-
Total load power (linear + non-linear)
- \({P}_{Grid}\) :
-
Active power exchanged with the utility grid
- \({i}_{\alpha },{i}_{\beta }\) :
-
α-β Frame currents after Clarke transform
- \({v}_{\alpha },{v}_{\beta }\) :
-
α-β Frame voltages after Clarke transform
- P, Q:
-
Instantaneous active and reactive power in α-β frame
- \({i}_{\alpha }^{*},{i}_{\beta }^{*}\) :
-
Reference currents in the α–β frame for SAPF
- \({i}_{a}^{*},{i}_{b}^{*},{i}_{c}^{*}\) :
-
Reference currents in the abc frame for SAPF
- THD:
-
Total HARMONIC DISTORTION
- \({D}_{PV}\) :
-
Duty ratio for PV DC-DC converter (P&O MPPT)
- \({I}_{BESS}^{ref}\) :
-
Reference current for BESS charge/discharge
- SoC:
-
State of charge of the BESS
References
Global Warming of 1.5 °C—Accessed 09 December 2024. [Online]. Available: https://www.ipcc.ch/sr15/
Küfeoğlu, S. SDG-7 Affordable and Clean Energy pp. 305–330 https://doi.org/10.1007/978-3-031-07127-0_9 (2022).
Mishra, S. & Viral, R. K. Introduction to hybrid AC/DC microgrids. Microgrids Model. Control Appl. https://doi.org/10.1016/B978-0-323-85463-4.00005-8 (2022).
Li, G., Li, D., Zhang, W. & Zheng, B. Analysis of Harmonic Amplification Induced by Non-linear Loads. In 2023 3rd International Conference on Electrical Engineering and Control Science, IC2ECS 2023 965–970 https://doi.org/10.1109/IC2ECS60824.2023.10493685 (2023)
(PDF) Application of passive harmonic filters in power distribution system with high share of PV systems and non-linear loads, accessed 09, Decembe 2024; https://www.researchgate.net/publication/369650587_Application_of_Passive_Harmonic_Filters_in_Power_Distribution_System_with_High_Share_of_PV_Systems_and_Non-Linear_Loads
Popescu, M., Bitoleanu, A., Suru, C. V., Linca, M. & Alboteanu, L. Shunt active power filters in three-phase, three-wire systems: A topical review. Energies 2024(17), 2867. https://doi.org/10.3390/EN17122867 (2024).
Yuan, W., Yuan, X., Xu, L., Zhang, C. & Ma, X. Harmonic loss analysis of low-voltage distribution network integrated with distributed photovoltaic. Sustainability https://doi.org/10.3390/su15054334 (2023).
Ahsan, S. M., Khan, H. A., Hussain, A., Tariq, S. & Zaffar, N. A. Harmonic analysis of grid-connected solar PV systems with nonlinear household loads in low-voltage distribution networks. Sustainability https://doi.org/10.3390/su13073709 (2021).
Al-Sharif, Y. M., Sowilam, G. M. & Kawady, T. A. Harmonic analysis of large grid-connected pv systems in distribution networks: A saudi case study. Int. J. Photoenergy https://doi.org/10.1155/2022/8821192 (2022).
Djeghader, Y., Boumous, S. & Boumous, Z. Study and analysis of the propagation of harmonics in electrical grid connected photovoltaic system. Diagnostyka 9, 101. https://doi.org/10.29354/diag/163629 (2023).
Mishra, D. P. et al. Power quality enhancement of grid-connected PV system. Int. J. Power Electron. Drive Syst. 14(1), 369–377. https://doi.org/10.11591/ijpeds.v14.i1.pp369-377 (2023).
Zaro, F. Shunt active power filter for power quality improvement of renewable energy systems: A case study. WSEAS Trans. Power Syst. 18, 241–247. https://doi.org/10.37394/232016.2023.18.25 (2023).
Imam, A. A., Sreerama Kumar, R. & Al-Turki, Y. A. Modeling and simulation of a pi controlled shunt active power filter for power quality enhancement based on p-q theory. Electronics https://doi.org/10.3390/electronics9040637 (2020).
Devassy, S. & Singh, B. Performance analysis of solar PV array and battery integrated unified power quality conditioner for microgrid systems. IEEE Trans. Industr. Electron. 68(5), 4027–4035. https://doi.org/10.1109/TIE.2020.2984439 (2021).
Reguieg, Z., Bouyakoub, I. & Mehedi, F. Integrated optimization of power quality and energy management in a photovoltaic-battery microgrid. Renew. Energy 241, 122358. https://doi.org/10.1016/J.RENENE.2025.122358 (2025).
Salem, W. A. A., Gabr Ibrahim, W., Abdelsadek, A. M. & Nafeh, A. A. Grid connected photovoltaic system impression on power quality of low voltage distribution system. Cogent Eng. https://doi.org/10.1080/23311916.2022.2044576 (2022).
Reguieg, Z., Bouyakoub, I. & Mehedi, F. Harmonic mitigation in grid-integrated renewable energy systems with nonlinear loads. Energy 324, 135882. https://doi.org/10.1016/J.ENERGY.2025.135882 (2025).
Lipták, R. & Bodnár, I. Effects of photovoltaic systems on the behavior of harmonic components in low voltage network. Analecta Technica Szegedinensia 17(2), 32–47. https://doi.org/10.14232/analecta.2023.2.32-47 (2023).
Shunt Active Power Filter for Power Quality Improvement and Comparative Study with FFT Analysis International Research Journal of Modernization in Engineering Technology and Science https://doi.org/10.56726/irjmets43085(2023).
Souza, L. L. D., Rocha, N., Fernandes, D. A., Sousa, R. P. R. D. & Jacobina, C. B. Grid harmonic current correction based on parallel three-phase shunt active power filter. IEEE Trans. Power Electron. 37(2), 1422–1434. https://doi.org/10.1109/TPEL.2021.3107399 (2022).
Chauhan, S. & Singh, B. Control of solar PV-integrated battery energy storage system for rural area application. IET Renew. Power Gener. 15(5), 1030–1045. https://doi.org/10.1049/rpg2.12086 (2021).
Reguieg, Z., Bouyakoub, I., Mehedi, F. & Bouhadji, F. Robust harmonic elimination method for various load conditions. J. Renew. Energies https://doi.org/10.54966/JREEN.V1I3.1295 (2024).
Apeh, O. O., Meyer, E. L. & Overen, O. K. Contributions of solar photovoltaic systems to environmental and socioeconomic aspects of national development—A review. Energies MDPI. https://doi.org/10.3390/en15165963 (2022).
Bashiru, O., Ochem, C., Enyejo, L. A., Manuel, H. N. N. & Adeoye, T. O. The crucial role of renewable energy in achieving the sustainable development goals for cleaner energy. Global J. Eng. Technol. Adv. https://doi.org/10.30574/gjeta.2024.19.3.0099 (2024).
A. Basit et al., Environmental Impact Assessments of the Renewable Energy Technologies Adaptation.
Kar, M. K., Kanungo, S., Dash, S. & Ramakant Parida, R. N. Grid connected solar panel with battery energy storage system. Int. J. Appl. Power Eng. https://doi.org/10.11591/ijape.v13.i1.pp223-233 (2024).
Mansor, M. A., Hasan, K., Othman, M. M., Noor, S. Z. B. M. & Musirin, I. Construction and performance investigation of three-phase solar PV and battery energy storage system integrated UPQC. IEEE Access 8, 103511–103538. https://doi.org/10.1109/ACCESS.2020.2997056 (2020).
Chapala, S., Narasimham, R. L. & Das, T. R. Power quality enhancement in solar PV and battery integrated UPQC grid connected system. Int. J. Electr. Electron. Res. 11(2), 291–298. https://doi.org/10.37391/IJEER.110207 (2023).
Jain, A. & Bhullar, S. Design and performance analysis of solar PV-battery energy storage system integration with three-phase grid. J. Power Sources https://doi.org/10.1016/j.jpowsour.2025.236486 (2025).
Abouchabana, N., Haddadi, M., Rabhi, A., Grasso, A. D. & Tina, G. M. Power efficiency improvement of a boost converter using a coupled inductor with a fuzzy logic controller: Application to a photovoltaic system. Appl. Sci. Page https://doi.org/10.3390/APP11030980 (2021).
Pandey, K. K., Kumar, M., Kumari, A. & Kumar, J. Bidirectional DC-DC buck-boost converter for battery energy storage system and PV panel. Smart Innov. Syst. Technol. 206, 681–693. https://doi.org/10.1007/978-981-15-9829-6_54 (2021).
Amir, A., Amir, A., Selvaraj, J. & Abd Rahim, N. Grid-connected photovoltaic system employing a single-phase T-type cascaded H-bridge inverter. Sol. Energy https://doi.org/10.1016/J.SOLENER.2020.02.045 (2020).
Khan, M. Y. A., Liu, H., Yang, Z. & Yuan, X. A comprehensive review on grid connected photovoltaic inverters, their modulation techniques, and control strategies. Energies https://doi.org/10.3390/EN13164185 (2020).
(PDF) Application of Passive Harmonic Filters in Power Distribution System with High Share of PV Systems and Non-Linear Loads, accessed 23 December 2024. https://www.researchgate.net/publication/369650587_Application_of_Passive_Harmonic_Filters_in_Power_Distribution_System_with_High_Share_of_PV_Systems_and_Non-Linear_Loads
Kumar, R. & Bansal, H. O. Shunt active power filter: Current status of control techniques and its integration to renewable energy sources. Sustain. Cities Soc. 42, 574–592. https://doi.org/10.1016/J.SCS.2018.07.002 (2018).
Biricik, S., Ahmed, H., Komurcugil, H., Guler, N., Ozmen, B. & Benbouzid, M. Single Phase Active Power Filter Control under Distorted Grid Voltage Using Quasi Open-Loop Grid-Synchronization Technique. In 2021 12th Power Electronics, Drive Systems, and Technologies Conference, (PEDSTC 2021), Institute of Electrical and Electronics Engineers Inc., https://doi.org/10.1109/PEDSTC52094.2021.9405949(2021).
Takagi, K. & Fujita, H. A Three-phase grid-connected inverter equipped with a shunt instantaneous reactive power compensator. IEEE Trans. Ind. Appl. 55(4), 3955–3966. https://doi.org/10.1109/TIA.2019.2910487 (2019).
Baros, J. et al. Review of fundamental active current extraction techniques for SAPF. Sensors https://doi.org/10.3390/S22207985 (2022).
Gautam, S. & Agrawal, S. Performance Analysis of Three Phase Grid Connected PV Array with ANN Controlled SAPF In 2021 2nd Global Conference for Advancement in Technology, (GCAT 2021), Institute of Electrical and Electronics Engineers Inc. https://doi.org/10.1109/GCAT52182.2021.9587532 (2021).
Lopez-Santos, O., Dantonio, D. S., Flores-Bahamonde, F. & Torres-Pinzón, C. A. Hysteresis control methods. Multilevel Invert. Control Methods Adv. Power Electron. Appl. https://doi.org/10.1016/B978-0-323-90217-5.00002-2 (2021).
Shah, A & Vaghela, A. “Shunt Active Power Filter for Power Quality Improvement in Distribution Systems | Shunt Active Power Filter for Power Quality Improvement in Distribution Systems”, [Online]. Available: www.ijedr.org
Acknowledgements
The author extends the appreciation to the Deanship of Postgraduate Studies and Scientific Research at Majmaah University for funding this research work through the project number ER-2025-2005.
Author information
Authors and Affiliations
Contributions
SAAK, AA,MA and ZAK developed the concept and methodology of the study, MSWA and MB carried out the simulations. SAAK, AA and ZAK supervised the project and ZAK, AA and MA administered the project. All authors contributed in writing the main manuscript and reviewed the manuscript. The funding acquisition is done via AA.
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendix
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
About this article
Cite this article
Saleh Waseem Abbasi, M., Kazmi, S.A.A., Billah, M. et al. Power quality optimization framework for three phase microgrids with grid tied solar PV and battery storage under nonlinear loads. Sci Rep 15, 42568 (2025). https://doi.org/10.1038/s41598-025-18954-3
Received:
Accepted:
Published:
Version of record:
DOI: https://doi.org/10.1038/s41598-025-18954-3




























































