Skip to main content

Artificial ecosystem optimized neural network controlled unified power quality conditioner for microgrid application


Unified power quality conditioner is chiefly employed to offer power quality improvement, especially in grid connected mode of operation in microgrid applications. This article proposes an artificial ecosystem optimized neural network for control of photovoltaic system and battery powered UPQC for microgrid applications. The intelligent routine implemented by the proposed controller helps tune parameters such as the error between load voltage references and measured load voltage signals so that the optimal performance of the system can be reached as its exploratory and exploitation capabilities are leveraged in controller design. A prototype of a three-phase system with a dually powered conditioner is tested and validated in MATLAB-Simulink environment in a variety of dynamic scenarios that are commonly present in a contemporary distribution network, such as grid voltage changes, grid inaccessibility, variation in photovoltaic power output, and nonlinear load. It is shown that the proposed controller, being aware of the instantaneous values of grid voltages, was able to adequately compensate in magnitude and phase under all dynamic scenarios to maintain the load voltage constant at the nominal value and sinusoidal. When the system switches automatically from grid-connected mode to islanded mode due to a grid fault, it was observed that the controller prioritizes delivering uninterrupted power to critical loads and enables fast discharge from the battery. The total harmonic distortion percentages of grid currents and load voltages are found to be within the limits as per IEEE-519 standards.


In recent times, there has been considerable interest among government departments, scientists, building owners, and the public in renewable energy sources and their deployment and installation. This is mainly due to the optimism about the adoption of sustainable technologies, the general feeling of good duty towards the planet, and the high visibility of merits. Among the several renewable energy technologies, photovoltaic (PV) systems score above the rest due to their translation of energy-saving potential into realistic outcomes and the easy availability of sunlight as a resource. The declining cost of solar power leaves more room for investments in the pairing of solar generation with electricity storage to address the variation challenges for grid integration (Lua et al. 2021). But the unpredictable and stochastic nature of solar energy brings forth an array of challenges to the planning, management, and operation of power grid systems, as the fluctuation in the output can lead to cost increases, difficulty in grid integration, and issues with control and reliability of the system (Karthika and Gomathi 2022). Battery storage systems can be suitably employed to enhance power quality, stability, and reliability and to provide features such as voltage sag compensation and frequency regulation. They are primarily used to store the energy over the medium term to support the grid in times of peak demand, thereby reducing cost of energy and help deferring infrastructure upgrade.

Photovoltaic generation, together with localized loads, batteries and corresponding control circuits, constitutes a DC microgrid. Microgrids can be suitably controlled to operate either in grid-connected mode or standalone mode and can seamlessly switch between the two modes. In a defined area, these systems could help facilitate meeting an additional power demand or maintaining regular supply. Standalone mode is also referred to by many terms: autonomous, self-reliant, isolated, or islanded mode. For the sake of clarity and uniformity, we will use the term—islanded mode—throughout this paper. If the code permits, battery units can support islanded operation of the grid, in the event of a power outage. During islanded mode, both real and reactive power is generated within the microgrids, and the battery systems offer stability and reliability to local loads.

Shunt and series compensation are traditionally used for improving power quality in power grid network. Shunt-connected topologies typically improve all things related to current, such as power factor, power, and current harmonics, while series compensation aids in mitigating voltage harmonics, sag, swell, and load voltage fluctuations in Point of Common Coupling (PCC). Nonlinear loads connected to the PCC might introduce harmonic and power quality issues in the grid. A series active compensator, typically, is leveraged to keep the load profile voltage constant at one per unit. Unified power quality conditioner (UPQC) combines the advantages of series compensation with shunt-connected topologies to offer power quality improvement, especially in grid-connected mode of operation. The UPQC device combines a shunt-active filter together with a series-active filter in a back-to-back configuration to simultaneously compensate the supply voltage and the load current (Monteiro et al. 2003; Devi et al. 2020). The main purpose of a UPQC is to compensate for voltage imbalance, reactive power, negative-sequence current, and harmonics (Gu et al. 2002; Kinhal et al. 2011). When dealing with microgrid difficulties such as fluctuating power supply and demand, an energy management system (EMS) is an essential ingredient for ensuring the grid's safe, cost-effective, and methodical functioning (Jitender and Prasenjit 2020; Nikhita and Seethalekshmi 2021; Senthil-Kumar et al. 2015; Vinod 2012). Intelligent control units or an energy management system (EMS) are responsible for its secure, economical, and systematic operation while addressing microgrid challenges, such as uncertainty in power generation and power demand (Md et al. 2019).

Hence, this paper proposes an Artificial Eco system Optimized Neural Network (AEONN) controller for PV and battery-powered UPQC for microgrid applications, and the system’s capability to be able to deal with dynamic scenarios such as grid voltage changes, grid inaccessibility, variation in photovoltaic power output, and nonlinear load is assessed and validated. As we will see in the next section, though several works have used nature-inspired optimization techniques in DC microgrids, none involved UPQC system. We have adopted the control methodology explained in Sachin and Bhim (2021) for our design, but instead of the traditional PI controller, we have employed artificial ecosystem optimization in shunt and series compensation schemes to leverage its exploratory and exploitation capabilities in controller design. The following are the salient features of the system presented in this work:

  1. 1)

    Integration of the production of renewable energy with the improvement of power quality at the supply and load sides.

  2. 2)

    Maintaining a constant load voltage profile with a nearly sinusoidal grid current.

  3. 3)

    Adaptability to changes in irradiance and PV system output

  4. 4)

    Seamless, automatic transfer between standalone and grid-tied modes. This is highly beneficial when critical loads such as hospitals, data centers, and factories are on the network.

  5. 5)

    Control of UPQC using artificial eco system optimized neural network for ensuring effective functioning of the system for above-listed objectives.

