Programmatically Set Test Sequence Ports To Log

1 Ansicht (letzte 30 Tage)
Andrew
Andrew am 27 Jun. 2023
Beantwortet: Prathamesh am 21 Jul. 2023
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!

Akzeptierte Antwort

Prathamesh
Prathamesh am 21 Jul. 2023
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.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by