Online Learning-Based ANN Controller for a Grid-Interactive Solar PV System

: The technology transformation of industry 4.0 comprises computers, power converters such as variable speed devices, and microprocessors, which distract from the quality of power. The integration of distribution-generation technologies, such as solar photovoltaic (PV) and wind systems with source grids, frequently uses power converters, which increases the issues with power quality. DSTATCOM is the FACTS device most proﬁcient in recompensing current-related power quality concerns. A model of DSTATCOM with an ANN controller was developed and implemented using a backpropagation online learning-based algorithm for balanced non-linear loads. This algorithm minimized the mathematical burden and the complications of control. It demonstrated a dynamic role in improving the quality of the power at the grid. The algorithm was implemented in MATLAB using an ANN model controller and the results were validated with an experimental set-up using an FPGA controller.


Introduction
Since the industrial insurgency, the energy blend of most nations across the globe has become subjugated by conventional fuels. This has had significant consequences for the global environment, and has worsened human health. Renewable energy will perform a crucial role in the decarbonization of our current systems in future decades. In 2020, 1% of global energy was generated from solar photovoltaic (PV) systems [1]. During power extraction from PV panels, there is no detrimental greenhouse gas discharges; thus, solar PV is ecologically-friendly. The operation of solar plants is reliant on environmental conditions such as irradiance, the speed of wind, temperature, and various operational loss components. The output of a solar panel can be improved by various suggestive practices while manufacturing and setting up the plant [2]. Solar photovoltaic power plants are connected to the grid with either the grossmetering system or net-metering system in India. The grid-interactive system has great potential and is very popular in India. The Ministry of New and Renewable Energy is promoting the solar grid-interactive system at a large scale [3]. The grid-tied system has great potential to make the power infrastructure stronger and more sustainable, and has the ability to meet the needs of the present without compromising the ability of the future.
The grid-tied systems may lead India to better energy security. The system can be installed for industrial purposes, domestic purposes, commercial purposes, etc.
The DG structure consists of a non-conventional energy resource, a DC/DC chopper, and an inverter. The voltage source converters (VSCs) use controllable switches that are controlled by various pulse generators [4,5]. Maximum power is extracted from the sun or the wind, and made constant using a DC-DC converter [6]. The power generated from renewables is given to the grid using grid-tied inverters. In a grid-tied system, however, the inverter has numerous supplementary roles to perform. Under normal scenarios, the inverter sustains the battery in a mode of full charge for use throughout power interruptions. When the grid is disconnected, the grid-tied inverter impeccably steps in to convert DC power from both the solar and battery sources into operational AC power to sensitive loads, so that they run without any interruption [7].
The power electronic-based converters and non-linear loads pollute the system with multiple power quality challenges, such as harmonics [8]. The grid-tied inverter works as a DSTATCOM and can mitigate the harmonics at the source side, keeping it purely sinusoidal [9]. Many conventional devices such as SVC, STATCOM, and UPQC [10][11][12][13][14][15][16], as well as advanced control techniques such as ANN and Fuzzy, are available in the literature, but due to their limitations, they are not flexible or simple to use [17][18][19][20][21]. Control of the grid-interactive VSC using an adaptive ANN model with online training is discussed in this paper. The VSC, connected via shunt to the system, was acting as a DSTATCOM. The performance of this grid-interactive solar-distributed generation system was analyzed using a three-phase balanced non-linear load. The simulation results were validated using an experimental set-up, and the THD was determined for the above-mentioned system.

System Description
A schematic diagram of the ANN-BP control strategy for the grid-tied solar PV-battery system is shown in Figure 1 with the balanced three-phase three-wire (3P-3W) nonlinear load. The proposed model, based on an ANN-based backpropagation algorithm, would be used to regulate the DSTATCOM. The three-phase balanced non-linear load was linked to three-phase grid sources. Load currents were sensed and given to the adaptive ANN controller to create the signal pulses of the VSC. The DC link voltage of the VSC was fed from the solar PV Panel. The panel voltage was boosted using a DC-DC boost converter, and an incremental conductance method was used to extract maximum power from the sun. The three-phase balanced non-linear load was linked to three-phase grid sources. Load currents were sensed and given to the adaptive ANN controller to create the signal pulses of the VSC. The DC link voltage of the VSC was fed from the solar PV Panel. The panel voltage was boosted using a DC-DC boost converter, and an incremental conductance method was used to extract maximum power from the sun.

