# Emulator Based on Switching Functions for a Dual Interleaved Buck-Boost Converter

Authors: Marco Antonio Sánchez Vázquez; Ismael Araujo-Vargas; Kevin Cano-Pulido
Journal: Mathematical Problems in Engineering
 (2019)

---

## Abstract

Under the unavailability of some components of a complex system, the Hardware In the Loop (HIL) tool allows the emulation of other subsystems. When these devices are not available, a customized emulator can be developed based on the Piecewise Linear Model (PWLM) and a numerical method for solving the differential equations system. However, these implementations require the use of a Field Programmable Gate Array (FPGA) with extensive hardware resources. In this article we propose the use of switching functions for the modeling of power converters of a Hybrid Power System (HPS), allowing the reduction of hardware resources of the FPGA, and the number of steps per switching cycle is increased. The results are compared with SABER simulations and a PWLM evaluated with the Euler method.


---

## Body

## 1. Introduction

Frequently during the development of a complex system there are multiple subsystems under study; this represents a challenge for the rapid evolution of large projects. With the help of an emulator, multiple components can be developed quickly and efficiently; these tools are called Rapid Control Prototyping (RCP) or HIL. The HIL simulation is a form of simulation of real time; its initial use was in flight simulators and in missile guides, and nowadays its use has been extended to power electronics [1]. HILs are based on two technologies: microprocessors and FPGA. The disadvantage of the microprocessor-based emulators is that sequential logic would require clocks of the order of 1012Hz to match the FPGA concurrence with clocks of the order of 106Hz that would perform the same number of operations [2]. The applications in power electronics are the development of the train power system [3], ships [4], electric vehicles [5, 6], and microgrids [7–9], achieving in the best of cases a step size of the order of 10ns, if the numerical representation is sufficiently accurate to reduce the error by truncation.It is observed that the development of a HIL requires the mathematical model that describes the behaviour of the system; that in the case of power converters refers to the equations that solve the electrical network. The hardware resources of the FPGA depend on the model to be implemented, the synthesis procedure, and the format of the arithmetic: in Fixed Point (FXP) or Floating Point (FP). In [10] to model an NPC converter, the network equations were described with the Modified and Augmented Node Analysis (MANA), obtaining the state equations. In [11] to model a three-phase inverter, the network equations were described under the Associated Discrete Circuit (ADC). In [12] the average value method was used to calculate the output value of a three-phase interleaved converter. In [3, 13–19], equations are used in the state space to describe the behaviour of different topologies of power converters. However, in order to be implemented, an FPGA with wide range of resources is required; around 65000 Look Up Tables (LUT) to obtain a step size of the order of 5ns, in some cases multiplex arithmetic operations can reduce the size between 15000 and 6000 LUT, with a cost of increasing the step size to 250 ns [18]In this article, the model based on Switching Functions (SF) for a Dual Interleaved Buck-Boost Converter (DIBBC) with interphase transformer (IPT) was developed, and the hardware implementation was made for an FPGA of limited resources. Likewise SABER simulations results were compared with a PWLM and this proposal. It was observed that the difference between models is minimal; however, in the hardware implementation the difference is drastic. In addition, it was noted that the step size is only restricted to the core speed of the FPGA.


## 2. Switching Functions Model for DIBBC

### 2.1. The DIBBC

Figure1 shows the diagram of a DIBBC composed of aDC voltage source, vS, a switch bridgeQ1,Q2,D1,D2, an (IPT) that includesL1 andL2 whereL1 =L2, a common inductor LCOM, an output capacitorC, and a loadR [20].Figure 1
Scheme of a Dual Interleaved Buck-Boost Converter (DIBBC).


### 2.2. Operation Principle

