Why use SIL(Software in the Loop) before HIL(Hardware in the Loop) if MIL(Model in the loop) simulation is already performed?

10,560

I wouldn't say it's mandatory, but it's good practice.

By doing MIL testing, you are testing the controller logic is functionally and algorithmically correct. When you move to SIL testing, you are actually testing the code generated from the model (for the controller part), whereas in MIL, you are testing the controller algorithm as implemented in Simulink, not the C code. Granted, the C code is generally compiled as a Windows DLL for SIL testing, so you are not testing the final implementation of your controller, but it's still a step in the right direction. If you are generating the C code and compiling on the final controller hardware (with a serial connection to the PC running the plant model), it's even better. The other thing you are not testing for is real-time execution.

Basically, with MIL you are detecting errors in whether your controller as implemented in Simulink is suitable for code generation (data types, sample times, etc...) and whether there any bugs/issues with the code generation process (unlikely but still possible).

Moving to HIL gives you even higher confidence as now both the plant model and controller model run in real-time, so you are exercising the code generated from your controller logic, implemented on its final hardware, in as realistic conditions as possible.

It's all about reducing risks and increasing confidence as you progress through the development cycle.

Share:
10,560

Related videos on Youtube

Leo
Author by

Leo

Matlab/Simulink developer

Updated on June 04, 2022

Comments

  • Leo
    Leo almost 2 years

    I have implemented a new controller logic in simulink and tested it using MIL(Model in the Loop) simulation.

    1. Is it mandatory to perform SIL before going to HIL?
    2. What kind of errors can be found in SIL which can't be detected in MIL?

    Please help me with one example.

  • Leo
    Leo over 8 years
    am304 Thank you for the answer.
  • Leo
    Leo over 8 years
    Are there any issues/bugs which can be detected in SIL if MIL is already passed?
  • am304
    am304 over 8 years
    @Leo Yes, those to do with code generation, or configuring the model for code generation (as opposed to simulation only).
  • Leo
    Leo over 8 years
    I read from another blog that in Targetlink, MIL mode means simulation with doubles while SIL mode means simulation in fixed-point. So there are chances that MIL and SIL results will be different. But in case of simulink MIL and SIL results should be ideally same rite
  • am304
    am304 over 8 years
    @Leo quite probably yes. Another reason why doing SIL is a good idea (to spot any issues in your fixed-point scaling)