DC Link Voltage of the VSC from the Solar PV System
Solar PV distributed generation systems generate DC voltage and are dependent on climatic conditions such as temperature and irradiance. As these climatic conditions vary frequently, PV panels also generate variable DC voltages, which are not suitable for any application. It needs to be stabilized by generating constant voltage. This can be accomplished by tracking the maximum power from the sun, irrespective of climatic conditions. For that purpose, DC-DC boost converters are required. They not only boost the voltage levels, but they also maintain constant, irrespective of temperature and irradiances of the sun. Different DC-DC boost converters are discussed in this paper, as shown in Figure 2, and it was concluded that the performance of the super-lift positive Luo converter was better than the other two converters, as shown in Figure 3. P&O and incremental conductance methods were used to track maximum power and between them, the incremental method was considered the best.

DC Link Voltage of the VSC from the Solar PV System
Solar PV distributed generation systems generate DC voltage and are dependent on climatic conditions such as temperature and irradiance. As these climatic conditions vary frequently, PV panels also generate variable DC voltages, which are not suitable for any application. It needs to be stabilized by generating constant voltage. This can be accomplished by tracking the maximum power from the sun, irrespective of climatic conditions. For that purpose, DC-DC boost converters are required. They not only boost the voltage levels, but they also maintain constant, irrespective of temperature and irradiances of the sun. Different DC-DC boost converters are discussed in this paper, as shown in Figure 2, and it was concluded that the performance of the super-lift positive Luo converter was better than the other two converters, as shown in Figure 3. P&O and incremental conductance methods were used to track maximum power and between them, the incremental method was considered the best.

DC Link Voltage of the VSC from the Solar PV System
Solar PV distributed generation systems generate DC voltage and are dependent on climatic conditions such as temperature and irradiance. As these climatic conditions vary frequently, PV panels also generate variable DC voltages, which are not suitable for any application. It needs to be stabilized by generating constant voltage. This can be accomplished by tracking the maximum power from the sun, irrespective of climatic conditions. For that purpose, DC-DC boost converters are required. They not only boost the voltage levels, but they also maintain constant, irrespective of temperature and irradiances of the sun. Different DC-DC boost converters are discussed in this paper, as shown in Figure 2, and it was concluded that the performance of the super-lift positive Luo converter was better than the other two converters, as shown in Figure 3. P&O and incremental conductance methods were used to track maximum power and between them, the incremental method was considered the best. The circuit diagram of the super-lift Luo DC-DC converter, as shown in Figure 4a, was analyzed in detail using the state model. During the ON state, as shown in Figure 4b, inductor L and capacitor C1 are charged, as diode D1 is in forward bias. Capacitor C2, which is already charged, delivers the current to the load R. During the OFF state, as shown in Figure 4c, diode D1 is off and diode D2 is on. L and C1 discharge through C2 and address the load demand.  The circuit diagram of the super-lift Luo DC-DC converter, as shown in Figure 4a, was analyzed in detail using the state model. During the ON state, as shown in Figure 4b, inductor L and capacitor C1 are charged, as diode D1 is in forward bias. Capacitor C2, which is already charged, delivers the current to the load R. During the OFF state, as shown in Figure 4c, diode D1 is off and diode D2 is on. L and C1 discharge through C2 and address the load demand. The circuit diagram of the super-lift Luo DC-DC converter, as shown in Figure 4a, was analyzed in detail using the state model. During the ON state, as shown in Figure 4b, inductor L and capacitor C1 are charged, as diode D1 is in forward bias. Capacitor C2, which is already charged, delivers the current to the load R. During the OFF state, as shown in Figure 4c, diode D1 is off and diode D2 is on. L and C1 discharge through C2 and address the load demand.   The differential equations representing the ON state are: The differential equations representing the OFF state are: Three state variables were considered, i.e., the current through the inductor and the voltages across the two capacitors. State equations were formulated and the transfer function of the converter was obtained, as shown in the equations.
( ) ( ) = 495 + 6.93 10 + 9.28 10 + 3819 + 7.22 10 + 3.52 10 (9) Using the transfer function approach, stability analysis of the super-lift converter was performed using the Bode plot method, which is a frequency domain testing method. As shown in Figure 5, it was observed from the plot that the gain margin and phase margin were positive, meaning the system was stable in nature; hence, the positive-lift Luo converter was used to boost the voltage from the solar panel and given as the DC link voltage for the grid-interactive VSC. The differential equations representing the ON state are: The differential equations representing the OFF state are: Three state variables were considered, i.e., the current through the inductor and the voltages across the two capacitors. State equations were formulated and the transfer function of the converter was obtained, as shown in the equations.
v o (s) v in (s) = 495s 2 + 6.93 × 10 6 s + 9.28 × 10 9 s 3 + 3819s 2 + 7.22 × 10 6 s + 3.52 × 10 9 (9) Using the transfer function approach, stability analysis of the super-lift converter was performed using the Bode plot method, which is a frequency domain testing method. As shown in Figure 5, it was observed from the plot that the gain margin and phase margin were positive, meaning the system was stable in nature; hence, the positive-lift Luo converter was used to boost the voltage from the solar panel and given as the DC link voltage for the grid-interactive VSC. Appl. Sci. 2021, 11, x FOR PEER REVIEW 6 of 16

