Simulation, Testing and Validation · X-in-the-loop testing
Model-in-the-LoopMIL
Also known as model testing, normal-mode simulation
An early test stage in model-based design where a controller model is simulated in closed loop with a plant model, both as executable models, to verify control logic before any production code or hardware exists.
Explanation
MathWorks describes MIL as the stage used early in development to verify control algorithms with a high-level simulation model, in which both the controller and the physical plant are represented by models. The MathWorks Support Team's guidance sequences verification as MIL, then software-in-the-loop, processor-in-the-loop, hardware-in-the-loop and finally tests with real hardware, and recommends recording the controller's inputs and outputs during MIL so they can be compared with later stages.
MIL results therefore become the reference for back-to-back comparison with generated code. ISO 26262-6:2018 lists back-to-back comparison between model and code, where applicable, among its software unit verification methods, as reproduced in Vector's guide to the standard.
A MIL test exercises an idealised model: it does not show the effects of fixed-point quantisation, task scheduling, timing, I/O or the compiler, and its conclusions are bounded by the plant model's fidelity. Passing MIL does not mean the code or the ECU will behave the same way; it means the control concept works under the modelled assumptions.
How it works
Engineers build a plant model, such as vehicle dynamics, sensors and actuators, and a controller model, then connect them in a closed loop in the simulation tool. Requirements-based test scenarios, such as step inputs, drive cycles or scripted traffic, are run with pass/fail criteria. Controller inputs and outputs are logged as baselines for the later SIL and PIL comparisons.
Automotive applications
- Early control algorithm design and tuning
- Requirements-based testing on models
- Generating baselines for back-to-back tests
- Design-space exploration
Example
An ACC controller model runs with a longitudinal vehicle model and a scripted lead vehicle that brakes at 3 m/s². Engineers check that the time gap never falls below the requirement, then save the inputs and outputs as the baseline for the SIL test of the generated code.
An illustrative example: any figures in it are worked numbers, not measurements.
References
- What Is Hardware-in-the-Loop (HIL)? (opens in a new tab)
- What are MIL, SIL, PIL, and HIL, and how do they integrate with the Model-Based Design approach? (opens in a new tab)
- Following the ISO 26262-6:2018 Guidelines with VectorCAST (whitepaper V3.0, 2021-02) (opens in a new tab)
Definitions are original summaries. Standards text is not reproduced; follow the links for the official publications.