Synchronization and Optimal Operation of a 140 kVA Inverter in On-Grid Mode Using Mamdani Controllers in Cascade

Tis paper addresses the synchronization and operation of a 140kVA inverter system connected to the main grid as part of a decentralized microgeneration system. Te considerations for the supply of electrical energy stored in battery banks, mostly of photovoltaic origin, involve a study of the details of a rigid nonlinear system, which parallels the generation and distribution standards typical of hydroelectric and thermoelectric plants. Considering aspects related to power electronics operation, this paper presents both the modeling and the controlling aspects necessary to synchronize and ensure a stable operation of the micro-generation systems when connected to the main grid. Statistical processing was developed to guarantee synchronization between the systems without presenting electric shocks by simulating the magnetic link in asynchronous generators to meet this aim. Te proposed model simulates the increase in power by a phase shift by maintaining a constant frequency based on a Chirp wave generator. Te proposed process considers a generation power baseband operation. A Mamdani-type fuzzy proportional-integral controller is used to determine the power setpoint, which sets the Chirp generator phase shift setpoint, which includes a Mamdani fuzzy proportional-type controller. Both controllers are connected in a cascade. Te applied correlational technique to achieve the synthesis of the sinusoid and the synchronization presented optimal performance when using 17 samples per signal period. Te design of the transformer primarily, guaranteed a phase shift of − 4.3018 ° , allowed for a THD below 2.75%.


Introduction
When a project on a microgeneration system is carried out, the study focuses on the primary energy source (whether wind, photovoltaic, or other), considering electronic aspects of switching and electrical regulation. However, it does not deal with issues related to interconnection with the main electric system, its implications, or possible limitations during the operation of the on-grid and of-grid switching [1].
In particular, an aspect such as regulation must be limited, since this topic is broad and in detail, many aspects must be considered. However, there are aspects to take into account that are common to any electric generation unit that needs to be synchronized with its main grid. Generally, of the four variables to be considered, such as voltage amplitude, frequency, and phase, only voltage amplitude and frequency are controlled [2]. In contrast, the phase is left relatively random until, given the conditions, the generation power switch can be closed. However, when the electric generation unit is the electronic inverter type, it can regulate and continuously monitor the three variables to be considered for synchronization [3][4][5]. Since these three parameters are electronically created, synchronism may be lost. Te mentioned conditions difer in hydroelectric or thermoelectric generation units that keep the generating unit synchronized once the electromagnetic link is synchronized.
In the same way, the state-of-the-art of controllers for frequency control in power systems with multiple areas has been carried out using fuzzy techniques, even though the fractional component, both for the integral and diferential efects, becomes less practical. Tis is due to weighted parameters, which are difcult to obtain with usual numerical methods and require convolution techniques that demand a lot of memory resources and computation time [6][7][8]. However, the tendency to incorporate studies using fuzzy logic for control to improve power quality in microgrids that use batteries and energy storage systems can be seen in works such as the one presented in [9], as well as the search for the maximum power transfer point, as shown in [10].
Likewise, studies related to voltage regulation and load sharing have been carried out for standard generation systems [11] and the case for alternative energy systems such as wind power are also being analyzed [2]. However, the appropriate way to share the load with statist systems more efciently is still being evaluated. Te research presented in [12] proposes a nonlinear way of compensating the frequency deviation in such a way that the power supplied to the system varies depending on the condition of the deviation, and it is intended to subtract weight from the compensation when the frequency deviation is too large. However, it is clear that in hybrid generation processes, whether with thermal, wind, or solar sources, compensation for power droop is present, as presented in [13].
Considering that the study on a generation system of the electronic type, where an inverter phase is involved, is similar to other electrical generation systems, the implementation of a grid frequency compensation mechanism is an aspect that must be considered during the control and operation development [4]. In particular, this factor should be considered when the aspects of operations and degree of participation in the supply of active and reactive power to the grid are analyzed. Furthermore, since partitioning with reactive energy is not commonly considered in research studies, the active power correlation study is pertinent to protecting the equipment.
Another aspect considered, in terms of protection, is the inductive nature of the transformers and the line emulated for transmission, making it necessary to propose the study and topology to provide suppressors of transient voltage peaks using MOV [5,6].
Te generation using power electronics devices distorts the voltage profle due to the low generation of reactive power and the operation in a baseband of power generation. Te traditional generation from relatively low-power generation systems aims at the simple generation and injection of active power [7] without considering other aspects, such as the grid frequency variation.
Fuzzy controls based on the Mamdani approach have been widely and efectively used in various applications where they have proven their best performance compared to other classical control techniques. Wang and Li proposed a nonlinear hybrid fuzzy system by adjusting Mamdani's parameters, and their results showed that the proposed fuzzy system has better approximation performance based on the variable universe (nonlinear constraints for applications that require quick response and high stability precision) than comparing with other control systems [14].
Fuzzy controls have been successfully applied in electrical networks and distributed generation environments. Sharma et al. proposed a dual-structured fuzzy (Mamdanibased) to switch between proportional and integral actions to improve the frequency regulation in a microgrid, including a wind-diesel generator system combined with an ultra-capacitor storage unit [15]. Barakat presented a Mamdani-based fuzzy logic control to reduce load frequency control issues and step load perturbations in terms of peaks and settling time under diferent multisource interconnected power systems (reheat, hydro, and gas units with and without HVDC links) [16]. Fayez et al. developed a fuzzy controller to command battery energy storage and a resistor brake to mitigate subsynchronous resonance oscillatory torque and speed response in steam turbines connected to power grids. Te results showed that the proposed control scheme could reduce the intensive computational burdens due to the applications of 3 fuzzy rules compared to more complex control techniques [17]. Manas et al. presented a methodology based on a Mamdani fuzzy expert system to determine the optimal sizing and placement of distributed generators in the distribution grid of Tezpur University (India), showing the efectiveness of the fuzzy algorithm in terms of loss reduction and voltage profle improvement [18].
In addition, this type of fuzzy control has shown its efciency and improved the performance of power electronics devices. Acikgoz et al. presented a control topology for an electronic power transformer (containing a threephase pulse width modulation rectifer that converts 800 Vrms AC to 2000 V DC bus at the input stage, a dual active bridge converter that provides a 400 V DC bus with 5: 1 high-frequency transformer at the isolation stage, and a three-phase two-level inverter that is used to obtain AC output at the output stage) based on a fuzzy controller to improve compensation ability for voltage harmonics, voltage ficker, and voltage sag/swell conditions [19]. Agarwal et al. proposed a fault analysis method (fuzzy-based) for voltage source converters in high voltage direct current (HVDC) transmission lines, which probed to be better than conventional methods in terms of computational requirements, less number of protections relays, implementation complexity, and required signals with 100% accuracy discrimination of AC and DC sections faults [20].
Finally, Mamdani-type fuzzy controls have been studied as alternative techniques for classical controls of motors and generation machines. Cross and Ma compared diferent techniques for model-based condition monitoring systems applied in wind turbines, such as linear model, artifcial neural networks, state-dependent "pseudo" transfer function, and Mamdani fuzzy-based approach, where this last technique demonstrated to be practically feasible to be implemented [21]. Errouha et al. introduce the Mamdani fuzzy logic techniques as an alternative approach to conventional direct torque control (DTC) to control induction motors for water pumping systems, where the results showed that the fuzzy control could improve the performance by minimizing the fux and torque ripples, reducing overshoot and undershoot, and enhancing the response time [22].
Te use of fuzzy inference in the protection and controller implementation process has two advantages. On the one hand, in the implementation of controllers (to generate and synchronize the inverter signal), more parameters allow for achieving the desired results with a computational cost only present during the training process. On the other hand, in correlation protection, fuzzy characterization allows implementation with elementary mathematical operations whose execution times are much lower and whose accuracy is acceptable for the desired purpose.
Tis research presents aspects related to the synchronization of a power inverter to operate in on-grid mode and its efcient performance. In this way, algorithms are proposed to carry out the correlation and adjustment function minimized by a decreasing gradient to modify the identifcation of the signal and parameters of the grid before synchronizing. Te way of generating the sinusoid signal, whose amplitude, frequency, and phase are controlled, is based on a chirp generator. Te novelty of the proposed control is based on a structure capable of creating a numerically stable condition that achieves a gradual phase adjustment of the sync chirp generator and produces an equivalent in amplitude, frequency, and phase with the addition of phase adjustment [23]. Te efect is like cloning the synchronized signal and adding the missing component to achieve the phase adjustment that allows power fow to the electrical grid.
Te aforementioned nonlinear conditions cannot be faced with classical control tools. Te use of Mamdani-type fuzzy controllers has been implemented due to the increased degree of freedom that implies the operation of this kind of controller. Based on this fact, another signifcant contribution of this paper is to present approximate models that allow an initial tuning of neuro-fuzzy controllers connected in cascade, which are subsequently tuned until the desired performance is achieved.

