Hardware-in-the-Loop Simulation Process

Use hardware-in-the-loop (HIL) simulation to verify a physical prototype of the product with a Simulink® Real-Time™ plant model. HIL simulation builds on the test harness and simulation results of rapid control prototyping. You can test the system for safety and performance and test operation and failure conditions that are difficult to replicate. You can substitute for unavailable parts of the system and minimize expensive downtime for the rest of the system.

With HIL simulation, you perform one or more of the following tasks:

  • Model the plant. — Use Simulink and Simulink Real-Time to model the plant for testing the physical prototype. To debug the plant model, run it with known-good data from rapid control prototyping.

  • Connect to a physical prototype.—Modify the system model to replace the Simulink Real-Time design with an I/O board connected to the physical prototype.

  • Program the physical prototype. — Use HDL Coder™ to generate FPGA code to program the physical prototype.

  • Test the physical prototype. — Visualize signals and tune parameters using Simulink Real-Time scopes and instruments. To write regression tests. parameter sweep tests, and edge tests, use data from rapid control prototyping.

As required, perform the following additional tasks:

  • Create instrument panels in Simulink Real-Time Explorer — Configure Simulink Real-Time Explorer with real-time scopes and with signal display and parameter tuning graphical instruments.

  • Configure a standalone application. — Configure the real-time application to run standalone.

  • Create a standalone program from a Simulink Real-Time Explorer configuration — Export the Simulink Real-Time Explorer configuration as a standalone program.

  • Execute the real-time application and display the results. — Use the exported Simulink Real-Time Explorer configuration to execute the standalone real-time application. To display signal values and tune model parameters, use the scopes and graphical instruments.

  • Write a regression test harness. — Extend the MATLAB® regression tests written for rapid control prototyping to cover functionality over the full parameter range.

  • Write a graphical test harness. — Use one of the APIs (.NET, C) to write a graphical test harness suitable for probing real-time application behavior from the development computer. As part of this effort, you can use MATLAB Coder™ to translate MATLAB regression test scripts into C for integration into the test environment.

As a test engineer, you can build on the plant model and HIL test scripts to create repeatable product tests for volume manufacturing. For example, you can extend and categorize the regression tests into smoke, go/no-go, and diagnostic tests. You can then use MATLAB Coder to translate MATLAB regression test scripts into C for integration into a production test environment.

Was this topic helpful?