Articles
Received: 19 October 2021
Accepted: 07 October 2022
Published: 31 December 2023
DOI: https://doi.org/10.22201/icat.24486736e.2023.21.6.1816
Funding
Funding source: Instituto Tecnologico Superior del Sur de Guanajuato
Funding source: Guanajuato Goverment
Contract number: 10774.21-DD
Funding statement: Instituto Tecnologico Superior del Sur de Guanajuato and Guanajuato Goverment, under project 10774.21-DD
Abstract: The use of hardware in the loop systems implemented in FPGAs is constantly growing due to their performance. However, hardware implementation of numerical methods to solve differential equations presents some challenges when applied to power converters. This paper shows a comparison of several numerical methods: Euler, Heun, Midpoint, and fourth order Runge-Kutta, considering the accuracy of the methods and how they can be applied to power converters, where the equations change depending on the status of the switches. Results show that the speed in the solution of the numerical method is the main variable that affects the accuracy of the simulation, so to keep a fast resolution speed numerical method with low resources should be used.
Keywords: HIL simulation, Numeric methods, Power converter, Accuracy.
1. Introduction
The hardware in the loop (HIL) simulation consists of the substitution of a real element for a digital system solving a mathematical model in real time. It is a technique widely used in segments such as the automotive, military, aerospace industry and more recently in power electronics (Faruque & Dinavahi, 2010), mainly to carry out tests and validation of new products, which could be dangerous, expensive or with complicated scenarios to obtain in a real environment.
Power electronics present challenges with respect to HIL simulation, caused by the high switching frequencies used, which are in the range of tens of kilohertz (kHz). There is commercial equipment that allows to conduct the HIL simulation for power converters (Karimi et al., 2010; Li et al., 2010; Mayet et al., 2017; Ramos et al., 2017). However, they present the disadvantage of a high economic cost, in addition, the solution time is in the range of microseconds, which limits the switching frequency used, it is recommended that the solution time be at least 100 times smaller than the switching period (Dagbagi et al., 2016), additionally, there are not control over the solution method used to solve the continuous system. Due to this, various researchers have developed customized systems based mainly on FPGAs to perform HIL simulation, achieving solution times in the order of hundreds of nanosecond conductor (Jiménez et al., 2014; Li & Jean, 2017; Lucia et al., 2010; Majstorovic et al., 2011; Matar & Iravani, 2013; Selvamuthukumaran & Gupta, 2014; Wang et al., 2014), however, languages with a high learning curve are used, such as VHDL or Verilog to carry out the implementation, which, significantly increases the complexity the implementation.
The HIL simulation begins with the development of a mathematical model in continuous time, to implement the model in a digital system; it must be solved using some numerical method. The most used numerical method is the Euler method, due to the easy implementation, some other methods such as Heun and fourth order Runge-Kutta, are mentioned as possibilities to perform the HIL simulation (Saralegui et al., 2018), however, experimental results are not obtained.
There are two types of HIL the controller hardware in the loop (CHIL) and the power hardware in the loop (PHIL). In CHIL the objective is to test the controller, in Mitsugi et al. (2020) it is used to test the control of an energy storage system, in Amiri et al. (2020), it is used to test the controller of a converter used to correct the power factor, in Zucuni et al (2020), and (Estrada et al., 2021), it is used to test a new cost function for predictive controllers, in Busarello et al. (2020) it is used to test digital controls for converters connected to the electrical network, the HIL simulation is helpful to reduce the time to market for new products.
In PHIL, the objective is to test the converter. Examples of this equipment are PV emulators, wind turbine emulators or any power supply that can emulate the behavior of an energy system generator.
This article discusses four numerical methods from the point of view of an FPGA-based HIL design: Euler, Heun, midpoint, and fourth order Runge-Kutta. The design effort is analyzed considering the resources used in the FPGA and the precision of the simulation, making the comparison against a real converter. The case study is a buck converter, which is a switched converter, so the equations are constantly changing, in each switching period.
The rest of the paper is organized as follows: Section II describes the case study and the equations that model the converter. Section III shows how to apply the different numerical methods to solve the converter model. Section IV shows the results obtained in the simulation conducted by each method and finally, section V presents the conclusions.
2. Buck converter modelling
As a case study, the buck converter is used (Figure 1), to evaluate the HIL simulation, this is a converter widely used as a power source for consumer electronics.
The buck converter has seven elements: a power supply (vin ), a switch (S), a diode (D), an inductor (L), a series resistance of inductor (RL ), a capacitor (C), and a load (R)
To model the converter, the following considerations were made: the switch and the diode are considered ideal.
The buck converter has three switching states, determined by the control signal of the switch S and the value of the inductor current (iL ).
The first state occurs when the switch is on, and the diode is not conducting as seen in Figure 2. The second state begins when the switch is turned off and the diode begins to conduct (Figure 3), and the third state occurs when the Inductor current is equal to zero and the switch is off as shown in Figure 4. However, when the power converter is operating in continuous conduction mode (CCM), only the first two states are present. The differential equations are obtained using Kirchhoff's laws.
Applying Kirchhoff's laws to the circuit in Figure 2, we obtain the equations for iL (Eq. 1) and the voltage across the capacitor (vC ) (Eq. 2).
Where RDS is the MOSFET on resistance.
In all states iO is equal to (Eq. 3):
In the same way, but using the circuit of Figure 3, the equations for iL (Eq. 4) and vC (Eq. 5) are obtained.
Where VD is the forward voltage of the diode.
Applying Kirchoff's laws to the circuit in Figure 4, the (Eqs. 6 and 7) are obtained:
Equations (1) - (7) model the converter in the three states that it can present.
3. Numerical method solution
To solve differential equations using numerical methods, a known value (yk ) and the slope of the function (θ) are used, with these data it is possible to calculate an approximation to the following value (y(k+1) ), of the function in an integration time (h), this can be seen graphically in Figure 5.
The main difference between the different numerical methods is how θ is calculated (Butcher, 2008).
Table 1 shows the formulation to obtain the solution by the different methods.
In Appendix ATable A1 the solution of the buck converter model using Euler method is shown. In Appendix B the solution using Heun method, in Appendix C the solution using Midpoint method is shown and finally in Appendix D the solution using the fourth order RK, these solutions are easily implemented in high-level languages, such as C or using programs such as Matlab or LabVIEW. In this paper LabVIEW was used for its simplicity, power and for the characteristic of being able to download its code directly on FPGA-based platforms, in this paper a CompactRIO system Model 9067 with a 667 MHz Dual-Core CPU, 512 MB DRAM, 1 GB Storage and Zynq-7020 FPGA is used.
In Figure 6 the experimental testbed used to obtain the results is shown. It can be seen the elements used during the tests.
The main ones are: a function generator to generate the PWM signal, the buck converter, the CompactRIO in which the converter model is programmed and the analog outputs (in this case the simulated inductor current and capacitor voltage), are obtained, an oscilloscope to be able to visualize the signals of the real converter and the simulation at the same time, and finally, the CPU in which the model of the converter was programmed, the graphic user interface (GUI), is running.
In Figure 7 a block diagram of the experimental test bed is shown.
4. Results
The buck converter was designed using the methodology shown in Kazimierczu (2008); the values for the passive components are shown in Table 2.
The numerical solution of the continuous model was programmed using the methodology shown in (Estrada et al. 2020)
Tests were performed with a fs of 100 kHz and then with a fs of 50 kHz using the numerical methods mentioned above. Figure 8 shows the current and voltage transient comparison between a real converter and the converter model using the four different numerical methods and a fs 100 kHz.
Once the results of all numerical methods are obtained for a fs of a 100kHz, the mean arithmetic error (MAE) is obtained, which is the average of all the errors at each instant of time, comparing the results of the HIL simulations with those of the real circuit. These results are shown in Table 3.
The same tests were performed reducing the fs from 100 kHz to 50 kHz. Figure 9 shows the current and voltage transient comparison between a real converter and the converter model using the four selected numerical methods with a switching frequency of 50 kHz. Again, obtaining the errors of each numerical method, but now with a fs of 50kHz, Table 4 was obtained with a comparison between each numerical method can be observed clearly.
In Figure 8 a load change was carried out in order to verify the behavior of the model. The load was changed from 24W to 12W. The results prove that the HIL system presents a good transient behavior with any numerical method. In addition to the comparison in Tables 3 and 4, to analyze the effectiveness of the numerical methods, the number of computational resources and solution time that each method requires is obtained. Table 5 shows the resources and time used by each numerical method.
Conclusions
The results reported in Tables 3, 4 and 5 show the arithmetic mean error between the developed HIL simulator and a real buck converter prototype. It can be seen that although Euler's method is considered the worst numerical method in terms of accuracy (as long as they have the same solution time), it is the method that contains the least error, and this is because it is the method with the shortest solution time which helps its accuracy.
Another crucial point to consider is the error when the switching frequency increases, since it is recommended that the solution time of the real-time simulation is at least 100 times smaller than the switching period of the converter, so, the one with the smallest error working at 100 kHz is Euler's method.
The results obtained shows that, although there are better numerical methods than Euler's with respect to stability and error, this is the best method for HIL systems where the integration time must be kept small and resources are limited, such as the case of power converters.
Although the results show that the Euler method is the best for high switching frequencies, the other methods are also capable of solving a system in real time and can be used for other types of applications where the integration time does not have to be so small and computational resources are not a limitation in its implementation.
References
Amiri, P., Gautam, D., Botting, C., Eberle, W., & Wang, L. (2020). Real-time hardware-in-the-loop simulation and control of totem pole PFC converter. In2020 IEEE 21st Workshop on Control and Modeling for Power Electronics (COMPEL)(pp. 1-7). IEEE. https://doi:10.1109/COMPEL49091.2020.9265648
Busarello, C. T. D., Zeb, K. & Simões, M. G. (2020). Highly accurate digital current controllers for single-phase LCL-filtered grid-connected inverters.Electricity, 1(1), 12-36. https://doi.org/10.3390/electricity1010002
Butcher, J. C. (2008). Numerical Methods for Ordinary Differential Equations. 2nd edition.
Dagbagi, M., Hemdani, A., Idkhajine, L., Naouar, M. W., Monmasson, E., & Slama-Belkhodja, I. (2016). ADC-Based Embedded Real-Time Simulator of a Power Converter Implemented in a Low-Cost FPGA: Application to a Fault-Tolerant Control of a Grid-Connected Voltage-Source Rectifier.IEEE Transactions on Industrial Electronics,63(2), 1179-1190. https://doi.org/10.1109/TIE.2015.2491883
Estrada, L., Vázquez, N., Vaquero, J., de Castro, Á., & Arau, J. (2020). Real-time hardware in the loop simulation methodology for power converters using labview FPGA.Energies,13(2), 373. https://doi.org/10.3390/en13020373
Estrada, L., Vazquez, N., Vaquero, J., Hernandez, C., Arau, J., & Huerta, H. (2021). Finite control set-model predictive control based on sliding mode for bidirectional power inverter.IEEE Transactions on Energy Conversion,36(4), 2814-2824. https://doi.org/10.1109/TEC.2021.3063601
Faruque, M. O., & Dinavahi, V. (2010). Hardware-in-the-loop simulation of power electronic systems using adaptive discretization.IEEE transactions on industrial electronics,57(4), 1146-1158. https://doi.org/10.1109/TIE.2009.2036647
Jiménez, Ó., Lucía, Ó., Urriza, I., Barragan, L. A., Navarro, D., & Dinavahi, V. (2014). Implementation of an FPGA-based online hardware-in-the-loop emulator using high-level synthesis tools for resonant power converters applied to induction heating appliances.IEEE transactions on industrial electronics ,62(4), 2206-2214. https://doi.org/10.1109/TIE.2014.2360138
Karimi, S., Poure, P., & Saadate, S. (2010). An HIL-based reconfigurable platform for design, implementation, and verification of electrical system digital controllers.IEEE transactions on industrial electronics ,57(4), 1226-1236. https://doi.org/10.1109/TIE.2009.2036644
Kazimierczu, M. K. (2008). Pulse-Width Modulated DC-DC Power Converters. Wiley. https://doi.org/10.1002/9780470694640
Li, W., & Jean, B. (2017). An equivalent circuit method for modelling and simulation of modular multilevel converter in real-time HIL test bench. In2017 IEEE Power & Energy Society General Meeting(pp. 1-1). IEEE. https://doi.org/10.1109/PESGM.2017.8274651
Li, W., Joos, G., & Belanger, J. (2010). Real-Time Simulation of a Wind Turbine Generator Coupled With a Battery Supercapacitor Energy Storage System.IEEE transactions on industrial electronics , 4(57), 1137-1145. https://doi.org/10.1109/TIE.2009.2037103
Lucia, O., Jimenez, O., Barragan, L. A., Urriza, I., Burdio, J. M., & Navarro, D. (2010). Real-time FPGA-based hardware-in-the-loop development test-bench for multiple output power converters. In2010 Twenty-Fifth Annual IEEE Applied Power Electronics Conference and Exposition (APEC)(pp. 309-314). IEEE. https://doi.org/10.1109/APEC.2010.5433653
Majstorovic, D., Celanovic, I., Teslic, N. D., Celanovic, N., & Katic, V. A. (2011). Ultralow-latency hardware-in-the-loop platform for rapid validation of power electronics designs.IEEE transactions on industrial electronics ,58(10), 4708-4716. https://doi.org/10.1109/TIE.2011.2112318
Matar, M., & Iravani, R. (2013). The reconfigurable-hardware real-time and faster-than-real-time simulator for the analysis of electromagnetic transients in power systems.IEEE transactions on power delivery,28(2), 619-627. https://doi.org/10.1109/TPWRD.2012.2229723
Mayet, C., Delarue, P., Bouscayrol, A., & Chattot, E. (2017). Hardware-In-the-Loop Simulation of Traction Power Supply for Power Flows Analysis of Multitrain Subway Lines.IEEE Transactions on Vehicular Technology,66(7), 5564-5571. https://doi.org/10.1109/TVT.2016.2622245
Mitsugi, Y., Shigemasa, T., Terazono, T., Hashiguchi, H., Ota, Y., & Nakajima, T. (2020). Control hardware-in-the-loop simulation on fast frequency response of energy storage system equipped with advanced frequency detection algorithm. In2020 9th International Conference on Renewable Energy Research and Application (ICRERA)(pp. 202-209). IEEE. https://doi.org/10.1109/ICRERA49962.2020.9242742
Ramos, G. A., Hernández, M. E., & Trujillo, M. D. (2017). Function test by hil for dc-dc converters type: Buck, boost and buck-boost. In2017 IEEE Workshop on Power Electronics and Power Quality Applications (PEPQA)(pp. 1-6). IEEE. https://doi.org/10.1109/PEPQA.2017.7981647
aralegui, R., Sanchez, A., Martínez-García, M. S., Novo, J., & de Castro, A. (2018). Comparison of numerical methods for hardware-in-the-loop simulation of switched-mode power supplies. In2018 IEEE 19th Workshop on Control and Modeling for Power Electronics (COMPEL)(pp. 1-6). IEEE. https://doi.org/10.1109/COMPEL.2018.8460060
Selvamuthukumaran, R., & Gupta, R. (2014). Rapid prototyping of power electronics converters for photovoltaic system application using Xilinx System Generator.IET Power Electronics, 7(9), 2269-2278. https://doi.org/10.1049/iet-pel.2013.0736
Wang, W., Shen, Z., & Dinavahi, V. (2014). Physics-based device-level power electronic circuit hardware emulation on FPGA.IEEE Transactions on Industrial Informatics,10(4), 2166-2179. https://doi.org/10.1109/TII.2014.2361656
Zucuni, J. P., Carnielutti, F., Pinheiro, H., Norambuena, M., & Rodriguez, J. (2020). Cost function design for stability assessment of modulated model predictive control. In2020 22nd European Conference on Power Electronics and Applications (EPE'20 ECCE Europe)(pp. P-1). IEEE. https://doi.org/10.23919/EPE20ECCEEurope43536.2020.9215797
Appendix A
Solution using Euler Method
Using the solution presented in Table 1 for Euler method, the next equations corresponding to the three states of the buck converter are derived:
Appendix B
Solution using Heun method
Using the solution presented in Table 1 for Heun method, the next equations corresponding to the three states of the buck converter are derived:
Appendix C
Solution using Midpoint method
Using the solution presented in Table 1 for Midpoint method, the next equations corresponding to the three states of the buck converter are derived:
Appendix D
Solution using fourth order RK Method
Using the solution presented in Table 1 for fourth order RK, the next equations corresponding to the three states of the buck converter are derived:
Notes
This research was supported by TecNM, Instituto Tecnologico Superior del Sur de Guanajuato and Guanajuato Goverment, under project 10774.21-DD.
Author notes
*Corresponding author. E-mail address: n.vazquez@ieee.org (N. Vázquez).
Conflict of interest declaration
The authors have no conflict of interest to declare.