%% Basic Operation of the Model Coverage Tool
% This example shows how to use the Configuration Parameters dialog to
% enable coverage for a Simulink(R) model and adjust the type of
% information that is reported.

% Copyright 2005-2019 The MathWorks, Inc.
 
%% Open Example Model
% The |sldemo_clutch| example model that ships with Simulink provides
% a good introduction to model coverage. This model contains several blocks 
% that have intrinsic decisions, places where control flow can take more than one path.

%%
% <matlab:open_system('sldemo_clutch') Open sldemo_clutch>

%%
% <<../basic_operation_1.png>>

%% Open Coverage Settings Dialog
% Coverage settings are found under the *Coverage* pane of the
% Configuration Parameters dialog. To navigate to this pane,
% from the *Modeling* tab, select *Model Settings*.

%%
% <<../basic_operation_2.png>>

%% Enable Multiple Coverage Metrics
% To enable the coverage tool, select *Enable coverage analysis*. This
% setting enables the other options in the Coverage pane.

%%
% The Coverage metrics group controls the types of coverage information
% that is collected during simulation.
%
% The *Structural coverage level* drop-down menu allows you to select which
% structural coverage metrics will be analyzed during simulation.  These
% are ordered from the least rigorous (_Block Execution_) to the most
% rigorous (_Modified Condition Decision (MCDC)_).
%
% For this example, select the _Modified Condition Decision (MCDC)_
% structural coverage level.  The resulting report will also include
% decision and condition coverage results.


%%
% <<../basic_operation_3.png>>

%%
% Additional coverage metrics can be found under the *Other metrics* toggle
% panel.  Click the black arrow to expand this panel and see the available
% metrics.  Selecting all coverage metrics provides the most coverage
% information. 
%
% For this example, select *Signal Range* and *Lookup Table*.

%%
% <<../basic_operation_4.png>>

%%
% Click OK to apply your selected settings and close the Coverage Settings
% dialog box.


%% Run Simulation and Explore Results
% Once you enable coverage collection for your model, coverage information
% is automatically recorded when you simulate the model. At the end of the
% simulation, the Coverage Results Explorer is opened, showing results for
% the latest coverage analysis.

%% 
% <matlab:sim('sldemo_clutch'); Run simulation and analyze coverage>

%%
% <<../basic_operation_5.png>>

%% Produce Coverage Report from Results Explorer
% The Coverage Results Explorer offers various functionality for
% processing, displaying, and reporting coverage results from previous
% simulations of your model.
%
% Click the *Generate report* link at the bottom of the Coverage Results
% Explorer window.  This produces an HTML report of coverage information 
% that displays within the built-in MATLAB(R) web browser.

%%
% <<../basic_operation_6.png>>
