Problems with pulse and LEADING/LAGGING Tolerance in Test Manager

3 views (last 30 days)
I am using Simulink Test Manager.
I need to define a baseline for a pulse with tolerances. As shown in the attached image, the baseline is just a pulse, while the simulation output, Sim Output, is a constant at 0.
If I set the LEADING/LAGGING tolerance to 0, everything works as expected and the test fails.
However, if I set a tolerance (0.000078125), the test always passes. I actually expected it to fail in that case, the tolerance should only allow the pulse to occur a little earlier or later than the baseline one, not not to happen at all.
Instead, Simulink seems to only check that SimOutput at a time t corresponds to one of the values ​​in the range [t-LEADING_TOL, t+LAGGING_TOL]. This means that if the pulse is smaller than the tolerance, the test always passes.
Is this the expected behavior? What would be the thing to do instead to satisfy my needs?

Accepted Answer

Abhas
Abhas on 7 Oct 2024
As you noted, Simulink Test Manager applies "leading and lagging tolerances" to allow for acceptable time shifts between the baseline signal and the simulation output. This means the test checks if the simulation output at any given time "t" falls within the tolerance window [t-LEADING_TOL, t+LAGGING_TOL]. You may refer to the following MathWorks documentation link to know more about setting and previewing tolerances: https://www.mathworks.com/help/sltest/ug/apply-tolerances-to-test-criteria.html#:~:text=Specify%20a%20tolerance%20when%20the%20difference%20between%20results%20falls%20in%20a%20range%20you%20consider%20acceptable.
In your case, the baseline is a pulse, and the simulation output is a constant zero. With a non-zero tolerance, the constant value of 0 is always within the specified tolerance range, which is why the test passes.
To ensure that the test fails when the pulse does not occur, even with tolerances, consider the following approaches:
  1. Use Absolute or Relative Tolerances: If applicable, use absolute or relative tolerances to enforce stricter value comparisons, ensuring that the presence of the pulse is required.
  2. Custom Verification Logic: Implement custom logic in MATLAB to explicitly verify the presence of the pulse. You can write a script to check if the pulse occurs within the expected time frame and use this script as part of your test criteria.
  3. Signal Comparison Block: Utilize Simulink's Signal Comparison block to create custom criteria for detecting the pulse. This block can help in setting up more complex conditions for signal validation.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!