Proposal of an Adaptive Neurofuzzy System to Control Flow Power in Distributed Generation Systems

Systems of distributed generation have shown to be a remarkable alternative to a rational use of energy. Nevertheless, the proper functioning of them still manifests a range of challenges, including both the adequate energy dispatch depending on the variability of consumption and the interaction between generators. This paper describes the implementation of an adaptive neurofuzzy system for voltage control, regarding the changes observed in the consumption within the distribution system. The proposed design employs two neurofuzzy systems, one for the plant dynamics identification and the other for control purposes. This focus optimizes the controller using the model achieved through the identification of the plant, whose changes are produced by charge variation; consequently, this process is adaptively performed. The results show the performance of the adaptive neurofuzzy system via statistical analysis.


Introduction
The increasing demands of energy, together with the associated costs, enhance the necessity of creating new energetic alternatives covering aspects such as the economic generation of energy and uninterrupted production.Distributed Generation (DG) has become an attractive method that offers electricity to consumers.This focus lowers the costs of installation of generators and the production of electricity; in addition, the electrical efficiency can also be improved using cogeneration [1].Distributed energy resources have demonstrated potential advantages for use in energy generation and distribution [2].
Conventionally, electric energy systems consist of large interconnections characterized by a centralized high voltage generation and transmission over long distances.In recent years, a DG approach is being implemented to reduce energy losses in transmissions [3].According to [4], electricity DG units located in adequate places (near to users) allow reducing transmission losses and increasing the flexibility to the generation system using local renewable energy sources.A microgrid integrates heterogeneous distributed energy resources within the distribution system [5].Microgrids represent a challenge that requires control techniques, automation, and computation for generation and distribution [6].
In terms of energy systems, resources of distributed energy, such as fuel cells, microturbines, wind generation, and photovoltaic systems, have a wide range of advantages [7,8].For instance, demands can be efficiently mitigated, increasing the reliability against failures in energy systems and improving the quality of those systems through sophisticated control schemes.The concept of microgrid has been proposed for solving common interconnection problems of individual DG in different energy systems [9].A microgrid is defined as an independent grid power of low or medium voltage of distribution that operates in three different modes: connected to a power grid, isolated (autonomous), and transition mode [10].

Complexity
Generator systems require to operate in the boundaries of design as complexity increases and doubts arise in terms of functioning, which also makes necessary more requirements in control systems [11,12].
In relation to applied computational intelligence in energy distribution systems, reference [13] shows the design of an automatic voltage regulator using machine learning; this system is tested in distribution systems with 6 and 118 nodes.A related work can be seen in [14], where is proposed the use of reinforcement learning technique to implement a decentralized voltage control of the distribution network.Reinforcement learning is a method used to improve the agent action through several trials in an unknown environment.
According to [15], state estimation is fundamental to energy management in distribution systems; in this way, the authors develop a state estimation using artificial neural networks, to observe the system performance.The tests are made in distribution systems with 33 and 69 nodes where connection/disconnection of DG and load variation is considered.
An approach for power flow and voltage regulation using multiagents is proposed in [16,17].The attractive characteristic of multiagents is the distributive operation; related to this issue, [18] proposed a tool for agent simulation for decentralized control strategies in electrical distribution systems; this tool allows observing the emergent behavior produced by agents.Additionally, in [19] is presented a proposal based on consensus protocol for cooperative voltage control applied to wind farms.Another related work is shown in [20] where optimal control strategies are proposed for distributed photovoltaic systems which manage the energy flow among the energy system in a power grid to charge electric vehicles.
About other related applications of computational intelligence, [21] proposes the identification of a permanent magnet synchronous generator using neuronal networks.Regarding applications using fuzzy logic, reference [22] shows a fuzzy predictive control for a gas turbine used for the power generation process.Authors emphasize the relevance of advanced control strategies to satisfy the control demands of energy generation.Meanwhile, in [23] is proposed an adaptive fuzzy logic system for load frequency control of multiarea power system.Load frequency control consists of regulating the distribution system frequency in a specified value and maintains the interchange power between areas [23].
According to the above, the DG is a remarkable alternative for the generation of electricity; however, advanced control techniques are required for its operation.In this way, a proposal of a neurofuzzy adaptive approach for the regulation of voltage in a distribution system controlling the power flow is presented in this document.This adaptive control system allows having a distributed implementation of controllers such that without direct communication each controller can assimilate the effects of other controllers as well as load variations in the distribution system.In order to have a frame of reference, a description of the characteristics of the neurofuzzy adaptive control and the model of a neurofuzzy controller used are provided below.