Proposed ANN Model to Control Grid-Interactive VSC
Valuation of the active component and reactive component of the load currents and reference source currents were determined using the backpropagation algorithm. The block diagram of the weight estimation is shown in Figure 6. The sensed source currents and reference source currents were processed, errors were amplified through a PI controller, and their outputs were fed to a PWM controller to generate IGBT switching pulses. URp, UYp, and UBp are the unit template voltages of the three-phase source grid. ILr, ILy, and IlB are the sensed load currents of the three phases. Assuming the initial weights, the estimated weights were calculated and activated using a sigmoidal function. The weights were updated until the error becames zero. The ANN model of the proposed controller is shown in Figure 7.

Proposed ANN Model to Control Grid-Interactive VSC
Valuation of the active component and reactive component of the load currents and reference source currents were determined using the backpropagation algorithm. The block diagram of the weight estimation is shown in Figure 6. The sensed source currents and reference source currents were processed, errors were amplified through a PI controller, and their outputs were fed to a PWM controller to generate IGBT switching pulses.

Proposed ANN Model to Control Grid-Interactive VSC
Valuation of the active component and reactive component of the load currents and reference source currents were determined using the backpropagation algorithm. The block diagram of the weight estimation is shown in Figure 6. The sensed source currents and reference source currents were processed, errors were amplified through a PI controller, and their outputs were fed to a PWM controller to generate IGBT switching pulses. URp, UYp, and UBp are the unit template voltages of the three-phase source grid. ILr, ILy, and IlB are the sensed load currents of the three phases. Assuming the initial weights, the estimated weights were calculated and activated using a sigmoidal function. The weights were updated until the error becames zero. The ANN model of the proposed controller is shown in Figure 7. Batch/offline training is typically a time-consuming matter as it may include many repetitions throughout the training data. In most cases, this may demand much time; furthermore, the learning parameters (i.e., learning rate, number of learning epochs, stopping criteria, and other predefined parameters) must be appropriately selected to ensure convergence. Whenever new sets of data are used by the batch model, it includes the past set of data together with the new data, and performs a retraining, thus taking a large amount of time.
Online learning performs parameter updates one by one (no training with the entire dataset) • No redundancy as there is only one update at a time; • It learns online, so it is faster than offline learning; • Backpropagation is the appropriate method for both offline and online learning.
A gradient descent-based backpropagation (BP) algorithm offers improved simplification performance at an enormously fast learning rate and the training of many models can be finished much faster. This algorithm is used to estimate the reference source current components to obtain the pulses for the DSTATCOM.
One input layer, one output layer, and two hidden layers were used in the model, as shown in Figure 8. There were three neurons in each layer for the active component estimation of reference source currents, and three for the reactive component. The weights were updated continuously using an online-learning based gradient descent backpropagation algorithm. The detailed algorithm is shown using the flowchart in Figure 9. The same ANN model can also be used for unbalanced loads. Batch/offline training is typically a time-consuming matter as it may include many repetitions throughout the training data. In most cases, this may demand much time; furthermore, the learning parameters (i.e., learning rate, number of learning epochs, stopping criteria, and other predefined parameters) must be appropriately selected to ensure convergence. Whenever new sets of data are used by the batch model, it includes the past set of data together with the new data, and performs a retraining, thus taking a large amount of time.
Online learning performs parameter updates one by one (no training with the entire dataset)

