Model coverage without using sim

조회 수: 6 (최근 30일)
Lucas
Lucas 2012년 6월 4일
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.

채택된 답변

Ryan G
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
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 CenterFile Exchange에서 Collect Coverage for Models에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by