Test harness for equivalence tests SIL versus Normal

조회 수: 6 (최근 30일)
Alessandro
Alessandro 2025년 2월 13일
답변: Oliver Jaehrig 2025년 2월 13일
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!!

답변 (1개)

Oliver Jaehrig
Oliver Jaehrig 2025년 2월 13일
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.

카테고리

Help CenterFile Exchange에서 Inputs에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by