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

Authors: Jesús Rodríguez-Flores; Victor Herrera-Perez; Javier Gavilanes; Andrés Morocho; Jorge Hernandez-Ambato
Journal: Journal of Electrical and Computer Engineering
 (2023)

---

## Abstract

This paper addresses the synchronization and operation of a 140 kVA inverter system connected to the main grid as part of a decentralized microgeneration system. The 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 microgeneration 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. The proposed model simulates the increase in power by a phase shift by maintaining a constant frequency based on a Chirp wave generator. The 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. The applied correlational technique to achieve the synthesis of the sinusoid and the synchronization presented optimal performance when using 17 samples per signal period. The design of the transformer primarily, guaranteed a phase shift of −4.3018°, allowed for a THD below 2.75%.


---

## Body

## 1. 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 off-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–5]. Since these three parameters are electronically created, synchronism may be lost. The mentioned conditions differ 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 differential effects, becomes less practical. This is due to weighted parameters, which are difficult to obtain with usual numerical methods and require convolution techniques that demand a lot of memory resources and computation time [6–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 efficiently is still being evaluated. The 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].The generation using power electronics devices distorts the voltage profile due to the low generation of reactive power and the operation in a baseband of power generation. The 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 effectively 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 (Mamdani-based) 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 different 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. The 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 effectiveness of the fuzzy algorithm in terms of loss reduction and voltage profile improvement [18].In addition, this type of fuzzy control has shown its efficiency and improved the performance of power electronics devices. Acikgoz et al. presented a control topology for an electronic power transformer (containing a three-phase pulse width modulation rectifier 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 flicker, 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 different techniques for model-based condition monitoring systems applied in wind turbines, such as linear model, artificial 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 flux and torque ripples, reducing overshoot and undershoot, and enhancing the response time [22].The 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.This research presents aspects related to the synchronization of a power inverter to operate in on-grid mode and its efficient performance. In this way, algorithms are proposed to carry out the correlation and adjustment function minimized by a decreasing gradient to modify the identification of the signal and parameters of the grid before synchronizing. The way of generating the sinusoid signal, whose amplitude, frequency, and phase are controlled, is based on a chirp generator. The 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]. The effect is like cloning the synchronized signal and adding the missing component to achieve the phase adjustment that allows power flow to the electrical grid.The aforementioned nonlinear conditions cannot be faced with classical control tools. The 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 significant 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.


## 2. Materials and Methods

### 2.1. Nomenclature

MOV Metal oxide varistor
PLL Phase-locked loop
THD Total harmonic distortion (−)
V
R
M
S Root mean square grid voltage (V)
V
1
R
M
S Root mean square voltage of the first harmonic of the grid voltage (V)
V
n
R
M
S Root mean square voltage of the nth harmonic of the grid voltage (V)
S Apparent power (VA)
Z Impedance (Ω)
η Efficiency (−)
S
1 Apparent power for the fundamental harmonic (VA)
S
overall Total apparent power (VA)
ρ Efficiency 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 Identified final frequency (rad/s)
β
f Identified amplitude correlated end condition (V)
ψ
f Identified 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
a
v 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 (−)
γ Degree of truth of a membership function (−)
μ
i Degree of truth of an i-th membership function (−)
x Variable of the fuzzy universe
x
i Abscissa value of the vertex of the i-th membership function
x
i
−
1 Abscissa value of the extreme left of the i-th membership function
x
i
+
1 Abscissa value of the right end of the i-th membership function
Δ Width of the base of the membership function
V
i Voltage output of the transformer (V)
V
0
i Transformer voltage output in the first harmonic (V)
L Inductance of the simulated line (H)
V
L
i
i-th voltage of the inductance in the simulated line inductance (V)
I
L
i
i-th current of the inductance in the simulated line inductance (A)
f Frequency of the i-th voltage and current of the simulated line inductance (Hz)
P
^
i
i-th power prediction (p.u.)
P
i
i-th power (p.u.)
ARX Exogenous regression analysis
K Gain of the linear model of the phase generator
φ
g Phase generator output (rad)
s
p
φ Phase setpoint (rad)
PI Integral proportional control
P Proportional control
S
P
p Power setpoint (p.u.)
P
^
l
i
i-th linear power prediction (p.u.)
P
n
l
i
i-th nonlinear power prediction (p.u.)
T
1 Time constant 1 (s)
T
2 Time constant 2 (s)
T
3 Time constant 3 (s)
T Time constant (s)
K
v Speed error constant
I
MOV MOV current (A)
I
^
M
O
V MOV current prediction (A)
P
MOV MOV power (W)
V
MOV MOV voltage (V)
V
ref MOV threshold voltage (V)
q MOV characterization exponent (−)


### 2.2. 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 first step is to study the grid’s aspects and characterize them using statistical identification techniques such as the correlation for sinusoidal systems. The 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.This 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 Thevenin simplification is developed in a three-bar electrical diagram for the study of static power flow. Thirdly, we perform the dynamic power flow study of the simplified electrical system using the obtained model.


#### 2.2.1. Distribution Grid: Electrical Signal Sample Recording and Processing

The study’s first phase consists of taking a record of the electrical signal from the distribution grid. This exploratory phase is sampled at 25 (kHz) for 1.27996 (s). The recording was made using an ACUTE DS-1202 digital oscilloscope, high-quality PC-based 2-channel DSO, with 200 (MHz) bandwidth, 200 (MSample/s) sampling rate, and 512 (Kbyte) memory.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.(1)THD2=VRMS2−V1RMS2V1RMS2=∑n=2∞VnRMS2V1RMS2.The impact of the value of the harmonic distortion factor is considered when an efficiency 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 Figure1:(2)S=VRMS2Z=V1RMS2Z+∑n=2∞VnRMS2Z,(3)η=S1STOTAL=V1RMS2/ZV1RMS2/Z+∑n=2∞VnRMS2/Z=V1RMS2V1RMS2+∑n=2∞VnRMS2,(4)η=V1RMS2V1RMS2+V1RMS2THD2=11+THD2.Figure 1
Power triangle considering the harmonic effect.Figure1 shows the power triangle made up of both the fundamental and harmonic components. The harmonic content, being of high frequency, is not broadly useable, because energy is lost in heat, both in static and dynamic machines.The same result is obtained when determining the energy efficiency due to the harmonic effect based on equation (3), if active or reactive power is considered instead of using apparent power.The 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 efficiency measured from equation (4) is an alternative way to determine the quality of the signal injected into the main grid. The following equation represents a way of presenting the energy losses due to the signal’s harmonic content:(5)ρ=THD21+THD2.The algorithm proposed in this paper is based on a double correlation, the first being an algorithm that offers a closed mathematical adjustment expression to determine the amplitude and phase, assuming that the frequency is 60 (Hz). The second correlation is an improvement that uses the result of the first correlation as a starting point and whose result is the product of an iterative search process using the decreasing gradient method.The 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.(6)λθ=sin2NTsω−Tsω4sinTsω+2N+14cotTsω4−cos2NTsω−Tsω4sinTsωcotTsω4−cos2NTsω−Tsω4sinTsω2N−14−sin2NTsω−Tsω4sinTsω−1⋅∑i=0N−1yi⋅cosTsiω∑i=0N−1yi⋅sinTsiω,(7)β=λ2+θ2∧ψ=arctanλθ.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.(8)J=12∑i=0N−1βsinωiTs+ψ−yi2.However, equation (9) is used to establish a relative parameter in the evaluation process for the identification of rest of the parameters. Therefore, equation (9) can be related with equation (10), which is the multivariable correlation factor of Pearson presented in the process of identification of systems.(9)ε=100×∑i=0N−1βsinωiTs+ψ−yi2∑i=0N−1yi2,(10)Ry2=1−∑i=0N−1βsinωiTs+ψ−yi2∑i=0N−1yi−y¯i2.It is worth mentioning that equations (8)–(10) are presented based on i-index samples because they are part of a sampling process defined based on N samples that can correspond to one or more periods, even a fraction thereof. This study proposes sampling with a buffer 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.


#### 2.2.2. Generated Power and Load Flow in the Coupling Line to the Grid Bar

The power generated and supplied to the grid depends on the power angleδ. The 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 defined by the following equations [1]:(11)Ps=1XVSVRsinδW,(12)Qs=1XVS2−VSVRcosδVAR,(13)PR=1XVSVRsinδW,(14)QR=1XVSVRcosδ−VS2VAR.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).The 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.(15)Qav=12XLVS2−VR2VAR,(16)Pline=PS2−QS2RVS2W.The 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 differential voltage.Although the active power is negligible before minimum values ofR, 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.


