Long-Horizon Nonlinear Model Predictive Control of Modular Multilevel Converters

Modular Multilevel Converters (MMCs) are a topology that can scale several voltage levels to obtain higher efficiency and lower harmonics than most voltage-source converters. MMCs are very attractive for renewable energy applications and fast charging stations for electric vehicles, where they can improve performance and reduce costs. However, due to the complex architecture and the large number of submodules, the current control of modular multilevel converters is a challenging task. The standard solution in practice relies on hierarchical decoupling and single-input-single-output control loops, which are limited in performance. Linearization-based model predictive control was already proposed for current control in MMCs, as it can optimize transient response and better handle constraints. In this paper, we show that the validity of linear MMC models significantly limits the prediction horizon length, and we propose a nonlinear MPC (NMPC) solution for current control in MMCs to solve this issue. With NMPC, we can employ long prediction horizons up to 100 compared to a horizon of 10, which is the limit for the prediction range of a linear MMC model. Additionally, we propose an alternative MMC prediction model and corresponding cost function, which enables directly controlling the circulating current and improves the capacitor voltages’ behavior. Using the state-of-the-art in sequential quadratic programming for NMPC, we show that the developed NMPC algorithm can meet the real-time constraints of MMCs. A performance comparison with a time-varying linearization-based MPC for an MMC topology used in ultra-fast charging stations for electric vehicles illustrates the benefits of the developed approach.


