Test Harness simulation step size

7 views (last 30 days)
Nathan Hinton
Nathan Hinton on 25 Aug 2022
Hi,
I am working in a project where I have a top level model containing multiple referenced models. The top level model also contains a Simscape model and so a variable step solver is used. All other model references are configured to have solvers of type Fixed-step discrete, with auto step size. All blocks in these models have a sample time of "-1".
I am now wanting to create Test Harnesses for some of these model references to conduct unit testing. When I do this, the Test Harness is created and runs with simulation time set to 0.2 s (which i believe is the default for the Fixed-step with "auto" step size). However, I wish to run tests using this Test Harness at a faster simulation rate (e.g. 0.01 s).
I have tried changing the step size from "auto" in the configuration of the Test Harness but this does not seem to work because whilst all the blocks in the component under test are set to "-1", the Signal spec. and routing block that is generated during harness correction contains blocks that have a sample time of 0.2 s. It then seems that all other blocks inherit their sample time from this block, and none use the sample time set in the configuration settings.
The Signal spec. and routing block cannot be edited, and appear to be locked to whatever value was used at creation of the harness. Therefore, other solutions such as this do not help. Is there a way to change this such that the sample time of the harness is not fixed to that of the Signal spec and routing block at harness creation? One workaround is to change the fixed-step sample time from "auto" in the model reference from which the harness is being generated prior to creating the harness, however I want to keep the model reference set to "auto" so that it inherits from the top level when a full simulation is run, and one aim of using the harness is to avoid having to change model parameters.
Any ideas are greatly appreciated!
Thanks,
Nathan

Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!