The circuit operates under the state of transistorsQ1 andQ2, presenting two possible permanent state operation regions:D < 0.5 andD > 0.5; the main waveforms are depicted in Figure 2, in (a) - (k) corresponding toD < 0.5 and in (l) - (v) toD > 0.5. In (a) and (l) the signals of the states of the transistorsQ1 andQ2 and vG1 and vG2 are observed for the fixed frequency (1/T) and a phase shifted between them ofT/2 and a balanced duty cycle,D. (b) and (m) show the voltages in the nodes vAG and vBG. In (c) and (n) is the differential voltage vAB = vAG - vBG. vAB produces the current in the differential inductor iLDIFF or IPT (d) and (o). (e) and (p) correspond to the voltage in the common inductor vLCOM. The currents in the common inductor iLCOM are shown in (f) and (q), the currents inL1 andL2 are (g) and (h), and the currents in diodes iD1 and iD2 are shown in (h) and (s). The currents ofQ1 andQ2 are shown in (i) and (v). The currents iD in (j) and (u) are the sum of the currents in diodesD1 andD2, and the current in the capacitor in (k) and (v).Figure 2
Steady-state waveforms of the DIBBC.Figure3 shows the nine possible configurations of the DIBBC. The configurations from I to IV, Figures 3(a)–3(d), correspond to Continuous Current Mode (CCM), the other five configurations are presented in the DCM, and the Discontinuous Current Mode (DCM) configurations V to IX are shown in Figures 3(e)–3(i); the DCM occurs wheniL1 = 0 oriL2 = 0; under these conditionsiD1 = 0 oriD2 = 0.Figure 3
DIBBC configurations.
(a) (b) (c) (d) (e) (f) (g) (h) (i)


### 2.3. Switching Functions Model for a DIBBC

In each configuration of the circuit, the voltages of the nodesvAB and vBG, which depend only on vS and vO, can be established by the product of (1)vH=MVvSThe vectors vH are the voltages in the vAG and vBG nodes: vAGvBGT, and the vector vS is the supply voltage vS and the capacitor voltage vO: vSvOT. MV is a transformation matrix for each configuration that is called Voltage Switching Matrix. For the currents of transistorsQ1 and Q2 there is a current vector iQ: iQ1iQ2T, and for the currents of the diodes, iD is iD1iD2T. The current vector of the inductors iL is iL1iL2T; after iL, iQ, and iD it can be obtained through the Current Switching MatricesMIQ andMID shown in (2) and (3), respectively. Equation (1) is called voltage switching function (FSWv) and (3) is called current switching function (FSWi):(2)iQ=MIQiL(3)iD=MIDiLTable 1 shows theMV andMID matrices for each configuration of the circuit; it indicates that the conditions for each configuration are presented and shade the configurations of the CCM.MQ is excluded because at the moment it is not of interest for this work.Table 1
Voltage switching function in A and B nodes and current switching function in diodes 1 and 2.The current inLCOM can be divided into two when applying the superposition principle: the current that produces the voltage in node A: vLCOMA and the current that produces the voltage in node B: vLCOMB. The voltages in CCM for LCOMA, LCOMB,L1, andL2, are given by (4), (5), (6), and (7), respectively, and are obtained from the node analysis between A, B, COM, and GND of the circuit of Figure 1, for whichL1 =L2 must be considered.(4)vLCOMA=12vAG(5)vLCOMA=12vBG(6)vL1=12vAG-vBG(7)vL2=12vBG-vAGIn DCM the voltages in LCOMA, LCOMB,L1, andL2 are given by (8), (9), (10), and (11), respectively:(8)vLCOMA=LCOML+LCOMvAG(9)vLCOMB=LCOML+LCOMvBG(10)vL1=LL+LCOMvAG-vBG(11)vL2=LL+LCOMvBG-vAGEquations (4) to (11) are the interactions in the voltage in the inductor network between nodes A, B, COM, and GND, and they are called XFRMv. The network of inductors is formed by an interphase transformer (IPT) with the branchesL1 andL2 and a common inductor, LCOM, the current proper to the IPTiLS is obtained by means of (12) where vL is the vector vL1vL2T andL−1 is the inverse matrix of the inductances of the transformer and iLS is the vector iLS1iLS2T.(12)iLS=L-1∫vLdtiLCOMA and iLCOMB are given by (13) and (14), respectively,(13)iLCOMA=1LCOM∫vLCOMAdt(14)iLCOMB=1LCOM∫vLCOMBdtThe currentsiL1 andiL2 are given in (15) and (16), respectively. This set of equations are the interaction of the currents in the inductor network and are called XFRMi:(15)iL1=iLS1+iLCOMA(16)iL2=iLS2+iLCOMBIn the DCM,L1 andL2 stop behaving like a transformer and become an inductor when leaving one of its branches at high impedance, so we can dovL1 =vL2 = 0. Observing the sets of (4) and (8), (5) and (9), (6) and (10), and (7) and (10), we have the common factors vAG, vBG, vAG-vBG, and vBG-vAG, respectively, and we can summarize (4) to (11) in Table 2, where we have the common factor for each inductor voltage and GXFRMV gain factor.Table 2
X F R M V factors.
CCMGXFRMV  (Config. I to IV) DCMGXFRMV  (Config. VI to IX) Common factor v L C O M A 1 2 L C O M L + L C O M v A G v L C O M B 1 2 L C O M L + L C O M v B G v L 1 1 2 0 v A G - v B G  v L 2 1 2 0 v B G - v A GThe balance of the currentiD is described by (17) and (18); (17) corresponds to the current coming from diodes D1 and D2 and (18) corresponds to the current injected into the RC output network.(17)iD=iD1+iD2(18)iD=iC+iRIf iR=vO/R and iC=Cdvo/dt are substituted in (18) and the equation is reordered, then (19) is obtained:(19)dvodt=iDC-vORCIf (19) is integrated, (20) is obtained, which would be the expression for modeling the output voltage vO(20)vO=1C∫iDdt-1RC∫vOdtEquations (1) to (20) and Tables 1 and 2 describe the system model; if you see each equation as a function of input output you can build a block diagram. This diagram is shown in Figure 4.Figure 4
Block diagram of the DIBBC described by switching functions.


