Clear Sky Science · en

Optimization of fuzzy logic controller in the converter of a standalone solar power system using the firefly algorithm

· Back to index

Smarter Sunshine for Off-Grid Power

As more homes, farms, and remote facilities turn to solar panels, keeping the lights steady and electronics safe becomes a major challenge. When clouds pass or devices switch on and off, the power flowing from a standalone solar system can wobble, creating flicker, heat, and wear in appliances. This paper explores a new way to make solar inverters—the devices that turn panel output into household-style electricity—much more stable and efficient by combining fuzzy logic control with a nature-inspired search method called the firefly algorithm.

Figure 1
Figure 1.

Why Solar Power Needs a Steady Hand

A standalone solar system typically includes panels, a device to boost the panel voltage, batteries, and an inverter that converts direct current into the alternating current used by standard equipment. The inverter must hold voltage and frequency within tight limits while keeping unwanted electrical “noise,” or harmonics, very low. Traditional controllers, such as PI or PID schemes, work well only if the underlying system is simple and perfectly known. In real solar setups, however, loads change suddenly, sunlight fluctuates, and the electronics behave in complex, non‑linear ways, making these fixed controllers slow, inaccurate, or even unstable during strong disturbances.

How Fuzzy Logic Learns from Experience

Fuzzy logic controllers offer an appealing alternative because they work more like an experienced technician than a rigid formula. Instead of strict equations, they use rules such as “if the voltage error is small but growing, ease back the control signal.” These rules rely on membership functions, which translate raw numbers like voltage error and its rate of change into qualitative levels such as “negative,” “zero,” or “positive.” The problem is that these membership functions are usually crafted by hand through trial and error, a slow process that can easily miss the best settings, especially when the inverter must handle very different types of loads, from simple heaters to motors and electronic devices.

Fireflies as Guides for Better Control

The authors tackle this design bottleneck by letting an optimization routine inspired by the flashing behavior of fireflies tune the fuzzy controller automatically. In the firefly algorithm, each candidate solution is like a firefly whose brightness reflects how well the controller performs, measured mainly by how closely the voltage follows its target and how small the harmonic distortion remains. Brighter fireflies attract dimmer ones, nudging the population toward better solutions while a touch of randomness keeps the search from getting stuck in a local dead end. In this study, the positions, widths, and shapes of all input and output membership functions become the variables that the algorithm adjusts, with the goal of minimizing mean squared error and keeping distortion below standard limits.

Figure 2
Figure 2.

Testing Under Realistic Load Changes

To judge the benefits, the team models a three‑phase standalone photovoltaic system in simulation, complete with a boost converter, inverter, and filter. They test three types of controllers: a conventional PI design, a standard fuzzy controller, and fuzzy controllers optimized by three different search methods—genetic algorithms, particle swarm optimization, and the firefly approach. The system is subjected to demanding scenarios in which a 50 kW resistive load is switched to a mixed resistive‑inductive load and then to a nonlinear load, all within a few tenths of a second. For each case, they track how quickly the voltage settles, how closely it follows its reference, and how much harmonic content appears in the output.

Cleaner Waves and Faster Recovery

The results show that the firefly‑optimized fuzzy controller delivers both smoother and more robust performance. Across resistive, inductive, and nonlinear loads, it keeps the output voltage within about ±1% of its desired value and restores it in less than a quarter of an AC cycle after sudden changes. Total harmonic distortion remains below the 5% limit recommended by international standards, with values as low as 2.89% in some phases—better than both the conventional PI controller and fuzzy controllers tuned by other optimization methods. The mean squared error in voltage tracking drops to about 0.0071, and the firefly search reaches these settings in fewer iterations, indicating faster design convergence.

What This Means for Everyday Solar Users

In plain terms, the study shows that letting an algorithm inspired by how fireflies swarm around bright flashes can automatically “teach” a fuzzy logic controller to run a solar inverter more smoothly. The optimized controller produces cleaner, more stable power for a wide range of electrical loads without relying on an exact mathematical model of the system. For off‑grid solar users, this translates into fewer flickers, less stress on equipment, and better use of the energy their panels produce, pointing toward smarter and more reliable standalone solar installations.

Citation: Nouri, P., Kamarposhti, M.A., Nouri, T. et al. Optimization of fuzzy logic controller in the converter of a standalone solar power system using the firefly algorithm. Sci Rep 16, 10248 (2026). https://doi.org/10.1038/s41598-026-41508-0

Keywords: standalone solar inverter, fuzzy logic control, firefly algorithm, harmonic distortion, renewable power quality