Model coverage without using sim

6 views (last 30 days)
Lucas on 4 Jun 2012
Hello, I was wondering if it was possible to get model coverage without using sim() on a simulink model? We can't use the sim() for our models. We need to run for a few cycles, check our input, run for another cycle and see if the input changed. Since sim() starts, runs and exits every call we can't use it. Our program works in every aspect we need it to but model coverage. Is there a way that I can invoke it manually outside of sim()?
cvt = cvtest(modelname);
cvt.setupCmd = 'load(''Set_Up.m'');';
cvd = cvsim(cvt);
cvhtml('TestCoverageHTML.html', cvd);
Ends up doing the same thing as sim() and is not what we need, since cvsim() acts the same way sim() does. Just need to be able to start and end the data gathering manually.
We're looking for a way to do this like we loaded our models:
cmd_line = [model_name '([], [], [], ''compile'');'];
[sys,x0,str,ts] = eval(cmd_line);
So we were able to do that without open or load system. Doing it like the way above we can start, pause and stop the model when we want.
I had a meeting with my boss and our verification officer and we realized that the was that we’re getting coverage it wrong. That the way we’re doing it won’t give us 100% coverage when we get to our latch blocks. So we want to collect coverage while we iterate through our model but even if we set up coverage it won’t do anything since we never call sim() or hit the play button (simulate) from within the model. We need a way where we can capture each iteration we did in the model and collect coverage based on that.
I set up the coverage options in the model before anything’s done to it.
set_param(modelname, 'RecordCoverage', 'on', 'CovHtmlReporting', 'on', 'CovCumulativeReport', 'on', 'CovMetricSettings', 'dcm');
But unless I use cvsim(), sim() or hit the simulate button (play) from within the model, I won’t get any type of coverage.

Accepted Answer

Ryan G
Ryan G on 31 Jul 2012
Edited: Ryan G on 31 Jul 2012
This may be what you're looking for:
This will allow you to continue processing commands while the model is playing as well as stop/pause the model whenever you desire.
  1 Comment
Ryan G
Ryan G on 31 Jul 2012
Although I would not suggest this is not what you are experiencing, it does sound odd that those 3 methods work but this does not. If you let the set_param method run until the model completes, do you get the coverage data?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!