{'fraction_non_alphanumeric': 0.03376010781671159, 'fraction_numerical': 0.011758760107816712, 'mean_word_length': 4.6470700152207005, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
An Artificial Neural Network-Based Model Predictive Control for Three-phase Flying Capacitor Multi-Level Inverter

Model predictive control (MPC) has been used widely in power electronics due to its simple concept, fast dynamic response, and good reference tracking. However, it suffers from parametric uncertainties, since it directly relies on the mathematical model of the system to predict the optimal switching states to be used at the next sampling time. As a result, uncertain parameters lead to an ill-designed MPC. Thus, this paper offers a model-free control strategy on the basis of artificial neural networks (ANNs), for mitigating the effects of parameter mismatching while having a little negative impact on the inverter's performance. This method includes two related stages. First, MPC is used as an expert to control the studied converter in order to provide a dataset, while, in the second stage, the obtained dataset is utilized to train the proposed ANN. The case study herein is based on a four-level three-cell flying capacitor inverter. In this study, MATLAB/Simulink is used to simulate the performance of the proposed method, taking into account various operating conditions. Afterward, the simulation results are reported in comparison with the conventional MPC scheme, demonstrating the superior performance of the proposed control strategy in terms of robustness against parameters mismatch and low total harmonic distortion (THD), especially when changes occur in the system parameters, compared to the conventional MPC. Furthermore, the experimental validation of the proposed method is provided based on the Hardware-in-the-Loop (HIL) simulation using the C2000TM-microcontroller-LaunchPadXL TMS320F28379D kit, demonstrating the applicability of the ANN-based control strategy to be implemented on a DSP controller.

substantial attention has been paid to multilevel inverters (MLIs) that introduced with certain advantages, such as: (i) reducing the total harmonic distortion, (ii) reducing common-mode voltage, and (iii) reducing the dv/dt (that is, the rate of voltage change over time in switching instant) stress that leads to a reduction in electromagnetic emissions. There are a number of wellestablished and conventional MLI topologies that have been implemented and refined over time, such as: flying capacitor (FC), cascaded H-Bridge (CHB), neutral point clamped (NPC), as well as innovative topologies that combine different topologies to improve MLIs performance [2]. As a result, different control methods have been investigated including various linear methods such as proportional-integral (PI) with pulse width modulation (PWM) or space vector modulation (SVM) [3], [4], non-linear methods with Hysteresis [5], and other nonclassical (i.e., modern) control methods such as different techniques of predictive control [5], [6]. However, controlling the MLIs with the high number of switches brings about dire problems in controlling algorithms and makes them more complex. Moreover, voltage imbalance among the MLI capacitors becomes an important concern in designing efficient control algorithms [7]- [10].
Model predictive control, among several control methods described, has appealing aspects that demonstrate its proper functioning. It provides a fast transient response, straightforward implementation, and non-linear constraints consideration [11]- [14]. Furthermore, the development of efficient microprocessors accounts for applying the MPC schemes widely in machine drive, gridconnected converters, and power supplies [15]- [18]. By explicitly utilizing the model of the system to be controlled, MPC selects, at each time step, the optimal switching state that minimizes a pre-defined cost function. However, it has a high online computational burden especially when multiple time-horizons are considered, as: (i) the cost function should be calculated for different possible switching states; (ii) the optimization yields the optimal control sequence (i.e., optimal switching states); (iii) the first optimal switching state is finally applied to the system in the next sampling time. Sequentially, it can be quite difficult to employ the MPC to control MLIs with numerous levels [19]- [22]. In addition, as previously mentioned, MPC directly uses the mathematical model of the system, and thus the prediction accuracy is sensitive to the change in system parameters. As a result, it is susceptible to perform incorrectly as a result of parameter variations that may occur in the real system due to degradation and temperature effects [23].
To be more specific, some non-modeled variables, such as temperature and magnetic saturation, have impacts on the real system's parameters that are so-called modeling errors or errors in measurements; these effects can deteriorate the control performance. Therefore, various control techniques have been proposed for tackling and analyzing the effects of parametric uncertainties [24], [25]. On the other hand, since MPC possesses a nonlinear structure, these studies were carried out empirically by studying the behavior of MPC under different uncertainty conditions [25], the obtained results led to adjust the model parameters such as inductance to mitigate the effects of the parameter mismatch. Moreover, the negative effects of mismatches in load resistance were ignored [23], [26]. For instance, authors in [26] examined the impact of electrical parameters' variation in sixphase induction motor drive. It has been shown that the parameter of inductance can affect the performance of MPC, especially the stator and rotor leakage. While, in [23], the predictive control-based direct power control with an adaptive parameter identification technique is proposed to cope with the parameter uncertainty problem. In this method, the input resistance and inductance of the converter are estimated using the input current and voltage at each sampling time, without having extra sensors. Thus, the converter parameters are updated online to curb the effects of parameter uncertainty.
Furthermore, the use of data-based control approaches, such as ANN-based control methods, has increased in recent research, particularly in power electronics and motor drives [27], [28]. Just to name a few, in [29], an ANN-based MPC control strategy was introduced to improve the performance of a three-phase inverter with an output LC filter, with comparison to the conventional MPC scheme. While, in [22], a general ANN-MPC scheme is presented to tackle the computational challenge in adopting MPC in highly complex power converters. In [30], the authors proposed a data-based technique for calculating the voltages of capacitors in order to eliminate the need for system sensors. While, an ANNbased method is used in [31] to regulate the weighting factors in the cost function of MPC, which represents one of the research challenges in Model Predictive Control. Moreover, data-based control schemes are used in motor drives for estimating rotor speed, rotor flux, and torque in induction motors [32]- [34]. In [35], the authors applied ANN to calculate the dwell-time of the 3-phase 2L-VSI, which can improve the THD at a fixed-switching frequency operation.
This paper proposes an artificial neural network-based (ANN-based) control strategy for a three-phase fourlevel flying capacitor inverter. MPC has been used as a baseline control scheme for (i) collecting the data required for training process, considering different operating conditions, and (ii) assessing our proposed control strategy. The main contributions of the proposed ANNbased control strategy can be summarized as follows: 1) It is an End-to-End (E2E) control scheme that generates directly the optimal switching states of the inverter, without the need for either the mathematical model of the inverter or a pre-defined cost function to be minimized at each time step. 2) It reduces the effects of the parameter mismatch problems as it offers a model-free control strategy based on ANNs.
3) The proposed technique exhibits low THD in the output current compared to the conventional MPC. 4) The HIL simulation is utilized to better assess the performance of the ANN-based control method comapared with conventional MPC. 5) Moreover, the impact of the input features selection on the performance of the proposed control strategy is studied and evaluated. Note that points 4) and 5) have not been addressed in the originally proposed method in [29]. 6) Finally, we provide an open repository of the dataset and simulation files to the community for further research activities 1 .
This paper is organized as follows. In Section II, the flying capacitor multilevel inverter (FCMLI) and its mathematical model are briefly described, whereas the model predictive control strategy is explained in Section III. The ANN-based MPC control strategy proposed in this work for the FCMLI is presented in Section IV. Simulation results for both control strategies are given in Section V. In Section VI, the HIL simulation is utilized to show the efficiency of the proposed ANN-based control strategy in comparison with the MPC scheme. Finally, conclusions are given in Section VII. Fig. 1. Topology of a three-phase four-level flying capacitor inverter that is directly connected to an RL-load.

