Analog Angle Blog

Hardware-in-the-loop or digital twin: Use one, both, or neither?

There’s been a lot of discussion lately – as well as quite a lot of hype and “hand-waving” IMO – about using a “digital twin” (DT) to accelerate product development, software debug, and resolve electrical-mechanical interaction issues. Digital twinning follows “hardware in the loop” (often written as HITL or just HIL) as the hot tool for similar activities just a few years ago.

What are DT and HITL? As with many such designations, it depends somewhat on who you ask and where they are coming from. One general description says that for DT, you create a software-only model of the system being controlled, and then provide it with inputs and outputs from your controller being tested, and see how well your controller acts as it does what it is supposed to be doing (Figure 1).

diagram of digital twin virtual modelFigure 1 In principle, a digital twin is a virtual model of the entire application and process, which allows designers to visualize and test the design via a single software entity. Source: Wipro Limited

In contrast, for HITL you build a software model of the core, but have it interface with and direct real hardware (circuitry and mechanical) to assess the performance of your controller (Figure 2). In other words, DT is pretty much all software and models, while HITL has, as the name implies, some real circuitry and even electromechanical components.

diagram of key components of a hardware in the loop test systemFigure 2 This top level diagram shows the key components of a HITL test system, which uses representative real-time responses, electrical stimuli, and functional cases to connect all the I/O of the unit being tested (here, an electronic control system for an automobile). Source: add2

An example using an automobile engine and its ECU (electronic control unit) may make this clearer. For the DT scenario, you model the engine entirely as a software construct, and this model “talks” to the software of the controller being developed. In contrast, for HITL, you model the engine but now the model software drives real circuitry I/O to the controller under development, which then sees those interfaces. The HITL often requires a rack of equipment, meaning substantial amounts of circuitry (Figure 3). One of the appeals of DTs is that they eliminate the need for most if not all of this hardware, of course.

photo of a single rack hardware in the loop simulatorFigure 3 As the name implies, HITL incorporates hardware, and that may be in both senses of the word: electronics and electromechanical components. Source: add2

HITL systems are even available as standard products, such as high-precision and high-dynamic three-axis and five-axis flight motion-simulator (FMS) systems for development and production testing of missile guidance and seeker packages (Figure 4).

photo of the Ideal Aerosmith 2443H-HR Three-Axis Flight Motion SimulatorFigure 4 HITL systems are available as standard product applications, such as this flight motion-simulator system for testing of missile guidance and seeker packages. Source: Ideal Aerosmith

So, which one is better? As is almost always the case for engineering questions, the answer is simple: “it depends.” The factors on which it depends include time to create their respective models, confidence in that model, and complexity of simulating I/O. If you go online, there are proponents of DT who say HITL is “so yesterday” and no longer needed (Reference 1), as well as proponents of HITL who claim that DTs are overhyped (Reference 2), oversold, and overly-dependent on the fidelity of the model to reality. Others contend that the best solution is a hybrid of both, applied with care (Reference 3).

Not surprisingly, the issues are largely about the model rather than the approach. We know that good digital models of the real analog world are hard to develop, and it’s the last 10% of the model that is hardest to do with accuracy. There are so many subtle unknowns, corner cases, exceptions, nonlinearities, inflection points, and more of which the model’s creator is simply not aware or can’t quantify. Depending too heavily on model accuracy is just the latest manifestation of the classic, yet still valid, maxim “garbage in, garbage out.”

No question, it’s absolutely necessary to use various models, whether they are DT or HITL, Spice, RF packages, or simulation and analysis tools such as COMSOL Multiphysics, Mathworks MATLAB and Simulink, and ANSYS HFSS. But be a realist about how perfect these models are, always keeping in mind that the model may show precision to three, four, or more significant figures, but actual accuracy is usually far less – and may be way off if the real world has “bumps” that the model didn’t capture.

What’s your view or experience with respect to digital twins, hardware-in-the-loop, and other sophisticated models and tools? Have you been burned, pleased, oversold, overwhelmed, or other?


  1. Opal-RT, “The ‘Digital Twin’ in Hardware in the Loop (HiL) Simulation: A Conceptual Primer
  2. Athens Group, “Digital Twin Gets Its Due
  3. Smart Robotics, “Using digital twin and hardware-in-the-loop simulations to speed up robot development & integration
  4. NI, “Hardware-in-the-Loop (HIL) Test
  5. NI, “What Is Hardware-in-the-Loop?
  6. add2, “Hardware-in-the-loop testing applications
  7. MathWorks, “What Is Hardware-In-The-Loop Simulation?
  8. Ideal Aerosmith, “Three- And Five-Axis Flight Motion Simulators For Hardware-in-the-Loop Simulation (HWIL)
  9. Deloitte, “Industry 4.0 and the digital twin
  10. Slideshare presentation by Megha Agrawal and Mohit Parkhi, “Digital Twins
  11. OSIsoft, “Digital Twins: Myths vs. Reality
  12. Wipro, “Digital Twin: Innovate the Way to Test

Related Content:

0 comments on “Hardware-in-the-loop or digital twin: Use one, both, or neither?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.