#### 2.2.3. 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 flow from the inverter system to the main grid.As shown in Figure2, the three-bar model contemplates the generator bar, whose voltage at bar 1 corresponds to the Thevenin 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.Figure 2
Simplified 3-bar model based on the Thevenin equivalent circuit of the electrical grid seen by the inverter system.The Thevenin model of the system was obtained under the following considerations:(i)
The regulations for the national interconnected system of Ecuador consider a system efficiency 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 effects of the line and 74.13 (kVAR) to inductive effects, with 150 (kW) losses arising due to the Joule effect.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 Table1.Table 1
Parameter for the per unit model of the grid.
Base parameters
Impedance and reactance of the model
VAR
base
=
1.11 (MVA)
R
L
i
=
1.875
e
−
6
V
base
=
13.8 (kV)
X
L
i
=
9.26
e
−
7
I
base
=
VAR
base
/
V
base
X
C
i
=
−
5995397.84
Z
base
=
V
base
/
I
base
Z
i
=
2278
+
1104.25
iFigure3 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.Figure 3
Thevenin model for the grid seen by the inverter system.Under the defined considerations, the Thevenin model has been calculated, in per unit, seen from the coupling bar 2 of the inverter system with the corresponding values described in Table2.Table 2
Parameter for the Thevenin model of the grid.
Thevenin parameters
Z
T
H
=
0.01474
+
0.00728
i
V
T
H
=
0.9741
X
L
=
11.11As shown in Figure4(a), taking into account the phase difference 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.Figure 4
Electrical behavior between bars 2 and 3: (a) phase, (b) active power flow, and (c) reactive power flow.
(a)
(b)
(c)To determine the phase condition in buses 2 and 3, as well as the generator voltage, the following considerations have been defined:(17)V3=V2,φ3=δ+φ2,(18)P=V22sinδXL,(19)V2∠φ2=V2∠δ+φ2−V1∠0XL+ZTHZTH+V1∠0.Solving the system, using equations (18) and (19), to determine V2 and φ2, the values for V3 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 difference between bus 3 and 2, such that the desired active power flow is fulfilled, the phases of bars 2 and 3 are evaluated concerning bar 1, as shown in Figures 5(b) and 5(c), respectively.Figure 5
Electrical behavior between bars 1, 2, and 3: (a) voltage in bar 3 provided by the inverter system, (b) phase of bar 2 with respect to bar 1, and (c) phase of bar 3 with respect to bar 1.
(a)
(b)
(c)


#### 2.2.4. Dynamic Power Flow Modeling

Using the simplified model of the three busbars electrical system (Figure2), a representation in the state space has been defined 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.The state space that allows obtaining the dynamic behavior of the voltage in bus 2, as well as the current that flows through the line that connects buses 3 and 2, as shown in the following equation:(20)x˙=−RTHLTH+Lx+1LTH+L−1LTH+LV3V1,VLILV2=−RTHLLTH+L1−RTHLTHLTH+Lx+LLTH+L−LLTH+L00LTHLTH+L1−LTHLTH+LV3V1.Figure6 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. The 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.(21)x˙=−6x+6V3⋅IL,Pline=1x+0V3⋅IL.Figure 6
Active power on the simulated transmission line.As depicted in Figure6, creating a positive phase shift (or in advance) produces an increase in power in the grid. This 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 affected by the injection of power from the electrical grid. This is why power flow dynamics are studied to anticipate and compensate for grid oscillations that cause undesirable frequency oscillations.


#### 2.2.5. Comparison of the Dynamic Power Flow between the Proposed Model and the Measurement with PMUs

This section summarizes power flux transmission measurements using ABB’s RES670 phasor measurement unit (PMU). 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. The results obtained are shown in Figure7.Figure 7
Response in per unit of the power flow dynamics (simulated and measured) when the generation set point corresponds to: (a) 20%, (b) 38%, (c) 70%, (d) 91%, and (e) 99%.
(a)
(b)
(c)
(d)
(e)The 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 affected 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 fulfilled 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 affected 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.


### 2.3. 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 flow 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.).


#### 2.3.1. Mamdani-Type Fuzzy Inference System Processing

The Mamdani-type fuzzy inference system has been implemented to characterize both the angular speed for the offset 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 offset setpoint value.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. The consequent is achieved through the aggregation of the rules implementing a sum, while the defuzzification 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.The membership functions of the rules in the consequent are adjusted using an optimization method based on the decreasing gradient. This optimization defines 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.(22)J=∑i=0N−1αΕi2+βddtΕi2.


#### 2.3.2. Considerations for PI andPControllers of the Mamdani Fuzzy Type

The degrees of freedom a fuzzy controller offers are directly related to the number of rules. The redundancy of degrees of freedom allows adjustments that guarantee a higher performance than a classic controller. However, there is a compromise between the number of rules and the complexity of reaching a global minimum on a cost function surface.For all the universes of discussion, the membership functions must be the simplest to calculate; therefore, delta or triangular type functions are used.(23)μi=maxminx−xi−1xi−xi−1,1,0−maxminx−xixi+1−xi,1,0.The 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.(24)μ&β=μ×β,(25)μ|β=μ+β−μ×β.In fuzzy inference aggregation, an OR has been implemented by addition, as shown in the following equation:(26)μ|β=μ+β.Implementing the sum as OR in the aggregation of rules allows obtaining a unique value in the defuzzification by implementing a centroid weighting of the membership functions of the activated rules.(27)y=∑i=1nΔ⋅μi/2xi∑i=1nΔ⋅μi/2.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 simplified consideration, eachi-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. The 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 simplification:(28)y=Δ/2⋅∑i=1nμi⋅xiΔ/2⋅∑i=1nμi=∑i=1nμi⋅xi∑i=1nμi,(29)y=∑i=1nμi⋅Ci∑i=1nμi.In equation (28), xi corresponds to the i-th singleton Ci, 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 efficient and, indeed, a better option to train function characterization systems. However, it is well known that Sugeno’s inference method modifies the general Mamdani fuzzy inference method. Additionally, the efficiency 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 2n as the total number of activated rules, where n is the number of variables or inputs of the fuzzy inference system.Therefore, 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 efficient in terms of time, with an estimate in the time relation of Tmamdani/Tsugeno equal to a mean of 0.9802.The adjustments to the fuzzy systems are made in two stages. The first 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 Figure8.Figure 8
Phase allocator regulated by a Mamdani-type fuzzy proportional controller.The second stage corresponds to the fuzzy PI control that guarantees compliance with the power setpoint and establishes the setpoint for the phase angle. The adjustment is made under the same considerations as the previous stage. The modeling of the active power measurement instrumentation is considered of the first order and closing the loop directly from the phase parameter, as shown in Figure9.Figure 9
Active power allocator regulated by a Mamdani-type fuzzy integral proportional controller.


#### 2.3.3. Variable Frequency Sinusoidal Signal Generator

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


## 2.1. Nomenclature

MOV Metal oxide varistor
PLL Phase-locked loop
THD Total harmonic distortion (−)
V
R
M
S Root mean square grid voltage (V)
V
1
R
M
S Root mean square voltage of the first harmonic of the grid voltage (V)
V
n
R
M
S Root mean square voltage of the nth harmonic of the grid voltage (V)
S Apparent power (VA)
Z Impedance (Ω)
η Efficiency (−)
S
1 Apparent power for the fundamental harmonic (VA)
S
overall Total apparent power (VA)
ρ Efficiency 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 Identified final frequency (rad/s)
β
f Identified amplitude correlated end condition (V)
ψ
f Identified 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
a
v 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 (−)
γ Degree of truth of a membership function (−)
μ
i Degree of truth of an i-th membership function (−)
x Variable of the fuzzy universe
x
i Abscissa value of the vertex of the i-th membership function
x
i
−
1 Abscissa value of the extreme left of the i-th membership function
x
i
+
1 Abscissa value of the right end of the i-th membership function
Δ Width of the base of the membership function
V
i Voltage output of the transformer (V)
V
0
i Transformer voltage output in the first harmonic (V)
L Inductance of the simulated line (H)
V
L
i
i-th voltage of the inductance in the simulated line inductance (V)
I
L
i
i-th current of the inductance in the simulated line inductance (A)
f Frequency of the i-th voltage and current of the simulated line inductance (Hz)
P
^
i
i-th power prediction (p.u.)
P
i
i-th power (p.u.)
ARX Exogenous regression analysis
K Gain of the linear model of the phase generator
φ
g Phase generator output (rad)
s
p
φ Phase setpoint (rad)
PI Integral proportional control
P Proportional control
S
P
p Power setpoint (p.u.)
P
^
l
i
i-th linear power prediction (p.u.)
P
n
l
i
i-th nonlinear power prediction (p.u.)
T
1 Time constant 1 (s)
T
2 Time constant 2 (s)
T
3 Time constant 3 (s)
T Time constant (s)
K
v Speed error constant
I
MOV MOV current (A)
I
^
M
O
V MOV current prediction (A)
P
MOV MOV power (W)
V
MOV MOV voltage (V)
V
ref MOV threshold voltage (V)
q MOV characterization exponent (−)