The rest of the paper is organized as follows: the next section provides an overview of the literature on the related topics. Section Methodology provides a brief background on the controller design of the subsystems, such as shunt and series active compensators and bidirectional converter. Section AEONN control describes the methodology of the proposed controller, while section Results presents the significant results and corresponding discussion, and section Conclusion draws the conclusions.

Related work

There are several studies in the literature that have reported linear control of microgrids, but the system exhibits nonlinear behavior due to dynamic scenarios present on the grid side as well as the load side. Linear control strategies are typically implemented with several feedback loops by proportional-integral (PI) controllers, while proportional-integral-derivative (PID) controllers use high-pass filters to implement the derivative components.

Liping et al. (2009) compared PI, PID, and fuzzy controllers based on design methodology, implementation issues, and experimentally measured performance. A major drawback of the scheme, however, is that the PI controller increases the dimension of the closed-loop system (Chimaobi and Alexis 2010). Another drawback is that the constant power loads’ current and voltage experience overshoots during transients that may be undesirable in some applications (Chimaobi and Alexis 2010). Grant and Philip (2006), Axel et al. (2009), and Julian et al. (2007) explored a nonlinear control approach called boundary control to achieve more robustness and better transient performance at the cost of complexity in implementation. Vahid et al. (2008) attempted to tackle the issue of constant power load using a combination of linear and nonlinear control approaches. Sana et al. (2023) opined that grid integration with the distribution network required hierarchical control structures for maintaining stable operation and control, which is otherwise challenging due to several technical challenges related to the large-scale integration of inverter-based resources.

In recent times, advancements in nonlinear control approaches have given rise to more sophistication in microgrid control. These modern control techniques offer a valuable alternative to the conventional control techniques mentioned above in terms of improvement in control performance. Artificial Intelligence (AI) techniques aid in the modeling of controllers in microgrids when the number, type, and nature of renewable energy sources and consumer participation are increasing by the day, which in turn leads to more complexity and uncertainty.

Among the AI techniques, several works cited the use of fuzzy and neural network-based strategies. While the fuzzy technique addresses the problems that arise due to uncertainty in the environment by embedding inference procedures that are akin to human reasoning, controllers implemented on neural network models leverage advantages such as supervised learning to tackle nonlinearity and to deal with Maximum Power Point Tracking (MPPT), voltage and frequency control, and load sharing. Intelligent controllers are notably suitable for these types of applications because they can adapt to uncertainties and be used when the exact model of a system is not available or is prone to changes (Tania et al. 2020). Navid et al. (2019) proposed an adaptive controller in a fuzzy-based model and applied it to a DC microgrid test bed that fed one constant power load, while Hiroaki et al. (2013) presented a new voltage control that combines fuzzy control with gain-scheduling techniques to accomplish both power sharing and energy management. Ahmed et al. (2022) presented an optimal adaptive fuzzy management strategy designed for a DC microgrid based on a fuel cell system, photovoltaic array, and battery bank.

Artificial neural networks (ANN) have certain characteristics that make them advantageous in the development of controllers in the different levels of control that microgrids must include to be economic, efficient, and able to satisfy the energy power quality and quantity requirements (Tania et al. 2020). ANN has been used for current and voltage control in microgrids, most popularly in tuning the parameters of the PI controller. Chettibi and Mellit (2018) presented a controller for MPPT tracking by implementing a neural network optimization for voltage reference for the PI controller. Marko et al. (2013) attempted to solve an optimization problem using neural networks to reduce energy imbalances between electric energy production and consumption. Michael et al. (2016) presented a neural network model to predict voltage in an environment with high penetration of renewable energy sources, using the well-known Levenberg–Marquardt algorithm for achieving the learning.

A few nature-inspired optimization techniques have been cited in the literature for DC microgrid control. Shehab et al. (2019) presented a fuzzy logic controller that was optimized using an artificial bee colony technique to increase the system’s energy-saving efficiency, in which the microgrid consisted of solar PV, wind turbine, battery energy storage and fuel cell. Basma et al. (2022) used an African vulture optimization algorithm to demonstrate the stability of a DC bus through voltage control for a DC-islanded microgrid. Farid et al. (2017) discussed the comparison of flower pollination algorithm, modified particle swarm optimization, and perturb and observe methods in MPPT-coupled inductor sepic converters on a DC microgrid-isolated system, while Hany and Mahmoud (2018) discussed a water cycle algorithm for efficient operation of microgrid. Sathish et al. (2022) introduced an artificial gorilla troop optimizer for use in artificial neural networks that manage energy consumption in DC-AC hybrid distribution networks.

None of the above works that have reported the use of intelligent control and nature-inspired techniques have dealt with the UPQC system, and we identified this as the research gap to explore in our work. Of those works that dealt with UPQC technologies, different control design methods have been discussed. Palanisamy et al. (2013) proposed a method of power angle control via the use of UPQC for interconnecting PV modules with the grid, while Victor et al. (2018) built a UPQC with a transformer-free model. Tey et al. (2002) detailed their study on the development of a UPQC for the correction of harmonics in a low AC voltage system with control provided by an ANN, and particularly, the inverter operation was managed by means of the Levenberg–Marquardt Back Propagation (LMBP) method. Hina et al. (2022) focused their study on the controller implementation for a UPQC that was part of a microgrid in which ANN provided the basis for the controller. In both of these works, artificial neural network control was used for overall control, not particularly for compensation. The use of ANN for overall control with the Levenberg–Marquardt algorithm as its core has some disadvantages—it needs a large amount of input and output data pairs for training the neural network, and this algorithm is trapped into the local minima points for efficient convergence. Hence, the AEONN controller is proposed in this paper to leverage its exploratory and exploitation capabilities in optimization and compensation and this controller utilizes the Artificial Ecosystem-based Optimization (AEO) algorithm which belongs to a class of meta-heuristic algorithms that were inspired by nature, and originally introduced by Weiguo et al. (2020).