II. FLYING CAPACITOR MULTILEVEL INVERTER
Flying capacitor multilevel inverter (FCMLI) comprises series of connected cells which have a flying capacitor and two switches with antiparallel diodes. These switches are working in a complementary manner to avoid the short-circuit between the flying capacitor terminals. An N -cell FCMLI has 2N switches in each leg, and it produces (N + 1) voltage levels from −V dc 2 to V dc 2 , where V dc denotes the input voltage source. The voltage of capacitors should be controlled in such a way that each cell experiences the same voltage stress. Thus, the average voltage of each capacitor should be kept fixed at multiples of V dc N . The nearest capacitor to the load has V dc N , whilst the capacitor that is connected to the voltage source has V dc . Therefore, each blocking switch will sustain a voltage equal to V dc N , where N is the number of cells. Fig. 1 shows a three-phase fourlevel flying capacitor (FC) inverter with three cells. The capacitor voltage ratio should be set as V 1x : V 2x : V 3x = 1 : 2 : 3 with x ∈ {a, b, c} for generating the fourlevel voltage waveform. In fact, by selecting the best switching state, some capacitors will charge and some will discharge during each sampling time to achieve the desired voltage ratio. Each capacitor's voltage can be estimated using the inverter current i x and switching states in the corresponding leg, as given in (1) and (2). As it can be seen in Fig. 1, the third capacitor C 3x is in parallel with the input voltage source V dc ; thus, V 3x is equal to V dc . In addition, for a resistive-inductive load (i.e., RL-load), the three-phase output voltage can be written as in (3), where R and L are the load resistance and inductance, respectively. Table I displays the eight possible switching states of a single-phase FCMLI and the corresponding output voltage [15], [36].