## 2.2. 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 first step is to study the grid’s aspects and characterize them using statistical identification techniques such as the correlation for sinusoidal systems. The 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.This 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 Thevenin simplification is developed in a three-bar electrical diagram for the study of static power flow. Thirdly, we perform the dynamic power flow study of the simplified electrical system using the obtained model.


### 2.2.1. Distribution Grid: Electrical Signal Sample Recording and Processing

The study’s first phase consists of taking a record of the electrical signal from the distribution grid. This exploratory phase is sampled at 25 (kHz) for 1.27996 (s). The recording was made using an ACUTE DS-1202 digital oscilloscope, high-quality PC-based 2-channel DSO, with 200 (MHz) bandwidth, 200 (MSample/s) sampling rate, and 512 (Kbyte) memory.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.(1)THD2=VRMS2−V1RMS2V1RMS2=∑n=2∞VnRMS2V1RMS2.The impact of the value of the harmonic distortion factor is considered when an efficiency 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 Figure1:(2)S=VRMS2Z=V1RMS2Z+∑n=2∞VnRMS2Z,(3)η=S1STOTAL=V1RMS2/ZV1RMS2/Z+∑n=2∞VnRMS2/Z=V1RMS2V1RMS2+∑n=2∞VnRMS2,(4)η=V1RMS2V1RMS2+V1RMS2THD2=11+THD2.Figure 1
Power triangle considering the harmonic effect.Figure1 shows the power triangle made up of both the fundamental and harmonic components. The harmonic content, being of high frequency, is not broadly useable, because energy is lost in heat, both in static and dynamic machines.The same result is obtained when determining the energy efficiency due to the harmonic effect based on equation (3), if active or reactive power is considered instead of using apparent power.The 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 efficiency measured from equation (4) is an alternative way to determine the quality of the signal injected into the main grid. The following equation represents a way of presenting the energy losses due to the signal’s harmonic content:(5)ρ=THD21+THD2.The algorithm proposed in this paper is based on a double correlation, the first being an algorithm that offers a closed mathematical adjustment expression to determine the amplitude and phase, assuming that the frequency is 60 (Hz). The second correlation is an improvement that uses the result of the first correlation as a starting point and whose result is the product of an iterative search process using the decreasing gradient method.The 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.(6)λθ=sin2NTsω−Tsω4sinTsω+2N+14cotTsω4−cos2NTsω−Tsω4sinTsωcotTsω4−cos2NTsω−Tsω4sinTsω2N−14−sin2NTsω−Tsω4sinTsω−1⋅∑i=0N−1yi⋅cosTsiω∑i=0N−1yi⋅sinTsiω,(7)β=λ2+θ2∧ψ=arctanλθ.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.(8)J=12∑i=0N−1βsinωiTs+ψ−yi2.However, equation (9) is used to establish a relative parameter in the evaluation process for the identification of rest of the parameters. Therefore, equation (9) can be related with equation (10), which is the multivariable correlation factor of Pearson presented in the process of identification of systems.(9)ε=100×∑i=0N−1βsinωiTs+ψ−yi2∑i=0N−1yi2,(10)Ry2=1−∑i=0N−1βsinωiTs+ψ−yi2∑i=0N−1yi−y¯i2.It is worth mentioning that equations (8)–(10) are presented based on i-index samples because they are part of a sampling process defined based on N samples that can correspond to one or more periods, even a fraction thereof. This study proposes sampling with a buffer 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.


### 2.2.2. Generated Power and Load Flow in the Coupling Line to the Grid Bar

The power generated and supplied to the grid depends on the power angleδ. The 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 defined by the following equations [1]:(11)Ps=1XVSVRsinδW,(12)Qs=1XVS2−VSVRcosδVAR,(13)PR=1XVSVRsinδW,(14)QR=1XVSVRcosδ−VS2VAR.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).The 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.(15)Qav=12XLVS2−VR2VAR,(16)Pline=PS2−QS2RVS2W.The 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 differential voltage.Although the active power is negligible before minimum values ofR, 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.


### 2.2.3. 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 flow from the inverter system to the main grid.As shown in Figure2, the three-bar model contemplates the generator bar, whose voltage at bar 1 corresponds to the Thevenin 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.Figure 2
Simplified 3-bar model based on the Thevenin equivalent circuit of the electrical grid seen by the inverter system.The Thevenin model of the system was obtained under the following considerations:(i)
The regulations for the national interconnected system of Ecuador consider a system efficiency 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 effects of the line and 74.13 (kVAR) to inductive effects, with 150 (kW) losses arising due to the Joule effect.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 Table1.Table 1
Parameter for the per unit model of the grid.
Base parameters
Impedance and reactance of the model
VAR
base
=
1.11 (MVA)
R
L
i
=
1.875
e
−
6
V
base
=
13.8 (kV)
X
L
i
=
9.26
e
−
7
I
base
=
VAR
base
/
V
base
X
C
i
=
−
5995397.84
Z
base
=
V
base
/
I
base
Z
i
=
2278
+
1104.25
iFigure3 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.Figure 3
Thevenin model for the grid seen by the inverter system.Under the defined considerations, the Thevenin model has been calculated, in per unit, seen from the coupling bar 2 of the inverter system with the corresponding values described in Table2.Table 2
Parameter for the Thevenin model of the grid.
Thevenin parameters
Z
T
H
=
0.01474
+
0.00728
i
V
T
H
=
0.9741
X
L
=
11.11As shown in Figure4(a), taking into account the phase difference 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.Figure 4
Electrical behavior between bars 2 and 3: (a) phase, (b) active power flow, and (c) reactive power flow.
(a)
(b)
(c)To determine the phase condition in buses 2 and 3, as well as the generator voltage, the following considerations have been defined:(17)V3=V2,φ3=δ+φ2,(18)P=V22sinδXL,(19)V2∠φ2=V2∠δ+φ2−V1∠0XL+ZTHZTH+V1∠0.Solving the system, using equations (18) and (19), to determine V2 and φ2, the values for V3 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 difference between bus 3 and 2, such that the desired active power flow is fulfilled, the phases of bars 2 and 3 are evaluated concerning bar 1, as shown in Figures 5(b) and 5(c), respectively.Figure 5
Electrical behavior between bars 1, 2, and 3: (a) voltage in bar 3 provided by the inverter system, (b) phase of bar 2 with respect to bar 1, and (c) phase of bar 3 with respect to bar 1.
(a)
(b)
(c)


### 2.2.4. Dynamic Power Flow Modeling

Using the simplified model of the three busbars electrical system (Figure2), a representation in the state space has been defined 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.The state space that allows obtaining the dynamic behavior of the voltage in bus 2, as well as the current that flows through the line that connects buses 3 and 2, as shown in the following equation:(20)x˙=−RTHLTH+Lx+1LTH+L−1LTH+LV3V1,VLILV2=−RTHLLTH+L1−RTHLTHLTH+Lx+LLTH+L−LLTH+L00LTHLTH+L1−LTHLTH+LV3V1.Figure6 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. The 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.(21)x˙=−6x+6V3⋅IL,Pline=1x+0V3⋅IL.Figure 6
Active power on the simulated transmission line.As depicted in Figure6, creating a positive phase shift (or in advance) produces an increase in power in the grid. This 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 affected by the injection of power from the electrical grid. This is why power flow dynamics are studied to anticipate and compensate for grid oscillations that cause undesirable frequency oscillations.


### 2.2.5. Comparison of the Dynamic Power Flow between the Proposed Model and the Measurement with PMUs

This section summarizes power flux transmission measurements using ABB’s RES670 phasor measurement unit (PMU). 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. The results obtained are shown in Figure7.Figure 7
Response in per unit of the power flow dynamics (simulated and measured) when the generation set point corresponds to: (a) 20%, (b) 38%, (c) 70%, (d) 91%, and (e) 99%.
(a)
(b)
(c)
(d)
(e)The 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 affected 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 fulfilled 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 affected 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.


## 2.2.1. Distribution Grid: Electrical Signal Sample Recording and Processing