Characteristics of the Neurofuzzy Adaptive Control.
From a biological perspective, adaptability refers to a capacity present in organisms, which allows them to survive in a particular environment; once the adaptation occurs, they prosper and produce offspring; otherwise, they may disappear [24].According to [25] and [26], this principle may be applied in both optimization and adaptive intelligent control systems.Also [25] displays a proposal using bioinspired optimization algorithms in adaptive control systems.Moreover, in [26] the author points out that intelligent control represents the study to achieve automatic control through the emulation of biologic intelligent systems (biomimetic).
Taking into account [27], adaptive control systems are appropriate for monitoring and controlling systems with variable and unknown parameters.Besides, considering the training techniques associated with optimization methods, evolutionary algorithms have shown to be a useful tool to approach an optimum global value.However, they require several executions and a high number of evaluations of the objective function.Meanwhile, methods based on gradient calculations manifest a rapid convergence, although they are highly susceptible to the initial search point and show convergence towards local minima [28].
According to [25], techniques based on gradient calculations offer practical and effective methods to undertake online optimization in order to achieve all parameter adjustments in the control system.The basic approach consists of adjusting parameters iteratively to minimize the error.However, local minima are usually presented since, in general, the objective function that characterizes the error is not convex.According to [29], the gradient calculation is widely utilized in algorithms for neuronal systems, particularly the descending gradient method which is used for the Backpropagation algorithm for neuronal networks training [30].
Considering the above, an adequate option for improving the performance of the adaptive control system employing gradient-based algorithms consists of a suitable preliminary configuration for both identification of the plant and control; meanwhile, a fuzzy system allows the establishment of a preliminary structure and configuration of the system that is used for identification of the plant and the optimization of the control.This also allows dealing with the problems present when setting neuronal networks as well as parameter initialization [31].In general, when using neuronal networks, the initial configuration is random, while a fuzzy system permits a previously set configuration based on a preliminary knowledge of the system.The initial configuration of fuzzy systems can be designed considering the general system behavior; then, training data is used to adjust the model of the plant and the controller.According to [27], when it comes to highly complex systems with uncertainty and variability, the adaptive feature is remarkably important.
The proposal made in this paper uses the compact fuzzy system shown in Section 3 which allows establishing an initial configuration (Figure 12); in this way, the optimization is made via the gradient-descend method described in Section 4. This fuzzy system and optimization process are used in the control structure.
1.2.General Model of a Neurofuzzy Controller.Two neurofuzzy systems are implemented in this architecture, one for the controller and the other for the plant model.In such a scheme, firstly the plant identification is made and later the training of the controller.Figure 1 displays the neurofuzzy systems used.As shown in Figure 1, the plant model has [] as input and [] as output signal, resulting in a structure given by (1).
Meanwhile, for the input controller, the error signal is [], the output to action control is [], resulting in a general equation for the controller as where   represents the number of output delays,   the input delays, and   the error signal delays.Generally, the number of delays implemented increases with the order of the plant.Furthermore, the plant identification (distribution system) is necessary to perform the controller optimization.
The control model shown in Figure 1 is used for the distribution system, because the plant identification permits acquiring system information such as power flow, the interaction between generators and load variation.This characteristic, combined with an adaptive process, allows the controller adjustment when changes occur in the distribution system.The following section describes the adaptive process.

Description of the Neurofuzzy Adaptive System for the Generation System
Regarding the above, to implement an adaptive control system, the structure of the control system and the training methods must allow the parameter adjustments in the required time according to the application.As previously highlighted, for plant identification and controller optimization, evolutionary algorithms may be implemented; however, the number of iterations is higher than a gradient-based algorithm [28,32].Fuzzy systems allow modeling nonlinear processes and obtaining information from a dataset using training algorithms.Unlike neuronal systems, those based on fuzzy logic allow an easy use of the knowledge of experts as a direct initial point for their optimization [33].Meanwhile, fuzzy systems based on Boolean relations show a compact scheme, which facilitates the calculations associated with the inference process, having compact structures for the identification of the plant as well as the controller [34,35].