### 2.4. System Discretization

The system of Figure4 is in the time domain; the Laplace transform must be applied to convert it to the domain of the complex variable s. In this diagram, with the exception of the integrators, all are arithmetic operators or gains, so the discretization consisted of replacing the integrators with discrete integrators of the block diagram. The discrete integrator that was used in this work has a delay physically feasible, and the transfer function of integration is given in equation (21): (21)Hs=1sEquation (21) is discretized by applying the z-transform, obtaining the transfer function of an integrator shown in (22), where TS is the sampling period:(22)z1s=TS1-z-1Equation (22) corresponds to an integrator without delay; an integrator with delay according to the delay theorem of the z transform is shown in (23)Hz=Tsz-11-z-1In Figure 5 a block diagram of the discrete model of the circuit of Figure 1 is shown.Figure 5
Discrete model of a DIBBC.


## 2.1. The DIBBC

Figure1 shows the diagram of a DIBBC composed of aDC voltage source, vS, a switch bridgeQ1,Q2,D1,D2, an (IPT) that includesL1 andL2 whereL1 =L2, a common inductor LCOM, an output capacitorC, and a loadR [20].Figure 1
Scheme of a Dual Interleaved Buck-Boost Converter (DIBBC).


## 2.2. Operation Principle

The circuit operates under the state of transistorsQ1 andQ2, presenting two possible permanent state operation regions:D < 0.5 andD > 0.5; the main waveforms are depicted in Figure 2, in (a) - (k) corresponding toD < 0.5 and in (l) - (v) toD > 0.5. In (a) and (l) the signals of the states of the transistorsQ1 andQ2 and vG1 and vG2 are observed for the fixed frequency (1/T) and a phase shifted between them ofT/2 and a balanced duty cycle,D. (b) and (m) show the voltages in the nodes vAG and vBG. In (c) and (n) is the differential voltage vAB = vAG - vBG. vAB produces the current in the differential inductor iLDIFF or IPT (d) and (o). (e) and (p) correspond to the voltage in the common inductor vLCOM. The currents in the common inductor iLCOM are shown in (f) and (q), the currents inL1 andL2 are (g) and (h), and the currents in diodes iD1 and iD2 are shown in (h) and (s). The currents ofQ1 andQ2 are shown in (i) and (v). The currents iD in (j) and (u) are the sum of the currents in diodesD1 andD2, and the current in the capacitor in (k) and (v).Figure 2
Steady-state waveforms of the DIBBC.Figure3 shows the nine possible configurations of the DIBBC. The configurations from I to IV, Figures 3(a)–3(d), correspond to Continuous Current Mode (CCM), the other five configurations are presented in the DCM, and the Discontinuous Current Mode (DCM) configurations V to IX are shown in Figures 3(e)–3(i); the DCM occurs wheniL1 = 0 oriL2 = 0; under these conditionsiD1 = 0 oriD2 = 0.Figure 3
DIBBC configurations.
(a) (b) (c) (d) (e) (f) (g) (h) (i)


