MIL SIL equivalence check.

6 views (last 30 days)
Dhruvilkumar Chavada
Dhruvilkumar Chavada on 20 Feb 2024
I am currently working on process advisor example. I am using built in task to perform MIL test cases. I change the built in TestsPerTestCase.m to perform SIL test execution (using 22b, so simulation mode is not supported).
I have stored the result file two specific folder MIL_test and SIL_test (each has 3 results).
I want to create a custom task where i can perform MIL and SIL test execution, with builtin queries.
Any idea on how to perform this?
Currently i am using built in example
processAdvisorExampleStart

Answers (1)

John D'Errico
John D'Errico on 20 Feb 2024
Edited: John D'Errico on 20 Feb 2024
A literally impossible question to answer. Both far too broad, too vague, and yet extremely specific. It is not even clear what your question is specifically about, since you use jargon and acronyms that you may understand, yet are not terribly clear to the rest of the world.
How do you do it? Broadly, you:
  1. Write down the mathematics of what you need to do.
  2. Learn sufficient MATLAB to do what you need.
  3. Write the code to do what you want.
We can't teach you all the MATLAB you might need to learn here, since we have no clue as to what you already know, and don't know. So any attempt to tell you want you need to know would involve writing an entire book, when you might only need to read chapter 17.
So as I said above, start by carefully writing down the mathematics of the problem. Make sure you understand it.
Then, once you understand the mathematics of what you need to do, write a simple function that does the above computation, and returns the desired result. Don't worry about the interface. Fix the function until it performs as you need. Finally, build an interface around the code you have written.
  1 Comment
Dhruvilkumar Chavada
Dhruvilkumar Chavada on 20 Feb 2024
Sorry for not being clear.
MIL = Model in Loop test and SIL = Software in the loop test.
% Software in the loop
silresult = sltest.testmanager.importResults("HLR_11_SIL_ResultFile.mldatx")
TSObjSIL = silresult.getTestCaseResults()
idSIL=TSObjSIL(1).getOutputRuns.id
% Model in the loop
milresult = sltest.testmanager.importResults("HLR_11_ResultFile.mldatx")
TSObjSim = milresult.getTestCaseResults()
idSim = TSObjSim(1).getOutputRuns.id
resEq = Simulink.sdi.compareRuns(idSim, idSIL)
resEq.Count
anyMismatch = false;
for iEqTest = 1:resEq.Count
if ~resEq.getResultByIndex(iEqTest).Match
anyMismatch = true;
break;
end
end
anyMismatch
I have 3 different test result files
folder SIL_test
HLR_11_SIL_ResultFile.mldatx
HLR_12_SIL_ResultFile.mldatx
HLR_13_SIL_ResultFile.mldatx
folder MIL_test
HLR_11_ResultFile.mldatx
HLR_12_ResultFile.mldatx
HLR_13_ResultFile.mldatx
I want to import the result file from these folders (store in project) one by one and compare the signal as mentioned above.
When HLR_11_ResultFile.mldatx is called HLR_11_SIL_ResultFile.mldatx.

Sign in to comment.

Categories

Find more on Test Model Components in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!