Is it possible to access the blocks inside the model under test from the test harness in custom criteria script of simulink test?
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jerome Almon
el 13 de Ag. de 2024 a las 11:49
Comentada: Fangjun Jiang
el 13 de Ag. de 2024 a las 19:07
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'.
--------------------------------------------------------------------
0 comentarios
Respuestas (1)
Fangjun Jiang
el 13 de Ag. de 2024 a las 12:16
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 comentarios
Jerome Almon
el 13 de Ag. de 2024 a las 18:27
Editada: Jerome Almon
el 13 de Ag. de 2024 a las 18:29
Fangjun Jiang
el 13 de Ag. de 2024 a las 19:07
Not sure if you are familar with Model Reference. Modle under test is referenced this way.
Ver también
Categorías
Más información sobre Inputs en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!