Efficient simulation of DC-AC power converters using Multirate Partial Differential Equations

Switch-mode power converters are used in various applications to convert between different voltage (or current) levels. They use transistors to switch on and off the input voltage to generate a pulsed voltage whose arithmetic average is the desired output voltage of the converter. After smoothening by filters, the converter output is used to supply devices. The simulation of these switch-mode power converters by conventional time discretization is computationally expensive since a high number of time steps is necessary to properly resolve the unknown state variables and detect switch events of the excitation. This paper proposes a multirate method based on the concept of Multirate Partial Differential Equations (MPDEs), which splits the solution into fast varying and slowly varying parts. The method is developed to work with pulse width modulated (PWM) excitation with a constant switching cycle and varying duty cycle. The important case of varying duty cycles in the MPDE framework is addressed for the first time. Switching event detection is no longer necessary and a much smaller number of time steps for a decent resolution are required, thus leading to a highly efficient method.


Introduction
Switch-mode power converters play nowadays a vital role in various applications [1,2]. They are used in domestic devices, e.g., in mobile phone chargers and computer power supply, as well as in industrial applications, e.g., in high-voltage DC (HVDC) power transfer and speed control of electrical motors, to convert voltage (or current) between different levels. Switch-mode power converters use transistors to periodically switch on and off the input voltage to generate a pulsed voltage, whose arithmetic average is the desired output of the converter. The pulsed voltage is smoothened by filter circuits, which also act as energy buffer before it is used to supply the appliance.
An exemplary circuit of such a switch-mode power converter is depicted in Fig. 1 along with its solution in DC-DC conversion mode. As can be seen the converter output voltage, even after filtering, still comprises of high-frequency components generated by the pulsed excitation, which are usually referred to as ripples [2]. Since the circuit is uncharged at the beginning, the converter needs some time to reach the steady state. As a result, the solution consists of a slowly varying envelope which is modulated with the fast periodically varying ripples. The method used to generate the control signals for the transistors is called pulse width modulation (PWM). There are different kinds of PWM [2], e.g., natural sampling with different carrier signals like sawtooth and triangle, and regular sampling. Since in this paper, we focus on natural sampling with a sawtooth carrier, we refer the interested reader to Vasca et al. [2] for more details on other modulations. Using natural sampling with a sawtooth carrier (trailing edge) leads to a pulsed signal as depicted in Fig. 2, where the switching (pulse) period T s = 1/f s and the duty cycle d are the quantities defining the pulses. The switching frequency is constant while the duty cycle varies with time.
Large-scale simulations of power converters require simplifications, e.g., ideal switching behaviour of the transistors and ideal diode [1]. Nonetheless, the simulation of power converters with conventional time discretization is still computationally expensive since a high number of time steps is necessary to properly resolve the ripples in the solution. Special techniques are commonly applied to detect switching events and up to now most software uses techniques which reduces the order of the applied time discretization to lowest order, see Tant et al. [3]. In this paper we develop a method which alleviates the need of high number of time steps by splitting the solution into fast and slowly varying parts. The resulting method is a (high-order) multirate approach, which is based on a concept called Multirate Partial Differential Equations (MPDEs) [4,5]. For DC-DC power converters the method has already been proposed in earlier papers by Pels et al. [6,7]. We extend the concept to DC-AC power converters (also called inverters), in the following. In the process we restrict ourselves to power converter circuits which can be described by linear electrical elements and thus by a system of linear ordinary differential equations (ODEs). An extension to nonlinear problems can be achieved similarly as described in Pels et al. [6]. The method is verified using the example of the converter in Fig. 1, which is referred to as inverter in the following since it is operated in DC-AC mode. The main contribution is the efficient treatment of (sinusoidally) varying duty cycle. The paper is structured as follows. Section 2 introduces the concept of MPDEs and their relation to the original ODEs describing the application. The focus of Section 3 lies on the modeling of the DC-AC converters using MPDEs. It describes how an efficient simulation can be achieved. The methods used for solving the MPDEs, i.e., a Galerkin approach for fast periodic parts of the solution and a conventional time discretization for the slowly varying parts are presented. Section 4 introduces B-spline basis functions used for the solution expansion and discusses their properties. It is shown that the basis functions are well suited for use with the proposed method since they allow to exploit smoothness almost everywhere but still lead to a cheap assembly of the arising matrices. Finally in Section 5, the method is applied to the example of the inverter and the computational efficiency is discussed. Section 6 concludes the paper.