•
No redundancy as there is only one update at a time; • It learns online, so it is faster than offline learning; • Backpropagation is the appropriate method for both offline and online learning.
A gradient descent-based backpropagation (BP) algorithm offers improved simplification performance at an enormously fast learning rate and the training of many models can be finished much faster. This algorithm is used to estimate the reference source current components to obtain the pulses for the DSTATCOM.
One input layer, one output layer, and two hidden layers were used in the model, as shown in Figure 8. There were three neurons in each layer for the active component estimation of reference source currents, and three for the reactive component. Batch/offline training is typically a time-consuming matter as it may include many repetitions throughout the training data. In most cases, this may demand much time; furthermore, the learning parameters (i.e., learning rate, number of learning epochs, stopping criteria, and other predefined parameters) must be appropriately selected to ensure convergence. Whenever new sets of data are used by the batch model, it includes the past set of data together with the new data, and performs a retraining, thus taking a large amount of time.
Online learning performs parameter updates one by one (no training with the entire dataset)

•
No redundancy as there is only one update at a time; • It learns online, so it is faster than offline learning; • Backpropagation is the appropriate method for both offline and online learning.
A gradient descent-based backpropagation (BP) algorithm offers improved simplification performance at an enormously fast learning rate and the training of many models can be finished much faster. This algorithm is used to estimate the reference source current components to obtain the pulses for the DSTATCOM.
One input layer, one output layer, and two hidden layers were used in the model, as shown in Figure 8. There were three neurons in each layer for the active component estimation of reference source currents, and three for the reactive component. The weights were updated continuously using an online-learning based gradient descent backpropagation algorithm. The detailed algorithm is shown using the flowchart in Figure 9. The same ANN model can also be used for unbalanced loads. The weights were updated continuously using an online-learning based gradient descent backpropagation algorithm. The detailed algorithm is shown using the flowchart in Figure 9. The same ANN model can also be used for unbalanced loads.
Revision of the weights using backpropagation algorithm is shown in Figure 9. Wp(k) is the average weight of three phases; WRp1(k) is the fundamental component of the R phase; iRp1 is the current of phase R, i.e., output of the hidden layer; ZRp(k) is the sigmoidal function output; and η is the learning rate, which was tuned and updated as per the adaptive learning based-gradient descent online learning.

Results and Discussion
The Deep Learning Toolbox was used for the modelling of estimation blocks, and pulses were generated using a hysteresis controller. The parameters used for the MATLAB simulation are tabulated in Table 1. The updated weight of the active component of phase R was assessed using Wp(k) as a feedback signal represented as an Equation (10).
Revision of the weights using backpropagation algorithm is shown in Figure 9. Wp(k) is the average weight of three phases; WRp1(k) is the fundamental component of the R phase; iRp1 is the current of phase R, i.e., output of the hidden layer; ZRp(k) is the sigmoidal function output; and η is the learning rate, which was tuned and updated as per the adaptive learning based-gradient descent online learning.