Adaptive Control Process.
For the implementation of the adaptive control system, the plant is first identified, then the training of the neurofuzzy controller is performed; this scheme integrates the model of the plant with the controller.
The time lapses involved during a cycle of the adaptation process appear in Figure 2, where   corresponds to the time of the controller operation after a change is present in the system;   represents the time when the system operates with the controller adjustment;   is the time interval in which the system presents variation.Finally,   is the time available to perform the adaptation process to identify the plant and the optimization of the controller.Moreover, in this specific case it is necessary to have adequate algorithms for the adaptation process in this lapse.
A graphical example of the neurofuzzy adaptive control process is presented using a radial net similar to the one considered in [36].Summarizing, the adaptive process is as follows.

Initial Configuration.
Here, based on knowledge of the system behavior, a general structure of fuzzy controller and plant model is established.Then, the plant identification is made, taking the nominal model (open loop) of the distribution network.Therefore, using the plant fuzzy model, the controller training is performed.Figures 3 and 4    a representation of the process; in this way both initial configurations of the controller and the neurofuzzy model of the plant are obtained.

Data Acquisition.
In this process, input-output data of the plant are obtained during the functioning of the system.An example of this step is given in Figure 5.

Plant Adjustment. The acquired data allow a new
training of the neurofuzzy model of the plant in a way that parameters are adapted to the new data.Figure 6 displays this process.

Controller Training.
With the new adjusted plant model, the training of the controller (optimization) is performed.Figure 7 shows the process example.

Optimized Controller Operation.
During this process, the new controller (optimized) is activated to correct the variation in the system.Figure 8 shows an example of this process.

Repeat Process.
The process is repeated from step 2 for the next time interval in a way that an iterative process for identification and training of the controller is performed.The example of this process is displayed in Figure 9.
Regarding the limited amount of data produced during the charge variation and the system response after the controller optimization, the process of plant identification and controller training is iteratively undertaken.It is noticeable the importance of establishing an initial search point to identify the plant and to optimize the controller when charge variation is present this is achieved with the neurofuzzy systems determined in the first point of the process.

General Architecture for the Plant Model.
According to [37], an approach to obtain a model system consists of the estimation of a structure working the same function of the plant.The input and output samples are taken from the plant to perform the identification using the neurofuzzy system in a way to perceive these signals as a nonlinear function.
Figure 10 displays the basic scheme to identify the plant.
Considering Figure 10 the model for output where   is the number of previous output samples,   the number of previous input samples, and H  the system vector parameter to be optimized.

General Architecture for Controller. Considering 𝑒[𝑛]
as the input of neurofuzzy controller, this can be represented as shown in Figure 11.
The controller equation with this structure is where   is the number of previous error samples and H  is the vector parameter for neurofuzzy controller.

