Hi Paturi
Kindly refer to the following steps to get an overview on creating test cases externally, importing them into Simulink and performing SIL and MIL simulations.
1. Creating Test Cases Externally
These test cases can be created in MATLAB as arrays or tables, or save them in files like Excel or CSV.
testInputs = [0 1; 1 0; 1 1; 0 0];
expectedOutputs = [1; 0; 1; 0];
2. Importing Test Cases into Simulink
To use these test cases in Simulink, use blocks like 'From Workspace' or 'From File' to bring input data into your model an run simulations for each test case using a MATLAB script loop as follows -
for i = 1:size(testInputs,1)
simOut = sim('your_model', 'SimulationMode', 'normal', 'SaveOutput', 'on', 'OutputSaveName', 'yout');
actualOutput = simOut.get('yout');
fprintf('Test case %d: Expected = %d, Actual = %d\n', i, expectedOutputs(i), actualOutput);
3. MIL (Model-in-the-Loop) simulation:
Run your Simulink model simulations using your test cases to verify that the model behaves as expected. The steps above describe MIL testing.
4. SIL (Software-in-the-Loop) simulation:
Generate code from your Simulink model (using Simulink Coder), then run that code inside Simulink or on your computer to check if the generated code matches the model behavior.
For more information regarding 'MIL' and 'SIL' simulations, kindly refer the following documentations -
I hope this helps