in custom criteria function of simulink test the test.sltest_output is empty

11 次查看(过去 30 天)
I am trying to use custom criteria by checking the custom criteria function in the test manager. The goal is to verify a signal acquired during real time testing on Speedgoat reaches two different values during testing.
I cannot access the signal data within the custom criteria function. I have logged the signal in the model, I have the logsout variable in the workspace after the model is executed, in the simulation output panel I added the signal, but the test sltest_simout is empty.
How can I access the data acquired by the real time test hardware within the custom criteria?

回答(1 个)

Dimitri MANKOV
Dimitri MANKOV 2021-10-25
Hi Stefano,
I would recommend logging the data in Simulink Real-Time using the Simuliation Data Inspector (SDI), which would enable you to base your custom criteria function on the following syntax :
% Extract desired run IDs from SDI
runID_List = Simulink.sdi.getAllRunIDs;
runID = runID_List(end);
% Export logged data to workspace
simDataset = Simulink.sdi.exportRun(runID);
% Unpack the data
signal_A = simDataset{1}.Values.Data(:,1);
signal_B = simDataset{1}.Values.Data(:,2);
...
Hope that's helpful!
Best,
Dimitri

类别

Help CenterFile Exchange 中查找有关 Outputs 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by