Introduction to Multirate Partial Differential Equations
Let the mathematical model of the converter be described by linear ordinary differential equations in the form where A, B ∈ R Ns×Ns are matrices, which depend on the topology of the circuit and the electrical elements, x(t) ∈ R Ns is the unknown solution consisting of voltages and currents, x 0 is the vector of initial conditions and c(t) ∈ R Ns is the excitation of the circuit. To obtain the multirate formulation, two artifical time scales t 1 and t 2 are introduced and (1) is rewritten in terms of the corresponding multivariate solution x(t 1 , t 2 ) and excitation c(t 1 , t 2 ) which yields the MPDEs [4,5] A The relation between the ODEs (1) and MPDEs (2) is given by [4,5] x(t, t) = x(t) Therefore, if any right-hand side c(t 1 , t 2 ) can be found which fulfills the relation c(t, t) = c(t), then the solution of the original system of ODEs can be extracted from the solution of the MPDEs by using x(t) = x(t, t), i.e., evaluating the multivariate solution along a diagonal line through the computational domain. It is important to note that the simulation efficiency depends on the choice of c(t 1 , t 2 ) and of course the methods which are used for solving the MPDEs. In our case, we require fast changes to occur along the "fast time scale" t 2 and slow changes along the "slow time scale" t 1 . The multivariate right-hand side c(t 1 , t 2 ) has then to be chosen appropriately, which depends on the application and is detailed in Section 5.

Multirate Modeling of DC-AC converters
The fast varying components, i.e., the ripples in the solution of the power converters, are assumed to be representable by basis functions p k (τ (t 2 ), d(t 1 )), which depend on the fast time scale t 2 and on the duty cycle d(t 1 ) assumed to be slowly varying. The first assumption is necessary for the convergence of the method but obvious for most classical bases. The second assumption on the dynamics of the duty cycle is not crucial but will be important to obtain an efficient method. The basis functions are periodic (with period T s ), which is realized using the function τ (t 2 ) = t 2 Ts modulo 1, also called the relative time. The multivariate solution is expanded into the basis functions and slowly varying coefficients w j,k (t 1 ) yielding [7,6,8] where Inserting the solution expansion into the partial derivatives from (2) leads to To solve the MPDEs, two methods are applied, one method for each time scale. To resolve the fast changes represented by the basis functions p k , a Galerkin approach is applied. The slowly varying coefficients are solved afterwards with a conventional time discretization. Applying the Ritz-Galerkin approach to the MPDEs (2) with respect to t 2 and on the interval of periodicity [0, T s ) yields Using integration by parts gives (function arguments are omitted in the following for the sake of readability) Since the solution is periodic with respect to t 2 in the interval [0, T s ), the boundary term vanishes. Inserting (6) and substituting t 2 with τ leads to Assembling all equations finally yields a linear system of ODEs with time-varying coefficients where and The equation system (10) can be solved using conventional time discretization with much larger time steps than for the original problem, since fast varying changes are already taken into account by the Galerkin approach and only the envelope is resolved. A disadvantage of (10) is the larger equation systems, which are N p + 1 times larger than the original ones (1). To solve the system (10) numerically, initial values have to be specified. To achieve an efficient simulation the following choice has proven advantageous: 1. Calculate the steady-state of the system (10), i.e., w s . . , N s to reconstruct the solution (ripple).
2. Since the reconstructed solution in steady-state does (usually) not fulfill the initial condition of the original ODEs (1), i.e., x s (0, 0) = x 0 , it has to be shifted by a constant c s as such that x(0, 0) = x s (0, 0) − c s = x 0 . The shift is accomplished by modifying the coefficients w s (0). In case of B-splines, due to partition of unity, this is achieved by choosing the coefficients w j (0) = w s j (0) − c s j as initial values for (10), where c s j is the j-th component of c s . This corresponds to the zero initial conditions as we use them for the original set of ODEs (1).
Other choices may still lead to the correct solution but may require higher effort from the time discretization algortihm.

Choice of basis functions
For the solution expansion (4) B-spline basis functions are employed. They allow a high-order basis while still capturing the C 0 continuity as it appears in the current ripples by construction. In the literature splines have also been used in the context of MPDE methods but for high-frequency problems. Brachtendorf et al. [9] for instant use cubic and exponential splines, which lead to a better approximation than Fourier basis functions for steep transients, while still enabling a simple extraction of the frequency spectrum and Bittner et al. [10] use an adaptive spline-wavelet to approximate solutions with steep transients. Both do not deal with C 0 solutions by construction. In contrast we take advantage of the a-priori knowledge of the excitation switching instant to contruct appropriate basis functions for the solution representation.