The study’s first phase consists of taking a record of the electrical signal from the distribution grid. This exploratory phase is sampled at 25 (kHz) for 1.27996 (s). The recording was made using an ACUTE DS-1202 digital oscilloscope, high-quality PC-based 2-channel DSO, with 200 (MHz) bandwidth, 200 (MSample/s) sampling rate, and 512 (Kbyte) memory.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.(1)THD2=VRMS2−V1RMS2V1RMS2=∑n=2∞VnRMS2V1RMS2.The impact of the value of the harmonic distortion factor is considered when an efficiency 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 Figure1:(2)S=VRMS2Z=V1RMS2Z+∑n=2∞VnRMS2Z,(3)η=S1STOTAL=V1RMS2/ZV1RMS2/Z+∑n=2∞VnRMS2/Z=V1RMS2V1RMS2+∑n=2∞VnRMS2,(4)η=V1RMS2V1RMS2+V1RMS2THD2=11+THD2.Figure 1
Power triangle considering the harmonic effect.Figure1 shows the power triangle made up of both the fundamental and harmonic components. The harmonic content, being of high frequency, is not broadly useable, because energy is lost in heat, both in static and dynamic machines.The same result is obtained when determining the energy efficiency due to the harmonic effect based on equation (3), if active or reactive power is considered instead of using apparent power.The 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 efficiency measured from equation (4) is an alternative way to determine the quality of the signal injected into the main grid. The following equation represents a way of presenting the energy losses due to the signal’s harmonic content:(5)ρ=THD21+THD2.The algorithm proposed in this paper is based on a double correlation, the first being an algorithm that offers a closed mathematical adjustment expression to determine the amplitude and phase, assuming that the frequency is 60 (Hz). The second correlation is an improvement that uses the result of the first correlation as a starting point and whose result is the product of an iterative search process using the decreasing gradient method.The 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.(6)λθ=sin2NTsω−Tsω4sinTsω+2N+14cotTsω4−cos2NTsω−Tsω4sinTsωcotTsω4−cos2NTsω−Tsω4sinTsω2N−14−sin2NTsω−Tsω4sinTsω−1⋅∑i=0N−1yi⋅cosTsiω∑i=0N−1yi⋅sinTsiω,(7)β=λ2+θ2∧ψ=arctanλθ.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.(8)J=12∑i=0N−1βsinωiTs+ψ−yi2.However, equation (9) is used to establish a relative parameter in the evaluation process for the identification of rest of the parameters. Therefore, equation (9) can be related with equation (10), which is the multivariable correlation factor of Pearson presented in the process of identification of systems.(9)ε=100×∑i=0N−1βsinωiTs+ψ−yi2∑i=0N−1yi2,(10)Ry2=1−∑i=0N−1βsinωiTs+ψ−yi2∑i=0N−1yi−y¯i2.It is worth mentioning that equations (8)–(10) are presented based on i-index samples because they are part of a sampling process defined based on N samples that can correspond to one or more periods, even a fraction thereof. This study proposes sampling with a buffer 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.


## 2.2.2. Generated Power and Load Flow in the Coupling Line to the Grid Bar

The power generated and supplied to the grid depends on the power angleδ. The 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 defined by the following equations [1]:(11)Ps=1XVSVRsinδW,(12)Qs=1XVS2−VSVRcosδVAR,(13)PR=1XVSVRsinδW,(14)QR=1XVSVRcosδ−VS2VAR.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).The 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.(15)Qav=12XLVS2−VR2VAR,(16)Pline=PS2−QS2RVS2W.The 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 differential voltage.Although the active power is negligible before minimum values ofR, 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.


## 2.2.3. 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 flow from the inverter system to the main grid.As shown in Figure2, the three-bar model contemplates the generator bar, whose voltage at bar 1 corresponds to the Thevenin 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.Figure 2
Simplified 3-bar model based on the Thevenin equivalent circuit of the electrical grid seen by the inverter system.The Thevenin model of the system was obtained under the following considerations:(i)
The regulations for the national interconnected system of Ecuador consider a system efficiency 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 effects of the line and 74.13 (kVAR) to inductive effects, with 150 (kW) losses arising due to the Joule effect.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 Table1.Table 1
Parameter for the per unit model of the grid.
Base parameters
Impedance and reactance of the model
VAR
base
=
1.11 (MVA)
R
L
i
=
1.875
e
−
6
V
base
=
13.8 (kV)
X
L
i
=
9.26
e
−
7
I
base
=
VAR
base
/
V
base
X
C
i
=
−
5995397.84
Z
base
=
V
base
/
I
base
Z
i
=
2278
+
1104.25
iFigure3 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.Figure 3
Thevenin model for the grid seen by the inverter system.Under the defined considerations, the Thevenin model has been calculated, in per unit, seen from the coupling bar 2 of the inverter system with the corresponding values described in Table2.Table 2
Parameter for the Thevenin model of the grid.
Thevenin parameters
Z
T
H
=
0.01474
+
0.00728
i
V
T
H
=
0.9741
X
L
=
11.11As shown in Figure4(a), taking into account the phase difference 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.Figure 4
Electrical behavior between bars 2 and 3: (a) phase, (b) active power flow, and (c) reactive power flow.
(a)
(b)
(c)To determine the phase condition in buses 2 and 3, as well as the generator voltage, the following considerations have been defined:(17)V3=V2,φ3=δ+φ2,(18)P=V22sinδXL,(19)V2∠φ2=V2∠δ+φ2−V1∠0XL+ZTHZTH+V1∠0.Solving the system, using equations (18) and (19), to determine V2 and φ2, the values for V3 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 difference between bus 3 and 2, such that the desired active power flow is fulfilled, the phases of bars 2 and 3 are evaluated concerning bar 1, as shown in Figures 5(b) and 5(c), respectively.Figure 5
Electrical behavior between bars 1, 2, and 3: (a) voltage in bar 3 provided by the inverter system, (b) phase of bar 2 with respect to bar 1, and (c) phase of bar 3 with respect to bar 1.
(a)
(b)
(c)


## 2.2.4. Dynamic Power Flow Modeling

Using the simplified model of the three busbars electrical system (Figure2), a representation in the state space has been defined 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.The state space that allows obtaining the dynamic behavior of the voltage in bus 2, as well as the current that flows through the line that connects buses 3 and 2, as shown in the following equation:(20)x˙=−RTHLTH+Lx+1LTH+L−1LTH+LV3V1,VLILV2=−RTHLLTH+L1−RTHLTHLTH+Lx+LLTH+L−LLTH+L00LTHLTH+L1−LTHLTH+LV3V1.Figure6 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. The 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.(21)x˙=−6x+6V3⋅IL,Pline=1x+0V3⋅IL.Figure 6
Active power on the simulated transmission line.As depicted in Figure6, creating a positive phase shift (or in advance) produces an increase in power in the grid. This 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 affected by the injection of power from the electrical grid. This is why power flow dynamics are studied to anticipate and compensate for grid oscillations that cause undesirable frequency oscillations.


## 2.2.5. Comparison of the Dynamic Power Flow between the Proposed Model and the Measurement with PMUs

This section summarizes power flux transmission measurements using ABB’s RES670 phasor measurement unit (PMU). 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. The results obtained are shown in Figure7.Figure 7
Response in per unit of the power flow dynamics (simulated and measured) when the generation set point corresponds to: (a) 20%, (b) 38%, (c) 70%, (d) 91%, and (e) 99%.
(a)
(b)
(c)
(d)
(e)The 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 affected 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 fulfilled 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 affected 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.


## 2.3. 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 flow 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.).


### 2.3.1. Mamdani-Type Fuzzy Inference System Processing

The Mamdani-type fuzzy inference system has been implemented to characterize both the angular speed for the offset 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 offset setpoint value.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. The consequent is achieved through the aggregation of the rules implementing a sum, while the defuzzification 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.The membership functions of the rules in the consequent are adjusted using an optimization method based on the decreasing gradient. This optimization defines 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.(22)J=∑i=0N−1αΕi2+βddtΕi2.


### 2.3.2. Considerations for PI andPControllers of the Mamdani Fuzzy Type

The degrees of freedom a fuzzy controller offers are directly related to the number of rules. The redundancy of degrees of freedom allows adjustments that guarantee a higher performance than a classic controller. However, there is a compromise between the number of rules and the complexity of reaching a global minimum on a cost function surface.For all the universes of discussion, the membership functions must be the simplest to calculate; therefore, delta or triangular type functions are used.(23)μi=maxminx−xi−1xi−xi−1,1,0−maxminx−xixi+1−xi,1,0.The 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.(24)μ&β=μ×β,(25)μ|β=μ+β−μ×β.In fuzzy inference aggregation, an OR has been implemented by addition, as shown in the following equation:(26)μ|β=μ+β.Implementing the sum as OR in the aggregation of rules allows obtaining a unique value in the defuzzification by implementing a centroid weighting of the membership functions of the activated rules.(27)y=∑i=1nΔ⋅μi/2xi∑i=1nΔ⋅μi/2.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 simplified consideration, eachi-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. The 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 simplification:(28)y=Δ/2⋅∑i=1nμi⋅xiΔ/2⋅∑i=1nμi=∑i=1nμi⋅xi∑i=1nμi,(29)y=∑i=1nμi⋅Ci∑i=1nμi.In equation (28), xi corresponds to the i-th singleton Ci, 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 efficient and, indeed, a better option to train function characterization systems. However, it is well known that Sugeno’s inference method modifies the general Mamdani fuzzy inference method. Additionally, the efficiency 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 2n as the total number of activated rules, where n is the number of variables or inputs of the fuzzy inference system.Therefore, 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 efficient in terms of time, with an estimate in the time relation of Tmamdani/Tsugeno equal to a mean of 0.9802.The adjustments to the fuzzy systems are made in two stages. The first 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 Figure8.Figure 8
Phase allocator regulated by a Mamdani-type fuzzy proportional controller.The second stage corresponds to the fuzzy PI control that guarantees compliance with the power setpoint and establishes the setpoint for the phase angle. The adjustment is made under the same considerations as the previous stage. The modeling of the active power measurement instrumentation is considered of the first order and closing the loop directly from the phase parameter, as shown in Figure9.Figure 9
Active power allocator regulated by a Mamdani-type fuzzy integral proportional controller.


