Adding baseline criteria to a test case. Signal did not align.

26 views (last 30 days)
I'm trying to add a baseline criteria from a mat file to a test case to compare the results of the test to the expected results. The tests fail with the status "Signal did not align. Comparison cannot be plotted". The file consists of a single Simulink.SimulationData.Dataset with several timeseries elements with the same name as the outports, which seems to work for the input values. I've tried adding the port number to the names i.e "Output:4" but that doesn't seem to make a difference.
Edit: To fix this I changed the model graphically by right clicking on the lines preceding the outports and selecting "Log selected signals" and then naming the signals. Removing the port number and logging the signals allowed mapping of the signals by name to the Simulink.SimulationData.Dataset object. I feed the dataset to testcases, and those test cases to the test manager and the tests are executed as expected.

Accepted Answer

Rong Mi
Rong Mi on 8 Aug 2018
Could you please tell me which release of MATLAB are you using?
Usually when the signal names are different, we will get the message “Signal did not align. Comparison cannot be plotted”. ":4" can also make the signal misalignment. You can try to capture the signal using Capture baseline in Test Manager from your design model to see whether you need the ":4" or not or other numbers.
One more possible reason is that if the logged signal is un-logged in the design model, we will get this message.
  1 Comment
Christian Hurtig
Christian Hurtig on 9 Aug 2018
Edited: Christian Hurtig on 9 Aug 2018
I'm using 2018a.
There is no additional information in the error message. If the output signals are not logged by default then maybe that is the problem. I've tried following the instructions found in the Programmatic Interface section here but I get an error saying "Cannot set parameter 'DataLogging' for the specified port. The specified port must be an output port", which is strange because I find the ports using find_system with the block type 'Outport'

Sign in to comment.

More Answers (1)

Rong Mi
Rong Mi on 9 Aug 2018
Hi, The blocks that you use find_system with the block type 'Outport' to obtained are blocks, not ports.
"Outport(1)" in the following code is a "Port":
ph = get_param('vdp/Mu','PortHandles');
set_param(ph.Outport(1),'DataLogging','on');
They are referring different things.
So when you log signals, the signal associated with the Outport(a port) can be logged using set_param command. For example, the port (Outport) is associated with a block ('vdp/Mu' in the vdp model) sending out signal.
The block "Outport" is a block not a port, and it is the reason you see the error message.

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!