overflowsaturationinfo
Retrieve saturation on integer overflow coverage fromcvdata
object
Syntax
Description
returns saturation on integer overflow coverage results from thecoverage
= overflowsaturationinfo(covdata
,object
,ignore_descendants
)cvdata
objectcovdata
for the model object specified byobject
and, depending on the value ofignore_descendants
, descendant objects.
[
returns saturation on integer overflow coverage results from thecoverage
,description
] = overflowsaturationinfo(covdata
,object
)cvdata
objectcovdata
for the model object specified byobject
, and textual descriptions of each coverage outcome.
Examples
Extract Saturation on Integer Overflow Data
This example shows how to useoverflowsaturationinfo
提取饱和强度ger overflow data for aMinMax
block from acvdata
object.
Generate coverage data
Open the model and set coverage settings.
load_system('slcoverage_fuelsys');
Create aSimulink.SimulationInput
object to change configuration parameters without modifying the model.
covSet = Simulink.SimulationInput('slcoverage_fuelsys');
Turn on coverage analysis and configure Simulink® to save the coverage data in a separatecvdata
object in the workspace.
covSet = covSet.setModelParameter('CovEnable','on'); covSet = covSet.setModelParameter('CovSaveSingleToWorkspaceVar','on'); covSet = covSet.setModelParameter('CovSaveName','covData'); covSet = covSet.setModelParameter('CovScope','EntireSystem');
Enable collection of saturation on integer overflow Coverage and simulate the model by callingsim
with theSimulationInput
object as the input.
covSet = covSet.setModelParameter('CovMetricSaturateOnIntegerOverflow','on'); simOut = sim(covSet);
Extract saturation on integer overflow results
Get the block handle to the MinMax block usingget_param
and then get the saturation on integer overflow results.
blockHandle = get_param(['slcoverage_fuelsys/',...'Engine Gas Dynamics/Mixing & Combustion/MinMax'],'Handle'); saturationResults = overflowsaturationinfo(covData,blockHandle) percentSaturationCoverage = 100 * saturationResults(1)/saturationResults(2)
saturationResults = 1 2 percentSaturationCoverage = 50
One out of two saturation on integer overflow decision outcomes were satisfied for theMinMax
block in theMixing & Combustion
subsystem, so it received 50% saturation on integer overflow coverage.
确定单个整数溢出的结果
This example shows how to useoverflowsaturationinfo
to determine whether or not integer overflow occurs for a block in a model.
Generate coverage data
Load theslvnvdemo_saturation_on_overflow_coverage
example model.
load_system('slvnvdemo_saturation_on_overflow_coverage');
Set coverage setting using aSimulink.SimulationInput
object. Turn coverage on and configure Simulink® to output acvdata
object into the workspace.
covSet = Simulink.SimulationInput('slvnvdemo_saturation_on_overflow_coverage'); covSet = covSet.setModelParameter('CovEnable','on'); covSet = covSet.setModelParameter('CovSaveSingleToWorkspaceVar','on'); covSet = covSet.setModelParameter('CovSaveName','covData'); covSet = covSet.setModelParameter('CovScope','EntireSystem');
Extract saturation on integer overflow results
Retrieve saturation on integer overflow coverage results and description for theSum
block in theController
subsystem of theTest Unit
subsystem.
covSet = covSet.setModelParameter('CovMetricSaturateOnIntegerOverflow','on'); simOut = sim(covSet); [covResults, covDesc] = overflowsaturationinfo(covData,...['slvnvdemo_saturation_on_overflow_coverage/Test Unit /'...'Controller/Sum']) percentSaturation = 100 * covResults(1)/covResults(2)
covResults = 1 2 covDesc = struct with fields: isFiltered: 0 isJustified: 0 justifiedCoverage: 0 filterRationale: '' decision: [1x1 struct] percentSaturation = 50
One out of two saturation on integer overflow decision outcomes were satisfied for the Sum block, so it received 50% saturation on integer overflow coverage.
Review the number of times theSum
block evaluated to each saturation on integer overflow outcome during simulation.
outcome1 = covDesc.decision.outcome(1) outcome2 = covDesc.decision.outcome(2)
outcome1 = struct with fields: execCount: 3 executionCount: 3 text: 'false' isFiltered: 0 isJustified: 0 filterRationale: '' executedIn: [] outcome2 = struct with fields: execCount: 0 executionCount: 0 text: 'true' isFiltered: 0 isJustified: 0 filterRationale: '' executedIn: []
During simulation, integer overflow didnotoccur in theSum
block because the'true'
outcome has an execution count of0
.
If integer overflow is not possible for a block in your model, consider clearing theSaturate on integer overflowblock parameter to optimize efficiency of your generated code.
Input Arguments
covdata
—Coverage results data
cvdata
object
Coverage results data, specified as acvdata
object.
object
—Model or model component
full path|handle
Model or model component, specified as a full path, handle, or array of paths or handles.
Object Specification | Description |
---|---|
|
Full path to a model or block |
|
Handle to a model or block |
|
Handle to a Simulink®API object |
|
Stateflow®ID |
|
Handle to a Stateflow API object |
|
Cell array with the path to a Stateflow chart or atomic subchart and the ID of an object contained in that chart or subchart |
|
Cell array with the path to a Stateflow chart or atomic subchart and a Stateflow object API handle contained in that chart or subchart |
|
Cell array with a handle to a Stateflow chart or atomic subchart and the ID of an object contained in that chart or subchart |
Example:'slvnvdemo_saturation_on_overflow_coverage'
Example:get_param('slvnvdemo_cv_small_controller/Saturation', 'Handle')
ignore_descendants
—Preference to ignore coverage of descendant objects
0
(default) |1
Preference to ignore coverage of descendant objects, specified as a logical value.
1 — Ignore coverage of descendant objects |
0 — Collect coverage for descendant objects |
Data Types:logical
Output Arguments
coverage
— Saturation on overflow coverage results forobject
numerical vector
Saturation on overflow coverage results, stored in a two-element vector of the form[covered_outcomes total_outcomes]
. The two elements are:
covered_outcomes |
Number of saturation on integer overflow outcomes satisfied forobject |
total_outcomes |
Total number of saturation on integer overflow outcomes forobject |
Data Types:double
description
— Textual description of coverage outcomes
structure array
Textual description of coverage outcomes for the model component specified byobject
, returned as a structure array. Depending on the types of model coverage collected, the structure array can have different fields. If only saturation on overflow coverage is collected, the structure array contains the following fields:
isFiltered |
|
||||
decision.text |
'Saturate on integer overflow' |
||||
decision.outcome |
Structure array containing two fields for each coverage outcome:
Saturation on integer overflow has two possible outcomes, |
||||
decision.isFiltered |
|
||||
decision.filterRationale |
Rationale for filtering the model component specified by |
Data Types:struct
Version History
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは 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:.
You can also select a web site from the following list:
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érica Latina(Español)
- Canada(English)
- United States(English)
Europe
- Belgium(English)
- Denmark(English)
- Deutschland(Deutsch)
- España(Español)
- Finland(English)
- France(Français)
- Ireland(English)
- Italia(Italiano)
- Luxembourg(English)
- Netherlands(English)
- Norway(English)
- Österreich(Deutsch)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)