### 2.3.3. Variable Frequency Sinusoidal Signal Generator

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


## 2.3.1. Mamdani-Type Fuzzy Inference System Processing

The Mamdani-type fuzzy inference system has been implemented to characterize both the angular speed for the offset 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 offset setpoint value.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. The consequent is achieved through the aggregation of the rules implementing a sum, while the defuzzification 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.The membership functions of the rules in the consequent are adjusted using an optimization method based on the decreasing gradient. This optimization defines 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.(22)J=∑i=0N−1αΕi2+βddtΕi2.


## 2.3.2. Considerations for PI andPControllers of the Mamdani Fuzzy Type

The degrees of freedom a fuzzy controller offers are directly related to the number of rules. The redundancy of degrees of freedom allows adjustments that guarantee a higher performance than a classic controller. However, there is a compromise between the number of rules and the complexity of reaching a global minimum on a cost function surface.For all the universes of discussion, the membership functions must be the simplest to calculate; therefore, delta or triangular type functions are used.(23)μi=maxminx−xi−1xi−xi−1,1,0−maxminx−xixi+1−xi,1,0.The 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.(24)μ&β=μ×β,(25)μ|β=μ+β−μ×β.In fuzzy inference aggregation, an OR has been implemented by addition, as shown in the following equation:(26)μ|β=μ+β.Implementing the sum as OR in the aggregation of rules allows obtaining a unique value in the defuzzification by implementing a centroid weighting of the membership functions of the activated rules.(27)y=∑i=1nΔ⋅μi/2xi∑i=1nΔ⋅μi/2.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 simplified consideration, eachi-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. The 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 simplification:(28)y=Δ/2⋅∑i=1nμi⋅xiΔ/2⋅∑i=1nμi=∑i=1nμi⋅xi∑i=1nμi,(29)y=∑i=1nμi⋅Ci∑i=1nμi.In equation (28), xi corresponds to the i-th singleton Ci, 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 efficient and, indeed, a better option to train function characterization systems. However, it is well known that Sugeno’s inference method modifies the general Mamdani fuzzy inference method. Additionally, the efficiency 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 2n as the total number of activated rules, where n is the number of variables or inputs of the fuzzy inference system.Therefore, 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 efficient in terms of time, with an estimate in the time relation of Tmamdani/Tsugeno equal to a mean of 0.9802.The adjustments to the fuzzy systems are made in two stages. The first 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 Figure8.Figure 8
Phase allocator regulated by a Mamdani-type fuzzy proportional controller.The second stage corresponds to the fuzzy PI control that guarantees compliance with the power setpoint and establishes the setpoint for the phase angle. The adjustment is made under the same considerations as the previous stage. The modeling of the active power measurement instrumentation is considered of the first order and closing the loop directly from the phase parameter, as shown in Figure9.Figure 9
Active power allocator regulated by a Mamdani-type fuzzy integral proportional controller.


## 2.3.3. Variable Frequency Sinusoidal Signal Generator

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


## 3. Results and Discussion

The 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 efficiently and at the lowest computational cost, using the correlational technique presented in the methodology section. In addition, the harmonic content’s effect 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 filtering of the voltage signal and how this produces an offset in delay that must be compensated when synchronizing the electronic generation unit by the inverter.(c)
Charging or power outlet: This section presents how to determine the experimental value of the specified 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: This 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. These conditions are studied when disturbances occur either due to load or generation rejections or due to regulation effects 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: This 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.


### 3.1. Periodic Processing of the Reference Bus Voltage Signal

Figure10 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.Figure 10
Sample of 30 periods of the electrical grid signal.Figure 11
50 millisecond sample of the electrical grid signal.Based on equation (4), the percentage efficiency of the reference voltage, determined by taking into account the harmonic distortion, is 99.87%. Therefore, the previous percentage efficiency value is a good value, considered absolute.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 effective 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]. Therefore, 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 effect, 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. The reference values of RMS voltage, frequency in (Hz), and phase in degrees are shown in Table3.Table 3
Samples per period selection criteria.
30 periods 416 samples per period
Samples
12500
Vrms: (V)
123.8733
f: (Hz)
60.0056
Phase: (°)
37.1615
Processing time (s)
0.1323195Table4 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 fit concerning the samples. In this case, the Pearson quadratic correlation factor was applied.Table 4
Samples per period selection criteria.
2.5 periods 9 samples per period
2.5 periods 17 samples per period
2.5 periods 33 samples per period
Samples
22
42
82
Vrms (V)
124.2519
124.4235
124.2813
f (Hz)
60.0477
60.0259
60.0176
Phase (°)
36.8646
36.9020
36.9904
Global deviation (%)
0.8582
0.82813
0.5662
R
y
2
0.998463
0.998472
0.998474
Processing time (s)
0.0005179
0.0005569
0.0016463


### 3.2. Considerations for Synchronization

The synchronization of the inverter system must consider filtering aspects associated with the coupling transformer of the inverter so that harmonic distortion values are satisfied. The harmonic distortion value has been set to be below 5%, a value estimated with equation (30), being Vi transformer output voltage, and Voi is the signal of the first harmonic of this output voltage.(30)THD=∑i=1NVi−1/N∑i=1NVi2−∑i=1NV0i−1/N∑i=1NVi2∑i=1NV0i−1/N∑i=1NVi2.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 filtering action of the power transformer −4.3018°, the harmonic distortion factor is around 0.027595 (2.75%). This offset, necessary to satisfy the THD condition, which is naturally introduced by the transformer, must be considered by the algorithm when compensating the offset to achieve synchronization with a zero-degree offset concerning the reference bar the microgeneration system wants to inject power.Figure12 shows the filtering effect of the power transformer and its inherent delay offset φ. Equations (6)–(8) applied to each of the signals allow for determining the gap between these signals. This process of determining the gap due to the filtering effect 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.Figure 12
Offset introduced by the inverter power transformer.Therefore, considering that the synchronization makes periodic use of the equations (6)–(8), once the parameters have been determined, the algorithm performs offset angle compensation by filtering the effect.