Sachin and Bhim (2021) reported a fascinating study on control methodology for shunt and series compensators, and we have adopted this control methodology explained in Sachin and Bhim (2021) for our design, but instead of the traditional PI controller, we have employed artificial ecosystem optimization in shunt and series compensation schemes. The PI controller increases the dimension of the closed-loop system and increases search space. Traditional PI controller can compensate for a part of harmonic, which is not too fruitful (Sen et al. 2018). Also, the appropriate selection of initial gains of PI controller, as done in Sachin and Bhim (2021) requires intuition and knowledge of the process, which can be eliminated by the proposed control design technique. When substituted for a traditional PI controller, the intelligent routine implemented by the AEONN controller helps tune the parameters so that the optimal performance of the system can be reached when PV sources and battery systems are involved. It is shown that this would enhance the voltage profile and current harmonics, and the power fed to nonlinear loads can be optimized. This efficient and reliable algorithm makes it possible to achieve a seamless transfer of power between islanded and grid-connected modes, which is otherwise a challenge with UPQC topologies. This feature is highly beneficial when critical loads, such as hospitals, factories, and data centers, are on the distribution network.

In this work, simulation-based experimentation is used to examine the system's performance in full detail. The system's performance is assessed under a variety of dynamic scenarios that are commonly present in a contemporary distribution network, such as grid voltage changes, automated changeover, grid inaccessibility, variation in PV power output, and nonlinear load. When the system switches automatically from grid-connected mode to standalone mode in the event of a grid fault or failure, the behavior of the system is also assessed.


In this section, the basic control methodology for the battery and photovoltaic-powered UPQC for microgrid application is detailed. The overall circuit diagram with its three chief subsystems—the bidirectional converter, series, and shunt compensators—is shown in Fig. 1. The point of common coupling is via the switches SW1, SW2, and SW3, using which the microgrid is connected to the three-phase system. Under normal operations, the system is connected to the grid via these switches. During any grid disruption event, the system will be operated via the UPQC operating in its islanded mode. The dually powered UPQC system includes a battery and a solar PV array integrated with the series and shunt compensators in conjunction with the DC link between them. The voltage source converters that make up these active compensators are linked to the supply via the interfacing inductors. To reduce the harmonics generated by the high-frequency switching of these devices, ripple filters are installed, as shown in the circuit diagram in Fig. 1.

Fig. 1
figure 1

Circuit diagram of dually powered UPQC for microgrid applications

Firstly, the shunt compensator’s control logic is described in the following paragraph, followed by that of the series compensator and the bidirectional converter, respectively. The shunt compensator of the dual-powered UPQC system operates in two modes, depending on whether it is operated in the grid-connected mode or islanded mode. When it is connected in the grid connected mode under normal operation, the compensator acts as a current regulator and while it is in the islanded mode under any grid disturbances, it acts as the voltage regulator. The fundamental purpose of the shunt compensator under islanded operation is to maintain a constant load voltage profile despite irradiance and load changes. The detailed control logic diagram of these modes is shown in Fig. 2.

Fig. 2
figure 2

Shunt control schematics with AEONN controller

In this work, we assume that the signal that distinguishes between the two modes is known by the symbol C_sig. When C_sig equals zero, the system operates in its islanded or standalone mode, whereas when C_sig equals one, the system is in its grid-connected mode. During grid-connected mode, the shunt compensator compensates for the load current and provides the PV electricity to the normal working grid. Whenever there is a load imbalance or little irradiance fluctuation, the shunt compensator is set up to provide power to the grid, and the battery bank provides the required extra power. In this way, the network’s stability is improved by pumping active power into the grid. As seen in Fig. 2, the gate pulses to control the Shunt Voltage Source Converter (SH-VSC) are generated using the reference currents received. When the system is operating in an isolated or islanded mode, the SH-VSC is structured to maintain a constant load voltage, regardless of fluctuations in the load currents and the solar irradiances. Here, a three-phase sine generator is used to generate the reference load voltages, which are then related to the measured load voltages for processing by the optimized AEONN controller to obtain the load reference current. Therefore, when the system is in standalone mode, the reference load currents are compared with the measured load currents, ahead of the generation of gate pulses for the SH-VSC. Depending upon the control logic signal, based on whether the system is operating in islanded or grid-linked mode, the corresponding gate pulses are delivered to the SH-VSC. As shown in Fig. 3, using the phase voltages, the voltages at the point of common coupling are obtained as follows:

Fig. 3
figure 3

PCC voltages

$${V}_{IN}=sqrt\left\{ \left(\frac{2}{3}\right)\left({V}_{in\_a}^{2}+{V}_{in\_b}^{2}+{V}_{in\_c}^{2}\right)\right\}$$

Based on the preset grid reference power, the magnitude of the reference phase current is calculated as given by Eq. (5), and the instantaneous currents are given in Eqs. (6)–(8).

$${I}_{in\_a}={I}_{in\_r}{ V}_{p\_a}$$
$${I}_{in\_b}={I}_{in\_r}{ V}_{p\_b}$$
$${I}_{in\_c}={I}_{in\_r}{ V}_{p\_c}$$

