{'fraction_non_alphanumeric': 0.04625748502994012, 'fraction_numerical': 0.01651696606786427, 'mean_word_length': 4.328636001063547, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Multilevel Selective Harmonic Modulation by Duality

We address the Selective Harmonic Modulation (SHM) problem in power electronic engineering, consisting in designing a multilevel staircase control signal with some prescribed frequencies to improve the performances of a converter. In this work, SHM is addressed through an optimal control methodology based on duality, in which the admissible controls are piece-wise constant functions, taking values only in a given finite set. To fulfill this constraint, the cornerstone of our approach is the introduction of a special penalization in the cost functional, in the form of a piece-wise affine approximation of a parabola. In this manner, we build optimal multilevel controls having the desired staircase structure.


Introduction
In power electronic engineering, Selective Harmonic Modulation (SHM) [15,14] is a well-known technique, employed to improve the performances of a converter by increasing its power and, at the same time, reducing its losses. In broad terms, the scope of SHM is to control the phase and amplitude of the harmonics in the converter's output voltage, by generating a control signal with a desired harmonic spectrum through the modulation of specific lower-order Fourier coefficients.
In practice, this signal consists in a step function with a finite number of switches, taking values only in a given finite set. This function can be fully characterized by: 1. The waveform, i.e. the sequence of values that the function takes in its domain. 2. The switching angles, i.e. the sequence of points where the signal switches from one value to following one. Hence, solving the SHM problem consists in determining the waveform and switching angles in the control signal.
SHM has been extensively studied in the engineering literature in the last decades. Nowadays, many different techniques are available to approach this problem, among which we highlight: 1. Conversion into a finite-dimensional optimization problem. It consists in fixing a suitable waveform for the desired control signal and finding the optimal location of the switching angles [13]. This approach has the main drawback of requiring an a priori knowledge of the waveform, which may be quite cumbersome in some situations. In fact, even determining the number of switching angles is not straightforward in general. 2. Conversion into a polynomial system. This approach is based on employing appropriate algebraic transformations to convert the SHM problem into a polynomial system whose solutions' set contains all the possible waveforms for a predetermined number of switching angles (see [17] and the references therein). Hence, also in this case, it is necessary to fix a priori the number of switching angles, which is something that, in general, is preferable to avoid. 3. Conversion into a constrained optimal control problem. This is a very novel approach, which has been firstly proposed in our recent contribution [2]. It consists in identifying the Fourier coefficients of the signal with the terminal state of a controlled dynamical system, where the control is actually the signal, which is computed by minimizing a suitable cost functional. In contrast with the aforementioned methodologies, the main advantage of this formulation is that neither the waveform of the solution nor the number of switching angles need to be a priori determined. On the contrary, the optimal waveform and switching angles are automatically obtained as a result of the minimization process. In this contribution, we present an alternative optimal control approach to solve the SHM problem, based on the so-called adjoint methodology, which has been systematically associated to optimal control problems and their applications to several fields of science and engineering [7,10]. A similar methodology has already been applied in our recent work [3] to obtain multilevel controls for linear time-dependent control systems satisfying the Kalman rank condition. In this work, we will show how this dual technique can be adapted to solve the SHM problem.
This document is structured as follows. In Section 2, we introduce the mathematical formulation of the SHM problem. In Section 3, we present the optimal control approach to SHM and its dual version, which is the main contribution of the present paper. Section 4 is devoted to numerical examples of a concrete SHM problem that we have solved by means of our methodology. Finally, in Section 5, we summarize the conclusions of our work and propose some open problems for future investigation.

Preliminaries
In this section, we present the mathematical formulation of the SHM problem and introduce the notation that will be used throughout the paper. Let be a given set of L ≥ 2 real numbers satisfying The main objective of SHM is to construct a step function u(t) : [0, 2π) → U, with a finite number of switches, such that some lower-order coefficients in its Fourier expansion take specific values prescribed a priori.
Due to applications in power converters, it is typical to only consider functions with half-wave symmetry, i.e.
Notice that, because of (2.2), the Fourier coefficients of u corresponding to even indices j vanish: which gives the Fourier expansion Moreover, in view of (2.2), in what follows, we will only work with the restriction u| [0,π) which, with some abuse of notation, we still denote by u. Hence, from now on, we will consider piece-wise constant functions u : [0, π) → U of the form • χ [φm,φm+1) denotes the characteristic function of the interval [φ m , φ m+1 ).
Observe that S and Φ fully characterize any function u of the form (2.4).
In the engineering applications that motivated our study, due to technical limitations, it is preferable to employ signals taking consecutive values in U. In the sequel, we will refer to this property of the waveform as the staircase property, which can be rigorously formulated as follows. Note that when U = {−1, 1} (which is known in the SHM literature as the bi-level problem), this property is satisfied for any u of the form (2.4).
We can now conclude this section by formulating the SHM problem as follows.

Problem 2.1 (SHM).
Let U be given as in (2.1), and let E a and E b be finite sets of odd numbers of cardinality |E a | = N a and |E b | = N b respectively. For any two given vectors a π ∈ R Na and b π ∈ R N b , we want to construct a function u : [0, π) → U of the form (2.4), satisfying (2.5), such that the vectors a ∈ R Na and b ∈ R N b , defined as satisfy a = a π and b = b π , where the coefficients a j and b j in (2.6) are given by (2.3).

SHM as an optimal control problem
In [2], the SHM problem has been formulated via optimal control. In this formulation, the Fourier coefficients of the signal u(t) are identified with the terminal state of a controlled dynamical system of N := N a + N b components defined in the time-interval [0, π). The control of the system is precisely the signal u(t), defined as a function [0, π) → U, which has to steer the state from the origin to the desired values of the prescribed Fourier coefficients. This approach is based on the observation (see [2,Section 4] for more detail) that the Fourier coefficients of the function u(t) can be rewritten as the initial state of a dynamical system controlled by u(t) with and C a (t) ∈ R Na and C b (t) ∈ R N b given by Here, e i a and e i b denote the elements in E a and E b , i.e.
We notice that the unique solution to (3.1) can be characterized through a direct integration against a test function φ ∈ R N as where ·, · is the standard scalar product in R N . We shall use this (3.4) in the proof of our main result Theorem 3.1.
With this formulation, the SHM Problem 2.1 can be reduced to a controllability one for (3.1).

Problem 3.1 (SHM via controllability).
Let U be given as in (2.1), and let E a , E b and the targets a π and b π be given as in Problem 2.1. We look for a function u : In [2], we have shown that Problem 3.1 can be solved via an optimal control approach, by computing the optimal SHM control u where ε > 0 is a (small) penalization parameter and the function L is constructed as the piece-wise affine interpolation of the parabola P(u) = u 2 in [−1, 1], considering the elements in U as the interpolating points: In particular, we have proved in [2, Theorems 4.1-4.2 and Proposition 4.1] that: • The optimal control u ε , solution to Problem 3.1 is unique and has the form (2.4) satisfying (2.5).
• u ε is continuous with respect to the initial datum x 0 in the strong topology of L 1 (0, π).
• The optimal trajectory x ε associated with u ε satisfies that is, u ε is an approximate control solution of the SHM problem, allowing us to get ε-close to the target Fourier coefficients. As we anticipated, the main interest of this paper is to show that the SHM Problem 3.1 can be solved through duality. As a matter of fact, applying general results of the Fenchel-Rockafellar theory [8], we can build the following dual problem associated with (3.5) where p is the solution of the adjoint equation (3.10) and L denotes the convex conjugate of L (see [4,Chapter 3] for the definition of L ). Moreover, we notice that in the particular situation of the SHM problem considered in this work, the adjoint dynamics is trivial and the solution of (3.10) is constant, p(t) = p π for all t ∈ [0, π). Hence, (3.9) simplifies into where the dynamical behavior is given only by the time-dependent matrix C(t).
Let us stress that the convex conjugate of a piece-wise affine function is still piece-wise affine and convex. In particular, for L defined as in (3.6) where (3.13) and (3.14) Dual optimization problems as (3.9) are widely employed in the control literature as they usually reduce the computational effort with respect to their primal counterpart (3.5) when actually addressing the optimization process. This is essentially because the optimization variable in (3.5) is the control u ∈ L 1 ([0, π); [−1, 1]), which is time-dependent, while in (3.9) one minimizes over p π ∈ R N , the final state of the adjoint equation (3.10). This renders an optimization process which is, typically, computationally less expensive. We refer to [6] for a more complete discussion on these issues in the context of the heat equation.
In what follows, we will show that the multilevel staircase control solution to the SHM Problem 3.1 can be obtained through the minimization of (3.11) and is given by for a.e. t ∈ [0, π), (3.15) where ∂L denotes the subdifferential of the (non-differential) function L , defined for any q ∈ R N as Besides, since ∂L coincides with the standard derivative wherever the function L is differentiable, we have from (3.15) that u ε is given by the slopes of the linear branches λ k in (3.14), except for the t m such that C (t m )p ε,π = ω m , ω m being one of the values given in (3.13). This, in particular, will imply that the controls computed through (3.11) have the desired multilevel and staircase structure. As a matter of fact, we have the following result. Theorem 3.1. For any ε > 0, there exists a unique minimizer p ε,π ∈ R N of the functional J ε . Moreover, this minimizer is related with the minimizer u ε of F ε through the formulas u ε (t) ∈ ∂L C (t)p ε,π , for a.e. t ∈ [0, π) (3.16) and x ε (π) = −εp ε,π . (3.17) In particular, the approximate controllability condition (3.8) is satisfied, i.e. p ε,π univocally determines a multilevel and staircase approximate control u ε , solution to the SHM Problem 3.1.
Proof. First of all, the existence and uniqueness of a minimizer p ε,π ∈ R N for J ε is an immediate consequence of the direct method of calculus of variations, since the functional is clearly continuous, strictly convex and coercive, i.e.
Let us show that, if u ε is in the form (3.16), then (3.17) holds. To this end, we first notice that the minimizer p ε,π can be characterized by the Euler-Lagrange equation which, in our case, reads as In the same way, the minimizer u ε of (3.5) can be characterized by the Euler-Lagrange equation wherex is the solution of (3.1) corresponding toũ. Moreover, let us recall that, by using (3.4) with φ =p π , the optimal trajectory x ε is characterized as Combining this with (3.18), we get that from which we immediately obtain that x ε (π) = −εp ε,π . Let now v(t) ∈ L 1 ([0, π); [−1, 1]) and let z v (t) be the solution of Multiplying (3.20) by p ε,π and integrating by parts using (3.17) we obtain that Combining this with (3.19), we then have that Since the above relation holds for all v(t) ∈ L 1 ([0, π); [−1, 1]), we then conclude that which, thanks to [3, Lemma A2], is equivalent to Finally, the multilevel and staircase structure of u ε in (3.16) is a direct consequence of the fact that, by construction, L is a piece-wise affine function and, therefore ∂L is piece-wise constant. The complete details of this last part of the proof are omitted here for brevity, and can be found in [3].

Remark 3.2. According to Theorem 3.1, our dual methodology provides a solution to the SHM Problem 2.1
under the perspective of approximate controllability, meaning that we can construct a multilevel and staircase approximate control u ε allowing us to get ε-close to the target Fourier coefficients. For completeness, we shall stress that in the literature (see, e.g., [9]) approximate controllability had also been addressed through a slightly different approach, by minimizing the functional (3.21) In this case, the coercivity of J ε , hence the existence of an optimal control p ε,π is guaranteed by the unique continuation principle C(t) p(t) = 0 for a.e t ∈ [0, π) ⇒ p π = 0, (3.22) which is trivially satisfied by the adjoint dynamics (3.10). This is the Fenchel-Rockafellar dual of the problem Nevertheless, as it has been observed in [11,6], to solve (3.21) or (3.23) numerically may lead to important computational difficulties, which can instead be avoided through (3.11)

Numerical experiments
In this section, we present some numerical experiments to illustrate how our dual optimal control problem (3.11) allows to solve the SHM Problem 3.1. To this end, we consider the frequencies In the engineering applications of SHM motivating our work, m in (4.2) is the so-called modulation index. Finally, we choose ε = 10 −5 and the control set meaning that u * will be a 3-level staircase control function taking only the constant values in (4.3).
As for the minimization of J ε , we adopt the approach of [2, Sections 6.1 and 6.2] and implement the interior point method via the optimization software IPOpt [16], with the help of the open-source tool CasADi [1] for nonlinear optimization and algorithmic differentiation.
Our experiments were conducted on a personal Acer laptop with 1.6 GHz Intel Core i5-10210U processor and 16GB RAM. The results of our simulations are displayed in Fig. 1 and 2, in which we have plotted the function where, for each m ∈ [−0.8, 0.8], u * m represents the solution to the SHM problem in our case of study. That is, Fig. 1 and 2 contain all the solutions of the SHM problem in the range of modulation indices m ∈ [−0.8, 0.8] and with the frequencies, targets coefficients and levels defined in (4.1), (4.2) and (4.3), respectively.
In Fig. 1, u * m is displayed seen from above. Each vertical snapshot in the picture corresponds to a multilevel control for a specific modulation index, which moves from one level to another each time there is a change of color. Moreover, to better appreciate the multilevel and staircase structure of the controls obtained, we present in Fig. 2 a side view of u * m . In both figures, we can appreciate how our numerical results are in accordance with Theorem 3.1.

Conclusions
In this paper, we have discussed the Selective Harmonic Modulation problem in power electronic engineering adopting an optimal control viewpoint. More precisely, we have illustrated how the SHM Problem 2.1 can be interpreted as an approximate controllability one for which the SHM signal u plays the role of the control and can be obtained through a dual minimization process. Besides, we have shown both theoretically and through numerical simulations that, by suitably designing the penalization L in our cost functional as the convex conjugate of the piece-wise affine approximation of a parabola, the proposed dual optimal control problem automatically generates SHM signals having the desired multilevel and staircase structure.
As already observed in our previous contribution [2], this optimal control approach to SHM solves several critical issues arising in practical power electronic engineering applications. In particular, neither the waveform nor the number of switching angles need to be a priori determined, as they are implicitly established by the optimal control. This bypasses the (usually difficult) task of a priori estimating the number of switches which is necessary to reach the desired Fourier coefficients.
However, some relevant issues are not covered by our study, and will be considered in future works: 1. SHM via null controllability. The results of this paper show that the SHM Problem 2.1 can be addressed as an approximate controllability one. It would then be natural to analyze whether this can be extended to the null controllability framework, which corresponds to taking the limit ε → 0 + in (3.11). This would require some precise estimate of the computational cost with respect to ε. 2. Characterization of the solvable set. The SHM Problem 2.1, by its own nature, brings some restrictions when converted into a controllability one. Firstly, the time horizon for the control problem is π, therefore fixed and bounded. Secondly, the energy of the controls is also bounded, as u can only take the values in the control set U. These restrictions yield that not all the initial data x 0 ∈ R N in (3.1) are controllable, meaning that the SHM problem may not be solvable. It would then be interesting to have a full characterization of the solvable set for the SHM problem, thus determining the entire range of Fourier coefficients which can be reached by means of our approach. A rough estimate of the solvable set can be obtained by considering (3.11) with ε = 0 and noticing that, as shown in [3, Section 3], there exists a constant C > 0 such that π 0 L (C(t) p π ) dt ≥ C p π R N . (5.1) The observability inequality (5.1) is equivalent to the unique continuation (3.22) and, therefore, yields that, in the limit ε → 0 + , the coercivity of J ε is guaranteed for small enough initial data, namely, x 0 R N ≤ C. On the other hand, for large initial data, this coercivity may be lost. We stress that this is just a sufficient condition showing that the SHM problem can be solved through null controllability if the solvable set is contained in some ball in the euclidean space R N . It would be interesting to obtain a sharper characterization of this solvable set and, possibly, its geometry. 3. Minimal number of switching angles. In practical applications, to optimize the converters' performance, it is required to keep the number of switches in the SHM signal the lowest possible. This yields to the very relevant yet challenging task of designing a cost functional for our optimal control problem which provides a multilevel and staircase signal u, with the additional structural property of having the minimal possible number of switching angles. A similar problem has been treated, in a different context, in [12]. There, the authors addressed optimal discrete-valued control problems using the so-called control parametrization enhancing technique and introducing in their cost functional a penalization term involving the T V -norm of the control. This term has precisely the effect of reducing the variations (hence, the switching) in the control signal. It would be worth to analyze whether a similar approach is applicable also in our context, for instance by penalizing the T V -norm of the control in (3.5), and if it effectively yields to a minimal switches' number.