Compact Fuzzy System for Control and Identification
The proposed compact fuzzy system used for identification and control is obtained modifying a linear system (in discrete Figure 9: System operation after the second controller optimization.time) using fuzzy sets to model nonlinear relations.The neurofuzzy architecture is obtained considering a general linear discrete-time system whose transfer function is The system equation in discrete time is where coefficients   ,   are constant, while for the fuzzy system these constant values are replaced by nonlinear relations given by fuzzy membership so that The fuzzy sets displayed in Figure 12 are considered to implement the fuzzy system; particularly, Figure 12(a Considering the fuzzy sets of Figure 12 and the general structure given by (7), Figure 13 provides the scheme of the proposed compact fuzzy system, where [] is the input, [] the output,  and  the number of output and input samples, respectively.According to Figures 10 and 11 Considering Figure 13 the fuzzy output system can be calculated as where Meanwhile, the membership function   (  ) is Thus, the group of parameters corresponds to H ∈ {V  ,   ,   }, which are the parameters to be optimized (adaptation parameters), being V  the virtual actuators,   the midpoint value of the sigmoidal function, and   the curve steepness.For plant identification H corresponds to H  and H  to controller.

Fuzzy Systems Optimization Process
The gradient-descend method is used to implement the optimization; such process is performed until the desired value is achieved in the objective function.Consequently, Figure 14 shows the optimization scheme, by which the system is first evaluated with the parameters to be optimized.Then, the objective function is calculated using the system response.Finally, using gradient calculations, the system parameters adjustment is developed.
In this process the objective function is where  is the number of total data,   is the desired output, and   is the neurofuzzy system response.For identification process   corresponds to the plant data,   is the neurofuzzy output, and  →  corresponds to the neurofuzzy vector parameter H  .Meanwhile, for controller optimization   corresponds to the reference [],   is the simulated system control output, and  →  is the controller vector parameter H  .
4.1.Gradient-Descend Method.This algorithm calculates the gradient of the objective function for a current position in the search space; then, the gradient of the objective function  is Complexity

Geometrically, vector
→  points to the direction where the objective function has a bigger descent.If the step is small enough in the direction of −  → , then the value of the objective function in this new point will be smaller.The next position is calculated through Here,  ∈ R + is the descent rate.It is also possible to implement a sequence of values   which diminishes as  increases (for convergence).Using a higher learning rate the algorithm will move farther in a single step, taking the risk of going above a minimum.
Bold driver is another known variation of the algorithm; this technique modifies the learning rate while the objective function is minimized [38].An implementation of this algorithm employs the following rule to update : where Δ = (  →   ) − (  →  −1 ) represents the change in the value of the objective function between steps  − 1 and .If Δ > 0, then  →   =  →  −1 and it is reduced to half the learning rate, ensuring the algorithm avoids moving in an ascendant way [38].In addition, the learning rate is

Energy Distribution System
5.1.Distribution Network Operator.Power distribution networks are a key constituent in the infrastructure as they permit carrying electricity to business and homes, offering a continuous service which is an essential function of the Distribution Network Operators (DNOs).The incorporation of Distributed Generation (DG) in the distribution networks carries out important effects in the distribution systems operation.The current distribution networks are designed to be passive, which leaves the transport of electricity with minimum surveillance, supervision, and control; likewise, these networks have been designed without the capacity to manage generators with lower voltage.Although DG introduces new challenges to DNOs, it also brings opportunities as economic benefits derived from more active networks [39].

Power Flow Calculation.
In electrical engineering, the power flow study is an important tool for numeric analysis in energy systems [40].Such studies are implemented to ensure that energy transfer from generators to consumers is stable, reliable, and economic.Moreover, flow power calculations allow determining power and tension values in a system of energy according to the capacity of regulation of the generators, condensers, and transformers [41].The efficiency of the algorithms to establish the flow of power is fundamental whenever numerous estimations of this flow are required.In this regard, the Backward/Forward Sweep BFS is the most widely used technique for flow power calculation in radial topology networks.

Energy Distribution Model.
Figure 15 shows the radial network model considered for the distribution system which also includes the nodes identification.
The system, which is taken from [42], consists of 33 nodes.The impedance values for the lines of the distribution system are shown in Table 1.Meanwhile, power charges are shown in Table 2.In the case of one generator, this is located in node 18 and the variable charge in node 17.For three generators these are placed in the nodes 18, 22, and 33.Additionally, variable loads are held in the nodes 17, 21, and 32.Finally, the node of reference corresponds to number 1.

Methodology for the Analysis of Statistical Results
Given the stochastic nature of the system, variability of results may appear when a particular configuration of the control system is implemented.A test is performed to observe if a relevant difference in the results obtained is present (regarding the aspects to be compared); then, a statistical hypothesis is performed as follows: (i)  0 Null hypothesis: the results obtained by the control systems exhibit equal average values.
(ii)  1 Alternative hypothesis: the results obtained by the control systems show no equal average values.
When formulating this hypothesis, there exists the possibility of making mistakes as shown in Table 3 in which error type I occurs when the null hypothesis is rejected even though it is true; meanwhile, for type II error the null hypothesis is accepted even though it is false [43].
Usually, the hypothesis test is performed considering a level of significance referred to as -value which is the probability of making a type I error.Under this orientation, the null hypothesis is rejected if the statistical -value test is equal to or less than an established significance level, which is in general 5% [43].

Statistical Tests.
The statistical test can be classified as parametric or nonparametric in terms of their application.Parametric tests are robust but based on normality and data equality variance.On the other hand, suppositions are not required in nonparametric tests but information is missed in their process as the comparison is made with the representation of data on an ordinal scale [43].
Figure 16 shows the suggested methodology for the hypothesis test as follows: (i) Kolmogorov-Smirnov: this test is applied to determine the data normality.Besides, other alternative tests are the Shapiro-Wilk and the Anderson-Darling.
(ii) Levene: through this test the variance equality (homoscedasticity) is established; another alternative is the Bartlett test.(iv) ANOVA: this test compares several distributions and requires normality and homoscedasticity.
(v) Kruskal-Wallis: it is a nonparametric test to compare several distributions; this test requires no previous suppositions.
Multiple tests of comparison are performed when having significant differences in experimental groups to determine such differences [44].
As in Figure 16, the same methodology is applied when assumptions of normality and homoscedasticity are fulfilled; here, Duncan and Newman-Keuls, Bonferroni, Scheff or HSD of Tukey contrasts can be used [43,44].Meanwhile, when these assumptions are not fulfilled, nonparametric contrasts of Nemenyi, Holm, and Bonferroni-Dunn are used [45][46][47].
The outcome of comparing the groups corresponds to "comparison intervals" which allow determining the difference between groups.A way to show such a result consists of graphically displaying the average ranking in each group and an equivalent interval; thus, with this representation, two groups are considered as different if their intervals are not overlapped [48].

Experimental Results
These results are directed to show the ability of adaptation of the neurofuzzy system proposed; whereby, the comparison is made with the fuzzy controller without adaptation.
According to [26], there are different alternatives to control, from the formal and traditional ones to those based on flexible computation and bioinspired systems.In addition, [27] this approach consists of showing the ability of adaptation present in these systems.The performance value used for comparison is the mean square error (MSE) which is also used as objective function for the controller optimization; the MSE value can be determined as 7.1.Experiments Configuration.Three aspects are considered to carry out the experimental design to observe the characteristics of the adaptive control system.A first comparison consists of regarding the controller performance with and without the adaptive process.Secondly, the configuration used for the control system considers the number of input and output delays (Figures 10 and 11).Considering the data of charge variation for each hour and using a scale of minutes, then,   = 60 and   =   = 20 are taken.
On the other hand, the controller and the model of the plant have different configurations depending on the inputs and feedback.Table 4 shows the experimental configurations considered for both adaptive and nonadaptive cases.
Considering the stochastic characteristics of the system, each configuration must be executed several times to be statistically valid; thus, the analysis described in Section 6 can be performed [43].
A 10 times simulation of 10 hours is performed to determine the experimental data for each configuration; thereby, each simulation obtained consists of 600 minutes and 10 load changes.Likewise, data of charge are randomly generated with data distributed (uniformly) in values from 0 to 1000.

Results
Using One Generator.In this case, the generator is located at node 18 and the charge (variable) at node 17.After carrying out the respective executions for each configuration, MSE is calculated.The results summary is shown in Table 5, including minimum and maximum values, standard deviation STD, and average value.
The respective tests are performed using the acquired data from the experiments.Table 6 shows both the results of the normality test in each experimental group and the accomplishment of the normality requirement.The homoscedasticity test produces a -value of 8.3068 × 10 −6 which indicates that the equality variance requirement is not accomplished.Considering the results of homoscedasticity and normality test, a Kruskal-Wallis test is undertaken to determine if there exists a representative difference between the experimental groups.Then a -value of 1.9486 × 10 −10 is obtained, which indicates the presence of differences between groups.In this way, Figure 17 shows the nonparametric test of Bonferroni performed for multiple comparisons; the level of significance considered is 0.05.
If the intervals of two groups in Figure 17 are overlapped, then there is no statistical difference between them.These results show a better controller response when the process of adaptation is used.

Simulation Results.
The configuration CS2AD1 is taken to qualitatively show the behavior of the control system.Figure 18 graphically displays the system response with the conventional controller and the adaptive system also shows that the controller adjusts the value of the system output to the reference value after a charge variation.Figure 18(a) shows the voltage regulation and Figure 18(b) displays the control signal corresponding to the amount of power to be delivered.Figure 19 shows the detailed adjustments made by the adaptive system.In the simulation, it is noticeable the time when the progressive adjustments of the controller are made to correct the change present when the charge has variance.

Results for Three Generators.
A key aspect in the distributed generation systems is the capacity to plug and unplug several generators in the distribution network showing no major alterations among voltage values in the nodes.In order to observe the performance in the neuroadaptive control, different generators are included in the distribution network as shown in Figure 15.Consequently, three generators located in the following nodes are considered:   Data for charge variation are evenly generated at random with values between 0 and 1000.The experimental groups are taken in the same way as in the implementation for one generator.Considering that each generator has an associated value of mean square error (MSE), then the performance index used for the statistical analysis is the sum of MSE for three generators: Table 7 shows the minimum and maximum values, standard deviation STD, and average results for the 10 executions of each configuration.
With the data obtained the statistical tests can be made.The normality test results are shown in Table 8 in which the normality requirement is accomplished.
The -value obtained for the homoscedasticity test is 8.3068 × 10 −6 ; this indicates that equality of variance is not met.Regarding the results in the normality and homoscedasticity tests, the Kruskal-Wallis test is performed; as a result, the outcome value is 1.9486 × 10 −10 .This shows the difference between experimental groups.The Bonferroni nonparametric test of multiple comparisons is then performed to establish differences between groups, using a significance level of 0.05.The results are displayed in Figure 20, where the

Simulation Results
. The CS2AD1 configuration is used to show the control system simulation.Figure 21 shows the system response for three generators using adaptive control.Figures 21(a) and 21(b) show the voltage regulation and the control signals, respectively.Meanwhile, Figure 22 presents the simulation when nonadaptive process is performed.It is worth noting that in Figure 21 the adaptive controller makes adjustments of the output system once the charge variation has occurred.
Figure 23 shows the adjustments made for the adaptive system when charge variation is present.It highlights that several adjustments are required to adjust the output.

Discussion
This article is focused on showing the capabilities of the adaptive control system proposed to manage the flow of energy in a distribution system.It is seen that the proposed system is a good alternative to manage the power flow in the distribution network.However, there are several aspects of the distribution system which should be studied in subsequent works.
Taking into account the above, in this work the profile of the voltages throughout the network is not considered.Only the voltages on the points are considered where the generators are located.This type of application might be studied in greater detail in future developments.The charge and the generation power are considered only with the real component; therefore, for future works it is possible to include a complex power for load and generators.
Additionally, the generators connection in the grid is considered where the greatest voltage drop occurs.However, a further study can contemplate different locations of these, including their dynamic connection and disconnection.

Conclusions
The scheme of the neurofuzzy system was proposed considering the general structure of a discrete-time system.It is also noteworthy that the considered plant presents parameter variations as well as generators interaction.
The proposed neurofuzzy scheme allows the adjustment of the controller after a charge variation.The system works satisfactorily in three generators, which is important in systems of distributed generation.
The statistical analysis reflects a better performance when the adaptation process is made; it is also observed that there are no differences in the configuration sets considered (inputoutput delays) in the neurofuzzy system.For the simulation

Figure 2 :
Figure 2: Times involved in the adaptation and control process. show

Figure 3 :Figure 4 :
Figure 3: Plant identification using the grid nominal model.

Figure 5 :Figure 6 :
Figure 5: Operation of the control system when load variation occurs.

Figure 7 :Figure 8 :
Figure 7: Controller training with the fuzzy plant model.

Figure 10 :
Figure 10: Scheme used for the plant identification.

Figure 11 :Figure 12 :
Figure 11: General architecture of the controller.
) presents a sigmoidal fuzzy set for modeling positive values in the universe of discourse; meanwhile, Figure12(b) represents negative values.

Figure 16 :
Figure 16: Methodology to determine the hypothesis test.

Figure 18 :Figure 19 :
Figure 18: Control system response with and without adaptation process.
Figure 23(a) shows the voltage regulation detail and Figure 23(b) displays the respective control signals detail.

Figure 23 :
Figure 23: Detail of the adaptive control system response.

Table 3 :
Type I and II errors.

Table 5 :
Summary of statistical values in the obtained results.

Table 6 :
Summary of normality test.

Table 7 :
Summary of statistical values of the results.

Table 8 :
Summary of normality test.results show that the adaptive system has a better performance.No overlapping is present for the comparison intervals of adaptive and nonadaptive configurations.The configurations for the adaptive cases obtain lower values of MSE. statistical