Programmatically Set Test Sequence Ports To Log

조회 수: 1 (최근 30일)
Andrew
Andrew 2023년 6월 27일
답변: Prathamesh 2023년 7월 21일
The Test Sequence Editor allows me to set a symbol to log its signal data when the test is running. I'd like to automate this because it is tedious to go into every symbol and set it manually. Is there a way to programmatically set a test sequence port to log its signal data during tests?
I found the documentation to programmatically change other properties of a test sequence port like the data type or the Scope, but I haven't been able to find anyway to access the logging settings. If this is not supported by the sltest.testsequence packages can someone suggest an alternative way to programmatically setup the test harness to log that signal data?
I am using MATLAB R2021a. Thanks!

채택된 답변

Prathamesh
Prathamesh 2023년 7월 21일
Hi,
I understand that you want to programmatically log the signal data.
This can be achieved by setting the parameter ‘SignalLogging’ of the signal to be logged as ‘on’.
%set_param function to enable or disable signal logging for a model programmatically
set_param("damped_nonlin_spring",'SignalLogging','on');
%mark signals for logging programmatically
Simulink.sdi.markSignalForStreaming('damped_nonlin_spring/Integrator',1,'on');
Simulink.sdi.markSignalForStreaming('damped_nonlin_spring/Integrator1',1,'on');
Please refer to the documentation below to get more information on signal logging.
Alternatively, you can programmatically set the "LogSignal" parameter to "on" for a specific test sequence port in a Simulink Test harness.
harness = sltest.harness.find('myModel/Test Harness');
sequence = harness.getSequence('mySequence');
port = sequence.getPort('myPort');
set_param(port.getFullName,'LogSignal','on');
Please refer to the documentation for more information.
I hope this helps in resolving your issue.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by