## 2.3. Switching Functions Model for a DIBBC

In each configuration of the circuit, the voltages of the nodesvAB and vBG, which depend only on vS and vO, can be established by the product of (1)vH=MVvSThe vectors vH are the voltages in the vAG and vBG nodes: vAGvBGT, and the vector vS is the supply voltage vS and the capacitor voltage vO: vSvOT. MV is a transformation matrix for each configuration that is called Voltage Switching Matrix. For the currents of transistorsQ1 and Q2 there is a current vector iQ: iQ1iQ2T, and for the currents of the diodes, iD is iD1iD2T. The current vector of the inductors iL is iL1iL2T; after iL, iQ, and iD it can be obtained through the Current Switching MatricesMIQ andMID shown in (2) and (3), respectively. Equation (1) is called voltage switching function (FSWv) and (3) is called current switching function (FSWi):(2)iQ=MIQiL(3)iD=MIDiLTable 1 shows theMV andMID matrices for each configuration of the circuit; it indicates that the conditions for each configuration are presented and shade the configurations of the CCM.MQ is excluded because at the moment it is not of interest for this work.Table 1
Voltage switching function in A and B nodes and current switching function in diodes 1 and 2.The current inLCOM can be divided into two when applying the superposition principle: the current that produces the voltage in node A: vLCOMA and the current that produces the voltage in node B: vLCOMB. The voltages in CCM for LCOMA, LCOMB,L1, andL2, are given by (4), (5), (6), and (7), respectively, and are obtained from the node analysis between A, B, COM, and GND of the circuit of Figure 1, for whichL1 =L2 must be considered.(4)vLCOMA=12vAG(5)vLCOMA=12vBG(6)vL1=12vAG-vBG(7)vL2=12vBG-vAGIn DCM the voltages in LCOMA, LCOMB,L1, andL2 are given by (8), (9), (10), and (11), respectively:(8)vLCOMA=LCOML+LCOMvAG(9)vLCOMB=LCOML+LCOMvBG(10)vL1=LL+LCOMvAG-vBG(11)vL2=LL+LCOMvBG-vAGEquations (4) to (11) are the interactions in the voltage in the inductor network between nodes A, B, COM, and GND, and they are called XFRMv. The network of inductors is formed by an interphase transformer (IPT) with the branchesL1 andL2 and a common inductor, LCOM, the current proper to the IPTiLS is obtained by means of (12) where vL is the vector vL1vL2T andL−1 is the inverse matrix of the inductances of the transformer and iLS is the vector iLS1iLS2T.(12)iLS=L-1∫vLdtiLCOMA and iLCOMB are given by (13) and (14), respectively,(13)iLCOMA=1LCOM∫vLCOMAdt(14)iLCOMB=1LCOM∫vLCOMBdtThe currentsiL1 andiL2 are given in (15) and (16), respectively. This set of equations are the interaction of the currents in the inductor network and are called XFRMi:(15)iL1=iLS1+iLCOMA(16)iL2=iLS2+iLCOMBIn the DCM,L1 andL2 stop behaving like a transformer and become an inductor when leaving one of its branches at high impedance, so we can dovL1 =vL2 = 0. Observing the sets of (4) and (8), (5) and (9), (6) and (10), and (7) and (10), we have the common factors vAG, vBG, vAG-vBG, and vBG-vAG, respectively, and we can summarize (4) to (11) in Table 2, where we have the common factor for each inductor voltage and GXFRMV gain factor.Table 2
X F R M V factors.
CCMGXFRMV  (Config. I to IV) DCMGXFRMV  (Config. VI to IX) Common factor v L C O M A 1 2 L C O M L + L C O M v A G v L C O M B 1 2 L C O M L + L C O M v B G v L 1 1 2 0 v A G - v B G  v L 2 1 2 0 v B G - v A GThe balance of the currentiD is described by (17) and (18); (17) corresponds to the current coming from diodes D1 and D2 and (18) corresponds to the current injected into the RC output network.(17)iD=iD1+iD2(18)iD=iC+iRIf iR=vO/R and iC=Cdvo/dt are substituted in (18) and the equation is reordered, then (19) is obtained:(19)dvodt=iDC-vORCIf (19) is integrated, (20) is obtained, which would be the expression for modeling the output voltage vO(20)vO=1C∫iDdt-1RC∫vOdtEquations (1) to (20) and Tables 1 and 2 describe the system model; if you see each equation as a function of input output you can build a block diagram. This diagram is shown in Figure 4.Figure 4
Block diagram of the DIBBC described by switching functions.


