Artificial Intelligence-Based Weighting Factor Autotuning for Model Predictive Control of Grid-Tied Packed U-Cell Inverter

The tuning of weighting factor has been considered as the most challenging task in the implementation of multi-objective model predictive control (MPC) techniques. Thus, this paper proposes an artificial intelligence (AI)-based weighting factor autotuning in the design of a finite control set MPC (FCS-MPC) applied to a grid-tied seven-level packed U-cell (PUC7) multilevel inverter (MLI). The studied topology is capable of producing a seven-level output voltage waveform and inject sinusoidal current to the grid with high power quality while using a reduced number of components. The proposed cost function optimization algorithm ensures auto-adjustment of the weighting factor to guarantee low injected grid current total harmonic distortion (THD) at different power ratings while balancing the capacitor voltage. The optimal weighting factor value is selected at each sampling time to guarantee a stable operation of the PUC inverter with high power quality. The weighting factor selection is performed using an artificial neural network (ANN) based on the measured injected grid current. Simulation and experimental results are presented to show the high performance of the proposed strategy in handling multi-objective control problems.


Introduction
Multilevel inverters (MLIs) have been widely used in interruptible power supplies, renewable energy integration, and motor drive applications due to their high power quality, reduced switching losses, higher number of levels (better voltage waveform), and possible operation in high power applications [1,2].
Various MLI topologies have been reported in the literature for different applications [1,[3][4][5][6][7][8]. Recently, the packed U-cell (PUC) inverter has been considered as one of the most interesting single DC source MLI topologies due to its high reliability (reduced number of active and passive elements), high power quality, and large multilevel voltage synthesis versatility [9][10][11]. However, the effective operation of the PUC inverter depends mainly on the appropriate selection of the switching patterns to guarantee high tracking accuracy of the state variables and minimization of the switching losses.

PUC7 Topology and Modelling
The PUC7 topology was initially proposed in [35]. Higher power quality can be achieved while employing a smaller number of active and passive components compared to other MLI topologies, which reduces the cost, volume, and the switching losses. The PUC7 topology is composed of six switches, one DC source, and one capacitor (Figure 1). If the capacitor voltage is controlled at 1/3 of the DC link voltage, seven voltage levels could be generated at the output terminals according to eight different switching states [18] (Table 1). It is worth noting that the switches S 1 , S 2 , and S 3 are operating in a complementary manner with S 1 ', S 2 ', and S 3 ' [10,35].
Energies 2020, 13, x FOR PEER REVIEW 3 of 15 switches, one DC source, and one capacitor ( Figure 1). If the capacitor voltage is controlled at 1/3 of 94 the DC link voltage, seven voltage levels could be generated at the output terminals according to 95 eight different switching states [18] (Table 1). It is worth noting that the switches S1, S2, and S3 are 96 operating in a complementary manner with S1', S2', and S3' [10,35]. 97

99
Let si ϵ{0,1} (i=1,2,3) illustrate the control actions expressed by 100 Using the Kirchhoff's laws, the mathematical model is obtained as follows: 101 , , s s s : switching states. 109 The capacitor voltage V2 and the injected grid current ig are the variables to be controlled in order 110 to guarantee a stable operation of the PUC7 inverter [18]. 111 112 Using the Kirchhoff's laws, the mathematical model is obtained as follows: where C: cell capacitors, L f : filtering inductor, V 1 : DC source voltage, V 2 : capacitor voltage, V grid : grid voltage, i g : injected grid current, and s 1 , s 2 , s 3 : switching states. The capacitor voltage V 2 and the injected grid current i g are the variables to be controlled in order to guarantee a stable operation of the PUC7 inverter [18].

FCS-MPC for PUC7 Inverter
The application of FCS-MPC for power converters has gained extensive attention in the research society [14,15,18,19,22]. Indeed, it is a powerful control technique that can handle system nonlinearities and easily operate in multivariable case [14,24]. FCS-MPC considers the discrete characteristic of the power converter in order to design a discrete-time model that can be used to predict the behavior of the power converter, which allows applying the most suitable control vector in each sampling period [17]. In this work, the dynamics of the variables shown in Equations (2) and (3) are approximated during a sampling time T s by Hence, the discrete-time model that allows the prediction of the controlled variables at the next (k + 1) step is obtained by Moreover, in order to ensure high tracking capabilities, the errors on the capacitor voltage and the injected grid current are divided by the maximum variations ∆V 2max and ∆i gmax , respectively (variable normalization) [18]. The designed cost function is computed for the eight switching states, and the pattern that minimizes the cost function it is used at the next sampling time as illustrated in Figure 2. The proposed cost function is defined as follows: where It is worth noting that the weighting factor λ has a crucial effect in the design of the FCS-MPC as it ensures proper balancing among the variable tracking. The adjustment of the weighting factor can reduce the computing time and response delay, which can lead to better results. The nonlinear behavior of the studied system makes the selection of a fixed weighting factor more challenging, especially under variable conditions and under different constraints. Thus, autotuning of the weighting factor is an important task in designing the MPC scheme, as will be discussed in the next section. especially under variable conditions and under different constraints. Thus, autotuning of the 134 weighting factor is an important task in designing the MPC scheme, as will be discussed in the next 135 section. 136 137

Autotuning of the Weighting Factor 140
ANN was used in this study for online autotuning to solve the challenge of optimal selection of 141 weighting factor in the FCS-MPC algorithm. The approach allows the best value of the weighting 142 factor to be chosen for each current rate, leading to good tracking quality system robustness to 143 parameter variation [36]. 144 The first step was to build a simulation model of the FCS-MPC for grid-connected PUC7 inverter 145 in the MATLAB/Simulink (2018b, MathWorks, Natick, Massachusetts, USA) environment and then 146 test the system under different operating conditions to check its performance. After that, a MATLAB 147 algorithm was coded to enable collection of data from various tests (different operating conditions). 148 In the current case study, the simulation was run with a set of weighting factors (from 0.001 to 0.5 at 149 a 0.001 step size), while the injected grid current was changed from 3 to 6 A. The THD of the grid 150 current ( ) and the mean absolute error voltage regulation loop ( ) were recorded in each 151 simulation scenario. 152 The next step was to use the collected data to train the ANN to be able to predict inverter 153 behavior for any current rate at different values of the weighting factor. Bayesian regularized 154 algorithm was selected to train the network due to its robustness. The algorithm is based on a 155 mathematical process that transforms a nonlinear regression into a statistical problem, which does 156 not need lengthy cross-validation. It is able to reduce the mean squared errors and build an accurate 157 model [37]. The advantage of Bayesian regularized ANN is that the models are solid, and the 158 validation process in standard regression methods, such as backpropagation steps, is unnecessary. 159 The trained neural network was able to provide the possible and ev for a given weighting factor 160 and injected grid current. This work was focused on the minimization of these two performance 161 criteria ( and ) due to their high effect on the overall system performance. 162 The authors in [29] proposed a similar solution with a focus on the minimization of the average 163 switching frequency in addition to the enhancement of the quality of injected grid current of a two-164 level inverter. However, the regulation of the DC link voltage in the standard three-phase two-level 165 inverter is much less complex compared to the PUC topology, which was the focus of this study. 166 Moreover, another algorithm was developed in this study to select the most appropriate weighting 167 factor at each sampling time using the outputs of the ANN and the function given in Equation (10). 168

Autotuning of the Weighting Factor
ANN was used in this study for online autotuning to solve the challenge of optimal selection of weighting factor in the FCS-MPC algorithm. The approach allows the best value of the weighting factor to be chosen for each current rate, leading to good tracking quality system robustness to parameter variation [36].
The first step was to build a simulation model of the FCS-MPC for grid-connected PUC7 inverter in the MATLAB/Simulink (2018b, MathWorks, Natick, Massachusetts, USA) environment and then test the system under different operating conditions to check its performance. After that, a MATLAB algorithm was coded to enable collection of data from various tests (different operating conditions). In the current case study, the simulation was run with a set of weighting factors (from 0.001 to 0.5 at a 0.001 step size), while the injected grid current was changed from 3 to 6 A. The THD of the grid current (THD ig ) and the mean absolute error voltage regulation loop (e v ) were recorded in each simulation scenario.
The next step was to use the collected data to train the ANN to be able to predict inverter behavior for any current rate at different values of the weighting factor. Bayesian regularized algorithm was selected to train the network due to its robustness. The algorithm is based on a mathematical process that transforms a nonlinear regression into a statistical problem, which does not need lengthy cross-validation. It is able to reduce the mean squared errors and build an accurate model [37]. The advantage of Bayesian regularized ANN is that the models are solid, and the validation process in standard regression methods, such as backpropagation steps, is unnecessary. The trained neural network was able to provide the possible THD ig and e v for a given weighting factor and injected grid current. This work was focused on the minimization of these two performance criteria (e v and THD ig ) due to their high effect on the overall system performance.
The authors in [29] proposed a similar solution with a focus on the minimization of the average switching frequency in addition to the enhancement of the quality of injected grid current of a two-level inverter. However, the regulation of the DC link voltage in the standard three-phase two-level inverter is much less complex compared to the PUC topology, which was the focus of this study. Moreover, another algorithm was developed in this study to select the most appropriate weighting factor at each sampling time using the outputs of the ANN and the function given in Equation (10). The proposed Energies 2020, 13, 3107 6 of 14 approach provides better accuracy and robustness because it considers the injected grid current as input during the training of ANN, which is different to that proposed in [29].
The function f a allows a proper balance between the THD ig and e v , which facilitates optimization of the control process based on the system requirements. In the studied system, the THD ig minimization was the most significant criteria to optimize in order to meet international standards (e.g., IEEE 519-1992). Therefore, when tuning the weighting factor, a high priority was given to the THD ig (90%), and less priority was given to the capacitor voltage regulation. In the last stage, the devolved neural network was implemented to predict the next inverter state while providing the required information in order to determine the optimal weighting factor. The weighting factor that would reduce the function given by Equation (10) was selected (e v and THD ig ) were within acceptable ranges). The obtained value of α, which fit the lowest value of function f a , was selected and substituted in the cost function. The different steps of the proposed autotuning weighting factor process are summarized in Figure 3. The proposed approach provides better accuracy and robustness because it considers the injected 169 grid current as input during the training of ANN, which is different to that proposed in [29]. 170 The function fa allows a proper balance between the THDig and , which facilitates optimization 171 of the control process based on the system requirements. In the studied system, the 172 minimization was the most significant criteria to optimize in order to meet international standards 173 (e.g., IEEE 519-1992). Therefore, when tuning the weighting factor, a high priority was given to the 174 (90%), and less priority was given to the capacitor voltage regulation. In the last stage, the 175 devolved neural network was implemented to predict the next inverter state while providing the 176 required information in order to determine the optimal weighting factor. The weighting factor that 177 would reduce the function given by Equation (10)