Introduction to B-splines
In this subsection we briefly introduce the most important properties and definitions concerning Bsplines for this work. The information is taken from Piegl et al. [11], to which the interested reader is referred for more details.
To define B-splines basis functions we first setup a knot vector Ξ = {ξ 0 , . . . , ξ m }, which is sorted in ascending order, i.e., ξ i ≤ ξ i+1 , i = 0, . . . , m − 1. The basis functions of degreep are now build up recursively from the piecewise constant basis functionp = 0 by the Cox-DeBoor recurrence formula where the first and the last knots appearp + 1 times. The regularity r j of the B-spline basis functions across the knots, i.e., their continuity C r j across the knot ξ j , j = 0, . . . , m, can be controlled using knot repetitions. The maximum regularity for degreep B-splines is given by r j,max =p − 1, which corresponds to knot repetitions of one for all knots except the knots at the boundary. To obtain less regularity, a knot repetition is introduced. Continuity C r j is achieved by a knot repetition of s j =p − r j . For instant, to represent a C 0 continuity across knot j, the knot repetition is given by s j =p − 0 =p.   where K is the number of additional knots inserted before and after the C 0 continuity, and α k ∈ [0, 1], β k ∈ [0, 1], ∀k = 1, . . . , K in ascending order.

Choice of knot vector
Using the refined knot vector (20) leads to the set of basis functions as depicted exemplary for K = 1 andp = 2 in Fig. 3, i.e., we have in total 2(p + K) + 1 basis functions. The basis functions for the solution expansion (4) are finally given by The periodicity of the set of basis functions is ensured using periodic boundary conditions in the implementation.
Using the set of B-spline basis functions as introduced above leads to a cheap calculation of the matrices arising in the MPDE approach since their elements depend only linearly on the duty cycle. For a low-order basis like classical Finite Element hat functions (i.e.,p = 1) this is rather obvious whilst for higher order B-splines it is more involved due to their non-local support. Hence this property is analyzed in the following theorem.
Using the Cox-DeBoor formula leads to The final polynomials P i,p (ξ, d) can be written as 3. The single basis function Pp +K,p consists of two terms due to the knot repetition. In the Cox-DeBoor formula, the first term in the sum stems from basis function in the interval [0, d], the second term stems from basis functions in the interval [1, d]. Therefore as well as for the other basis functions, the left term can be written as a polynomial of the form (24), the right term can be written as a polynomial of the form (27).
Using the above knowlegde, the matrix (13) is of the form where I 0 i,j , I 1 i,j are constants. Therefore the matrix I depends only linearly on the duty cycle. The matrices (14) and (15) are given by and where Q 0 i,j , Q 1 i,j , U 0 i,j and U 1 i,j are constants. The matrices are thus independent of the duty cycle d.
This is a helpful result since it allows a cheap calculation of the matrices I, Q and U for different duty cycles and time steps.

