You are on page 1of 10

Overview of MIL, SIL, HIL, Testing

Theories & Coverage Metrics


Learning Outcomes:
❏ Overview of Model in Loop, Software in Loop & Hardware in Loop
❏ Testing Theory & Testing Techniques
❏ Coverage Metrics & Test Report Analysis
Overview of Model in Loop Testing

❏ •Model-in-the-loop testing (MIL) and simulation is a


technique used to abstract the behavior of a system or
sub-system in a way that this model can be used to test,
simulate and verify that model.

❏ •By using an industry standard tool-chain such as Simulink for model definition you
can test and refine that model within a desktop environment, allowing a complex
system to be managed efficiently.
❏ •Once you have modelled your control system or environment (plant model), you
can use this plant model to test your controller strategies. Control strategies are
usually test cases which are developed in tune with the functional requirement of
the system.
❏ •MIL Testing is done at a stage when we are ready with the base design of the
requirement. All it needs is to have a simulatable model with all inputs defined in
workspace.
❏ •Apart from MATLAB, even 3rd party tools aid us in Model in Loop testing. Tools like
BTC & Reactis are used for MIL Testing as well.
Overview of Software in Loop Testing
❏ •Software-in-the-loop testing (SIL) is supported by the
MATLAB coder, which enables the user to verify the
production – ready source code and compiled object
code.

❏ •By using an industry standard tool-chain such as Simulink for model definition you can test and refine that model within a
desktop environment, allowing a complex system to be managed efficiently
❏ •Template which was exactly used for MIL shall be used for SIL as well. Only replace MATLAB Model block with S-Function
Builder block.
❏ •Define the properties like input port & output port, libraries, output definition, etc. Once these definitions are there, click
“BUILD” to create a wrapper MEX file which is based on C files generated.
❏ •Drills are similar to MIL testing once the wrapper function is generated. Test case generation, Coverage reports analysis
are all similar to MIL testing.
Overview of Hardware in Loop Testing
❏ •Hardware-in-the-loop (HIL) simulation is a type of real-
time simulation. You use HIL simulation to test your
controller design.
❏ •HIL simulation shows how your controller responds, in
real time, to realistic virtual stimuli.

❏ •You can also use HIL to determine if your physical system (plant) model is valid.
❏ •In HIL simulation, you use a real-time computer as a virtual representation of your plant model and a real version of your
controller.
❏ •The figure shows a typical HIL simulation setup.
❏ •The desktop computer (development hardware) contains the real-time capable model of the controller and plant. The
development hardware also contains an interface with which to control the virtual input to the plant.
❏ •The controller hardware contains the controller software that is generated from the controller model.
❏ •The real-time processor (target hardware) contains code for the physical system that is generated from the plant model.
Testing Theory & Testing Techniques
❏ Testing is a systematic way to check the correctness of a system by means of experimenting with it .
❏ Tests are applied to a system in a controlled environment, and a verdict about the correctness of the system is given, based
on the observation during the execution of the test.
❏ Thorough testing is necessary to be confident that the system works as it was intended to in its intended environment.
❏ When testing software, there are often a massive amount of possible test-cases even in quite simple systems.
❏ Tests are normally performed in several different stages of the V – cycle; The V – cycle illustrates the breaking down of
requirements in more detailed manner & integrating it into a ready product.
❏ Common types of testing, in concurrence with different stages of V – cycle are: Unit Testing, Integration Testing, System
Testing & Acceptance Testing
Structure Based Testing
❏ Structure Based Testing, aka coverage based testing is a white-box testing technique.
❏ Apart from writing test cases to check for the functional behavior, test cases needs to be developed in order to check if all
conditional scenarios are analyzed.
❏ Achieving full coverage here is not equal to the complete test; It only means the technique being used analyses all possible
outcomes & scenarios to arrive at the results.
❏ Some of the most commonly found structure based testing are:

❏ Condition Coverage
❏ Decision Coverage
❏ Modified Condition / Decision Coverage (MCDC)

❏ In MATLAB Simulink Environment, one out of these 3 techniques must be chosen in order to efficiently perform Model in
Loop testing or Software in Loop Testing
Condition Coverage
❏ •Condition Coverage is also known as Predicate Coverage in which each one of the Boolean Expressions have been
evaluated to both TRUE & FALSE.
❏ •Condition Coverage deals with logical operator blocks in both Simulink & Stateflow transitions.
❏ •Condition Coverage checks for execution of condition, not for all possible scenarios or not for all possible branches. Number
of test cases depends on number of operators. Here only one AND operator is used, so only one scenario is tested.

Cond A Cond B

True True

Flowchart C Code Test Case


Decision Coverage
❏ •Decision Coverage analyzes elements that represent decision points in a model, such as a Switch block or inside Stateflow
states.
❏ •Decision Coverage evaluates both the TRUE condition as well as the FALSE condition; Number of test cases depends on the
number of conditions. Here there are two conditions to be evaluated, hence two test case scenarios.
❏ •For each item, Decision Coverage determines the percentage of the total number of branches through the item that the
simulation traversed.

Cond A Cond B

True True

False False

Flowchart C Code Test Case


Modified Condition Decision Coverage
❏ •MC/DC coverage in other words is a combination of 100% condition coverage, 100% decision coverage.
❏ •Each condition must affect the final outcome decision independently while the other condition is fixed constant.
❏ •Since all combinational logics are to be tested, total of 2^Conditions are going to be tested; In this case, 4 possible test
scenarios must be tested

Cond A Cond B

True True

False False

True False

False True

Flowchart C Code Test Case

You might also like