### 3.3. 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. The 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. Then, based on equation (11), the phase angle adjustment for the generation of active power is carried out.The dependence of the active power generated on the line inductance requires its experimental determination in the first instance before starting the system’s operation. Line inductance is calculated by equations:(31)L=12πf∑i=1NVLi−1/N∑i=1NVLi2∑i=1NILi−1/N∑i=1NILi2,(32)L=12∑i=1NVLi+VLi−12∑i=1NVLi+VLi−1dILi/dt.The use of any of the equations presents a deviation in the order of 0.03%. Therefore, 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 differential between the generated and estimated power. For this, the variables of the offset 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 Figure13.Figure 13
Behavior of the power before the variation of phase angle and equal bus-inverter voltage.Its fuzzy implementation allows the theoretical determination of power at a lower computational cost by implementing a 25-rule Mamdani algorithm. Figure14 presents the universe of discussion of the variable ρ in a range between 0° and 90° with five membership functions.Figure 14
Membership functions of the degrees of gap.Figure15 shows the universe of the discussion of the variable Vs considered VR=VS in a range of probable existence for VS, between 100 (V) and 200 (V), with five membership functions. Figure 16 presents the universe of discussion for the prediction output P in a range between 0 (kW) and 30 (kW), with twenty-one membership functions. Figure 17 shows the surface characterization resulting from the power given by the fuzzy system.Figure 15
Membership functions the bus voltage and inverter voltage when they have the same amplitude.Figure 16
Membership functions as the power obtained by correlation.Figure 17
Fuzzy prediction of the behavior of the power in response to the variation of the phase angle and the same bus-inverter voltage.The 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. Tables5–7 present the construction parameters of the triangular functions of the fuzzy system.Table 5
Triangular membership functions corresponding to the gap between the bar and the inverter.
mf
Parameters (°)
RO1
−22.5
0
22.5
RO2
0
22.5
45
RO3
22.5
45
67.5
RO4
45
67.5
90
RO5
67.5
90
112.5Table 6
Triangular membership functions corresponding to the bus voltage and the inverter.
mf
Parameters (V)
V
1
75
100
125
V
2
100
125
150
V
3
125
150
175
V
4
150
175
200
V
5
175
200
225Table 7
Triangular membership functions corresponding to power prediction.
mf
Parameters (V)
P
1
−4630
0
4629
P
2
−1973
2657
7287
P
3
−478
4152
8782
P
4
280
4910
9540
P
5
1349
5979
10609
P
6
1786
6415
11045
P
7
2314
6944
11574
P
8
3042
7672
12302
P
9
3509
8138
12768
P
10
5395
10024
14654
P
11
6000
10630
15259
P
12
6221
10850
15480
P
13
6418
11048
15678
P
14
9805
14435
19065
P
15
10408
15038
19667
P
16
10995
15625
20254
P
17
15012
19641
24271
P
18
15018
19648
24278
P
19
16637
21267
25896
P
20
21033
25663
30292
P
21
23148
27777
32407The execution of the fuzzy inference system in the power correlation characterization uses 25 rules whose simplified matrix is summarized in Table8.Table 8
Rules matrix of the power correlation characterization system.
Rule
mfρ
mf V
mfP^
Weight
OperatorAnd 1 Or 2
1
1
1
1
1
1
2
1
2
1
1
1
3
1
3
1
1
1
4
1
4
1
1
1
5
1
5
1
1
1
6
2
1
2
1
1
7
2
2
3
1
1
8
2
3
5
1
1
9
2
4
9
1
1
10
2
5
11
1
1
11
3
1
4
1
1
12
3
2
8
1
1
13
3
3
13
1
1
14
3
4
15
1
1
15
3
5
17
1
1
16
4
1
6
1
1
17
4
2
10
1
1
18
4
3
14
1
1
19
4
4
18
1
1
20
4
5
20
1
1
21
5
1
7
1
1
22
5
2
12
1
1
23
5
3
16
1
1
24
5
4
19
1
1
25
5
5
21
1
1The 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 usingN 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.(33)J=12∑i=1NP^i−Pi2.For load taking or power generation, a nonlinear system has been implemented to adjust the offset angle between bars, which is controlled by a fuzzy system that improves the behavior of a proportional controller. This 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. This conversion is processed by a first-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.Figure18(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 fine adjustments of the membership functions of the universe of discourse associated with the outputs of the controllers for the nonlinear behavior.Figure 18
Fuzzy controller (a) applied to a simplified linear model for generating the shift angle for power generation, (b) applied to a nonlinear model for generating the shift angle for power generation.
(a)
(b)The 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 identification of a maximum precision integral model.(34)K=112Ts∑i=1N25yi−48yi−1+36yi−2−16yi−3+3yi−4ui∑i=1Nui2.Both PI andP 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.Figure 19
Membership functions of the power deviation.Regarding the universe of the discussion of the integral effect, 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). This result defines why the interval of the universe of discussion is confined to an absolute value of 0.08, with a partition given by three membership functions, as shown in Figure20.Figure 20
Membership functions of the power deviation integral.The phase can be between ±180°, which in radians can be limited between ±3, with a partition given by nine membership functions, as depicted in Figure21. Tables 9–11 present the construction parameters of the triangular functions of the fuzzy system.Figure 21
Membership functions of the phase setpoint prediction.Table 9
Triangular membership functions of the universe of discourse corresponding to the power deviation.
mf
Parameters (p.u.)
Desv1
−2
−1
0
Desv2
−1
0
1
Desv3
0
1
2Table 10
Triangular membership functions corresponding to the integral of the power deviation.
mf
Parameters (p.u.s)
IntDesv1
−0.16
−0.081
0
IntDesv2
−0.082
2.602e − 18
0.083
IntDesv3
0.000338
0.080338
0.160338Table 11
Triangular membership functions corresponding to the prediction of the phase setpoint.
mf
Parameters (rad)
R11
−2.9508
−2.3606
−1.7705
R12
−0.9398
−0.3496
0.2405
R13
1.0712
1.6614
2.2515
R21
−2.6012
−2.0111
−1.4209
R22
−0.5902
0
0.5901
R23
1.4208
2.011
2.6011
R31
−2.2516
−1.6615
−1.0713
R32
−0.2406
0.3495
0.9397
R33
1.7704
2.3605
2.9507The execution of the fuzzy inference system in the prediction of the phase command uses 9 rules whose simplified matrix is as shown in Table12.Table 12
Rules matrix of the phase setpoint characterization system.
Rule
mf DesPot
mf IntDesPot
mf phase
Weight
OperatorAnd 1 Or 2
1
1
1
11
1
1
2
1
2
12
1
1
3
1
3
13
1
1
4
2
1
21
1
1
5
2
2
22
1
1
6
2
3
23
1
1
7
3
1
31
1
1
8
3
2
32
1
1
9
3
3
33
1
1On the other hand, the real phase can only be present between ±90°. This value is bounded between ±1.571 ≅π⁄2, with a partition given by three membership functions, as shown in Figures 22 and 23, respectively.Figure 22
Membership functions of the phase setpoint.Figure 23
Membership functions of the real phase.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 (Figure24). 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. This value is close to 0.001571 (rad/s), whose absolute value defines the interval of the output of the fuzzy inference system of the phase controller.Figure 24
Membership functions of the phase variation prediction.Tables13–15 present the construction parameters of the triangular functions of the fuzzy system of the phase controller.Table 13
Triangular membership functions corresponding to the phase setpoint.
mf
Parameters (p.u.)
SPF1
−3.142
−1.571
0
SPF2
−1.571
5.551e − 17
1.571
SPF3
0
1.571
3.142Table 14
Triangular membership functions corresponding to the phase.
mf
Parameters (p.u.s)
F1
−3.142
−1.571
0
F2
−1.571
0
1.571
F3
0
1.571
3.142Table 15
Triangular membership functions corresponding to the prediction of the phase variation.
mf
Parameters (rad)
R1
−0.000786
0
0.000785
R2
−0.001571
−0.000786
0
R3
−0.002357
−0.001571
−0.000786
R4
0
0.000785
0.00157
R5
0.000785
0.00157
0.002356The execution of the fuzzy inference system in the characterization of the phase variation uses 9 rules, whose simplified matrix is shown in Table16.Table 16
Rules matrix of the phase variation characterization system.
Rule
mf DesPot
mf IntDesPot
mf phase
Weight
OperatorAnd 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
1
9
3
3
1
1
1Tests 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. This effect is shown in Figure25, with tests of 30, 60, 90, and 100% of the nominal power of the inverter system.Figure 25
Phases of the linear and nonlinear models with fuzzy controllers for power setpoints of 30%, 60%, 90%, and 100%.In operation, an initial test of the complete system has been performed for a load lasting 20 cycles. This test verifies 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. Figure26 shows the complete simulation scheme for this evaluation, with a graphical result depicted in Figure 27.Figure 26
Model of the power control system, synchronization, and load taking.Figure 27
Simulation of the synchronization process: (blue) bus voltage signal, (red) signal breaker closing order, (orange) signal inversion system voltage, and (green) signal generated power.Figure27 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. The blue line is the voltage signal of the unit’s inverter system, which is gradually out of phase until the power condition is satisfied, and the pink line is the power signal.By implementing the identification 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.(35)gs=1T1s+1T2s+1T3s+1.By applying the decreasing gradient method to find optimal values of the time constants, it was possible to minimize the cost function given by equation (36). In this equation, y^i is the linear prediction of the power from the model obtained with the proposed transfer function, as shown in (37), and yi is the power of the nonlinear model with the fuzzy controller, being ui the setpoint, which corresponds to a step by step synchronized with the closing order of the power switch.(36)J=∑i=1Ny^i−yi2,(37)y^i=ℒ−1usT1s+1T2s+1T3s+1.The evolution in generations of the cost function is shown in Figure28, observing the evolution of the parameters in Figure 29.Figure 28
Simulation of the synchronization process: (blue) bus voltage signal and (red) signal breaker closing order evolution of the adjustment cost function ofT1, T2, and T3, of the equivalent power system.Figure 29
Evolution of the values of parametersT1, T2, and T3.From Figure29 a simplified function can be defined for the model as shown in (38), which can be represented, as shown in equation (39).(38)gs=1Ts+13,(39)gs=1/TsT2s2+3Ts+31+1/TsT2s2+3Ts+3.Therefore, for the model presented in (38), Kv=3T, the value of T found by optimization is about 0.025 seconds, which allows estimating a Kv=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 Kv=16.0815. Due to this, the control system does not require tracking or speed compensation, which is sufficient 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.


### 3.4. 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. This system emulates the connection line [5] where the dynamics introduce a hysteresis behavior which can be simplified with the instantaneous equation presented in [6], as shown in equation (41), being IMOV the MOV current, P the current per unit flowing through the MOV for when the voltage is applied Vref, and q=7.2048 the exponent that characterizes the MOV.(40)IMOV=PVVrefq.The experimental case presented in [6] shows that P=155.9184 (A), Vref=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.(41)J=12∑i=1NI^MOV−IMOV2.Figure 30
Evolution of the cost function in the search for parameters that best fit the experimental behavior of a MOV.Considering that the transformer itself has an inductive effect, a protection connection is proposed as shown in Figure31, 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.Figure 31
Physical location of MOV protection to suppress transients upon disconnection.


