Model coverage without using sim
4 次查看(过去 30 天)
显示 更早的评论
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()?
EDIT1:
open_system(modelname);
cvt = cvtest(modelname);
cvt.setupCmd = 'load(''Set_Up.m'');';
cvd = cvsim(cvt);
cvhtml('TestCoverageHTML.html', cvd);
cvexit();
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.
EDIT2:
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.
EDIT3:
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.
EDIT4:
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.
0 个评论
采纳的回答
Ryan G
2012-7-31
编辑:Ryan G
2012-7-31
This may be what you're looking for:
set_param(gcs,'SimulationCommand','Start')
set_param(gcs,'SimulationCommand','Pause')
set_param(gcs,'SimulationCommand','Stop')
This will allow you to continue processing commands while the model is playing as well as stop/pause the model whenever you desire.
1 个评论
Ryan G
2012-7-31
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?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Collect Coverage for Models 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!