Simulation Results 185
A comprehensive simulation study was conducted using the parameters listed in Table 2. The  186 performance of the grid-tied PUC7 inverter with FCS-MPC was evaluated under different operating 187 conditions. An algorithm was established to run the system with different injected grid current with 188 peak values of 3, 4, 5, and 6 A, along with different weighting factor values (0 to 0.5 at 0.01 step size). 189 The obtained as well as the mean absolute error value between the desired voltage and 190 the measured voltage across the capacitor versus the variation of the weighting factor are shown 191 simultaneously in Figure 4. 192

Simulation Results
A comprehensive simulation study was conducted using the parameters listed in Table 2. The performance of the grid-tied PUC7 inverter with FCS-MPC was evaluated under different operating conditions. An algorithm was established to run the system with different injected grid current with peak values of 3, 4, 5, and 6 A, along with different weighting factor values (0 to 0.5 at 0.01 step size). The obtained THD ig as well as the mean absolute error e v value between the desired voltage and the measured voltage across the capacitor versus the variation of the weighting factor are shown simultaneously in Figure 4.  196 For different grid current values, it can be clearly seen from Figure 4 that the was small 197 for low values of the weighting factor and vice versa. In contrast, the absolute error of the capacitor 198 voltage showed high values for low values of weighting factor, then decreased when the 199 weighting factor was increased. The collected data were used to train the used ANN in order to 200 emulate the behavior of the whole system and to select the most appropriate weighting factor in each 201 operating condition. 202 The current study was mainly focused on the minimization of the , which is the most 203 significant power quality criteria. 204 Figure 5 presents the variation at the fixed weighting factor selected in [18] and the 205 proposed ANN-based dynamic weighting factor. It is obvious that the proposed weighting factor 206 provided better THD variation in all the presented ranges of injected grid current. It should be 207 mentioned that the peaks, which occurred during the transition periods of current change, were due 208 to the fact that the calculation of the THD was affected by the numerical process calculation; however, 209 physically, there was no such effect, as can be clearly seen during the dynamic transient of the injected 210 grid current in Figure 6. Furthermore, it can be said that there was an important improvement in the 211 quality of the injected grid current when the proposed algorithm was used. In addition, it is evident 212 that the in different current values met the international standard requirements (IEEE 519-213 1992). 214 Figure 6 shows the obtained injected grid current and its reference. The zoom taken within this 215 figure highlights the good quality of the injected current for different values of the current. It can be 216 noticed that pursuing of the reference current was ensured in a smooth manner during the dynamic 217 transients. Figure 7 shows the weighting factor evolution under different current values. Figure 8  218 shows the output voltage of the inverter along with the grid voltage.  For different grid current values, it can be clearly seen from Figure 4 that the THD ig was small for low values of the weighting factor and vice versa. In contrast, the absolute error of the capacitor voltage e v showed high values for low values of weighting factor, then decreased when the weighting factor was increased. The collected data were used to train the used ANN in order to emulate the behavior of the whole system and to select the most appropriate weighting factor in each operating condition.
The current study was mainly focused on the minimization of the THD ig , which is the most significant power quality criteria. Figure 5 presents the THD ig variation at the fixed weighting factor selected in [18] and the proposed ANN-based dynamic weighting factor. It is obvious that the proposed weighting factor provided better THD variation in all the presented ranges of injected grid current. It should be mentioned that the peaks, which occurred during the transition periods of current change, were due to the fact that the calculation of the THD was affected by the numerical process calculation; however, physically, there was no such effect, as can be clearly seen during the dynamic transient of the injected grid current in Figure 6. Furthermore, it can be said that there was an important improvement in the quality of the injected grid current when the proposed algorithm was used. In addition, it is evident that the THD ig in different current values met the international standard requirements (IEEE 519-1992). 196 For different grid current values, it can be clearly seen from Figure 4 that the was small 197 for low values of the weighting factor and vice versa. In contrast, the absolute error of the capacitor 198 voltage showed high values for low values of weighting factor, then decreased when the 199 weighting factor was increased. The collected data were used to train the used ANN in order to 200 emulate the behavior of the whole system and to select the most appropriate weighting factor in each 201 operating condition. 202 The current study was mainly focused on the minimization of the , which is the most 203 significant power quality criteria. 204 Figure 5 presents the variation at the fixed weighting factor selected in [18] and the 205 proposed ANN-based dynamic weighting factor. It is obvious that the proposed weighting factor 206 provided better THD variation in all the presented ranges of injected grid current. It should be 207 mentioned that the peaks, which occurred during the transition periods of current change, were due 208 to the fact that the calculation of the THD was affected by the numerical process calculation; however, 209 physically, there was no such effect, as can be clearly seen during the dynamic transient of the injected 210 grid current in Figure 6. Furthermore, it can be said that there was an important improvement in the 211 quality of the injected grid current when the proposed algorithm was used. In addition, it is evident 212 that the in different current values met the international standard requirements (IEEE 519-213 1992). 214 Figure 6 shows the obtained injected grid current and its reference. The zoom taken within this 215 figure highlights the good quality of the injected current for different values of the current. It can be 216 noticed that pursuing of the reference current was ensured in a smooth manner during the dynamic 217 transients. Figure 7 shows the weighting factor evolution under different current values. Figure 8  218 shows the output voltage of the inverter along with the grid voltage.  Figure 6 shows the obtained injected grid current and its reference. The zoom taken within this figure highlights the good quality of the injected current for different values of the current. It can be noticed that pursuing of the reference current was ensured in a smooth manner during the dynamic transients. Figure 7 shows the weighting factor evolution under different current values. Figure 8 shows the output voltage of the inverter along with the grid voltage.