Results and Discussion
The Deep Learning Toolbox was used for the modelling of estimation blocks, and pulses were generated using a hysteresis controller. The parameters used for the MATLAB simulation are tabulated in Table 1.
The voltage generated from the panel was fixed using a super-lift converter, and it was given as DC input to the VSC. The VSC connected to the system using a coupling inductor. The balanced non-linear load was used, which required harmonic current and reactive power to operate. Harmonic current and reactive power were provided by the VSC which was acting as the DSTATCOM. The simulation model is shown in Figure 10. The voltage generated from the panel was fixed using a super-lift converter, and it was given as DC input to the VSC. The VSC connected to the system using a coupling inductor. The balanced non-linear load was used, which required harmonic current and reactive power to operate. Harmonic current and reactive power were provided by the VSC which was acting as the DSTATCOM. The simulation model is shown in Figure 10. The developed DSTATCOM was tested with the three-phase balanced non-linear load. The single-phase source voltage, source current, compensator current, and compensator voltage waveforms are presented in Figure 11. Until DSTATCOM was activated, the non-linear load drew harmonic current from the source; thus, the source current was also non-sinusoidal. After DSTATCOM was activated, source current remained sinusoidal, and harmonic component currents were supplied by the DSTATCOM. The developed DSTATCOM was tested with the three-phase balanced non-linear load. The single-phase source voltage, source current, compensator current, and compensator voltage waveforms are presented in Figure 11. Until DSTATCOM was activated, the nonlinear load drew harmonic current from the source; thus, the source current was also non-sinusoidal. After DSTATCOM was activated, source current remained sinusoidal, and harmonic component currents were supplied by the DSTATCOM.
The three-phase voltages and currents are shown in Figure 12. It reflects that the ANN-BP-based algorithm compensates for the harmonics produced due to the non-linear load. Load current THD remained 26.4% and source current harmonics became 3.6%, as shown in Figure 13a The three-phase voltages and currents are shown in Figure 12. It reflects that the ANN-BP-based algorithm compensates for the harmonics produced due to the non-linear load. Load current THD remained 26.4% and source current harmonics became 3.6%, as shown in Figure 13a   The three-phase voltages and currents are shown in Figure 12. It reflects that the ANN-BP-based algorithm compensates for the harmonics produced due to the non-linear load. Load current THD remained 26.4% and source current harmonics became 3.6%, as shown in Figure 13a  Hardware Implementation: Balanced Non-Linear Load The above case was implemented using the experimental set-up. The developed scheme was realized using a dSPACE set-up for a balanced loading condition, as shown in Figure 14. The FPGA controller produced the wanted gating pulses for all six IGBT switches of voltage source converters to attain the expected performance, and demanded less sampling time, needing only 10 microseconds to perform the developed control algorithm. This section includes the experimental performances of the adaptive learning backpropagation-based control algorithm for a three-phase three-wire system feeding a non-linear balanced load. The ratings and specifications of the experimental set-up are presented in the Table 2  The prototyping set-up developed for testing the ANN-BP controller implementation comprised four parts: DSTATCOM; an FPGA board; a dSPACE Board; and two computers. Quartus software was used to design the controller for implementation on the FPGA board. The plant set-up, developed by MATLAB/SIMULINK, was copied to the dSPACE board via the interface. The test information set was transferred between the dSPACE and the FPGA using a serial link, and results were supervised using a DSO (digital storage oscilloscope).
As shown in Figure 15, whenever DSTATCOM was activated and started delivering the compensation current, the source current became purely sinusoidal. Before operating DSTATCOM, the non-sinusoidal current could be observed at the source side, the same as the currents drawn by the non-linear load. The change in the shape of the source current reflects the improvement of THD at the source side.  The prototyping set-up developed for testing the ANN-BP controller implementation comprised four parts: DSTATCOM; an FPGA board; a dSPACE Board; and two computers. Quartus software was used to design the controller for implementation on the FPGA board. The plant set-up, developed by MATLAB/SIMULINK, was copied to the dSPACE board via the interface. The test information set was transferred between the dSPACE and the FPGA using a serial link, and results were supervised using a DSO (digital storage oscilloscope).
As shown in Figure 15, whenever DSTATCOM was activated and started delivering the compensation current, the source current became purely sinusoidal. Before operating DSTATCOM, the non-sinusoidal current could be observed at the source side, the same as the currents drawn by the non-linear load. The change in the shape of the source current reflects the improvement of THD at the source side.
The load currents of the three phases are shown in Figure 16, which are purely nonsinusoidal, as load current is non-linear by nature. The three source currents are shown in Figure 17, and are purely sinusoidal.
The simulation results were validated using experimentation, and the values are tabulated in Tables 3 and 4 for the purpose of comparison and also shown in graph i.e., Figure 18. The DSTATCOM using the ANN-BP-based controller was implemented using a hardware set-up and the results were satisfactory. Comparison charts are displayed in The load currents of the three phases are shown in Figure 16, which are purely nonsinusoidal, as load current is non-linear by nature. The three source currents are shown in Figure 17, and are purely sinusoidal.  The load currents of the three phases are shown in Figure 16, which are purely nonsinusoidal, as load current is non-linear by nature. The three source currents are shown in Figure 17, and are purely sinusoidal.  The simulation results were validated using experimentation, and the values are tabulated in Tables 3 and 4 for the purpose of comparison and also shown in graph i.e. Figure  18. The DSTATCOM using the ANN-BP-based controller was implemented using a hardware set-up and the results were satisfactory. Comparison charts are displayed in Figures  19 and 20.     The simulation results were validated using experimentation, and the values a ulated in Tables 3 and 4 for the purpose of comparison and also shown in graph i.e. 18. The DSTATCOM using the ANN-BP-based controller was implemented using ware set-up and the results were satisfactory. Comparison charts are displayed in F 19 and 20.