Nomenclature
MOV Metal oxide varistor PLL Phase-locked loop THD Total harmonic distortion (−) V RMS Root mean square grid voltage (V) V 1 RMS Root mean square voltage of the frst harmonic of the grid voltage (V) V n RMS Root mean square voltage of the nth harmonic of the grid voltage (V) S Apparent power (VA) Z Impedance (Ω) η Efciency (−) S 1 Apparent power for the fundamental harmonic (VA) S overall Total apparent power (VA) ρ Efciency complement, 1 − η (−) λ Sinusoidal fundamental harmonic amplitude condition (V) θ Cosine fundamental harmonic amplitude condition (V) N Number of log samples for correlational processing T s Log sampling time (−) ω i Frequency in (rad/s) in correspondence with the theoretical 60 Hz y i Line voltage recording (V) i Indexer β i Amplitude correlated initial condition (V) ψ i Correlated phase initial condition (rad) J Cost function ω f Identifed fnal frequency (rad/s) β f Identifed amplitude correlated end condition (V) ψ f Identifed end condition of correlated phase (rad) P s Active power supplied by the electronic system (W) Q s Reactive power supplied by the electronic system (VAR) P R Active power received by the reference electrical bar (W) Q R Reactive power received by the reference electrical bar (VAR) X L Inductive reactance of the simulated line (Ω) V S Voltage provided by the electronic system (V) V R Reference bar voltage (V) δ Phase condition between the bus and the electronic system (rad) Q av Average reactive power on the simulated line (VAR) R Simulated line resistor (Ω) P line Active power on the simulated line (W) Ε i Error between an i-th prediction and its i-th sample α Participation factor for error (cost function) (−) β Participation factor for derivative error (cost function) (−) μ Degree of truth of a membership function (−) c Degree of truth of a membership function (−) μ i Degree of truth of an i-th membership function (−) x Variable of the fuzzy universe

