Hardware in the Loop Testing
Christoph Hahn, Speedgoat
Testing control algorithms can be time-consuming, expensive, and potentially unsafe if you decide to test against the real system. To remain competitive and deliver high-quality controller software, test engineers have replaced traditional testing methods with Hardware-in-the-Loop (HIL) testing. HIL testing lets you verify your controller design without the complete system hardware: rely on a real-time plant simulator that acts as a digital twin of the real system or parts of it, benefiting you in practicality and cost.
Let's do an introduction to Hardware in the loop testing or HIL testing in short. I will cover both, the set up of HIL systems as well as best practices for controller HIL testing. Let's look at a HIL test setup. There are typically two main components. First, your controller and the test. This includes both, the production hardware and the embedded software that requires thorough testing. And second, the HIL test system. The HIL system is composed of a real-time simulator, that runs a digital twin deterministically, together with I/O modules, that ensure low latency data acquisition, signal conditioning and communication with the controller under test.
The host computer runs a dedicated application software, that supports you on the setup and operation of the real-time simulator. Depending on the size of your group and how you organize development of embedded software, the hill system set up and controller HIL testing, can be done by the same or different teams. Let's assume our embedded system group is segmented into three. Simon's team, focusing on assembling and setting up new HIL test systems. Sophie's team, in charge of running embedded software test campaigns and Corine's team, who is tasked to develop and revise the embedded software. So, the question is, how are we enabling these teams to succeed in their specific task.
Simon, has previously built a HIL test system, based on the speed goat performance machine. Simon's team, is now challenged to specify a new, much more complex field test system, which is required to integrate high power actuators and electronic loads and sources. Implementing such a HIL system is time-consuming and requires specific expertise. With that in mind, Simon has decided to rely on speed goat's know how, to provide him with a modular wreck mounted HIL solution, customized to his needs. The final solution looked as follows. Two wreck mounted performance real time machines, enabling distributed and synchronized simulation across multiple schatz's. This setup fully integrates all power electronics components, the required signal routing and conditioning modules, as well as breaker panels in the cabling harness. For Simon's team, this is a true plug and play solution.
With hardware hurdles off the table, the team was able to focus on the design of the digital twin and even introduce some innovations. For instance, model parameters are now automatically fine-tuned to fit measured data. Connectivity with the controller was also done very quickly with a simple drag and drop of speed goat driver blocks. Using Simulink real time, the model ran on the speedgoat machine with a simple click and the team could verify correctness of all interfaces right from Simulink. The HIL system was instrumented with MATLAB built in Designer. User interface controls, directly connect with real time application, allowing the HIL system to be operated independent from Simulink.
In parallel, Sophie's team has been creating scripts to bench and optimize test workflows. Part of the team has been using Simulink test, which is shown to be a great asset worth of its investment. For instance, most of the desktop simulation tests, were reused in the real time runs. Real time test campaigns were triggered with just a few clicks and the assertion of results was fast and easy, using inbuilt visualization tools. Besides, detailed test reports could be generated automatically. This greatly simplified communication with Corine's team and helped further expediting software revision work.
All in all, the group was able to quickly resolve several critical errors and run all test campaigns without damaging any hardware. By using the right tools, the team could shield itself from many test trivialities and focus on what was truly their mission, which is develop outstanding controls.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.