III. MODEL PREDICTIVE CONTROL FOR FCMLI
Model predictive control (MPC) is one of the wellestablished and promising model-based control methods that is successfully used in power electronics. The key idea behind MPC is the use of the system model for predicting the future behavior of the variables to be controlled, considering a certain time horizon. To do so, it needs, in our case, the discrete model of the converter. The optimal control signal, i.e., switching states as described in Table I, that minimizes the cost function is then determined. The entire MPC procedure for FCMLI is shown in Fig. 2, which can be described step-by-step as follows: 1) At sampling instant k, the controlled variables (namely, V k 1x , V k 2x , i k x ) should be measured. 2) Those controlled variables are then predicted at instant k + 1 based on the discrete model of the converter given in (4) and (5), where M 1 = Ts L , x are the flying capacitor voltages and output current at instant k + 1.
where V ON is the common mode voltage. 3) After defining a proper cost function J i , as in (6), it should be calculated for the current switching states S i based on the desired value of each controlled variable, namely, As the main objective of the optimization problem is to find the optimum switching state (S opt ) that minimizes the cost function, the cost function of the current switching state J i is compared with the smallest previous value e. 5) Steps 2) to 4) are repeated for all possible switching states given in Table I. 6) Finally, the optimum switching state (S opt ) is applied at the next sampling instant. In Fig. 2, N refers to the total number of the possible switching states in each phase, which is equal to 8 in this study.
One of the most critical stages of MPC, as previously stated, is determining the optimal switching state (S opt ) that minimizes a given cost function. Different forms of cost functions have been established, in this regard, which are used according to the requirements from the MPC design. In this work, the cost function is expressed as (6), where i * x and i k+1 x are the reference and estimated values of the output current at k + 1, respectively.
and V * 1x , V * 2x refer to the first and second capacitor voltages and their desired values at Calculate cost function at k + 1 k + 1, respectively. λ 1 and λ 2 are weighting factors of the cost function that determines the importance of the related term in the cost function. For instance, a higher weighting factor indicates the importance of the variable in determining the optimal switching state, thus it shows the priority of that variable in determining the optimal switching state. As previously described, the cost function must be evaluated for all switching states at each sampling time, which can be difficult in systems with many possible switching states such as multilevel inverters; thereby, it needs a strong microprocessor to deal with this high computational burden. In fact, the major drawback of MPC is its optimization procedure that should be solved online, which imposes a large amount of real-time calculation. This is an important motivation for proposing an End-to-End (E2E) control strategy, such as ANN-Based control strategy, that generates directly the optimal switching states of the inverter, without the need for either: (i) the mathematical model of the inverter and (ii) a pre-defined cost function to be minimized [29].

IV. PROPOSED ANN-BASED CONTROL STRATEGY
This section provides a brief overview of the artificial neural network (ANN) followed by a detailed explana-tion of the proposed ANN-based control strategy for controlling the FCMLI. Moreover, it studies the influence of considering different input features on the performance of the ANN-based control scheme.