Grid
Modeling. In this section, methodological aspects are covered to determine the quality of the grid operation. Statistical knowledge of the electrical supply signal behavior allows drawing strategies for synchronizing the inverter power electronics system. Taking into account the aim proposed in this paper, the frst step is to study the grid's aspects and characterize them using statistical identifcation techniques such as the correlation for sinusoidal systems. Te objective is to achieve a minimum error in the global relative percentage deviation and a high value in the Pearson quadratic correlation factor using a minimum number of samples per period. Tis section can be subdivided into the following subsections: First, statistics for evaluating and identifying the grid to replicate conditions for synchronization. Second, the grid model and its Tevenin simplifcation is developed in a three-bar electrical diagram for the study of static power fow. Tirdly, we perform the dynamic power fow study of the simplifed electrical system using the obtained model. A sinusoidal quality assessment of the grid's electrical energy is carried out considering the harmonic distortion factor, or THD, for which the square root of the equation is used.
Te impact of the value of the harmonic distortion factor is considered when an efciency factor is established based on the active power used when the fundamental frequency is considered. For this purpose, the following equations are used based on the analysis proposed in Figure 1: (4) Figure 1 shows the power triangle made up of both the fundamental and harmonic components. Te harmonic content, being of high frequency, is not broadly useable, because energy is lost in heat, both in static and dynamic machines.
Te same result is obtained when determining the energy efciency due to the harmonic efect based on equation (3), if active or reactive power is considered instead of using apparent power.
Te importance of equation (5) is clear to establish the quality of the sinusoid, where its tendency to zero gives information about purity in the generation process. On the other hand, its tendency to unity, typical of synthesized alternating signals such as square waves, is generally not acceptable for all electrical devices. However, from the energy point of view, the efciency measured from equation (4) is an alternative way to determine the quality of the signal injected into the main grid. Te following equation represents a way of presenting the energy losses due to the signal's harmonic content: Te algorithm proposed in this paper is based on a double correlation, the frst being an algorithm that ofers a closed mathematical adjustment expression to determine the amplitude and phase, assuming that the frequency is 60 (Hz). Te second correlation is an improvement that uses the result of the frst correlation as a starting point and whose result is the product of an iterative search process using the decreasing gradient method.
Te following equation allows for determining amplitude conditions, which are determined with the help of equation (7) based on the amplitude and phase of the sinusoid of the grid-sampled voltage.
Besides, the following equation is the cost function that, when minimized with the decreasing gradient method, allows obtaining a much more accurate value of the amplitude, phase, and frequency of the sampled electrical signal of the system.
However, equation (9) is used to establish a relative parameter in the evaluation process for the identifcation of rest of the parameters. Terefore, equation (9) can be related with equation (10), which is the multivariable correlation factor of Pearson presented in the process of identifcation of systems.
It is worth mentioning that equations (8)-(10) are presented based on i-index samples because they are part of a sampling process defned based on N samples that can correspond to one or more periods, even a fraction thereof. Tis study proposes sampling with a bufer of two and a half periods to consider a 60 (Hz) signal. Nevertheless, the registered and parameterized signal does not have to have this value since the reality of the generation process presents a variation in the frequency that is usually below 1%, which could be much more under fault conditions.

Generated Power and Load Flow in the Coupling
Line to the Grid Bar. Te power generated and supplied to the grid depends on the power angle δ. Te power angle allows establishing the active power generated, supplied, and received by the grid bar, determined by following equations, as well as reactive powers, also defned by the following equations [1]: From equations (11) and (13), it is concluded that the maximum active power supplied by the generator (when the generator voltage is equal to the network bus voltage) is 90 degrees. Under this condition, the reactive power is equal in magnitude to the active power; therefore, the generator's maximum power is approximately 142 (kVA).
Te reactive power in the grid for a relatively small electrical grid with negligible resistance is of interest, as shown in equation (15). In the case of considering the resistance of the coupling grid, the active power can be determined using the equation (16) [1].
From equation (15), the value of the reactive power in the line is negligible. However, it is necessary to consider deviations in the voltage regulation, which is why it cannot be wrongly dimensioned and must be considered the worst of cases to avoid failure of this device.
Te reactive power in the grid is essential when designing the coupling reactor that emulates the short transmission line. From equation (15), it can be concluded that the value of the reactive power in the line is negligible. However, it is necessary to consider its deviations in the voltage regulation, the reason why it cannot be wrongly dimensioned, and, in the worst case, should be considered to avoid breakdowns on this device.
Additionally, implementing a transient suppressor of the MOV or Crowbar type in parallel with the reactor should be considered to suppress transients in case of diferential voltage.
Although the active power is negligible before minimum values of R, this must be considered at the moment of the design of the reactor and at the moment of quantifying the active power that will not be delivered to the reference bar, as shown in equation (16).
From the previous equations, it can be concluded that the power angle determines the contribution of active power to the bus. However, reactive power is generated by keeping the power angle at zero and only by varying the voltage.