Introduction
The Modular Multilevel Converters (MMCs) topology was presented in [1]. This type of power electronics hardware has as its main feature a series connection of module capacitors called submodules (see Figure 1). Employing these submodules allows scaling a higher number of output voltage levels. Performance-wise, this characteristic permits obtaining a low-current total harmonic distortion (THD) regardless of the switching frequencies [2]. Other advantages of MMCs include transformerless operational capability and increased fault-tolerance [3]. Compared to other existing voltage-source converters (VSCs), MMCs are considered more efficient and reliable solutions for high-and medium-power applications; see e.g., [4,5]. These applications include ultra-fast charging stations (UFCSs) of electric vehicles (EVs); see e.g., [6,7]. In this novel application, the MMC should ensure bidirectional power transfer between the grid and the DC bus with lower losses and perturbation to the grid.
MMCs have a modular design in which their submodules are interconnected physically. These submodules have nonlinear and discontinuous dynamics due to switching, and the proper functioning of the MMCs depends on the coordinated actions of these submodules. Hence, MMCs are multiple-inputs-multiple-outputs (MIMO) complex systems [8].
Regardless of the application, the control objectives of the MMCs are (i) tracking of a timevarying reference for the output currents, (ii) maintaining the average capacitor voltages around a nominal value, (iii) suppressing the circulating current and (iv) balancing the capacitor voltages. However, these control objectives cannot be achieved simultaneously, which further adds to the challenge of controller design for MMCs. Hierarchical PI (proportional-integral) single-input-single-output control schemes are well-established control solutions for these systems, see e.g., [9,10], but they are quite limited in performance. Model predictive control (MPC) has achieved promising results improving the transient response of MMCs, see e.g., [2,[11][12][13], as it allows finding a Pareto optimal solution to the multiple control objectives relevant for MMCs and handles constraints. In general, the MPC solutions for MMCs are of two types: finite-control-set MPC [11][12][13][14], which directly controls the discrete valued switching signals, and standard, continuouscontrol-set MPC [2,[15][16][17], which computes continuous insertion indexes and then utilizes modulation techniques to control the switches. While finite-control-set MPC holds a promise for the future, currently, its implementation is limited by the combinatorial increase in complexity with the increase of the prediction horizon and the number of submodules. In general, a long prediction horizon is desired when tracking time-varying references and for optimizing the efficiency of power electronics circuits, see, e.g., [18,19]. Hence, in this paper, we focus on continuous-control-set MPC (CCS-MPC), which in general exhibits a tractable complexity increase with the increase of the prediction horizon.
In [2], a successive linearization-based MPC solution for current control in MMCs with prediction horizon N p = 6 (this was extended to N p = 10 in [18]) showed improvement over alternative solutions such as finite-control-set MPC and hierarchical PI schemes. Therein, a cost for regulating the capacitor voltages behavior was also proposed. In [15,16], the bilinear relationship between the arm current and the capacitor voltage that describes the arm voltage dynamics is disregarded. Consequently, a linear model is obtained by defining the arm voltage as the control input of the system. However, the validity of such a linear model is limited to short prediction horizons (N p = 1 was used in these papers) since the dependency between the control input and the state is not considered. In [17], the authors built a model of the MMC in the dq-framework. This approach also yields a linear model of the system and shows good performance with a prediction horizon N p = 4.
However, extending this solution to MMC systems working under unbalanced conditions is challenging.
All of the above CSS-MPC solutions based on linear or time-varying linear models obtained via online linearization can be implemented as a single quadratic programming (QP) problem, which can be solved efficiently. In principle, QP solvers for MPC allow using a much longer prediction horizon compared to finite-control-set MPC. However, as shown in this paper, the validity of linear MMC models is limiting the prediction horizon length for which accurate predictions can be obtained, because the current dynamics of MMCs are essentially bilinear dynamics with a strong nonlinear behavior. It is also worth mentioning that recently, a differential-flatness nonlinear control solution for MMCs was developed in [20] and a neural networks based nonlinear MPC controller with a short prediction horizon (N p = 3) for MMCs was proposed in [21].
Motivated by the above analysis and the advances in sequential quadratic programming (SQP) solvers for nonlinear MPC (NMPC) [22,23], in this paper, we develop a continuous-control-set long-horizon NMPC algorithm for current control in MMCs. The NMPC controller optimizes a cost function that penalizes the above-mentioned (i)-(iii) objectives subject to constraints. We derive a nonlinear MMC prediction model using a per-phase approach, which allows accurate predictions over a long, 200-steps horizon, compared to a 10-steps horizon corresponding to a linearized MMC model. Additionally, we construct the MMC prediction model differently than done in the previous linear MPC solutions, e.g., [2], to enable direct control of the circulating current and to improve the capacitor voltages behavior. The developed NMPC algorithm computes a voltage reference for a carrier-based PWM (CB-PWM) modulator, and the capacitor voltage balancing is performed separately using the method proposed in [9]. To compare the developed NMPC solution with an online linearization-based MPC solution, we consider a specific MMC topology designed for ultra-fast charging stations of electric vehicles, as in [7]. The obtained results show a reduction of 29% of the power losses and 98% efficiency when a long-horizon NMPC controller is used. Moreover, we present the computational time of running the NMPC using the ACADO toolkit interface with MATLAB. Based on those results and the capacity of field-programmable gate array (FPGA) to outperform microprocessor implementations in terms of computational speed [24], the developed NMPC algorithm can be implemented in real time for much longer prediction horizons (i.e., N p = 25 up to N p = 100 compared to previous MPC solutions for MMCs surveyed above that use N p = 1 up to N p = 10).
The remainder of the paper is structured as follows. Section 2 describes the MMC topology along with the derivation of linear and nonlinear prediction models. After that, the MMC control problem is formulated in Section 3. The design and implementation of the NMPC algorithm for MMCs is presented in Section 4. Realistic simulation results and comparison with linearization-based MPC for MMCs are presented in Section 5. Conclusions are summarized in Section 7.
Notation: Let R, R + , Z, and Z + denote the field of real numbers, the set of non-negative reals, the set of integer numbers, and the set of non-negative integers, respectively. The quadratic norm of a vector x ∈ R n weighted by a positive-definite matrix Q = Q ∈ R n×n is denoted by |x| 2 Q := x Qx. The identity matrix is denoted by I n ∈ R nxn . For a set S ⊆ R n , define S [a,b] := {s ∈ S : a ≤ s ≤ b} and S N := S × . . . × S.

Modular Multilevel Converter Topology and Modeling
This section presents a general description of an MMC topology meant for usage in a ultra-fast charging station (UFCS) for electric vehicles instead of a traditional transformer solution [25,26]. A description of the MMC topology is given, and the differential equations describing the behavior of the internal variables of the MMC are derived.

MMC Topology for Utra-Fast Charging Stations
The studied MMC is configured using the topology presented in [7]; see Figure 1. The MMC is generally comprising of three-phase legs m ∈ {a, b, c}, each with two arms r ∈ {u, l}. The arms are composed of N submodules (SM) connected in series, an arm inductor (L m ), and an arm resistance (R m ) that models conduction and device losses of the arm.
The topology of the submodules is a full-bridge (FB), i.e., they are composed of a polarized capacitor (C r,m N = C) and four IGBTs. The IGBTs are driven by gating signals that determine the switching signals (S r,m ) and the corresponding terminal voltage of the submodule (v SM ), as described in Table 1. Since the N submodules are series-connected, the arm voltage (v r m ) can be represented as a voltage source depending on the submodules switching positions.
The inductor L DC and the resistor R DC are connected to a DC voltage source v DC and model the parasitic inductance and resistance, respectively. Those three components represent the DC-bus found in most charging stations. Additionally, this MMC is connected to a three phases grid represented by voltage sources v g {a,b,c} , grid resistor R g and grid inductor L g . Figure 1 shows the MMC as the linking element between the grid and DC bus of the UFCS. Hence, it should ensure a proper bidirectional power transfer while keeping the current THD (total harmonic distortion) inserted into the grid as low as possible. The latter can be achieved since FB submodules allow operation in an extended region wherê v g m ≥ v DC . These characteristics enable grid-to-vehicle (G2V) and vehicle-to-grid (V2G) power transfer. Moreover, this new topology is more efficient than a cascaded H-bridge topology previously proposed in the literature for UFCS applications [7].

MMC Modeling for Predictive Control
Using a per-phase modeling philosophy, as in [14], each phase leg m of the MMC is modeled separately. In this case, the dynamics of the current components are assumed to be identical for each phase. In addition, the grid is considered to be operating under balanced conditions.
Modeling a single leg m of the MMC, the upper arm current (i u m ), the lower arm current (i l m ), and the capacitor voltages (v r,m C i ) are taken as the state variables. Hence, the state vector x(t) is defined as where t ∈ R + . Similar to (1), the control inputs vector u(t) is composed of the corresponding switching signal (S r,m i ) of each ith submodule. Hence, the control inputs vector is defined as As shown above, the overall state-space model of an MMC has a high dimension [8], which is computationally challenging for control. Hence, a common approach is to derive a simplified model with a reduced dimension, see e.g., [2,15,27]. The above-mentioned examples assume having a PWM stage and that the arm capacitor voltages are balanced, i.e., and Under these conditions, we define a new state vector x s (t) as with where v Σ u,m and v Σ l,m are the average capacitor voltage of the upper and lower arm, respectively. Similarly, a new control input vector u s (t) is defined as with where d u m and d l m are the real-valued insertion indexes of the upper and lower arm. The influence of the grid voltages (v g m ), the DC-bus voltage (v DC ), and the DC-bus current (i DC ) are modeled via an exogenous input vector w s (t), i.e., The MMC outputs are the output current (i m ) and the common-mode current (i Σ m ), i.e., This yields the output vector The output choice as in (11) implies that the system outputs directly determine the power flow and efficiency of the MMC (as described in Section 3.2). Employing standard electrical circuit analysis, the state-space representation of the MMC is obtained as: where and It is important to observe that (12) is a bilinear model (which is a complex type of nonlinearity) due to the multiplication of inputs present in the A c matrix with states. Yet, the dimension of the state and control input vectors are lower than that presented in (1) and (2), respectively, and the control inputs are continuous real numbers instead of integers. The bilinear model (12) is commonly linearized since the most used MMC control solutions are based on control techniques for linear systems. For example, in [2], to implement a linear MPC, first-order Taylor series expansion is used to compute successive linearizations online. Following this approach, model (12) can be linearized at any time instant t 0 asẋ with the state matrix A cl defined as the input matrix B cl defined as and the control input vector is reformulated as Typically, t 0 is chosen as a multiple of the sampling period T s , when a new state measurement is available; see, e.g., [2,18] for more details. Next, we discretize both the nonlinear model (12) and the linearized model (20) using the Euler forward method with a sampling period T s = 0.2ms, which yields the corresponding discrete-time models: and A comparison of the prediction accuracy of the two models above is done using the MMC benchmark (i.e., parameters values) from [7]. The simulation of (20) and (19) versus the MMC benchmark was implemented using Matlab/Simulink and PLECs. Figure 2 shows the state variables response over 200 steps in simulation, when sinusoidal control inputs are applied to the MMC. In this case, it can be clearly seen that the error of the linear model increases rapidly when the number of steps increases, especially after 10 steps.  Table 2 presents the quantitative results of the model validation using the Mean Absolute Error (MAE). It is observed that the linear model is suitable when short prediction horizons are used and not usable for longer time periods. However, the nonlinear model preserves prediction accuracy quite well over longer time periods, which opens the door to using long prediction horizons. This is quite beneficial for closed-loop performance, as it will be shown in this paper. Remark 1. It is worth clarifying the differences in the adopted reduced-order nonlinear model (12) (for one phase) with respect to the MMC three-phase model in [2] (see Equations (5)-(8) therein). The model (12) of this paper has the arm currents and the capacitors voltages as states, while it has the output current and the circulating current as outputs that can be controlled. In addition, the DC voltage, the DC current, and the grid voltages are modeled as exogeneous inputs. In contrast, the model of [2] has the arms currents, capacitors voltages, DC voltage, DC current, and grid voltages as states, while it has the transformed αβ currents and the capacitor voltages as outputs. Both models have the insertion indexes as control inputs.

MMC Control Problem Formulation
In this section, the control problem for the considered MMC topology used in UFCS is described in detail. The standard control scheme and control objectives of MMC in general are also briefly explained.

Standard Control Scheme for MMCs
In control of MMCs, a standard three-layer hierarchical control scheme is used; see Figure 3 [9]. In the top layer, a current controller uses the information from model (38) to control the output current, the average capacitor voltage, and the circulating current. As it is seen in Figure 3, the "Controller phase a" block receives the references for the output current, circulating current, and capacitor voltages from a Reference Generator block. The control signals computed by the current controller (a long-horizon NMPC controller in this paper) are real-valued insertion indexes (d r m ), which are set as the voltage references for the CB-PWM in the middle layer. In the middle layer, the CB-PWM translates the insertion index (d r m ) into integer variables N r m that indicate how many submodules need to be switched ON or OFF. For this paper, multilevel CB-PWM as in [28] is used. The basic principle for this approach is to order the charging and discharging of the submodules capacitors based on the arm current direction and the instantaneous value of the capacitor voltage. For the positive direction of the arm current, capacitors with the lowest voltage are inserted in the arm for maintaining all the voltage from the capacitors submodules around the same value. The opposite is done if the arm current direction is negative. The interested reader is referred to [9] for more details.

Control Objectives
The main task of the MMC is to control the power transfer between the grid and the DC bus. For this system, the instantaneous power in the grid side is described as where P AC and Q AC are the active and reactive power on the grid side. The active power in the DC-bus (P DC ) is defined as To guarantee a proper and safe functioning of each of the phase m ∈ {a, b, c} of the MMC, four variables are controlled: the output current (i m ), the circulating current (i z m ), the upper average capacitor voltage v Σ u,m , and the lower average capacitor voltage v Σ l,m [9,10].
Equations (21) and (22) show how the grid voltage and the output current determine the power extracted from the grid. Therefore, for assuring the desired power transfer, a tracking problem is formulated, such that where y 1 (t) = i m (t) and the reference for the output current y r 1 (t) := i r m (t) for each phase m ∈ {a, b, c} can be calculated with (21) and (22). However, as this is an undetermined system of equations, using the amplitude-invariant Clarke transformation, a determined system of equations is used instead, i.e., where v α and v β are the transformation of v g m in the αβ coordinates, and P * AC and Q * AC are the desired active and reactive power on the grid side. Hence, the output current reference is obtained applying the inverse of the amplitude-invariant Clarke transformation, such that Using (25) also guarantees low THD if the reference is tracked accurately. Additionally, the output current is limited to reduce THD and grid interference as follows: where i max and i min are the upper and lower limit of the output current.
wherev g m is the peak of the grid phase voltage. This ensures reliability and reduces the capacitance needed for designing an MMC suitable for the application. Therefore, the control objective for the average capacitor voltage is formulated as , and δ Σ is a bound determined by the user and the application. Additionally, limits are imposed on the capacitor voltages as follows: where v Σ max = v Σ + δ Σ and v Σ min = v Σ − δ Σ are the upper and lower limit of the average capacitor voltage. It is important to observe that regardless of the application, δ Σ > 0 because for (24) to hold, then v Σ r,m (t) cannot be constant. Hence, these control objectives are competing and cannot be satisfied simultaneously.
Ideally, i Σ m = i DC , since the common-mode current is the inner current flowing through the arm and the DC-bus components. Hence, i Σ m (t) = i DC (t) means that the MMC achieves 100% efficiency. However, due to the conduction and devices losses represented by R m , this is not achievable. To control the efficiency of the system, a new inner current for each leg, called the circulating current (i z m ), is defined, such that which is only true if the grid and the MMC are balanced. In [29,30], it is proven that the steady state of the common-mode current only has even harmonics, such that it can be defined as where f g is the grid frequency,Î Σ m and φ 2 are the amplitude and the phase of the commonmode current. Substituting (32) in (31), the circulating current is defined as Re-arranging the power balance equation of the system, the amplitude of the commonmode current is formulated aŝ where φ is the phase difference between the current and voltage of the grid. In this paper, the efficiency (η) of the MMC is defined by its capacity of transferring power, such that η = P DC /P AC . Hence, using (34), a relationship between the amplitude of the commonmode current and the efficiency of the MMC is established. For ensuring a desired level of efficiency, the control objective for the circulating current is formulated as where y 2 (t) = i Σ m (t) and y r 2 (t) := 1 3 i DC (t). Similarly as above, we also impose limits on the circulating current as follows: where i z max =Î Σ m and i z min = −Î Σ m are the upper and the lower limit of the circulating current. As the highest efficiency possible is determined by R m , the minimal achievable circulating current is also limited by this element.
Observe also that suppressing the circulating current forces the common-mode current to be close to a defined value meaning that the average of the arm current is also regulated. Since the MMC power losses (P losses ) can be defined as see [7] for details, controlling the circulating current keeps the power losses as low as possible.
In summary, the current controller, i.e., the NMPC controller to be designed, has to track a time-varying sinusoidal reference for the output current, which is known in advance over the prediction horizon, to track a time-varying reference for the circulating current, which is assumed constant over the prediction horizon, and to keep the capacitor voltages as close as possible to their nominal value, without sacrificing the tracking performance. All these objectives must be achieved subject to soft constraints and hard constraints, which will be defined in the next section.

Nonlinear Model Predictive Control Design and Implementation
The NMPC scheme proposed in this paper follows the principle of receding horizon optimal control. In this case, at each sampling instant k, given the current state x s (k), an optimization problem is formulated and solved in real time. As a result, an optimal (or feasible) sequence of control inputs U(k) = u 0|k , u 1|k , . . . , u N p −1|k is obtained for a prediction horizon N p , which is optimal on the basis of a cost function subject to the dynamics of the prediction model and constraints. Following the receding horizon policy, only the first input u s (k) := u 0|k in the sequence is applied to the system, and the process is repeated at the next sampling instant k + 1. Additionally, if soft constraints are implemented, the optimization problem needs to find a sequence of slack variables E (k) = ε 0|k ,ε 1|k , . . . ,ε N p −1|k , which penalize violation of the soft constraints, see, e.g., [31].
In consonance with the analysis in Section 2.2, the prediction model used is the discrete-time bilinear model (19), i.e., where x i|k , u i|k , and w i|k denote the predicted state, control input, and exogenous input vectors at i-steps in the future, starting from the current system state x s (k) and exogenous input vector w s (k)measured at time k. Note that i ∈ N, i = 0, 1, . . . , N p − 1 and N p is the prediction horizon. The prediction model and real system states and inputs are linked for all k ∈ Z + via the relations x 0|k := x s (k), u s (k) := u 0|k . Additionally, w i|k is determined as follows: for the grid voltage, we assume perfect knowledge along the prediction horizon, due to its periodic nature, and for the DC voltage and DC current, we keep the measured values at time k constant over the prediction horizon. As explained in the previous Section 3.2, the MMC control problem is a constrained control problem due to the operation characteristics of the MMC. In this paper, not all the constraints were catalogued the same. Based on the control objectives definitions, (27), (30a), (30b), and (36) are treated as soft constraints since they are only performance requirements. Moreover, the system also has hard constraints due the physical limitations of the MMC, such as continuous insertion index, which it is limited by where d u m i|k and d l m i|k form the predicted input vector u i|k . The voltage of the polarized capacitors is also limited as follows In this paper, it is assumed that grid components R g and L g are small enough to be disregarded. Moreover, P DC behaves as a piece-wise step function with a constant voltage during the entire simulation. Hence, the derivative of the DC-bus current is assumed equal to zero.

Cost Function and Optimization Problem
The cost function is a scalar mapping of the desired performance of the control objectives. A crucial criterion for developing a tracking MPC is that the number of tracked output needs to be less than or equal to the number of control inputs. Hence, in this case, only two outputs can be accurately tracked.
The multiple control objectives of the MMC compete among them; therefore, it is impossible to find a control sequence that gives the optimal solution for all control objectives simultaneously. Hence, aiming to achieve Pareto optimal performance, a cost function is defined as where the individual cost functions are defined next. Firstly, for solving the tracking problem of the output current and suppressing the circulating current, the cost function J 1 is formulated as where Q 1 ∈ R 2×2 contains the weighting factors that penalize the tracking error and the deviation of the circulating current, R ∈ R 2×2 penalizes the control input rate of change ∆u i|k := u i|k − u i−1|k for i = 0, . . . , N p − 1 (u −1|k := u(k − 1)), and y r i|k = y r 1i|k y r 2i|k denotes the time-varying output reference vector, which is computed as explained in the previous section. Secondly, the cost function J 2 aims to keep the average capacitor voltage near to a desired nominal as follows where is the vector containing the nominal value of the average capacitor voltages. Since the MMC of UFCSs operates in an extended region, the standard formulation of the nominal value, see e.g., [2,32], does not ensure the desired performance. Therefore, the nominal average capacitor voltage is set as (28) for guaranteeing proper sizing of the capacitance and keeping the energy stored in the MMC balanced.
Thirdly, to implement soft constraints for (27), (30a,b), and (36), we define the slack variable vectorε := ε 1 , ε 2 , ε 3 , ε 4 ∈ R 4 + and the cost function where ε 1 , ε 2 , ε 3 , and ε 4 are slack variables that penalize the constraints violation of the output current, upper average capacitor voltage, lower average capacitor voltage, and circulating current, and λ is a constant that penalizes the slack variables and determines how strict the soft constraints are [31,33]. The corresponding soft constraints are defined as follows: Similarly, the average capacitor voltage constraints are reformulated. For the upper and lower average capacitor voltage (30a,b) respectively, the new inequalities are The circulating current constraints are reformulated as Using (41), the NMPC algorithm for MMCs is formulated as the following optimization problem: For solving the Nonlinear Programming (NLP) problem (48a) subject to (48b-i), an efficient NMPC solver based on Sequential Quadratic Programming (SQP) [34] can be used. In this paper, the ACADO Toolkit NMPC solver from [22] was used in combination with the qpOASES Active Set QP solver [35].
Since the main objective is to speed up the solver, we changed the default ACADO configuration. In this case, the KKT tolerance was relaxed to 10 −3 allowing a faster convergence. The Hessian approximation method used was the Gauss-Newton method. Compared to calculating Exact Hessian, this method represents a considerable time reduction, since there is no need for calculating second-order derivatives. The maximum number of iteration QP per sampling was set to 200, although as the KKT tolerance was softened, the maximum number of iterations should not be reached. In addition, the discretization type used was multiple shooting, since it provides a faster implementation.

Case Study: Control of Modular Multilevel Converters for Ultra-Fast Charging Stations of Electric Vehicles
This section presents the results of testing the proposed controller in an ultra-fast charging station topolgy presented in [7]. The rest of this section contains a brief description of the UFCS topology and the simulations from three different scenarios. The first scenario shows the performance of the NMPC when long prediction horizons are implemented. The second scenario compares the NMPC and MPC using a long prediction horizon. Finally, the third scenario offers insightful information about what is gained from the proposed prediction model and cost function.

Ultra-Fast EV Charging Stations Topology
The proposed control solution is tested in the MMC topology for UFCSs presented in [6]. In this case, the nominal active power of the UFCS is 3 MW. The grid is considered three-phase with 25 kV phase voltage. The nominal DC-bus voltage is 10 kV. The simulations of the UFCS and their control elements were done in MATLAB/Simulink and PLECs. Table 3 depicts more information about the UFCS components.
The control scheme used follows the guidelines explained in Section 3.1. In this case, at the Top layer, an NMPC (or linearization-based) MPC algorithm is used. The weighting factors were defined as Q 1 = diag(1500, 1500), Q 2 = diag(10, 10) R = diag(1, 1), and λ = 10 5 . To put more emphasis on tracking performance, Q 1 has a much higher value than Q 2 . The high value of λ is meant to strictly penalize the violation of soft constraints, as this improves the performance and efficiency of the MMC. The limits used in hard and soft constraints are provided in Table 4.
At the middle layer, a regularly sampled multilevel CB-PWM with phase disposition is used with a carrier frequency of 2.5 KHz. At the bottom layer, the balancing control from [9] is implemented.
Checking the performance of the MMC, a transient test is carried out. In Figure 4, the desired power extracted from the grid and the corresponding output current reference are depicted. In this case, a full power transfer is expected, and based on that, the desired DC-bus current is calculated; see Figure 4.  Figure 5 presents the behavior of the output current controlled with the NMPC using N p = 100. In this case, the NMPC scheme manages to regulate the output current closely along the references presented in Figure 4. The proposed control solution reaches the expected steady state, such as the one in [7], at a high speed without affecting other performance indexes. The average mean square error (MSE) among the three phases is 0.26, and the THD of the output current equals is 0.11%, which proves the good performance of long-horizon NMPC. The remaining controlled variables show an adequate behavior; see Figure 6. During this test, the constraints are not violated, and the controlled variables are kept near the references. The different behavior among the phases is mainly due to the initial conditions chosen. For this test, all phase legs have the same initial states but the references are not the same for every phase. Regardless, the performance of all phases is suitable. For the average capacitor voltage, the mean deviation with respect to the nominal voltage is approximately 7 V and the standard deviation error is 56.58 V which represent less than 0.16% of the nominal value. Finally, the root mean square (RMS) of the circulating current is approximately 1.3 A, which is less than 0.2%. One of the main advantages of using MPC is faster convergence to the steady state and consequently shorter settling time (T sett ). In Table 5, performance indicators are provided for various values of the prediction horizon. These indicators show that using a gradually longer prediction horizon corresponds to gradually increasing the performance and efficiency, which was matched by a reasonable increase in the required computation time. Among the considered indicators are also the mean, the standard deviation (std), the maximum (max), and the minimum (min) of the computational time, since the suitability of this method for real-time implementation is investigated. Based on Table 5, N p = 25 is already compatible with real-time implementation for a sampling period T s = 0.2 ms. For the remaining prediction horizons, it is key to clarify that the developed NMPC algorithm was implemented using the ACADO Toolkit on a 2.59 GHz Intel Core-i7-9750H using the MATLAB interface. On the other hand, in power electronic applications, controllers are implemented in real time using special hardware, such as field-programmable gate array (FPGA) and digital signal processors (DSP). FPGAs significantly outperform microprocessor and DSP implementations due to their parallelism characteristic [24]. As observed in [36], it is expected that FPGAs have a computational time 10 times shorter than the microprocessor implementations. This time reduction increases if the state dimension and prediction horizon increase [36]. Aligned with the results of [36], in [37], a nonlinear MPC with a long prediction horizon for Interleaved Switching AC/DC converters was tailored in an FPGA. In that case, the computational time was around 10 µs when a prediction horizon of 100 was used. Hence, using an FPGA will speed up our solves so that real-time implementation for N p = 100 will be feasible. Moreover, unlike other voltage-source converters, MMCs operate at low frequencies without significantly decreasing their performance. Hence, it is possible to decrease the carrier frequency/the sampling period up to certain limits [18].

NMPC vs. Linearization-Based MPC Comparison for N p = 100
Conversely to the behavior observed in NMPC implementation, when longer prediction horizons are used in a linearization-based MPC formulation, the performance of the MMC decreases significantly. These results are aligned with the findings from the model validation. The upper and lower limits of the output current are reached when the linearization-based MPC is used. Due to the soft constraints, these limits are not violated; see Figure 7. However, the observed performance is not suitable for the application. In the case of the average capacitor voltage, the limits are not reached. However, conversely to the NMPC performance, the voltage does not oscillate around the nominal value; see Figure 8. The comparison with the NMPC behavior shows an increase in the average deviation to the nominal average capacitor voltage and an increase in the standard deviation. The circulating current performance shows a significant difference compared to the NMPC; see Figure 9. The observed behavior of the circulating current is unsuitable for this application due to the high amplitude of the oscillations of the circulating current. Moreover, the current peaks are harmful to the MMC component lifespan. The evidenced behavior of the circulating current could endanger the safe functioning and the lifetime of the MMC. This increase in the circulating current is directly reflected in the arm current and, consequently, in the MMC losses. When the linearization-based MPC is used, the losses increase by 6.8%. Figure 9. Trajectory of the controlled circulating current (i z a ) using NMPC with N p = 100 (blue) and linearization-based MPC with N p = 100 (red).

Evaluation of the NMPC Cost Function
In this paper, a different prediction model and corresponding cost function were derived, which enabled directly controlling the circulating current. To assess the benefits of penalizing the circulating current in the cost function, even for a short prediction horizon, we compare the proposed NMPC algorithm for N p = 10 (as used in [18]) with the following cost functions: (i)-the cost function (41) developed in this paper and (ii)-a cost function that mimics the cost function derived in [2], denoted asJ, for the prediction model (19). The cost functionJ is obtained by taking the output of model (19) as the output current and the capacitor voltages, and then adding the correspondJ 1 andJ 3 costs (i.e., corresponding to J 1 and J 3 for the redefined output). The main difference is that the cost functionJ 1 corresponding to J 1 does not penalize the circulating current and that the costJ 1 penalizes the capacitor voltages as well, so the cost J 2 is no longer used. Figure 10 depicts the trajectory of the circulating current corresponding to the abovementioned cost functions. When the circulating current is not penalized, extremely high peaks are observed. The RMS of the circulating current is significantly higher when the circulating current is not controlled. These results are similar to the findings in [2]. Consequently, in [38], which is continuation of the work of [2], the circulating current was controlled using an external PI controller to improve performance. Figure 10. Trajectory of the controlled circulating current (i z a ) using NMPC with N p = 10 (blue) and MPC with N p = 10 (red).
Penalizing the circulating current provides a 29.75% reduction of the power losses, and therefore, the efficiency increases. Figure 11 shows the behavior of the common-mode current, which determines the power losses. Since the control objectives compete among them, this increase of the circulating current amplitude allows an improvement in the behavior of the average capacitor voltage; see Figure 12. However, the improvement of the average capacitor voltage does not compensate for the high circulating current. Figure 11. Trajectory of the controlled common-mode current (i Σ a ) using NMPC with N p = 10 (blue) and NMPC with N p = 10 (red).

Discussion
The use of NMPC provides a significant improvement in the MMC control. These improvements are obtained mainly since nonlinear models can predict the MMC bilinear behavior. Using NMPC controllers, MMCs can be used in applications where more strict performance requirements are needed or the system properties demand a more accurate controller. Moreover, Figure 6 shows how the NMPC maintains the average capacitor voltage within 1% of the nominal value. Since the common indications for the constraints of the average capacitor voltage are a maximum deviation of approximately 20% of the nominal value, using NMPC enables the reduction of the capacitance of the submodule and, consequently, decreases the MMC cost. The faster convergence to a steady state makes the NMPC more suitable for applications such as UFCS stations, where quick changes on the setpoint during intense periods of operation are expected.
However, there are many challenges that the NMPC implementation needs to overcome in the future. The need for faster solvers is a constant challenge for MPC solutions. Even if in this application a real-time implementation is achievable, many MMC appli-cations work at a higher frequency. Other improvements for the NMPC are providing some guarantees for stability and recursive feasibility. In this regard, we have to recall that our tracking problem has competing objectives and with less control inputs than output variables; therefore, minimizing the design cost function yields a Pareto-optimal solution. Methods for analyzing and providing some practical and robust stability for tracking MPC are presented in [39][40][41]. Exploring if these methods could be applied to our case is a good consideration for future works. In our application, we noted that using a long horizon is beneficial for stability. This observation aligns with the analysis on the stability of NMPC without terminal ingredients [42]. The other major challenge that the NMPC can encounter is the mismatches between the model and the real system due to uncertainties and perturbation of the grid or the failures in the lower control layers. Yet, this is a common challenge for the MPC solutions, and in this case, robust NMPC solutions can be studied to improve performance in conditions of high uncertainties.

Conclusions
A nonlinear model predictive control (NMPC) scheme for MMCs was proposed in this paper, which was motivated by the fact that linearization-based MPC for MMCs is limited to relatively short prediction horizons. The designed NMPC controller is suitable for various applications independently of the number of submodules of the MMC. Using a nonlinear prediction model enables a much larger prediction horizon (up to 100) compared to a linearized model (up to 10) and significantly increases perforamnce and efficiency. Using state-of-the-art in NMPC solvers based on sequential quadratic programming showed that the developed NMPC algorithm is suitable for real-time implementation with a long prediction horizon (ranging from 25 up to 100 with additional solver compiling and optimization) for a sampling period of 0.2 ms. A new prediction model and cost function was developed that enables penalizing the circulating current, which resulted in significant power losses reduction and efficiency improvements. The efficiency and performance improvement brought by the developed NMPC control solution for MMCs was demonstrated in a case study from ultra-fast charging stations for electric vehicles.