### 3.5. Power Droop Contribution to System Frequency Compensation

Studies aimed to evaluate the impact of reactive power (as a way of compensating the voltage profile 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]. The 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 effectively to the recovery of the system frequency in a way that affects the contribution of active power to the grid.Figure32 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%. Therefore, the process is done for ±2% of frequency variation for compensation purposes. This 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.Figure 32
Simulation diagram of the frequency compensation due to power droop in regulation in power mode that affects the phase adjustment.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%. Therefore, 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.).Figure33 shows this operating condition for power regulation during a frequency disturbance.Figure 33
Behavior of the variables: frequency, frequency after the frequency compensation dead band, power, phase, and switch closed.


### 3.6. Electronic Inverter System Coupled with a 10-Winding Transformer

In Section3.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]. This figure 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). Therefore, this distribution transformer contemplates 10 windings.The design under this consideration presents more reliability, improvements for maintenance management, cost reduction in power management, and a better compensation effect when managing power plant criteria such as operation in power mode and operation in power mode with speed regulation.Figure34 shows the configuration of the step-up transformer, with the design specifications presenting 10 windings in the primary and one in the secondary. This design satisfies the power specifications and distribution voltage, considering the line inductor and the respective protections using MOV technology.Figure 34
Step-up transformer with 10 primary windings and one secondary to inject power to the grid.


## 3.1. Periodic Processing of the Reference Bus Voltage Signal

Figure10 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.Figure 10
Sample of 30 periods of the electrical grid signal.Figure 11
50 millisecond sample of the electrical grid signal.Based on equation (4), the percentage efficiency of the reference voltage, determined by taking into account the harmonic distortion, is 99.87%. Therefore, the previous percentage efficiency value is a good value, considered absolute.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 effective 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]. Therefore, 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 effect, 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. The reference values of RMS voltage, frequency in (Hz), and phase in degrees are shown in Table3.Table 3
Samples per period selection criteria.
30 periods 416 samples per period
Samples
12500
Vrms: (V)
123.8733
f: (Hz)
60.0056
Phase: (°)
37.1615
Processing time (s)
0.1323195Table4 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 fit concerning the samples. In this case, the Pearson quadratic correlation factor was applied.Table 4
Samples per period selection criteria.
2.5 periods 9 samples per period
2.5 periods 17 samples per period
2.5 periods 33 samples per period
Samples
22
42
82
Vrms (V)
124.2519
124.4235
124.2813
f (Hz)
60.0477
60.0259
60.0176
Phase (°)
36.8646
36.9020
36.9904
Global deviation (%)
0.8582
0.82813
0.5662
R
y
2
0.998463
0.998472
0.998474
Processing time (s)
0.0005179
0.0005569
0.0016463


## 3.2. Considerations for Synchronization

The synchronization of the inverter system must consider filtering aspects associated with the coupling transformer of the inverter so that harmonic distortion values are satisfied. The harmonic distortion value has been set to be below 5%, a value estimated with equation (30), being Vi transformer output voltage, and Voi is the signal of the first harmonic of this output voltage.(30)THD=∑i=1NVi−1/N∑i=1NVi2−∑i=1NV0i−1/N∑i=1NVi2∑i=1NV0i−1/N∑i=1NVi2.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 filtering action of the power transformer −4.3018°, the harmonic distortion factor is around 0.027595 (2.75%). This offset, necessary to satisfy the THD condition, which is naturally introduced by the transformer, must be considered by the algorithm when compensating the offset to achieve synchronization with a zero-degree offset concerning the reference bar the microgeneration system wants to inject power.Figure12 shows the filtering effect of the power transformer and its inherent delay offset φ. Equations (6)–(8) applied to each of the signals allow for determining the gap between these signals. This process of determining the gap due to the filtering effect 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.Figure 12
Offset introduced by the inverter power transformer.Therefore, considering that the synchronization makes periodic use of the equations (6)–(8), once the parameters have been determined, the algorithm performs offset angle compensation by filtering the effect.