Static Power Flow
Modeling. Considering as a case study a small town with an electrical demand of approximately 3 (MW) of active power and around 8,000 subscribers to the electrical service. An empirical model of three bars has been considered to study the static and dynamic power fow from the inverter system to the main grid.
As shown in Figure 2, the three-bar model contemplates the generator bar, whose voltage at bar 1 corresponds to the Tevenin voltage of the model, and the voltage at bar 2 corresponds to the voltage at the substation or coupling transformer of the inverter system. Finally, bar 3 corresponds to the voltage generated by the inverter system.
Te Tevenin model of the system was obtained under the following considerations: (i) Te regulations for the national interconnected system of Ecuador consider a system efciency of around 95%, with an approximate power factor of 0.9. (ii) Considering a distribution voltage of 13.8 (kV), there is an apparent power of 3.33 (MVA) in the system, with 72.64 (kVAR) corresponding to reactive losses in the line. From this value, 1.48 (kVAR) corresponds to the capacitive efects of the line and 74.13 (kVAR) to inductive efects, with 150 (kW) losses arising due to the Joule efect. Figure 2: Simplifed 3-bar model based on the Tevenin equivalent circuit of the electrical grid seen by the inverter system. Base parameters Impedance and reactance of the model Journal of Electrical and Computer Engineering Considering 8,000 subscribers to the electrical service, the distribution of electrical impedances and reactances for the model is obtained, in per unit, as detailed in Table 1. Figure 3 shows how the loads connected to the network are distributed and the consideration of the line impedances by sections, where the line and load impedances keep the same value. In this model, 8,000 sections have been considered to correspond to the total subscribers of the case study.
Under the defned considerations, the Tevenin model has been calculated, in per unit, seen from the coupling bar 2 of the inverter system with the corresponding values described in Table 2.
As shown in Figure 4(a), taking into account the phase diference between bus bars 2 and 3, it is possible to obtain the active and reactive powers, in per unit, as depicted in Figures 4(b) and 4(c), respectively.
To determine the phase condition in buses 2 and 3, as well as the generator voltage, the following considerations have been defned: Solving the system, using equations (18) and (19), to determine V 2 and φ 2 , the values for V 3 and φ 3 are obtained. Under the evaluated conditions, Figure 5(a) shows the evolution of the voltage of the inverter system in bus 3. To achieve the phase diference between bus 3 and 2, such that the desired active power fow is fulflled, the phases of bars 2 and 3 are evaluated concerning bar 1, as shown in Figures 5(b) and 5(c), respectively.

Dynamic Power Flow
Modeling. Using the simplifed model of the three busbars electrical system (Figure 2), a representation in the state space has been defned considering a state to reproduce the response of the grid to the power supply by the inverter system. Due to their electronic nature, time considerations for power supply (which are typical of inversion systems) allow times between 2 and 5 seconds [11,24]. Although the time for the supply of power is very short, this is typical of distributed networks and is present in generation systems of an electronic nature.
Te state space that allows obtaining the dynamic behavior of the voltage in bus 2, as well as the current that fows through the line that connects buses 3 and 2, as shown in the following equation: (20) Figure 6 shows the dynamic behavior of the power in the transmission line, represented in p.u., which corresponds to the power generated by the inverter system. Te model's dynamic order is increased in estimating the active power of the line, for which the weighted integral of the instantaneous power is approximated based on the state.
As depicted in Figure 6, creating a positive phase shift (or in advance) produces an increase in power in the grid. Tis increase in power produces an increase in the voltage of the system. Although the model presented cannot reproduce the phenomenon associated with the increase in frequency, that is another variable is dynamically afected by the injection of power from the electrical grid. Tis is why power fow dynamics are studied to anticipate and compensate for grid oscillations that cause undesirable frequency oscillations.
Thevenin  Measurements were made on the line made up of the coupling inductor between the inversion system and the substation. For the comparison, the same generation set points used during the simulation were considered. Te results obtained are shown in Figure 7.
Te results show that the experimental measurements converge to the same simulated values for reasons of adjusting the power set point of the inversion system. However, the dynamics is afected by the randomness of the connected loads and the consideration of a higher dynamic order reality, or simply of distributed parameters present in the network.
It is important to highlight that the principles of scalarity, typical of linear systems, are no longer fulflled since the load-taking times are slightly increased as the power set point increases. It is important to highlight that during the experimentation, the AGC (automatic generation control) of the system was not inhibited, which is why the thermogenerators and hydrogenerators played an uncontrolled role in the secondary regulation, which afected the dynamics to be studied. However, the results show the ability to guarantee fast load taps for low power set points, and the response being slightly slower for when the power set point tends to 100% of the power capable of supplying the inversion system.

Control Systems for ON-GRID Operation.
In this section, control strategies based on neuro-fuzzy techniques are outlined for the implementation of cascade controllers that allow the regulation of the power supplied by the inverter system, as well as a gradual adjustment in the phase condition that allows the fow of desired power to guarantee the supply of power to the network. Although the study was designed for a 100 (kW) system, the modeling, and proposed control can be applied to a system of greater or lesser power, as can the interpretation of the results (presented in p.u.).