A. Overview of ANN
Artificial neural network (ANN) is a subset of machine learning that can be directly defined as a mathematical relationship between input features and targets; in other words, it is a mathematical model that uses learning algorithms to make intelligent decisions based on historical data. It consists of a set of nodes, so-called neurons, that form layers that are connected and executed in parallel. Fig. 3 shows the typical architecture of a multi-

Input Layer
Hidden Layer Output Layer In the hidden layer, the bias b 1j is added to the sum of the weighted values and an activation function is applied to it in each neuron; then, the results are multiplied by another weighting factors w jm before being passed to the output layer. Those correction factors (i.e., biases) allow us to shift the activation functions, which improves the model's fit to the given dataset. The mathematical formulation of the n th output can be described as: where h is the activation function, H j are the outputs of the hidden layer, and b 2n refer to the biases of the output layer. Activation functions h (such as sigmoid, hyperbolic tangent, softmax, and linear) are the key part of the neural network design that are used to learn complicated patterns and assess how well the network model learns the training dataset [37]. Moreover, there exist different learning methods; in this study, the feed-forward method is used. Unlike recurrent neural networks, connections between different nodes in various layers do not produce a cycle in the feed-forward learning approach.

B. ANN-Based Control Strategy
The ANN-based control scheme proposed, in this work, undergoes two main phases, namely, training and testing phases. As mentioned above, the ANN should be first trained offline. To do so, MPC has been used as a baseline control scheme for assessing our proposed control strategy and, in the meanwhile, for collecting data required for training, validation, and testing the proposed neural network. The acquired MPC dataset is used to train the ANN to anticipate the optimal switching state S opt at the instant k + 1. Afterwards, once the proposed neural network is fine-tuned, it can be successfully used online for controlling the FCMLI, instead of relying on the predictive control strategies. Fig. 4. Block diagram of the ANN-based control strategy, considering In this study, the input features of our proposed ANN-based control scheme consist of a set of measured variables of the inverter that will be discussed in Section IV-C, while the output includes the optimal switching states S opt that should be applied to the inverter at next sampling instant k + 1, as illustrated in Fig. 4. More precisely, the output includes a vector of eight elements that identifies the eight voltage vectors (V i ∀i ∈ {0, . . . , 7}) (see Table I). Each sampling instant, the index of the optimum voltage vector will be only active with a value of one, whereas others will be equal to zero.

