Hardware-in-the-loop
Hardware-in-the-loop, software-in-the-loop and the digital twin, untangled.
Three terms that get used for each other. Here is what each means, what each is good for, and where Nihil sits among them, including the part where its name is a little more generous than the strict definition.
| Term | What runs for real | What is simulated | Good for |
|---|---|---|---|
| Hardware-in-the-loop (HIL) | The real controller, on its real silicon | The plant it controls, in real time, through I/O hardware | Timing, electrical behaviour and integration faults that only show on the target |
| Software-in-the-loop (SIL) | The control code, compiled for a workstation | The controller's hardware and the plant | Early logic checks and batch runs, faster than real time, with no rig |
| Digital twin | Depends on who is talking | A virtual copy of the product or one of its parts | Testing against a model of the thing before, or instead of, touching the thing |
Why the terms blur
OPAL-RT, a maker of real-time simulators, draws the line at whether the real controller is in the loop: in SIL the control runs as model code or host software on a workstation, and in HIL it runs on the actual embedded controller connected to a real-time simulator. Ansys notes that in a HIL setup the simulated hardware is sometimes called a digital twin. A research paper on autonomous-vehicle testbeds argues the opposite, that a complete digital twin needs everything virtual. So “digital twin” means a virtual copy of the thing, and whether the controller inside it is real silicon is a separate question.
The usual advice from those vendors is to use both: start in software, where it is quick and runs anywhere, and add hardware when timing and I/O behaviour must be proven.
Where Nihil sits
Nihil closes the loop around simulated hardware running your real firmware. Three levels of that loop exist today:
- The twin. Your control code in the loop with a physics model of the product (tyres, motor, pack, sensors), at a fixed 1 ms step.
- The circuit. Your firmware on a chip model whose pins are nodes in a solved circuit: rails, copper, heat, buses.
- Both, coupled. A session ties the twin and one or more boards together at a fixed tick, each at the fidelity you pick.
By the strict definition that is software-in-the-loop with unusually detailed hardware models. The hardware comes in at the other end: a scenario that passes in the twin is meant to run on the real board unchanged, and any constant that only a bench can settle becomes a BENCH row that the twin's result names. The name says what the product is for. The simulation comes first because it is cheap to repeat, and the bench confirms.
The bench has its own tools. A board flashed with a bench build answers Nihil over a serial port: it says which build it runs, held against the project’s ELF, runs its self-test, gives up its field log, takes ADC and GPIO values held by the host and steps its clock on the host’s time. So far that has been run on one ESP32-S3 dev board; it is early, and off until you switch it on. The product page shows the session.
The engines run on your machine and are deterministic: the same inputs and seed give the same trace hash on the same toolchain. That is what lets a gate say pass or fail and be believed.
one_pass scenario. The firmware is the real rccar app; the plant is the model.Which do you need?
- You are checking control logic and have no board yet. Start in software. This is where Nihil helps most, and you see the result in minutes.
- You need a verdict you can trust before you order boards. You want determinism, stress cases (hot-plug, brown-out, a stalled motor) and a record. That is the gate.
- You need to prove timing on the real chip, interrupts and real peripherals. You need a bench or a HIL rig. Nihil does not replace one; it tells you what to take to it.
- You need certified, real-time plant simulation for a product line. That is a dedicated HIL vendor’s job.
See it run on a real board.
The demo project is an RC car, its two boards, its twin and every gate’s record, in the real app, read-only, in a tab. The desktop app is in invite-only alpha for Windows, macOS and Linux.