Mamdani-Type Fuzzy Inference System Processing.
Te Mamdani-type fuzzy inference system has been implemented to characterize both the angular speed for the ofset contribution in the inverter, once the generation unit is synchronized, as well as to adapt proportional and integral values of the closed-loop control of the active power that allows setting the ofset setpoint value.   Journal of Electrical and Computer Engineering For this particular case, inferences are presented with two universes of discussion, whose implication is achieved using a producer of the degrees of truth of the membership functions. If the conjunction of these degrees of truth is needed, it is carried out by implementing the probabilistic OR. Te consequent is achieved through the aggregation of the rules implementing a sum, while the defuzzifcation or single-valued value is achieved through the centroid method.
To facilitate the calculation of the rules, the range of the universe of discussion is obtained under the expert knowledge of the behavior of the signals, taking into consideration the possible extreme values that can be reached under the dynamics of the regulation, being the membership functions assigned using a regular partition following the rule of overlap.
Te membership functions of the rules in the consequent are adjusted using an optimization method based on the decreasing gradient. Tis optimization defnes a cost function that values the behavior of the fuzzy dynamic system, considering the control deviation and its variation. Equation (22) shows the cost function, whose minimization guarantees the achievement of the setpoint under the condition of minimum stress of the system or actuators.     For all the universes of discussion, the membership functions must be the simplest to calculate; therefore, delta or triangular type functions are used.
Te fuzzy AND has been implemented with the product, and the fuzzy OR has been implemented with the probabilistic OR, as shown in equations (24) and (25), respectively.
In fuzzy inference aggregation, an OR has been implemented by addition, as shown in the following equation: Implementing the sum as OR in the aggregation of rules allows obtaining a unique value in the defuzzifcation by implementing a centroid weighting of the membership functions of the activated rules.
In equation (27), Δ is the width of the membership function of the rule, i is the i-th activated rule or its degree of truth, and is the value, in the universe of discussion, where the vertex of the triangular or delta membership function is located and which represents its centroid.
In a simplifed consideration, each i-th membership function associated with the output presents an i-th area that depends on the degree of truth of the consequent, which in this case, being triangular functions, is considered to have the same bases. Te consideration of equal bases in the property functions of the outputs allows us to establish the relationship between the Mamdani inference and that of Takagi Sugeno Kang of order zero. Note the following simplifcation: In equation (28), x i corresponds to the i-th singleton C i , evidencing the equivalence between Mamdani fuzzy inference and Sugeno or TSK0, as seen in equation (29).
Considering equations (27)-(29), it is concluded that Sugeno's method is computationally more efcient and, indeed, a better option to train function characterization systems. However, it is well known that Sugeno's inference method modifes the general Mamdani fuzzy inference method. Additionally, the efciency of Sugeno's method is increased when the overlap method is used and programmed so that only the activated rules are evaluated. Under these considerations, there is a maximum of 2 n as the total number of activated rules, where n is the number of variables or inputs of the fuzzy inference system.
Terefore, Sugeno's method is conceptually better for the implementation of instantaneous systems in characterization processes, and therefore, it is also better for the implementation of dynamic systems. However, the reason for the implementation of this study using Mamdani is because it is better known than Takagi Sugeno Kang of zero order (or higher) and additionally because its performance, assessed with Matlab, is slightly more efcient in terms of time, with an estimate in the time relation of Tmamdani/ Tsugeno equal to a mean of 0.9802.
Te adjustments to the fuzzy systems are made in two stages. Te frst stage corresponds to the phase allocator, in which the membership functions of the consequent are adjusted (their position in the universe of discourse) based on a cost function that penalizes the error and the correction speed, as seen in Figure 8.
Te second stage corresponds to the fuzzy PI control that guarantees compliance with the power setpoint and establishes the setpoint for the phase angle. Te adjustment is made under the same considerations as the previous stage. Te modeling of the active power measurement instrumentation is considered of the frst order and closing the loop directly from the phase parameter, as shown in Figure 9.

Variable Frequency Sinusoidal Signal Generator.
Te variable-frequency sinusoidal generator implements the Chirp function based on a sine function of variable frequency and phase. Te variable frequency implementation allows for the generated signal's adaptation to the frequency of the main electrical grid. Te variable phase allows gradual adjustment until reaching the desired phase shift to achieve the power angle that allows supplying the desired active power.

Results and Discussion
Te process of synchronization and generation of a 140 (kVA) inverter to an electrical grid using Mamdani controllers in cascade are analyzed in this section under the following criteria: (a) Periodic processing of the reference bar voltage signal: this study guarantees the synchronization of the inversion system to the grid efciently and at the lowest computational cost, using the correlational technique presented in the methodology section. In addition, the harmonic content's efect and its implication in unused active power are also shown. (b) Considerations for synchronization: this section explains how the coupling transformer of the inverter system contributes to the fltering of the voltage signal and how this produces an ofset in delay that must be compensated when synchronizing the electronic generation unit by the inverter. (c) Charging or power outlet: Tis section presents how to determine the experimental value of the specifed inductance for one of the 10 (kW) inverters. Besides, this section shows the way to establish the power correlation, based on a fuzzy estimator, to be able to establish the deviation in the process of the generation that shows a failure. (d) Protection for the line inductor: in this section, the model for the MOV is presented as an element for suppressing voltage peaks, and the arrangement in the electrical topology of the transformer to reach the electronic inverter system is protected at all times. (e) Contribution of power droop for system frequency compensation: Tis section shows how the control diagram is structured such that the electronic generation system, by inversion, can contribute to the recovery of the frequency of the electrical system or interconnected grid. Tese conditions are studied when disturbances occur either due to load or generation rejections or due to regulation efects during peak hours, satisfying the concept of power stagnation and the proposed American standard of 4% frequency variation capable of producing 100% of generation power variation. (f ) Electronic inversion system coupled with a transformer with 10 windings: Tis section integrates the idea of generating electronic inversion units (precisely 10 units), which coupled with a transformer with 10 primaries allows conceiving the 140 (kVA) system, managed under the criteria of a central, which allows the increase of the reliability. Figure 10 shows 30 periods of the reference bar stress calculated with equations (6) and (7) and adjusted with equation (8), allowing the correlated signal that is shown in Figure 11. Besides, in Figure 10, the harmonic content present in the reference bus voltage is observed. Based on equation (4), the percentage efciency of the reference voltage, determined by taking into account the harmonic distortion, is 99.87%. Terefore, the previous percentage efciency value is a good value, considered absolute.

Periodic Processing of the Reference Bus Voltage Signal.
Taking into account, as an example, the Ecuadorian electrical system, which for the year 2020 registered 8,712.29 (MW) of nominal power and 8,095.25 (MW) of efective power [2], with annual energy generated between 20,095.49 (GWh) [3] and 25,024.20 (GWh) gross or 24,805.71 (GWh) of available energy [25,26]. Terefore, an average annual generated power between 2,294 and 2,857 (MW) is inferred, of which between 2.76 and 3.44 (MW) are lost due to the harmonic efect, as determined using equation (5).
To select the number of samples to be taken per period of the electrical signal, a study was carried out regarding a record of 416 samples per period for 30 cycles. Te reference values of RMS voltage, frequency in (Hz), and phase in degrees are shown in Table 3. Table 4 shows the execution time for 17 samples per period, yielding satisfactory results if the percentage global deviation is considered an indicator that highlights the goodness of ft concerning the samples. In this case, the Pearson quadratic correlation factor was applied.