## 3.3. 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. The 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. Then, based on equation (11), the phase angle adjustment for the generation of active power is carried out.The dependence of the active power generated on the line inductance requires its experimental determination in the first instance before starting the system’s operation. Line inductance is calculated by equations:(31)L=12πf∑i=1NVLi−1/N∑i=1NVLi2∑i=1NILi−1/N∑i=1NILi2,(32)L=12∑i=1NVLi+VLi−12∑i=1NVLi+VLi−1dILi/dt.The use of any of the equations presents a deviation in the order of 0.03%. Therefore, 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 differential between the generated and estimated power. For this, the variables of the offset 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 Figure13.Figure 13
Behavior of the power before the variation of phase angle and equal bus-inverter voltage.Its fuzzy implementation allows the theoretical determination of power at a lower computational cost by implementing a 25-rule Mamdani algorithm. Figure14 presents the universe of discussion of the variable ρ in a range between 0° and 90° with five membership functions.Figure 14
Membership functions of the degrees of gap.Figure15 shows the universe of the discussion of the variable Vs considered VR=VS in a range of probable existence for VS, between 100 (V) and 200 (V), with five membership functions. Figure 16 presents the universe of discussion for the prediction output P in a range between 0 (kW) and 30 (kW), with twenty-one membership functions. Figure 17 shows the surface characterization resulting from the power given by the fuzzy system.Figure 15
Membership functions the bus voltage and inverter voltage when they have the same amplitude.Figure 16
Membership functions as the power obtained by correlation.Figure 17
Fuzzy prediction of the behavior of the power in response to the variation of the phase angle and the same bus-inverter voltage.The 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. Tables5–7 present the construction parameters of the triangular functions of the fuzzy system.Table 5
Triangular membership functions corresponding to the gap between the bar and the inverter.
mf
Parameters (°)
RO1
−22.5
0
22.5
RO2
0
22.5
45
RO3
22.5
45
67.5
RO4
45
67.5
90
RO5
67.5
90
112.5Table 6
Triangular membership functions corresponding to the bus voltage and the inverter.
mf
Parameters (V)
V
1
75
100
125
V
2
100
125
150
V
3
125
150
175
V
4
150
175
200
V
5
175
200
225Table 7
Triangular membership functions corresponding to power prediction.
mf
Parameters (V)
P
1
−4630
0
4629
P
2
−1973
2657
7287
P
3
−478
4152
8782
P
4
280
4910
9540
P
5
1349
5979
10609
P
6
1786
6415
11045
P
7
2314
6944
11574
P
8
3042
7672
12302
P
9
3509
8138
12768
P
10
5395
10024
14654
P
11
6000
10630
15259
P
12
6221
10850
15480
P
13
6418
11048
15678
P
14
9805
14435
19065
P
15
10408
15038
19667
P
16
10995
15625
20254
P
17
15012
19641
24271
P
18
15018
19648
24278
P
19
16637
21267
25896
P
20
21033
25663
30292
P
21
23148
27777
32407The execution of the fuzzy inference system in the power correlation characterization uses 25 rules whose simplified matrix is summarized in Table8.Table 8
Rules matrix of the power correlation characterization system.
Rule
mfρ
mf V
mfP^
Weight
OperatorAnd 1 Or 2
1
1
1
1
1
1
2
1
2
1
1
1
3
1
3
1
1
1
4
1
4
1
1
1
5
1
5
1
1
1
6
2
1
2
1
1
7
2
2
3
1
1
8
2
3
5
1
1
9
2
4
9
1
1
10
2
5
11
1
1
11
3
1
4
1
1
12
3
2
8
1
1
13
3
3
13
1
1
14
3
4
15
1
1
15
3
5
17
1
1
16
4
1
6
1
1
17
4
2
10
1
1
18
4
3
14
1
1
19
4
4
18
1
1
20
4
5
20
1
1
21
5
1
7
1
1
22
5
2
12
1
1
23
5
3
16
1
1
24
5
4
19
1
1
25
5
5
21
1
1The 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 usingN 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.(33)J=12∑i=1NP^i−Pi2.For load taking or power generation, a nonlinear system has been implemented to adjust the offset angle between bars, which is controlled by a fuzzy system that improves the behavior of a proportional controller. This 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. This conversion is processed by a first-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.Figure18(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 fine adjustments of the membership functions of the universe of discourse associated with the outputs of the controllers for the nonlinear behavior.Figure 18
Fuzzy controller (a) applied to a simplified linear model for generating the shift angle for power generation, (b) applied to a nonlinear model for generating the shift angle for power generation.
(a)
(b)The 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 identification of a maximum precision integral model.(34)K=112Ts∑i=1N25yi−48yi−1+36yi−2−16yi−3+3yi−4ui∑i=1Nui2.Both PI andP 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.Figure 19
Membership functions of the power deviation.Regarding the universe of the discussion of the integral effect, 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). This result defines why the interval of the universe of discussion is confined to an absolute value of 0.08, with a partition given by three membership functions, as shown in Figure20.Figure 20
Membership functions of the power deviation integral.The phase can be between ±180°, which in radians can be limited between ±3, with a partition given by nine membership functions, as depicted in Figure21. Tables 9–11 present the construction parameters of the triangular functions of the fuzzy system.Figure 21
Membership functions of the phase setpoint prediction.Table 9
Triangular membership functions of the universe of discourse corresponding to the power deviation.
mf
Parameters (p.u.)
Desv1
−2
−1
0
Desv2
−1
0
1
Desv3
0
1
2Table 10
Triangular membership functions corresponding to the integral of the power deviation.
mf
Parameters (p.u.s)
IntDesv1
−0.16
−0.081
0
IntDesv2
−0.082
2.602e − 18
0.083
IntDesv3
0.000338
0.080338
0.160338Table 11
Triangular membership functions corresponding to the prediction of the phase setpoint.
mf
Parameters (rad)
R11
−2.9508
−2.3606
−1.7705
R12
−0.9398
−0.3496
0.2405
R13
1.0712
1.6614
2.2515
R21
−2.6012
−2.0111
−1.4209
R22
−0.5902
0
0.5901
R23
1.4208
2.011
2.6011
R31
−2.2516
−1.6615
−1.0713
R32
−0.2406
0.3495
0.9397
R33
1.7704
2.3605
2.9507The execution of the fuzzy inference system in the prediction of the phase command uses 9 rules whose simplified matrix is as shown in Table12.Table 12
Rules matrix of the phase setpoint characterization system.
Rule
mf DesPot
mf IntDesPot
mf phase
Weight
OperatorAnd 1 Or 2
1
1
1
11
1
1
2
1
2
12
1
1
3
1
3
13
1
1
4
2
1
21
1
1
5
2
2
22
1
1
6
2
3
23
1
1
7
3
1
31
1
1
8
3
2
32
1
1
9
3
3
33
1
1On the other hand, the real phase can only be present between ±90°. This value is bounded between ±1.571 ≅π⁄2, with a partition given by three membership functions, as shown in Figures 22 and 23, respectively.Figure 22
Membership functions of the phase setpoint.Figure 23
Membership functions of the real phase.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 (Figure24). 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. This value is close to 0.001571 (rad/s), whose absolute value defines the interval of the output of the fuzzy inference system of the phase controller.Figure 24
Membership functions of the phase variation prediction.Tables13–15 present the construction parameters of the triangular functions of the fuzzy system of the phase controller.Table 13
Triangular membership functions corresponding to the phase setpoint.
mf
Parameters (p.u.)
SPF1
−3.142
−1.571
0
SPF2
−1.571
5.551e − 17
1.571
SPF3
0
1.571
3.142Table 14
Triangular membership functions corresponding to the phase.
mf
Parameters (p.u.s)
F1
−3.142
−1.571
0
F2
−1.571
0
1.571
F3
0
1.571
3.142Table 15
Triangular membership functions corresponding to the prediction of the phase variation.
mf
Parameters (rad)
R1
−0.000786
0
0.000785
R2
−0.001571
−0.000786
0
R3
−0.002357
−0.001571
−0.000786
R4
0
0.000785
0.00157
R5
0.000785
0.00157
0.002356The execution of the fuzzy inference system in the characterization of the phase variation uses 9 rules, whose simplified matrix is shown in Table16.Table 16
Rules matrix of the phase variation characterization system.
Rule
mf DesPot
mf IntDesPot
mf phase
Weight
OperatorAnd 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
1
9
3
3
1
1
1Tests 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. This effect is shown in Figure25, with tests of 30, 60, 90, and 100% of the nominal power of the inverter system.Figure 25
Phases of the linear and nonlinear models with fuzzy controllers for power setpoints of 30%, 60%, 90%, and 100%.In operation, an initial test of the complete system has been performed for a load lasting 20 cycles. This test verifies 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. Figure26 shows the complete simulation scheme for this evaluation, with a graphical result depicted in Figure 27.Figure 26
Model of the power control system, synchronization, and load taking.Figure 27
Simulation of the synchronization process: (blue) bus voltage signal, (red) signal breaker closing order, (orange) signal inversion system voltage, and (green) signal generated power.Figure27 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. The blue line is the voltage signal of the unit’s inverter system, which is gradually out of phase until the power condition is satisfied, and the pink line is the power signal.By implementing the identification 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.(35)gs=1T1s+1T2s+1T3s+1.By applying the decreasing gradient method to find optimal values of the time constants, it was possible to minimize the cost function given by equation (36). In this equation, y^i is the linear prediction of the power from the model obtained with the proposed transfer function, as shown in (37), and yi is the power of the nonlinear model with the fuzzy controller, being ui the setpoint, which corresponds to a step by step synchronized with the closing order of the power switch.(36)J=∑i=1Ny^i−yi2,(37)y^i=ℒ−1usT1s+1T2s+1T3s+1.The evolution in generations of the cost function is shown in Figure28, observing the evolution of the parameters in Figure 29.Figure 28
Simulation of the synchronization process: (blue) bus voltage signal and (red) signal breaker closing order evolution of the adjustment cost function ofT1, T2, and T3, of the equivalent power system.Figure 29
Evolution of the values of parametersT1, T2, and T3.From Figure29 a simplified function can be defined for the model as shown in (38), which can be represented, as shown in equation (39).(38)gs=1Ts+13,(39)gs=1/TsT2s2+3Ts+31+1/TsT2s2+3Ts+3.Therefore, for the model presented in (38), Kv=3T, the value of T found by optimization is about 0.025 seconds, which allows estimating a Kv=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 Kv=16.0815. Due to this, the control system does not require tracking or speed compensation, which is sufficient 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.


## 3.4. 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. This system emulates the connection line [5] where the dynamics introduce a hysteresis behavior which can be simplified with the instantaneous equation presented in [6], as shown in equation (41), being IMOV the MOV current, P the current per unit flowing through the MOV for when the voltage is applied Vref, and q=7.2048 the exponent that characterizes the MOV.(40)IMOV=PVVrefq.The experimental case presented in [6] shows that P=155.9184 (A), Vref=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.(41)J=12∑i=1NI^MOV−IMOV2.Figure 30
Evolution of the cost function in the search for parameters that best fit the experimental behavior of a MOV.Considering that the transformer itself has an inductive effect, a protection connection is proposed as shown in Figure31, 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.Figure 31
Physical location of MOV protection to suppress transients upon disconnection.


## 3.5. Power Droop Contribution to System Frequency Compensation

Studies aimed to evaluate the impact of reactive power (as a way of compensating the voltage profile 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]. The 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 effectively to the recovery of the system frequency in a way that affects the contribution of active power to the grid.Figure32 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%. Therefore, the process is done for ±2% of frequency variation for compensation purposes. This 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.Figure 32
Simulation diagram of the frequency compensation due to power droop in regulation in power mode that affects the phase adjustment.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%. Therefore, 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.).Figure33 shows this operating condition for power regulation during a frequency disturbance.Figure 33
Behavior of the variables: frequency, frequency after the frequency compensation dead band, power, phase, and switch closed.


## 3.6. Electronic Inverter System Coupled with a 10-Winding Transformer

In Section3.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]. This figure 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). Therefore, this distribution transformer contemplates 10 windings.The design under this consideration presents more reliability, improvements for maintenance management, cost reduction in power management, and a better compensation effect when managing power plant criteria such as operation in power mode and operation in power mode with speed regulation.Figure34 shows the configuration of the step-up transformer, with the design specifications presenting 10 windings in the primary and one in the secondary. This design satisfies the power specifications and distribution voltage, considering the line inductor and the respective protections using MOV technology.Figure 34
Step-up transformer with 10 primary windings and one secondary to inject power to the grid.


## 4. Conclusions

The 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 filtering effect to achieve the THD in the synchronization process, taking into account that the grid voltage condition must be identified using correlational techniques that allow for lower computational costs because this algorithm must be running cyclically at all times.(2)
The 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)
The 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 offers better results than the application of computational tools that execute all the rules for determining the consequent aggregation.(4)
The 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)
The 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)
The consideration of the MOV as a transient overvoltage protection element minimizes the propagation of the fault that the presence of a crowbar could cause. This 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 efficiency of the equivalent generator of 140 (kVA).The static power flow 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 Thevenin equivalent circuit.The dynamic power flow study, taking into account that it was carried out considering linear models, showed the same response and settling time under different 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). The adjusted times to reach the power setpoint were 2 seconds for the five cases evaluated.Finally, regarding fuzzy control, a Mamdani system was implemented instead of Sugeno because the models developed with Matlab are more efficient in terms of execution time. The 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 configuration, allows the application of the decreasing gradient for the positioning of the membership functions of the consequent, taking into account the centroid method. This process is facilitated if a triangular or delta-type membership function is used (like the ones used in this paper).



---

*Source: 8617388-2023-02-03.xml*