Conclusions
The power derived using solar panels is more environmentally friendly and freely available by nature. Here, the system considered was a 3P3W grid-interactive solar PV system with an ANN-BP-based controller. Nonlinear loads connected at the distribution side generated power quality issues, and DSTATCOM compensated for it by injecting currents via shunt at the PCC to address the harmonic and reactive power demand of the loads. The implementation of the ANN-BP control scheme for a grid-tied solar PV system addressing the demand of balanced load has been successful. Hardware and simulated results of the ANN-BP control scheme have reflected that the proposed scheme is capable of addressing the balanced loads. The developed model is within the IEEE standard of power quality.

Conclusions
The power derived using solar panels is more environmentally friendly and freely available by nature. Here, the system considered was a 3P3W grid-interactive solar PV system with an ANN-BP-based controller. Nonlinear loads connected at the distribution side generated power quality issues, and DSTATCOM compensated for it by injecting currents via shunt at the PCC to address the harmonic and reactive power demand of the loads. The implementation of the ANN-BP control scheme for a grid-tied solar PV system addressing the demand of balanced load has been successful. Hardware and simulated results of the ANN-BP control scheme have reflected that the proposed scheme is capable of addressing the balanced loads. The developed model is within the IEEE standard of power quality.

Conclusions
The power derived using solar panels is more environmentally friendly and freely available by nature. Here, the system considered was a 3P3W grid-interactive solar PV system with an ANN-BP-based controller. Nonlinear loads connected at the distribution side generated power quality issues, and DSTATCOM compensated for it by injecting currents via shunt at the PCC to address the harmonic and reactive power demand of the loads. The implementation of the ANN-BP control scheme for a grid-tied solar PV system addressing the demand of balanced load has been successful. Hardware and simulated results of the ANN-BP control scheme have reflected that the proposed scheme is capable of addressing the balanced loads. The developed model is within the IEEE standard of power quality.

Conflicts of Interest:
The authors declare no conflict of interest.