The control logic for the decision signal C_sig, is depicted in Fig. 4. This signal, C_sig, is used to distinguish between grid-connected mode of operation and islanded mode and enables the switches to connect during the former and detach from the grid during the latter. The main criteria that decide the output of the decision signal C_sig are the phase differences, voltage magnitude differences, and frequency differences between the load and PCC voltages, along with the operating mode. As seen from Fig. 4, some conditions in the control logic include checking whether the phase difference and the frequency difference between the load and PCC voltages are less than 3° and 0.3 Hz, respectively. The same is true if the voltage magnitude difference is under 0.05 p.u. or above 0.3 p.u. All the criteria outputs are sent to two AND logic blocks, with one obtaining the output corresponding to standalone mode, that is when it is less than 0.05p.u., and the other corresponding to grid-connected mode having an amplitude difference tolerance of up to 0.3p.u. The outputs of the AND logic blocks are then sent to the OR logic gate to ultimately produce the decision control signal C_sig.

Fig. 4
figure 4

Control logic diagram: C_sig generation

The series compensator’s control logic is given as follows: As shown in Fig. 5, the gate pulses for the series voltage source converter (SER-VSC) are generated using Pulse Width Modulation (PWM). The control logic for this is based on Park-Clark’s synchronized reference frame theory. During grid-connected mode, the SER-VSC regulates load voltages to eliminate PCC voltage swings, whereas during islanded mode, the SER-VSC is bypassed as the SH-VSC controls the voltage at the time of grid outages.

Fig. 5
figure 5

Series control schematics with AEONN controller

To maintain the load voltages and the PCC voltages in phase, SER-VSC injects the required voltage, and this is done by translating these voltages into their d-q reference frame. The voltage differences between the d-q axes’ load and source voltages yield the actual SER-VSC voltages, and the corresponding differences between the load references and source voltages yield the reference SER-VSC voltages as given in the following equations.


The controllers receive the SER-VSC voltages in the d-q frame, and the necessary regulator voltages are produced, which are translated back into their corresponding values in abc frame and sent to the switching logic generator to generate the output signals depending on the decision signal C_sig. The AEONN controller is used to generate the reference compensating voltages for series compensation, as can be seen in Fig. 5. Using this control signal, the decision signal and the reference signal obtained from the load voltages, the switch logic determines the signal to be output to the PWM generator.

Finally, we describe the control logic for the bidirectional converter, which is responsible for keeping the system’s dc-link voltage constant throughout. To sustain the dc-link voltage of the SH-VSC and the SER-VSC systems, the duty cycle is generated via the proposed AEONN controller. The controller processes the MPPT voltage and the PV voltage error to obtain the duty cycle for the gate pulse generation as given by Eq. (13). Using the generated duty ratios, proper switching signals for the converter are produced via the PWM signal generator, as shown in Fig. 6.

Fig. 6
figure 6

Control logic diagram: Bidirectional converter

$${\mathrm{D}}_{\mathrm{dc}}=\sum {\mathrm{W}}_{\mathrm{i}}{\mathrm{V}}_{\mathrm{err}}+{\uptheta }_{\mathrm{i}}+\sum {\mathrm{W}}_{\mathrm{j}}{\mathrm{V}}_{\mathrm{ref}}+{\uptheta }_{\mathrm{j}}$$

AEONN control

The AEO algorithm offers particularly great optimization capabilities in microgrid applications for dealing with grid or load variations and typically requires only two parameters: the number of iterations and the population size. This feature, when combined with its simple structure, makes it a desirable candidate for problems requiring faster convergence. It neither imposes many tuning parameters nor a suitable range of values for these parameters. The computational complexity of this algorithm is further reduced due to its exploration and exploitation capabilities, which depend on a linearly decreasing value in the search space.


The AEO algorithm is based on a synthetic ecosystem having three operators: production, consumption, and decomposition (Weiguo et al. 2020). For the first operator, increasing the exploration-to-exploitation ratio is of paramount importance. The second operator typically improves the algorithm's exploratory capabilities, while the third operator is used to enhance its exploitation. To find a solution, AEO typically adheres to the following guidelines, as depicted in Fig. 7: the population of the ecosystem is made up of three different types of organisms: producers, consumers, and decomposers. Consumers make up the rest of a population, and they might be carnivores, herbivores, or omnivores. Each member of a population either contributes to the food chain or breaks it down.

Fig. 7
figure 7

Ecosystem structure in AEO (Weiguo et al. 2020)

Each person in the population has an energy level that their function aptness value quantifies. Since all individuals are arranged in decreasing order of function aptness value, greater values imply greater energy requirements for the minimization function. The worst person, x1, with the highest function aptness value, is a producer, whereas the best person, xn, with the least function aptness value, is a decomposer. Since the remaining xs are consumers, we may safely assume that x2 and x5 are herbivores, x3 and x7 are omnivores, and x4 and x6 are carnivores. A producer in an ecosystem uses carbon dioxide, water, sunshine, and nutrients from the decomposer to make food energy. In AEO, the decomposer (the best individual) and the lower and higher bounds of the search area are used to update the producer, who is the poorest individual in a population, and the latter then instructs the rest of the population's members, both herbivores and omnivores, to look in those regions. Using AEO, we can generate a new person to replace the present one at random, and it might be either the best person (xn) or a person generated at random from the search space (xrand). The following is a representation of the production operator's mathematical model (Weiguo et al. 2020):


