Is it possible to access the blocks inside the model under test from the test harness in custom criteria script of simulink test?

조회 수: 5 (최근 30일)
I would like to verify the datatype of inports and outports of a model in simulink test. So I created a test harness for it and when I try to access the inports inside the model under test in test harness from the custom cirteria script of simulink test, it doesnt work.
function ioAnalysisFunc(test)
res = get_param(strcat(test.sltest_bdroot, '/Model1/Inport1'), 'OutDataTypeStr'); % Here test.sltest_bdroot is the test harness 'Model1_Harness'
assignin('base', 'ress_out', res{1});
end
The error thrown is,
--------------------------------------------------------------------
Error occurred in custom criteria and custom criteria assessment did not run to completion.
--------- Error ID: ---------
Simulink:Commands:InvSimulinkObjectName
-------------- Error Details: --------------
Invalid Simulink object name: 'Model1_Harness/Model1/Inport1'.
--------------------------------------------------------------------

채택된 답변

Fangjun Jiang
Fangjun Jiang 2024년 8월 13일
I think the testing harness model is using the Model block to reference the model under test, so you can't access the block directly like that inside a model reference.
I would suggest getting the data type of the signal that is feeding into "Inport1". In most cases, it is the same as the data type of the output of "Inport1".
  댓글 수: 2
Jerome Almon
Jerome Almon 2024년 8월 13일
편집: Jerome Almon 2024년 8월 13일
Thanks for your reply. This is what I am doing right now. (Getting the datatype of the input signal using the simulation output log in custom criteria script.)
However it would be really useful if there exists a way to access the blocks inside the model under test. Ofcourse not to modify anything, but ony read access (eg. get_param()) should be good enough. Since we decided to maintain the whole UT only using simulink test, this feature would be really helpful. Is it not possible at all ? Or is there any other alternative to read the properties of the blocks inside the model under test from simulink test ? Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by