Considerations for Synchronization.
Te synchronization of the inverter system must consider fltering aspects associated with the coupling transformer of the inverter so  that harmonic distortion values are satisfed. Te harmonic distortion value has been set to be below 5%, a value estimated with equation (30), being V i transformer output voltage, and V o i is the signal of the frst harmonic of this output voltage.
Considering a triangular signal with a frequency 100 times greater than the nominal frequency of the grid (6 (kHz)) and considering a phase shift due to the fltering action of the power transformer −4.3018°, the harmonic distortion factor is around 0.027595 (2.75%). Tis ofset, necessary to satisfy the THD condition, which is naturally introduced by the transformer, must be considered by the algorithm when compensating the ofset to achieve synchronization with a zero-degree ofset concerning the reference bar the microgeneration system wants to inject power. Figure 12 shows the fltering efect of the power transformer and its inherent delay ofset φ. Equations (6)- (8) applied to each of the signals allow for determining the gap between these signals. Tis process of determining the gap due to the fltering efect is carried out only once during the evaluation and start-up phase of the system. Later, it will be carried out as part of a predictive maintenance routine to guarantee the adjustments.
Terefore, considering that the synchronization makes periodic use of the equations (6)- (8), once the parameters have been determined, the algorithm performs ofset angle compensation by fltering the efect.

Charging or Power Outlet.
Once the synchronization of the inverter system and the network is given, the switch is closed. After closing, the load or power is taken. Te power intake is governed by a power setpoint assigned based on a secondary control in correspondence with an algorithm that responds to the needs of the energy market. Ten, based on equation (11), the phase angle adjustment for the generation of active power is carried out.
Te dependence of the active power generated on the line inductance requires its experimental determination in the frst instance before starting the system's operation. Line inductance is calculated by equations: Te use of any of the equations presents a deviation in the order of 0.03%. Terefore, the value of the calculated inductance was 3.82 (mH), for a 100 (kW) power plant with ten units of 10 (kW) each. It is important to highlight that equation (31) is worth knowing the excitation frequency of the sinusoidal signal, and equation (32) is more sensitive to noise because it presents the current derivative. However, it is essential to mention that equation (32) is much more unbiased than equation (31).
During the operation of the inverter system, it is crucial to monitor the power diferential between the generated and estimated power. For this, the variables of the ofset angle in the bus bar between the coupling point and the terminal voltage of the inverter are used, considering that the inverter voltage is at the same amplitude as the bus voltage. With these variables and a neuro-fuzzy power correlation system, the power is estimated and contrasted with the power measured by instrumentation in the feedback. In the event of a severe discrepancy, it is necessary to produce a shutdown or emergency stop of the inverted transistorized generating unit. Considering the bus voltage and the inverter voltage with the same amplitude, the behavior of the active power supplied to the bus is as shown in Figure 13.
Its fuzzy implementation allows the theoretical determination of power at a lower computational cost by implementing a 25-rule Mamdani algorithm. Figure 14 presents the universe of discussion of the variable ρ in a range between 0°and 90°with fve membership functions. Figure 15 shows the universe of the discussion of the variable V s considered V R � V S in a range of probable existence for V S , between 100 (V) and 200 (V), with fve membership functions. Figure 16 presents the universe of discussion for the prediction output P in a range between 0 (kW) and 30 (kW), with twentyone membership functions. Figure 17 shows the surface characterization resulting from the power given by the fuzzy system.
Te standard deviation of the power prediction is ±66.6084 (W), with the percentage relative mean square error being ±0.66% concerning 10 (kW) of the active power of each inverter unit. Tables 5-7 present the construction parameters of the triangular functions of the fuzzy system.
Te execution of the fuzzy inference system in the power correlation characterization uses 25 rules whose simplifed matrix is summarized in Table 8.
Te adjustments of the membership functions of the power were made by minimizing the cost function between the estimated theoretical power and the power predicted by the neuro-fuzzy system using N points of power generated by the inversion system in the operating range, considering an approximate surplus of 30%. Equation (33) presents the minimized cost function using the decreasing gradient.
For load taking or power generation, a nonlinear system has been implemented to adjust the ofset angle between bars, which is controlled by a fuzzy system that improves the behavior of a proportional controller. Tis system is located downstream of a fuzzy integral proportional controller that guarantees compliance with the power setpoint. Considering that the system is of the rigid type, the controllers are tuned by taking the feedback from the phase output and incorporating a gain conversion from radians to power. Tis conversion is processed by a frst-order dynamic that characterizes the behavior of the power measurement instrumentation. For control reasons, the open-loop system considers the power setpoint as input and the instrument's power measurement as output, where the series controller must be able to meet performance conditions under this condition. Figure 18(a) shows a linear equivalent of the system that allows an adjustment with less commitment and, therefore, is more expeditious when training and improving the    location of the membership functions associated with the outputs of the controllers. Figure 18(b) proceeds to carry out the training and give the fne adjustments of the membership functions of the universe of discourse associated with the outputs of the controllers for the nonlinear behavior. Te estimate of the gain related to the integral model approximated by the phase adjustment is carried out by equation (34), obtained starting from an ARX identifcation of a maximum precision integral model.
Both PI and P fuzzy controllers for the nonlinear model are presented, considering their structure and the tables that allow their behavior to be reproduced. Considering basic control concepts, the power deviation in (p.u), for the worst case, can only vary between ±1, with a partition given by three membership functions, as shown in Figure 19.
Regarding the universe of the discussion of the integral efect, if the maximum deviation is unity (in absolute value) and if a triangular slope of the error is considered, until reaching zero in a time of 0.16 seconds (approximate time at 10 periods of a 60 (Hz) signal) the area under the curve is around 0.08 (p.u.s). Tis result defnes why the interval of the universe of discussion is confned to an absolute value of 0.08, with a partition given by three membership functions, as shown in Figure 20.
Te phase can be between ±180°, which in radians can be limited between ±3, with a partition given by nine membership functions, as depicted in Figure 21. Tables 9-11 present the construction parameters of the triangular functions of the fuzzy system.
Te execution of the fuzzy inference system in the prediction of the phase command uses 9 rules whose simplifed matrix is as shown in Table 12.     On the other hand, the real phase can only be present between ±90°. Tis value is bounded between ±1.571 � π⁄ 2, with a partition given by three membership functions, as shown in Figures 22 and 23, respectively. It is possible to establish the universe of the discussion of the variation of the phase-in time, considering its linear approximation based on an integral obtained discretely with the maximum precision ( Figure 24). Based on the approximate model, given the high gain, if it is desired that the output of the integral system reaches π⁄ 2 in 1⁄ 60 (s), considering a phase target of π⁄ 2 there must be a rate of change of (π⁄ 2)⁄ 1000. Tis value is close to 0.001571 (rad/s), whose absolute value defnes the interval of the output of the fuzzy inference system of the phase controller.
Tables 13-15 present the construction parameters of the triangular functions of the fuzzy system of the phase controller.
Te execution of the fuzzy inference system in the characterization of the phase variation uses 9 rules, whose simplifed matrix is shown in Table 16.
Tests of linear and nonlinear models, controlled with fuzzy systems, presented similar responses. However, it is evident that, due to fuzzy controllers, both systems fail to fully comply with the scalar factor, typical of linear dynamic systems. Tis efect is shown in Figure 25, with tests of 30, 60, 90, and 100% of the nominal power of the inverter system.
In operation, an initial test of the complete system has been performed for a load lasting 20 cycles. Tis test verifes the ability of the system to synchronize and produce the gradual phase shift to satisfy the load condition. However, this is a preliminary test since, in operation, the system must meet standards such that the load intake is not perceived as a load rejection. Under this consideration, a gradient control is incorporated in the assignment of the setpoint. Figure 26 shows the complete simulation scheme for this evaluation, with a graphical result depicted in Figure 27. Figure 27 shows the synchronization result, using simulation, of a 100% load tap, presenting the variables per unit (p.u), with the red line being the bus voltage signal and the green line showing the synchronization order. Once the algorithm has been performed, the correlation and assignment of parameters to the chirp generator must be done. Te blue line is the voltage signal of the unit's inverter system, which is gradually out of phase until the power condition is satisfed, and the pink line is the power signal.
By implementing the identifcation of the system's behavior, a candidate model has been chosen, as shown in equation (35), initializing the variables by trial with the values T_1 � 1/30, T_2 � 1/50 y T_3 � 1/60.
g(s) � 1/Ts T 2 s 2 + 3Ts + 3 Terefore, for the model presented in (38), K v � 3T, the value of T found by optimization is about 0.025 seconds, which allows estimating a K v � 13.0762. Hence, the speed of tracking error is around 0.076 (for the estimated model), which contrasts with the nonlinear model. Furthermore, when it is excited with a unit ramp setpoint, the tracking error is around 0.0621, resulting in a K v � 16.0815. Due to this, the control system does not require tracking or speed compensation, which is sufcient to control the rate of change of the power setpoint in the standard range between 1/60 (s) to 1/120 (s) as a maximum power setpoint gradient of change.

