How to programmatically pause and resume UUT Simulation in Test Sequence Block ?

Is there a way to pause unit uder test, UUT, simulation from test sequence, yet allow test sequence block to execute to evaluate verify statement?
I'm using test sequence to test a state machine that will transition between some of the states strickly based on timer expired; i need a way to pause simulation while it is timing and/or at the timer expiration but before it transition to new state, let test sequence verify some signals, then let it resume simulation back.

Answers (1)

Maybe you can add one or more breakpoints in different steps so to pause in the moment you prefer. Here I include documentation showing the steps to do it:

7 Comments

@Jesús ZambranoThanks for the feedback!
i was looking for an automated way of doing this - automate testing. I updated the case heading to reflect the need..
The breakpoints does not support conditional logic (if <condition> set breakpoint); requires manual intervension.
What about working with a Test Assessment block. It looks similar to a Test Sequence, but it comes with a "When decomposition" which uses lgics similar to if-then-else structure, and you can add breakpints in there.
More information here,
@Jesús Zambrano how the IF statement can help with the pause-resume simulation of the unit under test? note that test sequence block itself supports if statement as well.
my main issue is that some of unit under test's transitions will execute based strickly on timer expired; i need a way to pause under test simulation while it is timing and/or at the timer expiration, but before it transition to new state, verify some signals, then let it resume simulation back.
You could use an Assertion block to pause the simulation, by adding a pause command in its callback. Then, resume the simulation using Continue as you do for a pause simulation.
@Jesús Zambrano worked for pausing the simulation; Thank you!
However, the resume works only through manual intervention by clicking the "continue/play" button. I implemented some logic to automatically reset the signal that goes to the "Assert" block, but it wouldnt execute because the simulation is paused. this will work if the simulation pause impacts only the unit unders test, and not everything else including "test sequence" and "Assert" blocks.
In this case I suggest to implement all the pause/evaluate/continue logic using a MATLAB function block or create an script with all the evaluations.
set_param(bdroot,'SimulationCommand','pause');
run('myscript.m'); %
set_param(bdroot,'SimulationCommand','continue');
Good to recall that you could use callbacks (model callback and bloc callbacks) to execute different actions at soecific moments.
No specific functions about pause/continue are available in a test sequence/test assessment block. Also, pausing a especific block in a model is not supported.
yes, i thought about using the function callbacks after seeing the assert block using it; i have to do all the verification evaluation in there, then when done, resume simulation using "set_param(bdroot,'SimulationCommand','continue')". I was trying to do it all in the test sequence, one place for everything. easily plottable for review puposes, but it seems it is not possible.
I will try to see if the verification can be done easily, modularly, and scalably implemented in a script.
Thank you for your help!

Sign in to comment.

Products

Release

R2019a

Asked:

on 8 May 2021

Commented:

on 30 May 2021

Community Treasure Hunt

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

Start Hunting!