## 2.4. System Discretization

The system of Figure4 is in the time domain; the Laplace transform must be applied to convert it to the domain of the complex variable s. In this diagram, with the exception of the integrators, all are arithmetic operators or gains, so the discretization consisted of replacing the integrators with discrete integrators of the block diagram. The discrete integrator that was used in this work has a delay physically feasible, and the transfer function of integration is given in equation (21): (21)Hs=1sEquation (21) is discretized by applying the z-transform, obtaining the transfer function of an integrator shown in (22), where TS is the sampling period:(22)z1s=TS1-z-1Equation (22) corresponds to an integrator without delay; an integrator with delay according to the delay theorem of the z transform is shown in (23)Hz=Tsz-11-z-1In Figure 5 a block diagram of the discrete model of the circuit of Figure 1 is shown.Figure 5
Discrete model of a DIBBC.


## 3. Hardware Implementation

For implementation there is a card with a low-end FPGA Altera Cyclone IV E model EP4CE22F17C6N with 22320 LUT. The manufacturer provides the tool to develop systems called Quartus Prime, which allows the implementation of logic and arithmetic, in two languages of hardware description: VHDL and Verilog.


### 3.1. Arithmetic

Using the tool for IP development (Intellectual Property) of Quartus Prime called LPM Mega Wizard, the additions, subtractions, and multiplications of the model of Figure4 were implemented. It was decided to use fixed point arithmetic with the format Q (64.32), having 32 bits for the integer part and 32 for the fractional part. The advantage of using fixed point is that the implementation in hardware does not require sequential operations and allows all operations to be performed concurrently. The decision to use the fixed point format was made taking into account the dynamic range of the signals and the error of the representation of the constants of the system. With this format, the truncation error of the representation of the constants is less than 0.0005%. In Results, an error analysis will be shown over time.


### 3.2. Switching Functions

Only in the case that there are two possible states such as that of the switches, in hardware you can replace that switch represented by a product in the switching function by a multiplexer, like the functions of (1) to (3). Figure 6 shows how the switching function was implemented. It is observed that the products are replaced by multiplexers, which are controlled by the configuration multiplexers, which allow the input of the coefficients of the mX_mn switching matrices. A 64-bit multiplier in hardware for the CYCLONE IV occupies a space of 4352 LUT, while a 64-bit multiplexer occupies only 64 LUT, which represents a reduction of 68 times the hardware space.Figure 6
Hardware implementation for a switching function.


## 3.1. Arithmetic

Using the tool for IP development (Intellectual Property) of Quartus Prime called LPM Mega Wizard, the additions, subtractions, and multiplications of the model of Figure4 were implemented. It was decided to use fixed point arithmetic with the format Q (64.32), having 32 bits for the integer part and 32 for the fractional part. The advantage of using fixed point is that the implementation in hardware does not require sequential operations and allows all operations to be performed concurrently. The decision to use the fixed point format was made taking into account the dynamic range of the signals and the error of the representation of the constants of the system. With this format, the truncation error of the representation of the constants is less than 0.0005%. In Results, an error analysis will be shown over time.


## 3.2. Switching Functions