Protection for Line
Inductor. Two widely used techniques for suppressing electromagnetic transients that generate high voltage are crowbar protection and MOV protection. Considering that MOV devices are more common in transmission lines and their compensation, this device is considered for the protection of the inductor. Tis system emulates the connection line [5] where the dynamics introduce a hysteresis behavior which can be simplifed with the instantaneous equation presented in [6], as shown in equation (41), being I MOV the MOV current, P the current per unit fowing through the MOV for when the voltage is applied V ref , and q � 7.2048 the exponent that characterizes the MOV.
Te experimental case presented in [6] shows that P � 155.9184 (A), V ref � 125.3540 (V), and q � 7.2048 are the values obtained by applying the decreasing gradient to the experimental values in [5] according to the cost function presented in (41) and whose evolution is observed in Figure 30.   Considering that the transformer itself has an inductive efect, a protection connection is proposed as shown in Figure 31, making use of MOV S20K75 [6]. It is possible to model it by conserving the parameter q � 7.2048, and placing the values P � 100 (A) and P � 100 (A) as presented in the manufacturer's datasheet.

Power Droop Contribution to System Frequency
Compensation. Studies aimed to evaluate the impact of reactive power (as a way of compensating the voltage profle of transmission grids) based on the administration of reactive power given by the participation of generating units with inverter systems with renewable energy as the primary source have been studied in [7].
However, even more necessary is the study that aims to improve participation by droop control for both active and reactive power to improve the participation of inverter electronic generating units working in parallel in a microgrid [27]. Te work presented in [12] considers static, dynamic, and nonlinear droop to compensate for the frequency using power droop.
In this paper, the contribution due to power drooping of the inversion electronic generating units is proposed using the classic concept of the frequency dead band, with a drooping power corresponding to 4%, equivalent to a gain of 25, and a frequency dead band of 0.3%. Its implementation contributes efectively to the recovery of the system frequency in a way that afects the contribution of active power to the grid.     IntDesPot mf phase Weight  Operator  And 1 Or 2  1  1  1  1  1  1  2  1  2  2  1  1  3  1  3  3  1  1  4  2  1  4  1  1  5  2  2  1  1  1  6  2  3  2  1  1  7  3  1  5  1  1  8  3  2  4  1 Figure 26: Model of the power control system, synchronization, and load taking. Figure 32 shows the simulation diagram for evaluating the frequency compensation when the power regulation mode presents a power droop. Under the simulation condition, a frequency disturbance of ±2.3% is presented with a dead zone of 0.3%. Terefore, the process is done for ±2% of frequency variation for compensation purposes. Tis variation causes a compensation of ±50% of the power. Due to this fact, the simulation presents a setpoint of 50% such that the inverter system has control capacity.
When the frequency exceeds the regulation band of 0.3%, the power droop compensates for 2% above the regulation band, and the power must drop 50%. Terefore, if the setpoint is at 50%, the power must be at zero, and the phase condition must be 0°or 0 radians (or 0 in p.u.). Otherwise, if the frequency is below the regulation band of 0.3%, the power droop compensates for 2% below the regulation band. Here, the power must rise 50%, so if the setpoint is at 50%, the power must be at 100%, and the phase condition is 90°or π⁄ 2 radians (or 1 in p.u.). Figure 33 shows this operating condition for power regulation during a frequency disturbance.

