Software-in-the-loop testing applications
The term ‘software-in-the-loop testing’, or SIL testing, is used to describe a test methodology where executable code such as algorithms (or even an entire controller strategy), usually written for a particular mechatronic system, is tested within a modelling environment that can help prove or test the software.
SIL versus HIL testing
HIL or ‘hardware-in-the-loop’ testing is by its very nature a resource-hungry solution to testing, requiring multi-skilled teams able to set up and configure both the execution platform and the I/Os as well as the modelling environment.
While filling an important part of the overall test process, it may take longer to prove out significant issues with HIL testing than can be achieved in a SIL test scenario as testing hardware availability is not required.
SIL testing and simulation can thus be a useful technique for software proving at earlier stages of the design.
Simulation techniques
Often to achieve the ability to test versions of the software it is necessary to simulate the aspects of the system that will ultimately be present, but that are initially not required or would be too cumbersome to use, such as the mechatronic hardware and sensors.
To simulate the software conveniently, it is usual to use a locally-hosted compiler to run the code on the laptop and then, when the code has been satisfactorily tested, deploy the code on the target controller using a cross-compiler.
Often, some signals can be estimated and treated as unimportant, whereas others are required to be present. The partition of what is required and what is not is usually the decision of the team performing the testing, but this can be assisted by using tools, such as simulated and stimulated values.
Simulation and stimulation
During these software testing stages the use of modelling toolchains – such as MATLAB Simulink from The MathWorks – can greatly improve the ability to integrate software code execution within an overall simulated environment. The use of third-party toolboxes can also be employed to simulate particular mechanical systems if required.
As well as simulating the environment, known as the ‘plant model’, it can also be beneficial to provide stimulus, such as loading, wear, noise and so on using a desktop GUI tool, such as VISUALCONNX which can connect and control aspects of the modelling environment.
Real-time or Offline?
In general, SIL testing and simulation does not require real-time execution, as it is proving the code algorithms and functions to perform various tasks. It may even require special drivers or hardware to run in real-time. Sometimes the software will run much faster than real-time, due to the code’s simplicity, and at other times it will run more slowly.
If realistic timing information is required, then this can either be simulated numerically, or in some cases pseudo real-time blocks may be used in the modelling environment to pace the model as required.