where n is the size of the population, T is the maximum number of epochs, L and U are the minimum and maximum bounds, respectively, r1 is an arbitrary number between 0 and 1, r is a random vector between 0 and 1, a is a linear weight constant, and xrand is the position of a randomly generated distinct in the exploration space. Equation (14) uses the weight coefficient a to linearly drift the person from an arbitrarily generated starting point near the optimal starting point as the number of repeats increases. Equation (14) shows that in the first few iterations, × 1(t + 1) may cause the other people to accomplish a broad search of the exploration space, while in the last few iterations, × 1(t + 1) can cause the other people to engage in a highly exploitative phase around xn. Using Eq. (14), we can reproduce this production operator in both 2D and 3D spaces. Suppose this production behavior is carried out 20 times. The operator provided by Eq. (14), as seen in Fig. 7, progressively drives a randomly produced person in the direction of the ideal person who achieves the position of the best person after 20 repetitions.

All consumers may engage in consumption operator once the producer completes production operator. A consumer may get food energy by eating a creator or an arbitrarily chosen customer with less energy, or both. Levy flying is a scientific operator that mimics the foraging behaviors of several creatures, such as cuckoos, bumblebees, deer, and lions. Levy flight is a kind of arbitrary walk that can discover the global optimum since certain steps have higher lengths over time. As a result, levy flying was often included in algorithms as it was inspired by nature to improve their optimization efficiency. This straightforward, parameter-free random walk with the levy flying feature promotes computational search space reduction since it does not require tuning of parameters. Given below C is the consumption factor (Weiguo et al. 2020):

$$\mathrm{C}=\frac{1}{2} \frac{{\mathrm{v}}_{1}}{\left|{\mathrm{v}}_{2}\right|}$$
$${\mathrm{v}}_{1}\sim \mathrm{N}\left(\mathrm{0,1}\right), {\mathrm{v}}_{2}\sim \mathrm{N}(\mathrm{0,1})$$

The standard distribution N(0,1) has a mean of 0 and a normal deviation of 1. It has been discovered that these arbitrary walks tend to congregate around a fundamental location and sometimes allow for lengthy jumps away from the starting position. It gives AEO the chance to avoid regional extremes and scan the full search area. Therefore, although different consumer types use various consumption techniques, this consumption component may aid each consumer in their quest for food.

A consumer will only eat the producer if it is a randomly selected herbivore. Consumers × 2 and × 5 are both herbivores who exclusively eat the manufacturer × 1, as seen in Fig. 7. Equation (19) quantitatively represents this herbivore eating pattern.

$${\mathrm{x}}_{\mathrm{i}}\left(\mathrm{t}+1\right)={\mathrm{x}}_{\mathrm{i}}\left(\mathrm{t}\right)+\mathrm{C}.\left({\mathrm{x}}_{\mathrm{i}}\left(\mathrm{t}\right)-{\mathrm{x}}_{1}\left(\mathrm{t}\right)\right),\quad\mathrm{ i}\in [2\dots ..,\mathrm{n}]$$

If a consumer is nominated at random to be a carnivore, it can only eat a customer arbitrarily who has a greater energy level. The consumer × 6 in Fig. 7 is a carnivore, so it must arbitrarily select a consumer from the group of people × 2 to × 5 with the highest energy level for food. The following equation represents a carnivore's eating habits:

$${\mathrm{x}}_{\mathrm{i}}\left(\mathrm{t}+1\right)={\mathrm{x}}_{\mathrm{i}}\left(\mathrm{t}\right)+\mathrm{C}.\left({\mathrm{x}}_{\mathrm{i}}\left(\mathrm{t}\right)-{\mathrm{x}}_{\mathrm{j}}\left(\mathrm{t}\right)\right),\quad\mathrm{ i}\in [3\dots ..,\mathrm{n}]$$
$$\mathrm{j}=\mathrm{randi}(\left[2\mathrm{ i}-1\right])$$

If a consumer is arbitrarily selected as an omnivore, it may devour both a producer and a consumer with a greater power level. The consumer × 7 in Fig. 7 is an omnivore; thus, it must devour both the producer × 1 and a customer arbitrarily nominated among the people × 2 to × 6 who have more energy than × 7. The following is the precise equivalence that describes how an omnivore consumes food:

