Quantcast

Documentation Center

  • Trial Software
  • Product Updates

overflowsaturationinfo

Retrieve saturation on integer overflow coverage from cvdata object

Syntax

  • coverage = overflowsaturationinfo(covdata, object) example
  • coverage = overflowsaturationinfo(covdata, object, ignore_descendants)
  • [coverage, description] = overflowsaturationinfo(covdata, object) example

Description

example

coverage = overflowsaturationinfo(covdata, object) returns saturation on integer overflow coverage results from the cvdata object covdata for the model object specified by object and its descendants.

coverage = overflowsaturationinfo(covdata, object, ignore_descendants) returns saturation on integer overflow coverage results from the cvdata object covdata for the model object specified by object and, depending on the value of ignore_descendants, descendant objects.

example

[coverage, description] = overflowsaturationinfo(covdata, object) returns saturation on integer overflow coverage results from the cvdata object covdata for the model object specified by object, and textual descriptions of each coverage outcome.

Examples

expand all

Collect Saturation on Integer Overflow Coverage for MinMax Block

Collect saturation on integer overflow coverage information for a MinMax block in the example model sldemo_fuelsys.

Open the sldemo_fuelsys example model. Create a model coverage test specification object for the Mixing & Combustion subsystem of the Engine Gas Dynamics subsystem.

open_system('sldemo_fuelsys');
testObj = cvtest('sldemo_fuelsys/Engine Gas Dynamics/' ...
		'Mixing & Combustion');

In the model coverage test specification object, specify to collect saturation on overflow coverage.

testObj.settings.overflowsaturation = 1;

Simulate the model and collect coverage results in a new cvdata object.

dataObj = cvsim(testObj);

Get the saturation on overflow coverage results for the MinMax block in the Mixing & Combustion subsystem. The coverage results are stored in a two-element vector of the form [covered_outcomes total_outcomes].

blockHandle = get_param('sldemo_fuelsys/' ...
		'Engine Gas Dynamics/Mixing & Combustion/MinMax','Handle');
covResults = overflowsaturationinfo(dataObj, blockHandle)
covResults =

     1     2

One out of two saturation on integer overflow decision outcomes were satisfied for the MinMax block in the Mixing & Combustion subsystem, so it received 50% saturation on integer overflow coverage.

Collect Saturation on Integer Overflow Coverage and Description for Example Model

Collect saturation on integer overflow coverage for the example model slvnvdemo_saturation_on_overflow_coverage. Review collected coverage results and description for Sum block in Controller subsystem.

Open the slvnvdemo_saturation_on_overflow_coverage example model.

open_system('slvnvdemo_saturation_on_overflow_coverage');

Simulate the model and collect coverage results in a new cvdata object.

dataObj = cvsim('slvnvdemo_saturation_on_overflow_coverage');

Retrieve saturation on integer overflow coverage results and description for the Sum block in the Controller subsystem of the Test Unit subsystem.

[covResults covDesc] = overflowsaturationinfo(dataObj, ...
		'slvnvdemo_saturation_on_overflow_coverage/Test Unit /' ...
		'Controller/Sum')
covResults =

     1     2


covDesc = 

    isFiltered: 0
      decision: [1x1 struct]

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 the Sum block evaluated to each saturation on integer overflow outcome during simulation.

covDesc.decision.outcome(1)
ans = 

    executionCount: 3
              text: 'false'
covDesc.decision.outcome(2)
ans = 

    executionCount: 0
              text: 'true'

During simulation, integer overflow did not occur in the Sum block.

If integer overflow is not possible for a block in your model, consider clearing the Saturate on integer overflow block parameter to optimize efficiency of your generated code.

Input Arguments

expand all

covdata — Coverage results datacvdata object

Coverage results data, specified as a cvdata object.

object — Model or model componentfull path | handle

Model or model component, specified as a full path, handle, or array of paths or handles.

Object SpecificationDescription

BlockPath

Full path to a model or block

BlockHandle

Handle to a model or block

slObj

Handle to a Simulink® API object

sfID

Stateflow® ID

sfObj

Handle to a Stateflow API object

{BlockPath, sfID}

Cell array with the path to a Stateflow chart or atomic subchart and the ID of an object contained in that chart or subchart

{BlockPath, sfObj}

Cell array with the path to a Stateflow chart or atomic subchart and a Stateflow object API handle contained in that chart or subchart

[BlockHandle, sfID]

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 objects0 (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

expand all

coverage — Saturation on overflow coverage results for objectnumerical vector

Saturation on overflow coverage results, stored in a two-element vector of the form [covered_outcomes total_outcomes]. The two elements are:

covered_outcomesNumber of saturation on integer overflow outcomes satisfied for object
total_outcomesTotal number of saturation on integer overflow outcomes for object

Data Types: double

description — Textual description of coverage outcomesstructure array

Textual description of coverage outcomes for the model component specified by object, 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

0 if the model component specified by object is not excluded from coverage recording. 1 if the model component specified by object is excluded from coverage recording. For more information about excluding objects from coverage, see Coverage Filtering.

decision.text'Saturate on integer overflow'
decision.outcome

Structure array containing two fields for each coverage outcome:

executionCountNumber of times saturation on integer overflow for object evaluated to the outcome described by text.
text'true' or 'false'

Saturation on integer overflow has two possible outcomes, 'true' and 'false'.

decision.isFiltered

0 if the model component specified by object is not excluded from coverage recording. 1 if the model component specified by object is excluded from coverage recording. For more information about excluding objects from coverage, see Coverage Filtering.

decision.filterRationale

Rationale for filtering the model component specified by object, if object is excluded from coverage and a rationale is specified. For more information about excluding objects from coverage, see Coverage Filtering.

Data Types: struct

See Also

| | | | | | | | |

Was this topic helpful?