Ground Embedded KO Subscribe

Notes / Automotive Software

MIL, SIL and HIL testing

Widen the scope of verification in the order model, software, real hardware. How most problems are found before the real vehicle.

GROUND EMBEDDED · NOTEAutomotive Software 07MIL, SIL and HIL testingCAN_HCAN_LEngineABSBMSClusterGateway
Stage Under test Plant Problems found
MIL (Model) Simulink control model Model Control algorithm, logic
SIL (Software) Generated or hand-written C code (on a PC) Model Code generation, fixed point, implementation differences
PIL (Processor) Running on the real MCU Model (PC) Compiler, execution time
HIL (Hardware) The finished real ECU Real-time simulator I/O, communication, diagnostics, fault reactions
MILmodel against modelSILgenerated code on a PCHILreal ECU + virtual vehicleReal vehicle
The same control logic is tested ever closer to reality.

MIL → SIL back-to-back test

Feed the same inputs to the model and the code and compare the outputs. If the difference exceeds the allowed range, check the code-generation settings and the numeric representation.

HIL

A real-time simulator (dSPACE, NI, Vector) imitates the vehicle, motor and sensors with mathematical models and is connected to the real ECU's I/O pins and CAN. Situations that are dangerous or hard to reproduce on a real vehicle (a broken sensor wire, overvoltage, extreme temperature signals) can be tested again and again.

In a personal project

  • MIL: simulate the PID and plant in Python/Simulink
  • SIL: unit-test the control code on a PC
  • Simple HIL: a second MCU imitates the motor and sensor signals and tests your board

The cost grows with each stage to the right, so the aim is to find as much as possible on the left.

FREE PDFGet the 3 free ebooksIf you want to keep reading this topic as one book: BLDC motor control, serial communication and sensors at book length. PDFs are in Korean.Get them free →