MATLAB: Does a Simulink Test Test Case with enums fail despite setting Time Tolerance

caseenumsfailinginterpinterpolationlinearsettingsimulinksimulink testtesttimetoleranceunexpectedzoh

Simulink Test with an enum test case is failing because the simulation enum output is slightly lagging behind the test baseline enum value. A small lagging time tolerance was added to compensate, but the test is still failing despite the time tolerance being larger than the delay between the simulation output and baseline.
Why is this happening? Please advise.

Best Answer

If the particular test case is using enums as opposed to numerical values and the interpolation method is chosen to be "linear" instead of "zoh", Simulink Test will attempt to interpolate between the enum's backing numerical values linearly as opposed using a zero-order-hold for the time tolerance. This will produce unexpected results or test failures.
Once the test case interpolation method is adjusted to "zoh", this test case should pass as expected.