Test harness for equivalence tests SIL versus Normal

4 visualizzazioni (ultimi 30 giorni)
Hello dear Matworks community,
I am using the test harness to do equivalence testing of the matlab code I wrote against the auto generated C code. I have been following the following guide “https://www.mathworks.com/help/ecoder/ug/software-and-processor-in-the-loop-sil-and-pil-simulation.html” and I have still a couple of questions:
I have the model “my_fun.slx” that is a Simulink subsystem and I would like to run the equivalence testing to this model. I created the test harness called “my_fun_test_harness” and I want to test normal vs SIL output with the test harness. I did the following simple code:
model='my_fun_test_harness';
open_system(model);
set_param('my_fun_test_harness','SimulationMode','Software-in-the-Loop (SIL)')
out = sim(model,20);
When I run this, it is automatically created the folder “my_fun_test_harness_grt_rtw” . In that folder, I find C files of the test harness (my_fun_test_harness_grt_rtw) and not of the model I want (my_fun).
However, I would expect to see somewhere “my_fun.c” and not only “my_fun_test_harness.c”, as "my_fun.c" is what shall be use in the software of my machine. Can you help me to understand this?
Thanks!!

Risposte (1)

Oliver Jaehrig
Oliver Jaehrig il 13 Feb 2025
It currently sounds like you created a test harness as a normal model, which would explain the behavior.
With Simulink Test you can use a feature to explicitly create "test harnesses" which do not modify the model itself and can be saved externally or internally of your model.
I recommend to follow this example:
which helps to setup a back to back test with Simulink Test and automatically creating a test harness for it.

Prodotti


Release

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by