$${\mathrm{x}}_{\mathrm{i}}\left(\mathrm{t}+1\right)={\mathrm{x}}_{\mathrm{i}}\left(\mathrm{t}\right)+\mathrm{C}.({\mathrm{r}}_{2}\left({\mathrm{x}}_{\mathrm{i}}\left(\mathrm{t}\right)-{\mathrm{x}}_{1}\left(\mathrm{t}\right)\right), +\left(1-{\mathrm{r}}_{2}\right)\left({\mathrm{x}}_{\mathrm{i}}\left(\mathrm{t}\right)-{\mathrm{x}}_{1\mathrm{j}}\left(\mathrm{t}\right)\right),\quad\mathrm{ i}\in [3\dots ..,\mathrm{n}]$$
$$\mathrm{j}=\mathrm{randi}(\left[2\mathrm{ i}-1\right])$$

where r2 is a chance number that falls between [0, 1]. When using this consumption operator, AEO adjusts a search person's position in relation to the worst or an arbitrarily selected distinct in a populace, or both. This performance favors examination and enables AEO to conduct a worldwide search.

For an ecosystem to work properly, decomposition is a very important process. It also supplies crucial nutrients for the producer's development. When every member of the population passes away during decomposition, the decomposer's remnants will deteriorate or undergo chemical breakdown. To quantify this behavior, we develop the decay factor D and the weight constants e and h. By adjusting D, e, and h, one may determine where the decomposer xn is relative to the location of the ith person xi in the population. It partially demonstrates exploitation by allowing each person's next position to circulate around the best person (the decomposer). The following equation accurately describes this breakdown behavior (Weiguo et al. 2020):

$${\mathrm{x}}_{\mathrm{i}}\left(\mathrm{t}+1\right)={\mathrm{x}}_{\mathrm{n}}\left(\mathrm{t}\right)+\mathrm{D}.\left(\mathrm{e}{.\mathrm{x}}_{\mathrm{n}}\left(\mathrm{t}\right)-{\mathrm{h}.\mathrm{x}}_{\mathrm{i}}\left(\mathrm{t}\right)\right)\mathrm{ i}=[1\dots ..,\mathrm{n}]$$
$$\mathrm{D}=3\mathrm{u},\mathrm{ u}\sim \mathrm{N}(\mathrm{0,1})$$
$$\mathrm{e}={\mathrm{r}}_{3}.\mathrm{randi}\left(\left[1 2\right]\right)-1$$

Equation 14 is applicable to extending the position to 2-D and 3-D spaces as well. As the gap between the current person xi and the person xn becomes larger, the sampled points become more sparsely distributed, where most of the sampled points randomly disperse in this range. According to this scenario, a few sampled points tend to randomly occupy certain places that are located far from the individual xn. This finding may be used to justify taking advantage of and avoiding the regional extreme. AEO creates a population at random to begin the optimization process. The primary exploration individual changes its location as per Eq. (14) at each iteration, while the other people have the same chance of updating their positions based on Eqs. (20)–(23). If someone is provided a better function value, the algorithm will accept it and each person will adjust their position. During the updating process, if a person crosses the lower or higher bound, a random number will be created in the search space. Until the AEO algorithm meets a termination value, all updates are carried out iteratively. The finest parameter so far discovered has finally been returned.

In summary, the following observations are made in accordance with the procedure and the corresponding optimization results:

  1. 1.

    With a greater number of iterations, the production helps AEO build an applicant solution that drifts from an arbitrarily created location to the optimal location and will direct other people to conduct consumption operators throughout the consumption process. The equilibrium between exploratory and manipulative search is substantially aided by this tendency.

  2. 2.

    The eating element motivates AEO to conduct a worldwide exploration. Each customer is equally likely to be an herbivore, a carnivore, or an omnivore throughout the eating process.

  3. 3.

    Using three important factors, the decay permits AEO to modify each person's position depending on the best result in the populace. It could improve AEO exploration. The flowchart of the AEO procedure is shown in Fig. 8.

Fig. 8
figure 8

Flowchart of AEO procedure

Neural network structure

Neural networks have the capability to organize themselves depending on the inputs they receive throughout the learning process and create and remember the mapping between the input–output pair. This capability is exploited in controller applications where a nonlinear relationship between the input and output data pairs exists. The valuable feature of the ANN controller is its ability to learn, adapt, calculate the mean square error, and predict the corresponding output to reduce the error between input and output. Figure 9 depicts the generalized black diagram of an ANN based controller.

Fig. 9
figure 9

Generalized blocks of ANN controller

The generic structure of the ANN controller with AEO optimization embedded makes it an ideal candidate for microgrid applications. The data-based approach of ANN, wherein knowledge is contained within and extracted from the data itself, is very applicable to tuning the controller parameters so that the optimal performance of the system can be reached when PV sources and battery systems are involved in the microgrid. More importantly, the AEONN controller uses the same method for training the shunt and series compensator as well as the bidirectional converter. For UPQC compensation, it is necessary that the controller response be fast and accurate. In the proposed AEONN controller, the generation of error between load voltage reference and sensed load voltage signals must be not only rapid and accurate but also consistent over a large operating range.

The AEONN model is built in the following ways: (1) load the data; (2) fix the targets and number of neurons; (3) create the feed-forward neural network; (4) calculate each neuron's starting weight value and bias; (5) obtain the cost function to determine a neuron's output; (6) run the AEO routine; and (7) get the AEONN weights and Mean Squared Error (MSE). This paves the way for the optimal network structure. The number of neurons was fixed at ten for a rapid response of the controller, and the feed-forward network propagates from the input layer to the output layer in a forward direction through the hidden layer. Table 1 shows the parameters of the feed-forward network configured.

Table 1 Parameters of the neural network

Figure 10 shows the snapshot of the program routine written for shunt compensation.

Fig. 10
figure 10

Program routine for shunt compensator

The above AEONN algorithm was tested for MPPT, shunt, and series compensators, and the optimal value of the fitness function in all these cases was examined. The convergence plot corresponding to the shunt compensator is shown in Fig. 11 in which the best cost value of 0.635 was reached by the 67th iteration and stayed stable after that. Similarly, the MPPT algorithm produced 1.59 at the 100th iteration, while the series compensator had the best cost value of 2.56 at the 500th iteration.

Fig. 11
figure 11

Convergence curve for shunt compensator

AEONN controller schematics

A prototype of a three-phase, battery, and PV-powered UPQC is tested in MATLAB-Simulink (R2021a) in a variety of dynamic settings, representative of both standalone and grid-connected modes of operation to assess the system's performance in each setting. Table 2 displays the specifications of the settings that were employed.

Table 2 Specification of the test system

The overall implementation in Simulink is shown in Fig. 12, which shows the various subsystems such as the PV system, battery management system, MPPT control system, PWM generator, coupling inductor, and a nonlinear load, complete with the proposed AEONN controller.

Fig. 12
figure 12

Overall schematics


The simulation results for normal and dynamic irradiance conditions with grid-connected mode as well as islanded mode operation at the time of grid fault conditions are presented in this section. We show the zoomed results for better clarity.

Grid connected mode

Firstly, the PV system was assumed to be operating under normal conditions, that is, the irradiance maintained at 1000 W/m2 and the temperature maintained at 25 °C under grid-connected mode. The performance of the dually powered UPQC with the proposed controller was assessed under these normal test conditions.

Normal PV system condition

First, we describe the zoomed results of the normal test conditions. The proposed system was simulated with a nonlinear load, and the magnitude of the load current varies according to the number, type, and nature of the loads. It can be observed from the schematics in Fig. 12 that the load current is simply a branch current, and hence its peak value of approximately 2.5A is less than that of grid current (about 10A). The photovoltaic and battery-powered UPQC system with the AEONN controller ensures a steady stream of supply in the grid at all times to be able to compensate for grid voltage changes, automatic changeover, and variation in PV power output. This is yet another reason for the grid current to be in excess of the load current in magnitude. The grid voltage was maintained at 1 p.u. at its nominal value of 110 V; Fig. 13 shows the corresponding peak value of grid voltage, and that the controller is able to maintain a constant voltage across the nonlinear load satisfactorily. Figure 14 depicts the grid, load, and compensator currents, while from Fig. 15, it can be observed that the voltage of the battery is held at 120 V and current is at 24 A, and the battery is constantly being charged by the normal conditions prevailing at the grid and load sides.

Fig. 13
figure 13

Voltages of normal PV system condition

Fig. 14
figure 14

Currents of normal PV system condition

Fig. 15
figure 15

Battery voltage and current of normal PV system condition

Voltage sag condition

Voltage fluctuations at the grid side are a scenario that is very much a possibility in a contemporary network, as the PCC may not be near the voltage-regulated supply node and hence voltage sag and swell conditions are validated for the proposed controller in this subsection and the next. When a 0.2 p.u. voltage sag condition was created at the grid side, the grid voltage reduced from a peak value of approximately 155 V to 124 V for a duration of 0.3 s to 0.5 s, but the system was able to maintain the load voltage constant at 1 p.u. due to the injection of compensation voltage by the series active compensator, and the amount of voltage compensated was found to be exactly what was required in magnitude and phase, and the load voltage was sinusoidal, as can be observed in Figs. 16 and 17. The shape of waveforms for currents at grid, load, and compensator sides, respectively, are same as in Fig. 14 for the sag condition as well. The AEONN controlled shunt converter supplies the current in a phase opposite to the harmonics present in load currents due to the combination of the sag condition and nonlinear loads, and so the grid currents were compensated accordingly. Thus, the harmonics in grid currents were reduced, and the proposed controller was able to deliver very satisfactory results under sag the condition.

Fig. 16
figure 16

Voltages for sag condition

Fig. 17
figure 17

Sag condition-zoomed view of voltages

Voltage swell condition

Under this scenario, the grid voltage was increased to 1.2 p.u. (186 Vp), mirroring under-loaded conditions that can prevail in a contemporary distribution network, and the results were analyzed. Figure 18 shows the grid, load, and compensated voltages, while Fig. 19 shows the zoomed figures of the same. It can be observed that the AEONN controlled UPQC system efficiently compensates for the swelled voltage and helps sustain the sinusoidal load voltage waveform at 1 p.u. This is primarily due to the series converter, controlled by the AEONN, being aware of the instantaneous values of grid voltages, and was able to introduce out-of-phase voltages under the swell condition to maintain the load voltage sinusoidal, along with mitigating the harmonics at the load side. The contribution by the controlled shunt compensator in reducing its reactive current drawn from the grid also assists the series compensator in injecting the correct voltages, in both magnitude and phase. Hence, here again, we see that the proposed controller was able to maintain a constant load voltage with a sinusoidal waveform.

Fig. 18
figure 18

Voltages for swell condition

Fig. 19
figure 19

Swell condition—zoomed view of voltages

Dynamic change in irradiance

The simulation results with dynamic change in irradiance conditions (i.e., irradiance change from 1000 W/m2 to 500 W/m2 at 0.5 s and temperature maintained at 25 °C) are presented in this subsection. Figure 20 shows grid voltage reduced to 0.8 p.u. between time periods of 0.2 s to 0.4 s and increased to 1.2 p.u. between 0.6 s to 0.8 s and that the AEONN controller efficiently compensates both for the sag and swelled voltage and helps sustain the sinusoidal load voltage waveform at 1 p.u. It can be observed that under the dynamic change in irradiance condition, the amount of voltage compensated was found to be exactly what was required in magnitude and phase, and the load voltage was sinusoidal, as can be observed in Fig. 20.

Fig. 20
figure 20

Voltage waveforms due to dynamic change in irradiance

As the primary function of a UPQC is to improve power quality by mitigating voltage sags, swells, and harmonics, the dually powered UPQC with the proposed controller injects compensating current into the grid, as can be seen in Fig. 21, with its magnitude and phase in accordance with the required degree of compensation. Under conditions of irradiance fluctuation, the AEONN controlled shunt compensator sets up to provide active power into the grid, and the battery bank supplies the required extra power. During the compensation process, any excess current flows into the grid, and hence the peak value of grid current is higher than that of load current. The AEONN controlled shunt converter, as shown in Fig. 21, injects accurate compensation current in the point of common coupling to make the grid current sinusoidal. The controller supplies the current in a phase opposite to the harmonics present in load currents under the dynamic change in irradiance, and so the grid currents were compensated accordingly, and the proposed controller was able to deliver very satisfactory results under this scenario.

Fig. 21
figure 21

Current waveforms for dynamic change in irradiance

Islanded mode

The simulation results with grid disturbance conditions when a grid fault occurs are presented in this subsection, and the system’s ability to maintain seamless operation from grid-connected mode to islanded mode and from islanded mode back to grid-connected mode is investigated. With irradiance maintained at 1000 W/m2 and temperature maintained at 25 °C, the grid is made unavailable between 0.3 to 0.5 s, as grid voltage is reduced to 0.2 p.u. during this period, as can be seen in Fig. 22, and it can be noted that a constant load voltage profile is adequately maintained by the shunt compensator as the series compensator does not have any role during this mode of operation. Here again, by maintaining the grid currents sufficiently higher than the load current, the controller was able to counteract voltage disturbances and maintain a stable voltage at the load side. The dually powered UPQC, controlled by AEONN, automatically switches to islanded mode, which can be noticed by the absence of grid current in Fig. 23, and prioritizes the resource to be available for critical loads. A continuous supply of power, though not at its nominal value, is provided by the battery system, as can be noticed in Fig. 24, as the battery is discharging at a fast rate to supply power to the critical load. Upon restoration to grid-connected mode, it can be noted from Fig. 22 that the phase voltages of the load are aligned with those of the grid voltages, and thus a seamless transition from islanded mode to normal operation is enabled by the proposed controller.

Fig. 22
figure 22

Voltages under islanded mode

Fig. 23
figure 23

Currents under islanded mode

Fig. 24
figure 24

Battery system voltage and current under islanded mode

Total harmonic distortion

We investigated the waveforms of PCC grid currents and load voltages of AEONN controlled UPQC system and calculated the total harmonic distortion (THD) percentages of fundamental components. Figure 25 shows the THD of the current of the grid at normal conditions is 3.67% while the THD of the load voltage is 0.02%. It was found that the PCC grid current THD and load voltage THD are both under 5%, satisfying the requirements of the IEEE-519 standard.

Fig. 25
figure 25

THD percentages with AEONN controller under normal condition: grid current THD (left figure) and Load voltage THD (right figure)

We also simulated the UPQC system with just a traditional PI controller under normal condition, and obtained the waveforms of grid current and load voltages (Figs. 26 and 27), and calculated THD percentages of fundamental components (Fig. 28). The THD of the grid current and load voltage with traditional PI control was found to be 8.31% and 0.12%, respectively and the grid current THD is over the limit as per IEEE-519 standards. On the other hand, the proposed AEONN controller, in comparison to the traditional PI controller, has been able to efficiently reduce the high amount of THD in both the grid current and load voltage variables and bring it within the limits so as to obey the IEEE-519 standard as demonstrated in Fig. 25.

Fig. 26
figure 26

Grid current waveform with traditional PI control

Fig. 27
figure 27

Load voltage waveform with traditional PI control

Fig. 28
figure 28

THD percentages with traditional PI controller under normal condition: grid current THD (left figure) and Load voltage THD (right figure)

We investigated the waveforms of PCC grid currents and load voltages for all the scenarios discussed above and calculated the THD percentages of fundamental components. The summary of what we found is presented in Table 3. As can be seen, the values pertaining to the proposed AEONN controller are within the limits as per IEEE-519 standards.

Table 3 THD percentages


This study detailed a new method for controlling the UPQC system that was dually powered by the battery and photovoltaic system, based on an artificial ecosystem optimized neural network. AEO algorithms are a great choice as optimization routines in controller applications due to their simpler structure, enhanced exploration capability, and faster convergence, reduced complexity, and cost. The intelligent control algorithm was implemented in the shunt and series compensator of UPQC, both of which exhibited excellent performance attributes both under normal and voltage fluctuation conditions during grid-connected mode of operation when normal PV system behavior was established. The system was able to maintain a constant load voltage profile with a satisfactory PCC grid current under all the stated conditions. The system was also assessed under dynamic conditions such as irradiance changes and fault occurrence, and the battery system was able to instantly start discharging the current to maintain a steady stream of power to the vital loads, while the overall system also ensured a quick and seamless transition when normal operation was restored. The quality of power delivered also conformed to the standards of IEEE-519, as evidenced by the THD values of the point of common coupling currents. The system shows a lot of promise for real time implementation, as this would mean faster response of the controller due to the intelligence embedded without compromising the accuracy of compensation. These modeling approaches can be employed to design, test, and commission dually powered UPQC systems in the microgrid and could aid in the systematic planning of the macrogrid as well. Our future research will focus on improving the speed and accuracy of the controller in combination with robust battery and inverter design strategies of PV system, along with the provision of electricity pricing.

Availability of data and materials

Data is available from the authors upon request.



Artificial Ecosystem Optimized Neural Network


Artificial Intelligence


Artificial neural network


Energy management system


Levenberg Marquardt Back Propagation


Maximum Power Point Tracking


Per unit


Point of common coupling


Proportional Integral


Proportional Integral Derivative




Pulse Width Modulation


Series voltage source converter


Shunt voltage source converter


Total harmonic distortion


Unified power quality conditioner


Voltage source converter


Download references


This research received no external funding.

Author information

Authors and Affiliations



RR and GBR did Conceptualization, while the methodology was devised by RR. and AF. The validation was done by RR, GBR and AF. All the three authors contributed to writing and review and editing. All authors read and approved the final manuscript

Corresponding author

Correspondence to Gomathi Bhavani Rajagopalan.

Ethics declarations

Ethics approval and consent to participate

Not applicable.

Consent for publication

Not applicable.

Competing interests

The authors declare that they have no competing interests.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, 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 changes were made. 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

Reprints and Permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Ratnakaran, R., Rajagopalan, G.B. & Fathima, A. Artificial ecosystem optimized neural network controlled unified power quality conditioner for microgrid application. Energy Inform 6, 45 (2023).

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: