1. Introduction
In today’s modern era of electrification, Electric Power Systems (EPS) are essential for supporting the functioning of the authors’ society. However, a significant drawback is the presence of harmonics in EPS, which lead to various problems affecting reliability, safety, and efficiency [
1,
2]. Every phase of any process related to electrical energy must remain continuously efficient [
3].
Starting with generation at power plants, energy is transmitted over long distances via transmission lines and ultimately delivered to consumption points. The final distribution stage is especially critical due to its direct relationship with energy demand [
4].
The electrical sector currently faces the challenge of reducing costs while delivering efficient, high-quality power. Distribution companies must find solutions to high expenses associated with extending transmission networks and both technical and non-technical losses in power systems. Investments in financial, technical, and human resources are essential to enhance system reliability. This includes integrating special loads and adopting modern technologies such as microgrids, electric vehicles, and distributed generation [
5,
6].
Conducting thorough studies and effectively managing these new technologies is vital to optimize resources and bolster reliability—thus avoiding penalties for distribution companies and providing more dependable service to end users [
3].
According to the Ecuadorian Institute of Statistics and Census (INEC), 31.7% of the population in Ecuador still lacks access to electricity. This situation is due to remote areas being far from conventional generation facilities [
7]. Extending the main grid to these distant regions and adapting it to existing generation infrastructure is both costly and challenging. In this context, distributed generation becomes indispensable for providing solutions in underserved areas—promoting economic development, improving quality of life, and fostering socioeconomic growth in these communities. The implementation and adherence to these standards are critical to ensure electrical systems operate safely and efficiently. By keeping voltage, harmonic distortion, sags, flicker, and imbalance within prescribed limits, equipment damage is minimized and a stable, reliable power supply is maintained. Utilities and system designers must incorporate these limits during planning, design, and operation, and perform regular audits and continuous monitoring. Deploying power quality meters allows early detection and correction of deviations, ultimately improving system reliability and efficiency.
Table 1 summarizes the adopted power quality limits used throughout the analysis.
The scientific literature contains numerous articles addressing the problem of harmonics in electrical systems and offering partial solutions. These studies explore a range of approaches, from passive filters to advanced active power control techniques. Below, we summarize the most relevant works in this field, highlighting their contributions, limitations, and how they set the stage for the present investigation.
Mudaheranwa et al. [
9] investigated harmonic reduction in power systems using an active power filter (SAPF). They employed MATLAB/Simulink to simulate a filter that injects an inverse waveform of the harmonic component into a distorted signal, reducing its harmonic content. Their results showed a dramatic decrease in source current Total Harmonic Distortion (THD) from 19.5% to 0%, thereby meeting the IEEE Std 519-1992 standard.
Atuchukwu et al. [
10] focused on reducing harmonics in power lines by implementing a Finite Impulse Response (FIR) filter. They modeled a system in MATLAB/Simulink to generate compensation signals and switching pulses for an active filter. Their findings demonstrated that THD dropped from 17.77% to 0.87%, and the system’s current, voltage, and power factor improved by 95%.
Guest et al. [
11] implemented active filters in the control of converters connected to Type-IV offshore wind turbines to mitigate voltage-harmonic amplification. By applying the “extra element theorem” to tune the active filters and determine stability margins, they successfully suppressed both converter- and grid-generated harmonics. Their results confirmed that harmonic levels remained below planned thresholds in a 270 MW wind farm.
Zeleničić et al. [
12] targeted current-harmonic reduction in data center power systems using single-phase shunt active power filters (SAPF). They combined active components (IGBT or MOSFET) with passive elements (R, L, and C) and conducted two simulations: one filtering only current harmonics and another also compensating reactive current. Using a Voltage Source Inverter (VSI) and an LCL filter for switching frequency attenuation, they demonstrated that SAPFs significantly improved power quality by reducing both THD and current ripple.
Cazacu et al. [
13] aimed to mitigate voltage and current harmonics in a nonlinear industrial load by installing a 300 A active harmonic filter (AHF) in parallel with the load on the low-voltage side. Their detailed analysis of energy quality parameters before and after AHF installation showed that harmonics were kept within regulatory limits, improving the facility’s power quality.
Constantinescu et al. [
14] studied how DC-link voltage in active power filters affects harmonic compensation. Through MATLAB/Simulink simulations, they adjusted the filter’s DC-link voltage and observed its impact on current THD reduction. Their results revealed that proper DC-link voltage management is crucial for optimizing filter performance in systems with nonlinear loads.
Madhubabu et al. [
15] investigated the use of series active power filters (SAPF) to improve energy quality in distribution lines. By injecting compensating voltage to counteract distortions (e.g., voltage drops and flicker), they showed that SAPFs greatly reduce THD in low- and medium-voltage networks, complying with established power quality standards.
Tupiza et al. [
16] proposed reducing THD in low-voltage distribution networks using a Unified Active Power Filter (UAPF) powered by photovoltaic generation. Their MATLAB/Simulink model placed a nonlinear load at bus 7 of the IEEE 13-bus system and used the UAPF to cut both current and voltage harmonics. They achieved THD reductions to 6% (current) and 3% (voltage), meeting ARCERNNR-017/2020 and IEEE 1159 standards.
Kaiwart [
17] presented a Simulink model of a shunt active power filter (SAPF) with a PI controller to regulate the DC-link capacitor voltage. The results confirmed that SAPF implementation significantly improved power quality by reducing harmonics to levels compliant with IEEE standards.
Waheed et al. [
18] explored hybrid power filters—combining passive series filters with active filters—for harmonic reduction in the IEEE 3-bus system. Their simulations under various operating conditions showed that the hybrid filter lowered THD from 29.85% to 0.78%, greatly enhancing system performance.
From these studies, it is evident that harmonic mitigation techniques range from passive and active filters to hybrid combinations. While passive filters offer simplicity, they lack flexibility under variable load conditions. Active filters provide adaptive compensation but at a higher cost. Hybrid filters combine advantages of both but are more complex to implement and maintain.
In contrast, this investigation proposes designing an active power filter (SAPF) to improve energy quality in EERSA’s distribution network. CYMDIST is employed to develop detailed feeder models that precisely identify the root causes of power quality issues. CYMDIST’s built-in modules for distribution system analysis enable comprehensive data evaluation, studies, and simulations. Our goal is to reduce harmonics in compliance with Regulation No. ARCERNNR-002-20. This approach not only aims to enhance power supply quality but also provides targeted corrective solutions based on a thorough, contextual analysis of the distribution system.
2. Methodology
Clarification. The 150 kVA distribution transformer installed at Substation 8 is owned by the electric utility (EERSA). This project does not involve replacement of utility-owned assets; the work focuses on analysis, simulation, and the sizing/validation of the shunt active power filter.
The case study focuses on feeder 1500080T03, an overhead radial circuit with a nominal line-to-line voltage of 13.2 kV, originating at Substation 8 in the city of Riobamba. The feeder spans 7.6 km and supplies a mixed load of residential, commercial, and municipal customers. Five measurement nodes—coded MTA_S_298959, MTA_S_299878, MTA_S_331576, MTA_S_61155, and MTA_S_87877—were selected because they host clusters of 70 W HPS street-lighting luminaires driven by magnetic ballasts.
Table 1 summarizes key electrical parameters derived from SCADA data for the peak loading hour (19:00 LT) in the dry season.
The complete workflow is summarized in
Table 2.
This methodology ensures a fully traceable chain from in situ harmonic measurement through network simulation to active filter design and validation, suitable for replication in other medium-voltage distribution feeders.
Figure 1 shows the feeder layout and the simplified single-line diagram used as context for modeling.
The single-line diagram provided by EERSA was digitized in CYMDIST 8.0. Conductor series impedances were obtained from geometry with Carson’s correction; transformers used IEEE C57.12 equivalent circuits. Capacitor banks and voltage regulators were modeled with control curves disabled to isolate harmonic interactions. Each street-lighting branch was represented as a lumped harmonic current source following IEC 61000-3-2 Class C limits, validated against bench-top analyzers.
The measurements and data presented here were gathered for both LED and HPS luminaires.
Table 3 summarizes their nominal power ratings and luminous flux.
Co-simulation was orchestrated by exchanging phasor quantities between CYMDIST and MATLAB/Simulink at each fundamental cycle. The interface exploited the open-data DLL API of CYME, allowing the inverter to respond to unbalanced harmonic voltages produced by the network. Simulations were executed for three lighting scenarios—baseline (HPS), LED retrofit, and LED + SAPF—and for low-, medium-, and high-load snapshots defined by daily load curves. Key output metrics included per-node THD, individual harmonic voltage distortion (VHD) factors, line losses, and SAPF capacitor ripple.
Table 4 shows the percent voltage distortion at the third harmonic (180 Hz) for five field nodes, each tested with 5, 10, and 15 HPS luminaires. At node MTA_S_298959, the distortion remains below the 3% limit when only 5 lamps are installed, but rises to 3.14% with 10 lamps and 4.71% with 15 lamps. Similar behavior is observed at nodes MTA_S_87877 and MTA_S_299878, which both stay under 3% at five lamps but exceed the standard for larger installations. Nodes MTA_S_331576 and MTA_S_61155 exceed the 3% threshold in all three configurations; these two nodes are the farthest from the main feeder and thus experience the highest harmonic distortion.
Table 5 presents the percent voltage distortion (IHD %) at the third (180 Hz), fifth (300 Hz) and seventh (420 Hz) harmonics for five field nodes, each tested with 5, 10, and 15 LED luminaires, but only the 3rd–7th harmonics are summarized here for brevity.
Table 6 shows the overall %THD measured at five field nodes for 5, 10, and 15 HPS lamps. All 5-lamp cases meet the 5% limit; several nodes exceed the limit at 10 and 15 lamps, with a worst-case THD of 9.78% (MTA_S_61155, 15 lamps).
Table 7 presents the overall %THD for the same five nodes with LED lamps. Performance is generally better than HPS at low counts; however, some far-end nodes still exceed 5% at 10 and 15 lamps, reaching up to 8.62% (MTA_S_87877).
The P–Q theory control algorithm is implemented as a cascade of five analytic blocks. Each block performs a specific transformation or control action in the shunt active filter [
19,
20]:
Clarke Transformation (Block 1). Converts the three-phase voltages and currents
into the stationary
frame via
Instantaneous Power Calculation (Block 2). Computes the instantaneous real and imaginary powers
from
and
, where
then separates the average (fundamental positive sequence) components
from the oscillatory parts
:
Here is the average active power (guarantees the minimum RMS current), is the negative-sequence component, is the average reactive power, and is the oscillatory reactive term.
Compensation Current Reference (Block 3). Derives the
compensation current from the power components:
This block effectively filters out the unwanted oscillatory components.
Physical Inverter and Filter (Block 4). Models the inverter and output
filter dynamics. The supply-side voltage asymmetry obeys
while the final compensation current command is scaled by
where
and
denote the specific harmonic components to be compensated.
DC–Bus Voltage Regulation (Block 5). A PI controller adjusts the active power reference to maintain the DC–link voltage . The resulting feeds back into Block 2, closing the loop.
This modular structure allows straightforward analytic and logical implementation of P–Q control, with each block addressing one stage of transformation or regulation. The inverter’s PWM is governed by the PI current controller.
The PI controller parameters are obtained by analyzing the closed-loop step response. The transfer function from the reference voltage
to the actual DC-link voltage
is given by
where
and
are the proportional and integral gains, respectively, and
C is the DC-link capacitance.
To achieve a desired natural damping frequency
and damping factor
, the PI gains are selected as
where
L represents the damping inductance.
Figure 2 illustrates the complete P–Q filter control diagram, highlighting how
(which sets the speed of response) and
L (which influences damping and stability) determine the PI tuning.
2.1. Co-Simulation Architecture
This study implements a steady-state harmonic co-simulation between CYMDIST and MATLAB/Simulink to combine feeder-level network models with device-level control of the shunt active power filter (SAPF). The exchange follows a master–slave handshake per simulation step , ensuring that both solvers advance on a common timeline without numerical drift.
Exchanged phasor quantities. At the SAPF point of common coupling (PCC), the interface exchanges per-phase RMS phasors and (magnitude and angle). CYMDIST provides the network solution at the PCC; Simulink returns the SAPF current set-points computed by the P–Q blocks.
Time resolution and synchronization. CYMDIST advances the harmonic load-flow, while Simulink integrates the SAPF control at a fixed step using a zero-order hold at the interface. Each outer iteration supplies updated PCC conditions to the SAPF and returns the resulting compensating current until convergence.
Open-data DLL API. The exchange uses CYMDIST’s open-data DLL API to read/write PCC phasors. After each iteration, the API returns the solver status; a fixed-point loop repeats until the PCC current mismatch norm falls below a user-defined tolerance .
Scenario execution. The three lighting scenarios (HPS, LED, and mixed) are executed sequentially with identical feeder topology to isolate the effect of lamp technology.
Validation. The co-simulation was validated by (i) cross-checking against stand-alone CYMDIST harmonic-flow results at the same operating point, and (ii) verifying that the SAPF control reproduces bench-top measurements reported in the literature for P–Q algorithms. Agreement within the measurement resolution was obtained for node voltages, dominant harmonic orders, and phase angles.
The CYMDIST–Simulink co-simulation handshake is summarized in Algorithm 1.
| Algorithm 1 CYMDIST–Simulink Co-Simulation Handshake. |
- 1:
Initialize feeder state in CYMDIST; choose step and tolerance . - 2:
for each operating scenario and lamp count do - 3:
Outer loop: Solve CYMDIST harmonic load-flow to obtain PCC . - 4:
Send PCC phasors to Simulink (P–Q blocks). - 5:
Simulink computes compensating current reference ; return to CYMDIST. - 6:
Inject at PCC; re-solve CYMDIST. - 7:
Convergence check: If , stop; else repeat outer loop. - 8:
end for
|
2.2. SAPF Design Specifications
The SAPF is sized at to compensate the dominant harmonic currents observed at the far-end nodes while maintaining margin for seasonal and load-technology variability. The following items summarize the design rationale and the parameters required for reproducibility.
Converter topology. Three-phase, two-level voltage-source converter (VSC) with L-type coupling reactor.
Rated apparent power. The rating satisfies
where
is the peak compensating current estimated from field measurements and harmonic-flow snapshots.
DC-link and capacitor. The DC-link voltage is chosen to provide modulation-index margin at the worst-case PCC voltage. The capacitor is computed from the allowable voltage ripple
and the energy exchanged per mains period:
Coupling inductance. The reactor L limits current ripple and filters switching harmonics; L is selected from the admissible ripple at the switching frequency and the desired control bandwidth.
Sensing and interface. Hall-effect current transducers with anti-aliasing filters; three-wire connection at the PCC.
Controller gains. The PI gains follow the tuning relationships derived in the control section:
and the numerical values
used in the simulations are reported in
Table 8.
Alternative Ratings
A alternative risks saturation at peak lamp counts in far-end nodes, whereas adds cost and footprint with limited incremental benefit given the measured residual voltage THD of 1.28–1.53% after compensation. The 150 kVA choice balances headroom and lifecycle cost while meeting IEEE Std 519-2022 limits.
2.3. Canceling-Current Synthesis Under Unbalanced Conditions
The SAPF computes the compensating current by isolating the non-fundamental and reactive components of the load current and injecting their opposite at the PCC. The implementation follows the instantaneous p–q theory:
Clarke transform. Voltages and currents are mapped from the
frame to the
frame using the power-invariant Clarke matrix, yielding the vectors
and
:
Instantaneous powers. The instantaneous active and reactive powers in the
frame are
where
denotes a
rotation. Low-pass filters decompose each power into DC (fundamental) and AC (oscillatory) components:
Reference current. The SAPF cancels the oscillatory and reactive powers by commanding the compensating-current reference:
which, after inverse Clarke transformation, yields the per-phase references
,
, and
.
Unbalance handling. A positive-sequence voltage extractor (e.g., moving-average or notch-based PLL) provides the fundamental reference under unbalanced conditions. The mapping inherently rejects zero-sequence components, while negative-sequence distortion is compensated by the outer loop so that the inner current controller maintains on each phase.
Injection. The two-level VSC, interfaced through coupling inductors
L, tracks the reference currents using a synchronous-frame PI current controller. The controller gains follow
with numerical parameters
given in
Table 8.
This flow is aligned with the block diagram in
Figure 2 and ensures reproducibility across balanced and moderately unbalanced operating points.
3. Results
To avoid redundancy, the article reports one representative time-domain and one frequency-domain example of the P–Q shunt active filter performance, and summarizes all nodes in tables.
Figure 3 shows the voltage waveform before and after compensation at a worst-case node under a 15-luminaire scenario; the filter removes the peak flattening and restores a near-sinusoidal shape. In the frequency domain
Figure 4, the dominant third, fifth, and seventh components are strongly attenuated.
The full set of results across nodes and lamp counts is compacted in
Table 4,
Table 5,
Table 6 and
Table 7. In all cases, the post-filter residual voltage THD remains in the 1.28–1.53% range, safely meeting IEEE Std 519-2022.
For LED luminaires the qualitative behavior is the same: the SAPF yields clean sinusoids with residual THD near 1.4%. For compactness, repeated waveforms are omitted and the reader is referred to
Table 5 and
Table 7.
3.1. Comparison of Results Obtained
The study compares the voltage waveforms before and after filter activation in both the time and frequency domains, and measures the resultant Total Harmonic Distortion (THD). Compliance is assessed against the IEEE Std 519-2022 5% voltage-THD limit.
As summarized in
Table 9, the worst-case THD for HPS at 15 luminaires decreases from 9.48% to 1.51%.
Table 10 shows that LED scenarios exhibit residual THD near 1.4% after compensation.
The filter consistently reduces Total Harmonic Distortion (THD) by an average of 77% and 87% for HPS luminaires and 70% and 86% for LED luminaires. All post-filter THD values, ranging from 1.28% and 1.53%, remain well below the IEEE Std 519-2022 regulatory threshold of 5%, providing a comfortable safety margin. The uniform residual distortion levels across varying load conditions confirm that the filter operates within its compensation capacity and is not saturated, indicating available headroom for additional load or disturbance suppression.
3.2. Harmonic Data Reconciliation and KPI Summary
To avoid ambiguity, this version clearly defines the “worst-case” voltage THD as the maximum phase-averaged THD observed across all monitored nodes and all lamp count scenarios within the same measurement campaign. Node-level tables report scenario-specific values; summary text refers to the worst case defined above. Minor differences between table entries (e.g., 9.76% vs. 9.78%) reflect either rounding or distinct measurement campaigns; these are now explicitly identified in the captions.
As summarized in
Table 11, the key metrics are presented for clarity.
3.3. Techno-Economic Analysis
The abstract reports an internal rate of return (IRR) above 17% and a payback period of 3.4 years. This section makes the underlying assumptions and calculations explicit so the results are reproducible.
3.3.1. Scope and Ownership
The analysis includes the SAPF equipment, installation, commissioning, and annual O&M. The 150 kVA distribution transformer at Substation 8 is utility-owned (EERSA) and is therefore excluded from project CAPEX.
3.3.2. Cost Breakdown
Table 12 details the capital expenditures (CAPEX) and the recurring O&M assumptions used in the cash-flow model.
3.3.3. Energy-Savings Method
Let
be feeder fundamental-frequency losses before SAPF and
the measured reduction after SAPF. Annual energy savings are
where
is the number of equivalent full-load hours. Monetary savings use the applicable energy tariff
(and demand charges if relevant).
3.3.4. Cash-Flow Model
Year-
t net cash flow is
. The Net Present Value (NPV) at discount rate
r is
The reported 17% IRR and 3.4-year payback correspond to the baseline in
Table 12 and the tariff assumptions specified by the utility.
3.3.5. Sensitivity Analysis
A one-at-a-time sensitivity was performed for tariff, CAPEX, and loss-reduction assumptions. As discussed in the text, a change in tariff shifts payback by approximately years; the analysis for other parameters is documented in the supplementary spreadsheet (same methodology).
3.4. From Simulation to Deployment: Practical Considerations
While validation is simulation-based, transitioning to field deployment requires addressing:
Converter losses and thermal design. Switching and conduction losses increase heat flux; heatsink sizing and forced ventilation must ensure junction temperatures remain within device SOA under worst-case THD.
Measurement chain accuracy. CT/VT classes, anti-aliasing filters, and ADC resolution bound the accuracy of p–q estimates; sensor drift impacts DC-link control.
Digital delays and sampling jitter. PWM and computation delays reduce phase margin; the design bandwidth for accounts for these delays.
EMI/EMC and grounding. Fast dv/dt edges require proper shielding, cable layout, and compliance with IEC 61000-6-4/-6-2 at the cabinet level.
Protection and ride-through. DC pre-charge, crowbar schemes, and fault-ride-through logic avoid nuisance trips on sags or transients.
These aspects are included in the bill of materials of
Table 8 and guide the selection of
L,
C, and enclosure/IP rating.
3.5. Figure Quality and Readability
Time- and frequency-domain figures have been prepared for final submission at ≥300 dpi with standardized axis labels and font sizes for readability. No change in scientific content was required.
3.6. Techno-Economic Analysis (With Web-Sourced Inputs)
The tariff used is the Ecuador business electricity price of 0.095 USD/kWh (2025 benchmark), and equipment cost anchors come from public list prices of 200 A active harmonic filters (comparable to 150 kVA at 400–480 V). Annual savings are computed from the measured 10.7% reduction in fundamental losses.
Table 13 reports 10-year NPV@10%, IRR and simple payback for a range of baseline feeder losses, and CAPEX assumptions; O&M is 2% year of equipment cost.
4. Limitations and Future Work
A limitation of the present study is the focus on steady-state harmonic performance. While dynamic tests such as voltage sags, swells, and temporary overvoltage were considered qualitatively, a full electromagnetic transient (EMT) study was not carried out. EMT simulations would be warranted to characterize interactions between the SAPF control loop and distribution-level protection devices, especially under fault conditions. Additionally, scalability to feeders with significant distributed generation warrants further research. Grid-forming inverters may alter the feeder’s harmonic impedance and either enhance or hinder SAPF effectiveness.
Another limitation pertains to cybersecurity risks. Although the SAPF controller’s firmware supports secure boot and encrypted communications, no penetration test was performed. With the rise in cyber-physical threats to grid assets, future deployments should include vulnerability assessments in compliance with IEC 62443.
Finally, the projected economic returns may vary with future electricity prices and regulatory changes. Scenario analysis with ±20% tariff fluctuation alters the payback period by ±0.9 years, indicating moderate sensitivity. Nevertheless, the base case remains robust under a wide spectrum of plausible futures.