Only in the case that there are two possible states such as that of the switches, in hardware you can replace that switch represented by a product in the switching function by a multiplexer, like the functions of (1) to (3). Figure 6 shows how the switching function was implemented. It is observed that the products are replaced by multiplexers, which are controlled by the configuration multiplexers, which allow the input of the coefficients of the mX_mn switching matrices. A 64-bit multiplier in hardware for the CYCLONE IV occupies a space of 4352 LUT, while a 64-bit multiplexer occupies only 64 LUT, which represents a reduction of 68 times the hardware space.Figure 6
Hardware implementation for a switching function.


## 4. Results

Four simulations were carried out, the first using a simulator for physical systems, which in this case was SABER 2.4, the second simulation using PWLM evaluated by the Euler method in MatLAB 2015a, the third being the switching functions using a SIMULINK 2015a model and evaluated by the Euler method, and the fourth being the embedded model of the switching functions with the RTL simulation tool included in Quartus Prime 18.00. Table3 shows the values of the simulation parameters. SABER is a very accurate simulator so it will be the reference to calculate the error. The state variables of the PWLM are iL1, iL2, and vO, so the graphs for them are displayed. Figures 7, 8, and 9 show the results of the simulations for the time from 0 ms to 10 ms: (a) corresponds to the four simulations, (b) corresponds to the error of the PWLM, the SF evaluated in SIMULINK, and SF evaluated by the FPGA all with respect to SABER, (c) is a zoom between 9.50 ms to 9.55 ms, and (d) is a zoom of the error for the interval of (c). When the system is in steady state it is observed that the errors between the SFs overlap without diverging. The error for iL1 at t = 9.526 ms for the PWLM is under 1.09%, for both SFs it is 1.22%, the error for iL2 at t = 9.526 ms for PWLM is 0.83%, and for SFs it is 0.63%; the error for vO at t = 9.526 ms for PWLM is 0.45% and for SFs it is 0.44%. It should be noted that the circuit enters the DCM in two regions: when the circuit is turned on at t = 0s and during the transient in the interval t = 159µs to t = 413µs. The system reaches the steady state at t = 3.5 ms.Table 3
Simulation parameters.
Parameter Value V s 350 V F s w 75 kHz F s t 150 MHz D 45% R 4 Ω L 38µH L c o m 7µH C 95µFFigure 7
Analysis of the error ofiL1 between SABER and PWLM, SF Simulink and SF FPGA.
(a) (b) (c) (d)Figure 8
Analysis of the error ofiL2 between SABER and PWLM, SF Simulink and SF FPGA.
(a) (b) (c) (d)Figure 9
Analysis of the error ofvO between SABER and PWLM, SF Simulink and SF FPGA.
(a) (b) (c) (d)In terms of hardware implementation, a PWLM for the DIBBC would occupy a space of 79552 LUT in a Cyclone IV. In the case of the switching function model it deals with 9738 LUT (43.63% of the resources of the available card), depending on the Quartus Prime synthesis reports. Other embodiments were made for the PWLM by multiplexing the multipliers: one was multiplexing one row of equation and another was multiplexing rows of matrix. The results are shown in Table4.Table 4
Comparison between different implementation strategies.
Implementation Sampling Frequency Number of steps per switching cycleFSa/FSW Multipliers Resources FPGA(CYCLONE 4 22K) PWLM multiplier multiplexed in equation row 52.5 MHz 700 3 14.67%  PWLM multiplexer multiplexed in matrix row 105 MHz 1400 9 89.60%  SFM 150 MHz 2000 5 43.63%


## 5. Discussion

In order to implement a HIL based on a PWLM whose step size is less than 10 ns in an FPGA, extensive hardware resources are required. It is observed that when using a model based on switching functions and fixed point arithmetic with a high resolution, the space in hardware for its implementation is drastically reduced, allowing the use of a FPGA with few resources and with accuracy similar to that of other implementations and the step size is restricted to the core speed of the FPGA. This implementation is intended to be used for the development of a hybrid power system, since it is required to embed in a FPGA the models of several power converters, sources, and loads. This implementation can be extended for use in microgrids. The switching functions allow seeing in the systems how the flow of the power is in a natural way so that the power balance does not require a very complex mathematical description that increases the hardware resources of a HIL.



---

*Source: 5930548-2019-08-04.xml*