Numerical results
To verify the proposed method and measure its efficiency, we test the method on the inverter example as depicted in Fig. 1. To measure the accuracy of solutions they are compared to a reference solution calculated in Simulink using PLECS. In the following we use three simulation setups: 1.) The MPDE approach; 2.) A conventional time discretization with switch detection implemented in MATLAB; 3.) A simulation in Simulink using PLECS. The conventional approaches 2.) and 3.) exploit a-priori knowledge on discontinuities, e.g. by a pre-defined event function.
The buck converter is described by the ordinary differential equation where L = 4 mH (inductance of the coil), C = 10 µF (capacitance of the capacitor), R L = 10 mΩ (coil resistance), and R = 20 Ω (load resistance) are fixed parameters, and v C , i L and v i are the voltage at the capacitor, the current through the coil and the PWM excitation, respectively. The excitation for the inverter is generated using natural sampling PWM with a sawtooth carrier. It can be written as where s(t) = t Ts mod 1 is the sawtooth carrier,v i is the peak excitation voltage, and sgn(t) is the sign function. The switching frequency is fixed at f s = 1/T s = 5 kHz. An excerpt of the excitation is shown in Fig. 4.
For the MPDE formulation we choose the multivariate excitation as v i (t 1 , t 2 ) = v i (t 2 , d(t 1 )), i.e., we force the duty cycle, which is slowly varying compared to the switching of the excitation, to evolve along the time scale t 1 and the switching to occur along the time scale t 2 . As it turns out the right-hand side of the ODEs after the MPDE approach, i.e., (12) is also linearly dependent on the duty cycle and thus allows a cheap evaluation. The proof is analog to the one detailled in Section 4. The duty cycle is assumed to be sinusoidal and given by wherev C,desired is the desired peak output voltage of the converter and f ac is the desired frequency of the AC output voltage. The constants are fixed tov i = 350 V,v C,desired = 325 V (corresponding to 230 V effective voltage) and f ac = 50 Hz. The resulting inverter output, i.e., voltage at the capacitor and current through the coil, are depicted in Fig. 4. The multivariate solution of the MPDEs is depicted in Fig. 5. The solution of the original equations (1) is marked as black line. The MPDE approach is implemented in MATLAB and the solver ode15s is used for the Simulink, the time discretization and the MPDE approach simulation. For the MPDE approach, the maximum order MaxOrder for the solver is set to 2 whilst for the other two methods the original setting of 5 is used. To compare the solutions, the relative L 2 error of the capacitor voltage on the simulation interval Ω = [0, is approximated using the mid-point quadrature rule. The error of the current through the coil i is defined analogously. The reference solution 3. High order approximation:p = 3 and K = 3.
The error of the MPDE approach using these settings is calculated for different tolerances of the time discretization and is depicted in Fig. 6 for both the current through the coil and the voltage at the capacitor. The error is evaluated using 100 points per cycle. Reference solution values which are not available at the corresponding points are interpolated linearly. Fig. 6 shows that the error decreases with smaller tolerances for the solver until it stagnates, which is due to the fact that the approximation of the Galerkin approach bounds the accuracy. It is also visible that with better discretization settings for the Galerkin approach, the stagnation is shifted to smaller tolerances. For the three settings introduced above we now fix the tolerances for the solver as such, that we achieve highest accuracy without wasting computational effort in the stagnation region. The corresponding tolerances are marked as dots in Fig. 6 and summarized in Table 1. To be able to compare statistical data like the number of time steps, number of LU decompositions and number of function evaluations used by the solvers, the accuracy of conventional time discretization in MATLAB and PLECS are controlled by the tolerance abstol = reltol. The error of both with respect to the tolerance is shown in Fig. 7 for both voltage and current. The errors corresponding approximately to the errors of the MPDE approach are listed in Table 1 with the associated solver tolerance. Statistical data of all approaches, i.e., number of time steps, number of failed steps, number of LU decompositions, number of function evaluations and number of forward/backward substitution (solution of linear systems) are compared in Table 2 for the settings in Table 1. For the PLECS simulation only the number of time steps is supplied. The other figures of merit can to our knowledge not be extracted from the Simulink solvers. For high solver tolerance, i.e., abstol = reltol = 10 −2 , the conventional time discretization in MATLAB is slightly more accurate than the PLECS results (see Fig. 7) since the MaxStep option is used to guarantee that no switching events are missed. This explains the considerably higher number of time steps compared to PLECS in Table 2, setting 1 (lowest order). For the other settings, the number of time steps between MATLAB and PLECS is almost similar.
It should be noted, that the actual efficiency in terms of computing time depends on the efficiency of the solver used for the solution of the equation systems. Since the equation systems in the MPDE approach are larger than the ones of the original problem, the solver will take more time. This has to be taken into account when choosing the number of basis functions for the solution expansion. The MPDE approach will be especially efficient, if the computational effort for function evaluation is higher than the effort for solving the equation systems.

Conclusions
A multirate method for the efficient simulation of DC-AC switch-mode inverters has been presented. The system of equations describing the converter circuit is first formulated as a system of Multirate Partial Differential Equations (MPDEs), which allow to split the solution into components of different explicitly stated time scales. The MPDEs are efficiently solved using a combination of a Galerkin approach with B-spline basis functions for the solution expansion, and a conventional time discretization. The functionality of the proposed approach is verified on a simple inverter circuit with sinusoidal AC output. The computational efficiency is analyzed among others in terms of the number of time steps, number of LU decompositions, number of functions evaluations, compared to a conventional time discretization of the problem. It shows the high potential efficiency of the method. The method is particularly efficient in applications in which the function evaluations, i.e., the evaluations of the matrices/functions in the differential equation describing the application are computationally expensive.