C. Input Features Selection and Training Process
Basically, selecting the best set of input features is a significant part of designing the ANN-based control strategy. Based on the type of inverters and the main purpose of the study, different features can become efficient in both the training phase and testing phase that assess the capability of learning the mathematical model of the system to be controlled and its dynamics. For the FCMLI, the input features are considered to be a combination of measured variables such as capacitor's voltage, output current and voltage, switching states, and current errors. We have empirically observed that in order to seek the best mapping from the raw input data to the desired outputs, different combinations of input features should be first considered and then assessed. Furthermore, it is observed that adding the optimal switching state S opt at instant k to the input features improves the performance of the learning-based control strategy.
To be more specific, five different sets of input features, named: X 1 , X 2 , X 3 , X 4 , and X 5 , are chosen and then assessed, as illustrated in Table II. It can be seen, for instance, that X 1 is composed of 9 measurable variables, namely: , S opt is the optimal switching state at time instant k, and V ph refers to the four-level output voltage. To evaluate each input set X i ∀i ∈ {1, 2, ..., 5}, a set of training samples (i.e., S 1 , S 2 , . . . , S 16 ) that represent different operating conditions are considered. Each sample has different system parameters such as input voltage V dc , sampling time T s , RL impedance, and reference output current i ref (see Table II). Afterward, these samples that have been acquired by MPC provide a new dataset, which is then used to train the ANN for each X i . In the following, the inverter is directly controlled using trained ANN with each of the X i and the THD of the output current i x is computed. This procedure repeats for each X i and the results of different operating conditions (i.e., for sample S i ∀i ∈ {1, 2, ..., 16}) are reported in Table II. In fact, the THD of the output current i x is used as a decision parameter to find the best set of input features X i to be used in the next sections. We can observe from the preliminary results given in Table II that the performance of the proposed control strategy on the basis of X 5 , in which the lowest set of features is used, is the worst as the THD is quite higher. Furthermore, it can be observed that the four-level output voltage V ph that has been added to X 1 , does not have much improvement. For that reason, X 2 is selected as input features for the proposed control scheme given in Fig. 4, due to its significant improvement compared to other considered sets. X 2 is composed of 8 measurable variables, namely: Once the effective set of features is selected, MPC is again utilized for providing the required dataset for training the proposed control scheme given in Fig. 4. Similar to Table II, various training samples (namely,  Table II  THD OF THE OUTPUT CURRENT ix FOR DIFFERENT SETS OF INPUT FEATURES, WHERE THE LOWEST THD IS HIGHLIGHTED IN BLUE.   Sample No.  S1  S2  S3  S4  S5  S6  S7  S8 S9 S10 S11 S12 S13 S14 S15 S16 S 1 , S 2 , . . . , S 11 ) have been acquired by MPC, each comprising different system parameters that were previously defined in Table II (   In this work, the total dataset is randomly divided into three sets: training set, validation set, and testing set with 70%, 15%, and 15% of the total dataset, respectively. The optimum number of hidden layers is determined by varying the number of hidden layers and observing the testing accuracy. In addition, the trainscg function is used as a training function. After the training process, the trained ANN can be used to control the fourlevel three-phase flying capacitor inverter. The training confusion matrix that assesses the performance of the training is shown in Fig. 5, where the lowest validation error is 0.1016 taken from epoch 701 and the overall accuracy is 89.80% with the total instances numbers of 509, 788. The training results are summarized in Table IV, demonstrating that the training dataset based on X 2 is properly selected, resulting in an efficient control system.

V. SIMULATION RESULTS AND DISCUSSION
In this section, the ANN-based control strategy is simulated using MATLAB/Simulink software and its performance is compared to that of the conventional MPC. The parameters of the FCMLI given in Fig. 1 are listed in Table V. The dynamic behavior of the ANN-based and MPC    is observed that both methods have similar and good performance under dynamic conditions, since both control strategies track the reference current properly. The behavior of our proposed ANN-based control strategy under steady-state condition is depicted in Fig. 8, while the behavior of the classical MPC is shown in Fig. 9. It can be seen in the figures that the two control strategies generate a high-quality sinusoidal output current i x with low distortion. However, the THD of the output current in the case of an ANN-based control scheme is slightly lower than that in the case of MPC, namely, 1.34% compared to 1.28% in case of ANN-based method. For more information, the frequency spectrum of the two control methods are shown in Figs. 10 and 11. In addition, the voltages of the capacitors (i.e., V 1x , V 2x ) obtained by the two proposed control strategies are depicted in Figs. 12 and 13, respectively. As can be observed, our proposed control scheme has a proper performance to keep the voltage at its desired value, as well as the MPC scheme.  S1 S2 S4 S5 S6 S7 S9 S11 S13 S14 S15 S16  be seen that the proposed ANN-based control scheme has better performance in such a situation. This can be clearly seen in the THD of the output current for the ANN-based control scheme that has a 2.78% compared to 3.05% in the case of MPC after changing the inductance value, which demonstrates that the proposed control scheme is more robust to the parameter uncertainty than the classical MPC.
To better assess and show the superiority of the proposed control strategy in learning the mathematical model of the inverter and its dynamics, a comparison of the THD of the output current obtained by the two control strategies is represented in Fig. 16, considering the different operating conditions listed in Table II. The obtained results demonstrate that the proposed ANNbased control scheme on the basis of the selected input feature (namely, X 2 ) has good performance compared to the conventional MPC, without requiring a large amount of training data.

Target LAUNCHXL-F28379D
Host-PC (TMS320 F28379D)  Figure 17. Schematic diagram of the HIL simulation for the proposed system, with the main components and signals flow [38].

VI. HIL VALIDATION AND RESULTS
In this section, a rapid prototyping technique was utilized to implement the proposed ANN-based control strategy that previously described in Section IV. More precisely, a Hardware-in-the-Loop (HIL) simulator was used to verify and validate our proposed control scheme for controlling a three-phase four-level flying capacitor inverter. Figure 17 illustrates the basic components and signal flows of the HIL simulation for the proposed system. For a typical HIL simulation, the control strategies (namely, MPC and ANN-based) are implemented in an external target micro-controller kit (in our study, C2000TM-microcontroller-LaunchPadXL TMS320F28379D kit), while the three-phase four-level flying capacitor inverter and its different loads are simulated and hosted on the personal computer (i.e., Host-PC) as a model in the MATLAB. The HIL simulation requires cooperation between the Host-PC and the Target LAUNCHXL-F28379D, which is achieved using a virtual serial COM port [39]. To be more specific, the Host-PC transmits the measured signals (or, input features) such as V 1x , V 2x , i ref , i x , ∆V 1x , ∆V 2x , ∆i x to the LAUNCHXL-F28379D kit. Afterwards, once the target kit receives these signals, the proposed control strategy selects the optimal switching state S opt to be applied in the next sampling instant. Finally, the Host-PC receives S opt to feed the inverter switches. This procedure will be repeated every sampling time T s . More details about the HIL design procedures, including the simulation setup, Code Composer Studio (CCS), installation, building the target model, and running the Host program, can be found in [40].  After setting up the hardware and the Host-PC as described in [40], the HIL simulation is used to assess the performance of the proposed control schemes in controlling the output current i x , phase voltage V ph and voltage of the capacitors V 1x and V 2x . Figures 18 and  19 show the voltages of the capacitors for each control method. It can be seen that both ANN-based and MPC have the same and qualified performance to keep the voltage at the desired values, as previously depicted in the simulation section (see Figs. 12 and 13). In Figs. 20 and 21, we validate the performance of the two control strategies to deal with the parameter uncertainty problem, which is clearly described and tested in the previous section (see Figs  Figs. 20 and 21 that after changing the inductance from L = 10 mH to L = 5 mH at t = 0.1 s, the ANN-based control strategy has better performance in comparison with the classical MPC scheme. This comparison is carried out based on the THD of the output current which is 2.82% for the proposed control method, after changing the inductance value, compared to 3.05% when the MPC is employed. These results demonstrate the applicability and good performance of our proposed control strategy under realistic conditions. To demostatre the efffectiveness of the proposed ANN-based control strategy, the THD value of the output current is measured in both simulation and HIL environmnet as shown in Fig. 22.
The THD value is clearly increased as the load power factor decreases due to the reduction of load inductance. The differences between the results of simulation and HIL are negligible, which confirms the proposed ANNbased control strategy to be effective in terms of practical applications.

VII. CONCLUSIONS
In this paper, we have proposed an ANN-based control strategy for controlling a three-phase four-level flying capacitor inverter with the aim of generating a highquality sinusoidal output current and improving the robustness against parametric mismatches, especially when compared to conventional MPC scheme. The proposed control scheme employs the classical MPC to generate a reliable dataset of inverter variables to be used as input features by the proposed a feed-forward ANN. Afterwards, once the off-line training is performed based on the obtained data from MPC, it can be used to directly control the inverter without the requirement for a mathematical model of the system. Simulation results reveal that ANN-based control strategy performs better with respect to the THD under most conditions. Additionally, an experiment is carried out for assessing its robustness against parameter uncertainty. Moreover, to better assess the performance of the proposed ANNbased control method compared to the traditional MPC, HIL simulation is utilized to demonstrate its applicability to be run on a DSP kit and prove its efficiency under parameter mismatch problems. According to the results, the proposed control scheme showed better performance than the conventional MPC under parameter mismatch conditions, owing to the fact that, unlike MPC, the proposed technique does not dependent on the system model.