Hardware-in-the-loop (HIL) testing is real-time simulation that lets you begin testing your embedded code without needing system hardware. This lets you test for abnormal and fault conditions that may damage hardware if the code under development does not operate within specifications. Power electronics control systems are integral parts of electric-based transportation and renewable energy systems. Validating embedded code for these control systems by testing prototypes is challenging because the risk of hardware damage prevents you from exercising systems across the complete range of transient conditions.
Hardware-in-the-loop simulation performance depends on both the complexity of the electrical system dynamics that you’re modeling and the real-time computer hardware you’re using. For example, you can choose how to model the power electronics switching behavior of the motor drive inverter. You can use an average-value inverter model that averages voltage across the switching period, as it computes quickly and provides the needed dynamics. And to understand the impact of the harmonics injected by power electronic components, you need to include their on-off behavior and accept the burden to the processor of the hardware-in-the-loop computer.
To ensure real-time behavior when simulating switching behavior, you need to run your simulation sampling frequency 100 times faster than the expected switching speed of the actual system. For example, in a motor control application running at a switching frequency of 10 KHz, the hardware-in-the-loop simulation needs to run at 1 MHz to capture the nonlinearities caused by switching devices. To run a simulation at 1 MHz and higher, you need the real-time system to have low I/O latency and a processor that can achieve the operating frequency.
When performing hardware-in-the-loop testing for power electronics systems, there is no absolute guidance on whether a CPU or an FPGA is better for simulating systems with switching dynamics. When deciding, you need to consider the complexity of the model, the mathematical detail of the power electronics, the modeling detail of the loads and power supplies, and the number of channels and kinds of test system I/Os. You may find that it is beneficial to use both CPUs and FPGAs if your hardware-in-the-loop system can partition the desktop simulation model onto multiple cores and different kinds of processors.
Hardware-in-the-Loop Simulation with MATLAB and Simulink
Hardware-in-the-loop testing for power electronics systems starts with a control system simulation that models the electrical behavior of the active and passive circuit components, loads, and power supplies. With Simulink® and Simscape Electrical™, you can build and simulate your system model. Generate C code from the electrical model using Simulink Coder™, and generate HDL code via HDL Coder™. You can deploy this code to a real-time computer for testing control code, letting you validate it for a range of normal and fault operating conditions. With Simulink Real-Time™, you can deploy the code to Speedgoat real-time target machines. Further, Speedgoat supports power hardware-in-the-loop, letting you test battery management systems (BMS), electric powertrains, and renewable power systems. Learn more about HIL Testing of Grid-Side Converters with Speedgoat.
Examples and How To
Go from basic tasks to more advanced maneuvers by walking through interactive examples and tutorials.
Explore the Power Electronics Control Community
The MathWorks community for students, researchers, and engineers using Simulink to apply power electronics control to Electric Vehicles, Renewable Energy, Battery Systems, Power Conversion, and Motor Control.