Electronic Inverter System Coupled with a 10-Winding
Transformer. In Section 3.4, the MOV was presented as protection for the line inductor, and Figure 30 showed the physical location of the MOV protection to suppress transients at the time of disconnection [24,27]. Tis fgure represents the connection of only one 10 (kW) inverter unit.  Due to cost and reliability facts, it is more robust than the 100 (kW) inverter system formed by 10 inverter units of 10 (kW), each one coupled through a power switch to a primary winding of a step-up transformer from 120 (V) to 13.8 (kV). Terefore, this distribution transformer contemplates 10 windings.    Te design under this consideration presents more reliability, improvements for maintenance management, cost reduction in power management, and a better compensation efect when managing power plant criteria such as operation in power mode and operation in power mode with speed regulation. Figure 34 shows the confguration of the step-up transformer, with the design specifcations presenting 10 windings in the primary and one in the secondary. Tis design satisfes the power specifcations and distribution voltage, considering the line inductor and the respective protections using MOV technology.

Conclusions
Te conceptual development of an electronic inverter unit with the capacity to provide electrical energy to an interconnected system must take into account: (1) To consider the fltering efect to achieve the THD in the synchronization process, taking into account that the grid voltage condition must be identifed using correlational techniques that allow for lower computational costs because this algorithm must be running cyclically at all times. (2) Te nonlinear modeling that allows reproducing the behavior of the chirp function and the phase condition for synchronization is controlled by the time fuzzy controllers, which allow considering greater degrees of freedom for the adjustment of system performance. (3) Te implementation of the power correlation using neuro-fuzzy, reduced computational time when the rule of overlapping membership functions was implemented. Despite the direct programming of the fuzzy system, it ofers better results than the application of computational tools that execute all the rules for determining the consequent aggregation.
(4) Te importance of power correlation is in predicting operating conditions under fault when power should be generated under voltage and phase conditions, and the deviation concerning the measured power is determined. (5) Te consideration of dealing with power drooping is that this is the regulation modality on which these equipment operate. However, the degree of participation to try to correct grid frequency deviations must be taken into consideration. (6) Modeling the equipment as a whole and obtaining a linear representation allow us to determine that the ability to follow the power setpoint does not require a correction and that, therefore, a gradient control is only necessary for ratio regulation power setpoint change. (7) Te consideration of the MOV as a transient overvoltage protection element minimizes the propagation of the fault that the presence of a crowbar could cause. Tis protection element was considered due to the inductive load represented by the transmission line and emulated when connecting the electronic inverter units to the grid. (8) Considering the complete equipment by including ten units of 10 (kW) allows handling power elements to be subjected to less stress, increasing reliability, and improving the capacity and efciency of the equivalent generator of 140 (kVA).
Te static power fow study showed a contribution to the voltage increase in bus 2, associated with the substation that couples to the generation system by the inverter through the line emulated by the inductor. Likewise, bus 2 had a slight delay in phase (less than 1.5 degrees) concerning bus 1, associated with the connection node of the generator modeled by the Tevenin equivalent circuit.
Te dynamic power fow study, taking into account that it was carried out considering linear models, showed the same response and settling time under diferent phase shift conditions between the voltages of buses 2 and 3 (with bus 3 being the voltage in the generator by inversion and bus 2 being the node associated with the coupling substation). Te adjusted times to reach the power setpoint were 2 seconds for the fve cases evaluated.
Finally, regarding fuzzy control, a Mamdani system was implemented instead of Sugeno because the models developed with Matlab are more efcient in terms of execution time. Te critical aspect to remember is to demystify the fact that Sugeno is always a better inference method due to its ease of singleton adjustment. Mamdani, with the correct adjustment of its confguration, allows the application of the decreasing gradient for the positioning of the membership functions of the consequent, Step-up transformer with 10 primary windings and one secondary to inject power to the grid. 22 Journal of Electrical and Computer Engineering taking into account the centroid method. Tis process is facilitated if a triangular or delta-type membership function is used (like the ones used in this paper).

Data Availability
Data required to reproduce the proposed study are already included in this manuscript.

Conflicts of Interest
Te authors declare that they have no conficts of interest.