Experimental Results 236
The experimental performance validation was performed on a grid-tied PUC7 inverter using a 237 dSPACE control platform (dS1103, dSPACE GmbH, Paderborn, Germany) ( Figure 10). The 238 experimental system parameters are listed in Table 2. The FLUKE 435 Series II power quality and 239 energy analyzer was used for the THD measurement. factor (equal to 0.2) and dynamic weighting factor, respectively. It can be seen that the weighting 245 factor was adjusted dynamically according to the current variation, i.e., 0.11, 0.13, 0.14, and 0. 16

Experimental Results
The experimental performance validation was performed on a grid-tied PUC7 inverter using a dSPACE control platform (dS1103, dSPACE GmbH, Paderborn, Germany) ( Figure 10). The experimental system parameters are listed in Table 2. The FLUKE 435 Series II power quality and energy analyzer was used for the THD measurement.

Experimental Results 236
The experimental performance validation was performed on a grid-tied PUC7 inverter using a 237 dSPACE control platform (dS1103, dSPACE GmbH, Paderborn, Germany) ( Figure 10). The 238 experimental system parameters are listed in Table 2. The FLUKE 435 Series II power quality and  239 energy analyzer was used for the THD measurement. 240 The experimental tests were conducted under the same simulation operating conditions. Figures 11  and 12 represent the experimental results showing the grid injected current at fixed weighting factor (equal to 0.2) and dynamic weighting factor, respectively. It can be seen that the weighting factor was adjusted dynamically according to the current variation, i.e., 0.11, 0.13, 0.14, and 0.16, for the peak values of 3, 4, 5, and 6 A, respectively. The voltage across the capacitor perfectly tracked the reference value of 50 V in both cases (constant and dynamic). On the other side, the injected grid current adequately tracked its sinusoidal reference. In order to identify the best tuning scenario (fixed or dynamic weighting factor), the THD of the injected grid current was measured at different current ranges using the power analyzer. The measured THDs for both weighting factor cases are presented in Figures 13 and 14. Figure 15 shows a comparison between the measured THD values at dynamic weighting factors (in red) and fixed weighting factor (in blue). From this figure, it is worth noting that the proposed dynamic tuning algorithm showed a clear superiority in minimizing the grid current THD compared to the fixed tuning technique. Figure 16 shows the grid voltage, the injected grid current, the voltage across the capacitor, and the output voltage of the studied single-phase seven-level PUC inverter. The presented results were measured under a current peak value of 6 A, and the tuned weighting factor value was obtained using the dynamic weighting factor algorithm. It can be seen that the injected grid current followed its sinusoidal reference with high power quality. The voltage across the capacitor was well controlled around the reference value of 50 V with very low ripples, and the output voltage showed the expected seven levels.
Energies 2020, 13, x FOR PEER REVIEW 10 of 15 current adequately tracked its sinusoidal reference. In order to identify the best tuning scenario (fixed 249 or dynamic weighting factor), the THD of the injected grid current was measured at different current 250 ranges using the power analyzer. The measured THDs for both weighting factor cases are presented 251 in Figures 13 and 14. Figure 15 shows a comparison between the measured THD values at dynamic 252 weighting factors (in red) and fixed weighting factor (in blue). From this figure, it is worth noting 253 that the proposed dynamic tuning algorithm showed a clear superiority in minimizing the grid 254 current THD compared to the fixed tuning technique. Figure 16 shows the grid voltage, the injected 255 grid current, the voltage across the capacitor, and the output voltage of the studied single-phase 256 seven-level PUC inverter. The presented results were measured under a current peak value of 6 A, 257 and the tuned weighting factor value was obtained using the dynamic weighting factor algorithm. It 258 can be seen that the injected grid current followed its sinusoidal reference with high power quality. 259 The voltage across the capacitor was well controlled around the reference value of 50 V with very 260 low ripples, and the output voltage showed the expected seven levels. current adequately tracked its sinusoidal reference. In order to identify the best tuning scenario (fixed 249 or dynamic weighting factor), the THD of the injected grid current was measured at different current 250 ranges using the power analyzer. The measured THDs for both weighting factor cases are presented 251 in Figures 13 and 14. Figure 15 shows a comparison between the measured THD values at dynamic 252 weighting factors (in red) and fixed weighting factor (in blue). From this figure, it is worth noting 253 that the proposed dynamic tuning algorithm showed a clear superiority in minimizing the grid 254 current THD compared to the fixed tuning technique. Figure 16 shows the grid voltage, the injected 255 grid current, the voltage across the capacitor, and the output voltage of the studied single-phase 256 seven-level PUC inverter. The presented results were measured under a current peak value of 6 A, 257 and the tuned weighting factor value was obtained using the dynamic weighting factor algorithm. It 258 can be seen that the injected grid current followed its sinusoidal reference with high power quality. 259 The voltage across the capacitor was well controlled around the reference value of 50 V with very 260 low ripples, and the output voltage showed the expected seven levels.

Conclusions
In this paper, a real-time ANN-based weighting factor autotuning algorithm is proposed for the design of FCS-MPC of a grid-connected PUC7 inverter. The proposed solution shows high capability in selecting the most appropriate weighting factor for different grid current values while balancing the capacitor voltage around the desired value with low voltage ripples. The presented simulation and experimental results have shown that the proposed algorithm leads to a higher power quality compared to the standard FCS-MPC due to its higher capability in minimizing the grid current THD at different current ratings.