Set design verifiers parameters programmatically
Ältere Kommentare anzeigen
We have to set design verifiers 'MaxProcessTime' parameter programmatically so by using 'set_param' getting error like,
" block diagram does not have a parameter named 'MaxProcessTime'".
We have also tried sldvoptions but parameters are not reflecting in model.
Please provide effective solution for the same.
Antworten (2)
Pat Canny
am 4 Jan. 2022
Hi Aditi,
You should not use set_param to define the MaxProcess Time. The model itself has no parameter for this.
sldvdemo_cruise_control
optsModel = sldvoptions(bdroot);
optsCopy = optsModel.deepCopy;
optsCopy.MaxProcessTime = 120;
[ status, files ] = sldvrun(bdroot, optsCopy);
2 Kommentare
Aditi Kanawade
am 5 Jan. 2022
jarvis
am 1 Aug. 2025
Hi Aditi
I have tried to configure DVMaxProcessTime through scripting
set_param(COV_MODEL_NAME, 'DVMaxProcessTime', 1200);
But I faced problem like block_diagram does not have a parameter named 'DVMaxProcessTime'
then I found design verifier option or design verifier app should open then
the properties for design verifier will come in configuration set
Then we can use
set_param(COV_MODEL_NAME, 'DVMaxProcessTime', 1200);
The above process -> opening design verifier option (how to perform this through programitically)
Design Verifier Pane --> in this doc there is no information regarding that
have u found out how to achieve that
Devendra Bhave
am 9 Feb. 2022
0 Stimmen
Use parameter DVMaxProcessTime to set maximum analysis time. You must save the model before calling sltest.testmanager.createTestForComponent() API.
6 Kommentare
jarvis
am 1 Aug. 2025
I have tried to configure DVMaxProcessTime through scripting
set_param(COV_MODEL_NAME, 'DVMaxProcessTime', 1200);
But I faced problem like block_diagram does not have a parameter named 'DVMaxProcessTime'
then I found design verifier option or design verifier app should open then
the properties for design verifier will come in configuration set
Then we can use
set_param(COV_MODEL_NAME, 'DVMaxProcessTime', 1200);
The above process -> opening design verifier option (how to perform this through programitically)
Design Verifier Pane --> in this doc there is no information regarding that
Devendra Bhave
am 1 Aug. 2025
Thank you for pointing out this issue. We will update the documentation page.
"Design Verifier" entry is added to the model settings when you open "Design Verifier" app by clicking Simulink toolstrip -> "Apps" -> "Design Verifier" button.
It works even when Design Verifier settings are not available for a model.
jarvis
am 7 Okt. 2025
Thanks for your reply. What I'm try to say is I need to configure maximum process time of design verifier for a specific model in cfg panel. The reason is I'm running model coverage through simulink Test verifier (which means if I used sldvoption---> it will create one structured object in that I can change the MaxAnalysis Time then I can use the object to run design verifier for target model by using sldvrun(model, options) as you said but I'm not using that technique )
I need to change that property in cfg of model.
For that I found out API set_param(COV_MODEL_NAME, 'DVMaxProcessTime', 1200);
As I said before this option only visible in cfg pane only if Design verifier is opened in App window.
I will attach the snippet of my script
load_system(model_path)
COV_MODEL_NAME=[modelName '_cov'];
COV_MODEL_Subs=[COV_MODEL_NAME '/' modelName];
MODEL_Subs =[modelName '/' modelName];
try
sampletime = get_param(MODEL_Subs, 'Description');
catch
sampletime='0.001'
end
if ~bdIsLoaded(COV_MODEL_NAME)
new_system(COV_MODEL_NAME);
load_system(COV_MODEL_NAME);
end
starttime=0.0;
stoptime=10.0;
if str2double(sampletime) < 0.001
stoptime=2.00;
end
set_param(COV_MODEL_NAME, 'StartTime', num2str(starttime),'StopTime',num2str(stoptime),'SolverType','Fixed-step','Solver', 'FixedStepDiscrete', 'FixedStep',num2str(sampletime))
if isempty(find_system(MODEL_Subs, 'SearchDepth', 0))
error("There is no target subsytem is present with name of parent model name ")
end
try
add_block(MODEL_Subs,COV_MODEL_Subs);
set_param(COV_MODEL_Subs, 'TreatAsAtomicUnit', 'on');
save_system(COV_MODEL_NAME);
load_system(COV_MODEL_NAME);
catch ME
error("Problem in add block ",ME.message)
end
disp("Creating harness for target model and creating test file")
try
sltest.harness.create(COV_MODEL_Subs,Name='COV_HARNESS');
sltest.testmanager.clear;
testfileName=[COV_MODEL_NAME '_TestFile'];
testfile =sltest.testmanager.TestFile(testfileName);
testsuite = createTestSuite(testfile,'Test Suite');
testcase = createTestCase(testsuite,'baseline',[COV_MODEL_NAME '_testcase']);
catch ME
error("Problem while creating harness and test file for model coverage",ME.message)
end
try
tsDel = getTestSuiteByName(testfile, 'New Test Suite 1');
remove(tsDel);
catch
end
setProperty(testcase,'Model',COV_MODEL_NAME);
setProperty(testcase,'HarnessOwner',COV_MODEL_Subs,'HarnessName','COV_HARNESS');
% Enable coverage collection
cov = getCoverageSettings(testfile);
cov.RecordCoverage = true;
cov.MetricSettings = 'cd';
disp("Running default test casses with coverage enabled")
% Run the test
results = run(testfile);
try
% Get coverage results
cvdataArray = getCoverageResults(results);
for i = 1:numel(cvdataArray)
if contains(cvdataArray(i).modelinfo.analyzedModel, modelName)
cvdata = cvdataArray(i);
break;
end
end
% Add tests for missing coverage
testOpts = sltest.testmanager.TestOptions(testcase);
% --- Set Design Verifier Options ---
% Create Design Verifier options
sldvtimer(1)
opts = sldvoptions;
opts.MaxProcessTime = 600; % Increase max time to 20 minutes
disp("Add Test cases for missing coverage")
newTestCaseObj = sltest.testmanager.addTestsForMissingCoverage(testOpts, cvdata);
disp("Running addition test cases to incraese coverage")
ResultsObj = run(newTestCaseObj);
catch ME
error("Error occurred during adding missing coverage testcases", ME.message)
end
cvdata_final = getCoverageResults(ResultsObj);
for i = 1:numel(cvdataArray)
if contains(cvdata_final(i).modelinfo.analyzedModel, modelName)
cv_result = cvdata_final(i);
break;
end
end
disp("Model coverage completed .Converting result into html report")
cvhtml(fullfile(report_dest_dir, [modelName '_coverage.html']), cv_result);
catch ME
delete_cache('scv_images',3);
delete_cache('slcov_output',3);
delete_cache('sldv_output',3);
delete_cache('slprj',3);
delete('*.slxc','*.xml','*.slx','*.mexw64', '*.html', '*.mldatx','*.slx.autosave');
bdclose('all');
sltest.testmanager.clear; % Clears the test manager
sltest.testmanager.clearResults; % Clears test results
sltest.testmanager.close; % Closes test manager UI
error('Problem in Model coverage',ME.message);
end
try
delete_cache('scv_images',3);
delete_cache('slcov_output',3);
delete_cache('sldv_output',3);
delete_cache('slprj',3);
delete('*.slxc','*.xml','*.slx','*.mexw64', '*.html', '*.mldatx','*.slx.autosave');
bdclose('all');
sltest.testmanager.clear; % Clears the test manager
sltest.testmanager.clearResults; % Clears test results
sltest.testmanager.close; % Closes test manager UI
catch ME
error("Problem while try to clear workspace(deleting catch files):%s",Me.message)
end
Devendra Bhave
am 7 Okt. 2025
Open MATLAB with Design Verifier license.
load_system(model_name);
hCs = getActiveConfigSet(model_name); % Get current configuration settings.
hCs.attachComponent(Sldv.ConfigComp); % Add Design Verifier settings to it.
set_param(model_name, 'DVMaxProcessTime', 1200); % This shall succeed.
You may need to save the model as settings are now changed.
Thanks @Devendra Bhave
Its working. I can able to change Max process time.
I need some more help
While running above script which I have shared before for complex model (its has lot of LUTs and few extern variables) I'm facing error at the command
newTestCaseObj = sltest.testmanager.addTestsForMissingCoverage(testOpts, cvdata);
Errror: Problem facing while adding test case for missing coverage
What might be the reason for this ?
My assumption is due to increasein max process time its try to add different test cases in order to achieve higher coverage, while doing that its faced error. If Yes means How to solve this problem. Or How efficiently utilize design verifier
Devendra Bhave
am 8 Okt. 2025
It is hard to answer definitively about this issue based on the above description.
Try Simulink Test Add Missing Coverage workflow with user interface (UI). This will open the Design Verifier UI, show analysis progress, and display any errors. A Design Verifier analysis timeout is usually not a serious error.
Contact MathWorks technical support for further assistance.
Kategorien
Mehr zu Analyze Model or Subsystem finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!