Slcoverage。Filter class
Package:Slcoverage
Coverage filter set
Description
使用一个对象Slcoverage。Filter
class to filter out unsatisfied coverage objectives by creating rules using theSlcoverage。FilterRule
class.
TheSlcoverage。Filter
班级是handle
class.
Creation
Description
creates an菲尔特
= slcoverage.Filter()Slcoverage。Filter
目的。
creates an菲尔特
= slcoverage.Filter(菲尔特erFile
)Slcoverage。Filter
包含保存在的过滤器规则的对象菲尔特erFile
。
Input Arguments
菲尔特erFile
—过滤文件
路径名
CVF格式的过滤文件,指定为文件名的路径名的字符数组,或字符数组的单元格数组。您无需包括文件扩展名。
Example:'myfilt'
,'filters\myfilt'
,{'myfilt1', 'myfilt2'}
方法
Public Methods
addRule |
Add coverage filtering rule to filter |
removeRule |
Remove rule from filter rule set |
rules |
Rules for filter |
setFiltername |
设置覆盖范围过滤对象的名称 |
菲尔特erName |
Get name of coverage filter object |
setFilterDescription |
Set description of coverage filter object |
过滤器描述 |
获取覆盖范围过滤对象的描述 |
save |
Save coverage filter object to coverage filter file |
Examples
Add Rule to a Filter File
This example shows how to add a rule to a coverage filter file.
Create a filter object and use theBlockSelector
类来创建aBlockSelector
饱和块的对象slvnvdemo_covfilt
模型。
菲尔特= slcoverage.Filter; blockSel = slcoverage.BlockSelector(slcoverage.BlockSelectorType.BlockInstance,。。。'slvnvdemo_covfilt/饱和');
Create a rule to filter the Saturation block usingSlcoverage。FilterRule
将选择器作为第一个输入和基本原理作为第二输入。
rule = slcoverage.FilterRule(blockSel,'Edge case');
Use theaddRule
method of theSlcoverage。Filter
类将规则添加到过滤器对象。
addrule(filt,规则);
Save the filter with the new rule to a filter file using thesave
method of theSlcoverage。Filter
class.
save(filt,'myFilterFile')
Create and Use a Coverage Filter Object
This example shows how to create a filter object and add a rule to exclude a subsystem from coverage analysis.
Open theslvnvdemo_covfilt
模型。用一个SimulationInput
object to enable coverage recording and specify coverage settings.
modelName ='slvnvdemo_covfilt';load_system(modelName)simin = s金宝appimulink.simulationInput(modelName);simin = setModelParameter(simin,'CovEnable','on');simin = setModelParameter(simin,“ covmetricsstructurallevel”,'MCDC');simin = setModelParameter(simin,'CovSaveSingleToWorkspaceVar','on');simin = setModelParameter(simin,'CovSaveName','covData');
Simulate the model. The coverage data is stored in the value supplied for theCovSaveName
property.
simout = sim(simin);covData = simOut.covData;
You can filter a block by using theslcoverage.blockselector
class. To exclude the Switchable config subsystem, useslcoverage.blockselettype.subsystemallcontent
as the first input.
subsysSel = slcoverage.BlockSelector(。。。slcoverage.blockselettype.subsystemallcontent,。。。'slvnvdemo_covfilt/Switchable config');
Create the filter rule by passing the selector, rationale, and the exclude filter mode as inputs.
rule = slcoverage.FilterRule(subsysSel,。。。'Unused configuration',。。。slcoverage.filtermode.exclude);
Create anSlcoverage。Filter
对象,然后将规则添加到其中。
菲尔特= slcoverage.Filter; addRule(filt,rule);
Save the filter to a file calledblockFilter.cvf
。要创建使用此覆盖过滤器的报告,请将过滤器文件作为值添加到菲尔特er
property ofcovData
,并创建一个名为的报告coverageData.html
usingcovData
。
save(filt,'blockFilter') covData.filter ='blockFilter';cvhtml('coverageData',covData)
Use Multiple Coverage Filter Files for a Simulation
如果您有多个包含自己的规则集的过滤文件,则可以通过创建过滤器文件名或路径名的单元格数组将其应用于覆盖范围结果。在此示例中,您将两个过滤文件应用于一个cvdata
object and then view the report to see that the filters are applied.
加载slvnvdemo_covfilt
model into memory.
modelName ='slvnvdemo_covfilt';load_system(modelName)
Set the coverage settings by using aSimulink.SimulationInput
object and simulate the model usingsim
。
simin = 金宝appsimulink.simulationInput(modelName);simin = setModelParameter(simin,'CovEnable','on');simin = setModelParameter(simin,“ covmetricsstructurallevel”,'MCDC');simin = setModelParameter(simin,'CovSaveSingleToWorkspaceVar','on');simin = setModelParameter(simin,'CovSaveName','covData');simout = sim(simin);
Apply the two filters to thecvdata
将它们分配给过滤器属性作为单元格数组来对象。
covData.filter = {'filter_1','filter_2'}; cvhtml('twoFiltersCovData',covData);
You can see the applied coverage filters in theObjects Filtered from Coverage Analysissection of the coverage report.
Version History
Abrir ejemplo
Tiene una versión modificada de este ejemplo. ¿Desea abrir este ejemplo con sus modificaciones?
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:。
您还可以从以下列表中选择一个网站:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- AméricaLatina(Español)
- Canada(English)
- United States(English)
欧洲
- Belgium(English)
- 丹麦(English)
- Deutschland(德意志)
- España(Español)
- Finland(English)
- 法国(Français)
- 爱尔兰(English)
- Italia(Italiano)
- Luxembourg(English)
- Netherlands(English)
- 挪威(English)
- Österreich(德意志)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)