Is there a way to programmatically add Logged Signals from within referenced model in Test Manager?
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am attempting to develop a script that will allow me to programmatically add in Logged Signals to a Test Case in Test Manager.
(Main reason for this is any time I make a change like subsystem names, I have to go back and manually remove and select the signal again as well as being able to specify the plot index automatically.)
Using the addLoggedSignal() function, I am able to add signals from the top level of the Test Harness without any issues and am able to successfully run the simulations in Test Manager.
When I try to add signals that are within the referenced model inside the test harness, the signal is successfully getting added to the Logged Signals, but I run into an error "Signal not found in Harness". In this case, the block path i entered into the addLogged Signal() function was from the referenced model
I have also changed the block path to include the Harness but in that case I get the error:Caused by: Error using sltest.testmanager.LoggedSignalSet/addLoggedSignal (line 116) 'Model' is not a SubSystem block.
Is this a matter of having the correct block path when running addLoggedSignal() or something else possibly due to there being a reference model within the harness
0 commentaires
Réponses (1)
Shishir Reddy
le 16 Juin 2025
Hi @Andy Lee
The issue seems to be related to how signal paths are resolved within the test harness context. When using 'addLoggedSignal' function, the block path must be specified relative to the simulation hierarchy as seen from the harness, not directly from the referenced model.
If the signal resides in a Model block, it may need to be exposed through an outport or handled using Signal Logging Mapping, as signals inside Model blocks aren’t treated the same as those in Subsystem blocks. The error 'Model' is not a SubSystem block typically occurs when the path points to a Model block rather than a Subsystem.
To identify the correct path, the signal can be logged manually in the Test Manager UI, and the resolved path can be retrieved using:
tc = sltest.testmanager.TestCase(...);
lgset = getLoggedSignalSet(tc);
getLoggedSignals(lgset)
This can help verify how Test Manager expects the signal to be referenced. Further adjustments, such as plot index assignment, can also be handled after the signals have been added.
For more information regarding 'getLoggedSignals', kindly refer the following documentation - https://www.mathworks.com/help/sltest/ref/sltest.testmanager.loggedsignalset.getloggedsignals.html
I hope this helps.
0 commentaires
Voir également
Catégories
En savoir plus sur Outputs dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!