Simulink test Input not time aligned
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am using Simulink test Manager to run tests on my model. For inputs I am using a created .mat input file. When I log the signal on the test harness input signal line the signal does not match the input file signal. I have confirmed they are mapped correctly by running the simulation with changed inputs. It appears the logged harness signal starts at half the time of the input signal. e.g. the input file has flase until time 5s then true for the rest of the simulation. The logged signal on the harness shows true at 2.5s. If the input file signal goes back to false the signal in the harness also returns to false but delayed by an inconsistant amount that varies with when when the input file value has returned to false. e.g. input return to false at 6 seconds logged return to false at 4.5s, input return to false at 4 seconds logged returns to false at 3.5 seconds.
0 comentarios
Respuestas (1)
Hari
el 27 de Dic. de 2023
Hi Reuben Symons,
I understand that you are using Simulink Test Manager with a .mat file for input signals, and you're experiencing a timing mismatch between the logged signals in the test harness and the input file. Also, the logged signals appear to start at half the intended time and also show inconsistent delays when returning to false.
Assuming that your model and test harness are set up correctly, one possible cause of this issue could be a configuration setting related to the sample time or the synchronization between the test harness and the model. It's also possible that the logging settings might be affecting the timing of the logged signals.
To troubleshoot this issue, you can:
1. Verify that the sample times for the input signals and the test harness are consistent and correctly configured.
2. Check the logging configuration in the test harness to ensure it's set up to log the signals at the appropriate times.
3. If you're using interpolation or resampling methods in the test harness, ensure they match the intended behavior of your input signals.
Here's an example of how you might check and set the sample time in Simulink:
% Load your input .mat file
input_data = load('input_file.mat');
% Check the sample time of the input signal
sample_time = input_data.sample_time; % Replace with actual field name if different
% Set the sample time in your model or test harness
% (Assuming 'your_block_path' is the path to your input block)
set_param('your_block_path', 'SampleTime', num2str(sample_time));
Refer to the documentation of Simulink Test Manager for more information on how to configure and run tests:
To learn about signal logging and how to configure it, refer the documentation on singal logging https://www.mathworks.com/help/slrealtime/signal-logging-start-here.html
Hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre Outputs en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!