MATLAB and Simulink® Coverage™ Users Guide (The MathWorks, Inc.) (z-library.sk, 1lib.sk, z-lib.sk)
,
Matlab
No Description
7
Views
Registered users can read the full content for free
Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.
Page
1
Simulink® Coverage™ User's Guide R2021b
Page
2
How to Contact MathWorks Latest news: www.mathworks.com Sales and services: www.mathworks.com/sales_and_services User community: www.mathworks.com/matlabcentral Technical support: www.mathworks.com/support/contact_us Phone: 508-647-7000 The MathWorks, Inc. 1 Apple Hill Drive Natick, MA 01760-2098 Simulink® Coverage™ User's Guide © COPYRIGHT 2017–2021 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form without prior written consent from The MathWorks, Inc. FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through the federal government of the United States. By accepting delivery of the Program or Documentation, the government hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and Documentation by the federal government (or other entity acquiring for or through the federal government) and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the government's needs or is inconsistent in any respect with federal procurement law, the government agrees to return the Program and Documentation, unused, to The MathWorks, Inc. Trademarks MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders. Patents MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for more information. Revision History September 2017 Online only New for Version 4.0 (Release 2017b) March 2018 Online only Revised for Version 4.1 (Release 2018a) September 2018 Online only Revised for Version 4.2 (Release 2018b) March 2019 Online only Revised for Version 4.3 (Release R2019a) September 2019 Online only Revised for Version 4.4 (Release R2019b) March 2020 Online only Revised for Version 5.0 (Release R2020a) September 2020 Online only Revised for Version 5.1 (Release R2020b) March 2021 Online only Revised for Version 5.2 (Release R2021a) September 2021 Online only Revised for Version 5.3 (Release R2021b)
Page
3
Model Coverage Definition 1 Model Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 Types of Model Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 Execution Coverage (EC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 Decision Coverage (DC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 Condition Coverage (CC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 Modified Condition/Decision Coverage (MCDC) . . . . . . . . . . . . . . . . . . . . 1-4 Cyclomatic Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 Lookup Table Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5 Signal Range Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5 Signal Size Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5 Objectives and Constraints Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 Saturate on Integer Overflow Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7 Relational Boundary Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7 Simulink Optimizations and Model Coverage . . . . . . . . . . . . . . . . . . . . . . . 1-9 Inlined Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9 Block Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9 Conditional Input Branch Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9 Model Objects That Receive Model Coverage 2 Model Objects That Receive Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 Abs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 Bias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 Combinatorial Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 Compare to Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 Compare to Zero . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7 Data Type Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 Dead Zone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 Direct Lookup Table (n-D) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 Discrete Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9 Discrete FIR Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9 Discrete-Time Integrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-9 Discrete Transfer Fcn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10 Dot Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10 Enabled Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10 Enabled and Triggered Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11 Fcn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11 For Iterator, For Iterator Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12 iii Contents
Page
4
Gain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12 If, If Action Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12 Index Vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13 Interpolation Using Prelookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13 Library-Linked Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13 Logical Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-14 1-D Lookup Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-14 2-D Lookup Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15 n-D Lookup Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15 Math Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15 MATLAB Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16 MATLAB System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16 MinMax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16 Multiport Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-17 Observer Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-17 PID Controller, PID Controller (2 DOF) . . . . . . . . . . . . . . . . . . . . . . . . . . 2-17 Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-17 Proof Assumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-18 Proof Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-18 Rate Limiter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-18 Relational Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-19 Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-19 C/C++ S-Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20 Saturation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20 Saturation Dynamic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-21 Simulink Design Verifier Functions in MATLAB Function Blocks . . . . . . . 2-21 Sqrt, Signed Sqrt, Reciprocal Sqrt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-22 Sum, Add, Subtract, Sum of Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-22 Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-22 SwitchCase, SwitchCase Action Subsystem . . . . . . . . . . . . . . . . . . . . . . . 2-22 Test Condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-23 Test Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-23 Triggered Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-23 Triggered Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-24 Truth Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-24 Unary Minus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-24 Weighted Sample Time Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-24 While Iterator, While Iterator Subsystem . . . . . . . . . . . . . . . . . . . . . . . . 2-25 Model Objects That Do Not Receive Coverage . . . . . . . . . . . . . . . . . . . . . 2-26 Setting Coverage Options 3 Specify Coverage Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 Coverage Pane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 Access, Manage, and Aggregate Coverage Results . . . . . . . . . . . . . . . . . . . 3-7 Accessing Coverage Data from the Results Explorer . . . . . . . . . . . . . . . . . 3-7 Managing Coverage Data from the Results Explorer . . . . . . . . . . . . . . . . 3-11 Accumulating Coverage Data from the Results Explorer . . . . . . . . . . . . . 3-12 iv Contents
Page
5
Cumulative Coverage Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14 Cumulative Coverage Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15 Obtain Cumulative Coverage for Reusable Subsystems and Stateflow® Constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-31 Saturation on Integer Overflow Coverage . . . . . . . . . . . . . . . . . . . . . . . . . 3-33 Code Coverage 4 Types of Code Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Statement Coverage for Code Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Condition Coverage for Code Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 Decision Coverage for Code Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 Modified Condition/Decision Coverage (MCDC) for Code Coverage . . . . . . 4-3 Cyclomatic Complexity for Code Coverage . . . . . . . . . . . . . . . . . . . . . . . . 4-4 Relational Boundary for Code Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 Function Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 Function Call Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5 Code Coverage for Models in Software-in-the-Loop (SIL) Mode and Processor-in-the-Loop (PIL) Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6 Enable SIL or PIL Code Coverage for a Model . . . . . . . . . . . . . . . . . . . . . . 4-6 Review the Coverage Results for Models in SIL or PIL Mode . . . . . . . . . . . 4-6 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7 Collect Code Coverage Metrics with Simulink® Coverage™ . . . . . . . . . . . 4-9 Specify Code Coverage Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-17 Models with S-Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-17 Models with Software-in-the-Loop and Processor-in-the-Loop Mode Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-17 Models with MATLAB Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . 4-18 Coverage for Models with Code Blocks and Simulink Blocks . . . . . . . . . 4-19 Set Up the Model to Record Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . 4-19 Record Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20 Review Results by Generating a Coverage Report . . . . . . . . . . . . . . . . . . 4-20 Justify Missing Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20 Software-in-the-Loop Code Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-22 Use Justification Rules to Filter Code Coverage Outcomes . . . . . . . . . . . 4-23 v
Page
6
Coverage Collection During Simulation 5 Create and Run Test Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 Modified Condition and Decision Coverage (MCDC) Definitions in Simulink Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3 Differences between Masking MCDC and Unique-Cause MCDC in Simulink Coverage Coverage Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3 Certification Considerations for MCDC Coverage . . . . . . . . . . . . . . . . . . . 5-4 Setting the (MCDC) Definition Used for Simulink Coverage Coverage Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 Modified Condition and Decision Coverage in Simulink Design Verifier . . . 5-5 Modified Condition and Decision Coverage in Simulink Design Verifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6 MCDC Definitions for Simulink Coverage and Simulink Design Verifier . . . 5-6 Logical Operator Cascade Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 Analyzing MCDC for Cascaded Logic Blocks . . . . . . . . . . . . . . . . . . . . . . . 5-10 View Coverage Results in Simulink Canvas . . . . . . . . . . . . . . . . . . . . . . . . 5-22 Overview of Model Coverage Highlighting . . . . . . . . . . . . . . . . . . . . . . . 5-22 Enable Coverage Highlighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-22 View Coverage Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-24 Model Coverage for Multiple Instances of a Referenced Model . . . . . . . 5-26 About Coverage for Model Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-26 Record Coverage for Multiple Instances of a Referenced Model . . . . . . . 5-26 Obtain Cumulative Coverage for Reusable Subsystems and Stateflow® Constructs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-34 Trace Coverage Results to Requirements . . . . . . . . . . . . . . . . . . . . . . . . . 5-36 Prerequisites for Tracing Requirements Links . . . . . . . . . . . . . . . . . . . . . 5-36 Assess Coverage Results from Requirements-Based Tests . . . . . . . . . . . 5-39 Rationale for Scoping Coverage Results to Linked Requirements-Based Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-39 Prerequisites for Scoping Coverage Results to Linked Requirements-Based Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-39 Coverage Reporting for Aggregated Coverage Results Scoped to Linked Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-39 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-40 Trace Coverage Results to Associated Test Cases . . . . . . . . . . . . . . . . . . . 5-41 Prerequisites for Tracing Associated Test Cases to Coverage Results . . . 5-41 Aggregate Unit-Level Coverage Data into Top-Level Model Coverage . . . 5-41 Model Coverage for MATLAB Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 5-45 About Model Coverage for MATLAB Functions . . . . . . . . . . . . . . . . . . . . 5-45 Types of Model Coverage for MATLAB Functions . . . . . . . . . . . . . . . . . . 5-45 How to Collect Coverage for MATLAB Functions . . . . . . . . . . . . . . . . . . . 5-46 vi Contents
Page
7
Examples: Model Coverage for MATLAB Functions . . . . . . . . . . . . . . . . . 5-47 Coverage for MATLAB® Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . 5-57 Coverage for Custom C/C++ Code in Simulink Models . . . . . . . . . . . . . . 5-59 Enable Code Coverage for Custom C/C++ code in MATLAB Function Blocks, C Caller Blocks, and Stateflow Charts . . . . . . . . . . . . . . . . . . . 5-59 Code Coverage for S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-59 View Coverage Results for Custom C/C++ Code in S-Function Blocks . . 5-61 Coverage for S-Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-65 Model Coverage for Stateflow Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-68 How Model Coverage Reports Work for Stateflow Charts . . . . . . . . . . . . 5-68 Specify Coverage Report Settings for Stateflow Charts . . . . . . . . . . . . . . 5-68 Cyclomatic Complexity for Stateflow Charts . . . . . . . . . . . . . . . . . . . . . . 5-68 Decision Coverage for Stateflow Charts . . . . . . . . . . . . . . . . . . . . . . . . . 5-69 Condition Coverage for Stateflow Charts . . . . . . . . . . . . . . . . . . . . . . . . 5-71 MCDC Coverage for Stateflow Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-71 Relational Boundary Coverage for Stateflow Charts . . . . . . . . . . . . . . . . 5-72 Simulink Design Verifier Coverage for Stateflow Charts . . . . . . . . . . . . . 5-72 Model Coverage Reports for Stateflow Charts . . . . . . . . . . . . . . . . . . . . . 5-73 Model Coverage for Stateflow State Transition Tables . . . . . . . . . . . . . . 5-80 Model Coverage for Stateflow Atomic Subcharts . . . . . . . . . . . . . . . . . . . 5-81 Model Coverage for Stateflow Truth Tables . . . . . . . . . . . . . . . . . . . . . . . 5-82 Model Coverage Display for Stateflow Charts . . . . . . . . . . . . . . . . . . . . . 5-86 Code Coverage for C/C++ code in Stateflow Charts . . . . . . . . . . . . . . . . 5-88 Model Coverage for Variant Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-89 Update-Time and Compile-Time Variants . . . . . . . . . . . . . . . . . . . . . . . . . 5-89 Startup Variants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-91 Collect Coverage for Multiple Simulations by Using Design Studies . . . 5-94 Results Review 6 Types of Coverage Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Model Summary Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2 Model Reference Coverage Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 External MATLAB File Coverage Report . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 Subsystem Coverage Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7 Code Coverage Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9 Top-Level Model Coverage Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10 Analysis Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10 Aggregated Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 Coverage Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-12 Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-13 Cyclomatic Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-21 Decisions Analyzed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23 vii
Page
8
Conditions Analyzed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-24 MCDC Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-24 Cumulative Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-25 N-Dimensional Lookup Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-27 Block Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-31 Relational Boundary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-32 Saturate on Integer Overflow Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 6-34 Signal Range Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-35 Signal Size Coverage for Variable-Dimension Signals . . . . . . . . . . . . . . . 6-36 Simulink Design Verifier Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-37 Export Model Coverage Web View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-39 Filtering in Simulink Coverage 7 Coverage Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 When to Use Coverage Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 What Is Coverage Filtering? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2 Coverage Filter Rules and Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 What Is a Coverage Filter Rule? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 What Is a Coverage Filter File? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 Model Objects to Filter from Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5 Create, Edit, and View Coverage Filter Rules . . . . . . . . . . . . . . . . . . . . . . . 7-6 Create and Edit Coverage Filter Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 Save Coverage Filter to File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Create New Coverage Filter File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Load Coverage Filter File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 Remove Applied Coverage Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9 Manage Applied filters by Using the Simulink Test Manager . . . . . . . . . . . 7-9 Update the Report with the Current Filter Settings . . . . . . . . . . . . . . . . . . 7-9 View Coverage Filter Rules in Your Model . . . . . . . . . . . . . . . . . . . . . . . . . 7-9 View Applied Filters in the Coverage Results Explorer . . . . . . . . . . . . . . 7-10 Creating and Using Coverage Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11 Automating Model Coverage Tasks 8 Automating Model Coverage Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 Collect Coverage Data Using a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 Differences between sim and the Run Button . . . . . . . . . . . . . . . . . . . . . . 8-3 Collecting Coverage with Simulink Test . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3 viii Contents
Page
9
Programmatically Retrieve Coverage Details from Results . . . . . . . . . . . . 8-4 Analyze Coverage Data Using A Script . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4 Coverage Information Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6 Command Line Verification Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-7 Extracting Detailed Information from Coverage Data . . . . . . . . . . . . . . . 8-16 Operations on Coverage Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-24 Record Coverage in Parallel Simulations by Using Parsim . . . . . . . . . . . 8-30 Filter Coverage Results Using a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-33 Component Verification 9 Component Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 Simulink Coverage Tools for Component Verification . . . . . . . . . . . . . . . . . 9-2 Workflow for Component Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 Verify a Component Independently of the Container Model . . . . . . . . . . . . 9-4 Verify a Model Block in the Context of the Container Model . . . . . . . . . . . 9-4 Fix Requirements-Based Testing Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6 Verification and Validation 10 Test Model Against Requirements and Report Results . . . . . . . . . . . . . . 10-2 Requirements – Test Traceability Overview . . . . . . . . . . . . . . . . . . . . . . . 10-2 Display the Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 Link Requirements to Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3 Run the Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-4 Report the Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5 Analyze a Model for Standards Compliance and Design Errors . . . . . . . 10-7 Standards and Analysis Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-7 Check Model for Style Guideline Violations and Design Errors . . . . . . . . 10-7 Perform Functional Testing and Analyze Test Coverage . . . . . . . . . . . . . 10-9 Incrementally Increase Test Coverage Using Test Case Generation . . . . . 10-9 Analyze Code and Test Software-in-the-Loop . . . . . . . . . . . . . . . . . . . . . 10-12 Code Analysis and Testing Software-in-the-Loop Overview . . . . . . . . . . 10-12 Analyze Code for Defects, Metrics, and MISRA C:2012 . . . . . . . . . . . . . 10-12 Test Code Against Model Using Software-in-the-Loop Testing . . . . . . . . 10-17 ix
Page
10
(This page has no text content)
Page
11
Model Coverage Definition • “Model Coverage” on page 1-2 • “Types of Model Coverage” on page 1-3 • “Simulink Optimizations and Model Coverage” on page 1-9 1
Page
12
Model Coverage Model coverage helps you validate your model tests by measuring how thoroughly the model objects are tested. Model coverage calculates how much a model test case exercises simulation pathways through a model. It is a measure of how thoroughly a test case tests a model and the percentage of pathways that a test case exercises. Model coverage analyzes the execution of the following types of model objects that directly or indirectly determine simulation pathways through your model: • Simulink® blocks • Models referenced in Model blocks • The states and transitions of Stateflow® charts During a simulation run, the tool records the behavior of the covered objects, states, and transitions. At the end of the simulation, the tool reports the extent to which the run exercised potential simulation pathways through each covered object in the model. For the types of coverage that model coverage performs, see “Types of Model Coverage” on page 1- 3. For an example of a model coverage report, see “Top-Level Model Coverage Report” on page 6- 10. The Simulink Coverage™ software can only collect model coverage for a model if its simulation mode is set to Normal. If the simulation mode is set to any other mode, model coverage is not measured during simulation. If you have an Embedded Coder® license, you can also measure code coverage for code generated from models in software-in-the-loop (SIL) mode or processor-in-the-loop (PIL) mode. For the types of coverage that code coverage performs, see “Types of Code Coverage” on page 4-2. For an example of how to enable code coverage, see “Code Coverage for Models in Software-in-the-Loop (SIL) Mode and Processor-in-the-Loop (PIL) Mode” on page 4-6 1 Model Coverage Definition 1-2
Page
13
Types of Model Coverage Simulink Coverage can perform several types of coverage analysis. In this section... “Execution Coverage (EC)” on page 1-3 “Decision Coverage (DC)” on page 1-3 “Condition Coverage (CC)” on page 1-3 “Modified Condition/Decision Coverage (MCDC)” on page 1-4 “Cyclomatic Complexity” on page 1-4 “Lookup Table Coverage” on page 1-5 “Signal Range Coverage” on page 1-5 “Signal Size Coverage” on page 1-5 “Objectives and Constraints Coverage” on page 1-6 “Saturate on Integer Overflow Coverage” on page 1-7 “Relational Boundary Coverage” on page 1-7 Execution Coverage (EC) Execution coverage is the most basic form of coverage. For each item, execution coverage determines whether the item is executed during simulation. Decision Coverage (DC) Decision coverage analyzes elements that represent decision points in a model, such as a Switch block or Stateflow states. For each item, decision coverage determines the percentage of the total number of simulation paths through the item that the simulation traversed. For an example of decision coverage data in a model coverage report, see “Decisions Analyzed” on page 6-23. Condition Coverage (CC) Condition coverage analyzes blocks that output the logical combination of their inputs (for example, the Logical Operator block) and Stateflow transitions. A test case achieves full coverage when it causes each input to each instance of a logic block in the model and each condition on a transition to be true at least once during the simulation, and false at least once during the simulation. Condition coverage analysis reports whether the test case fully covered the block for each block in the model. When you collect coverage for a model, you may not be able to achieve 100% condition coverage. For example, if you specify to short-circuit logic blocks, by selecting Treat Simulink Logic blocks as short-circuited in the Coverage pane in the Configuration Parameters, you might not be able to achieve 100% condition coverage for that block. See “MCDC Analysis” on page 6-24 for more information. For an example of condition coverage data in a model coverage report, see “Conditions Analyzed” on page 6-24. Types of Model Coverage 1-3
Page
14
Modified Condition/Decision Coverage (MCDC) Modified condition/decision coverage analysis by the Simulink Coverage software extends the decision and condition coverage capabilities. It analyzes blocks that output the logical combination of their inputs and Stateflow transitions to determine the extent to which the test case tests the independence of logical block inputs and transition conditions. • A test case achieves full coverage for a block when a change in one input, independent of any other inputs, causes a change in the block output. • A test case achieves full coverage for a Stateflow transition when there is at least one time when a change in the condition triggers the transition for each condition. If your model contains blocks that define expressions that have different types of logical operators and more than 12 conditions, the software cannot record MCDC coverage. Because the Simulink Coverage MCDC coverage may not achieve full decision or condition coverage, you can achieve 100% MCDC coverage without achieving 100% decision coverage. Some Simulink objects support MCDC coverage, some objects support only condition coverage, and some objects support only decision coverage. The table in “Model Objects That Receive Coverage” on page 2-2 lists which objects receive which types of model coverage. For example, the Combinatorial Logic block can receive decision coverage and condition coverage, but not MCDC coverage. To achieve 100% MCDC coverage for your model, as defined by the DO-178C/DO-331 standard, in the Coverage pane of the Configuration Parameters, select “Modified Condition/Decision Coverage (MCDC)” on page 1-4 as the Structural coverage level. When you collect coverage for a model, you may not be able to achieve 100% MCDC coverage. For example, if you specify to short-circuit logic blocks, you may not be able to achieve 100% MCDC coverage for that block. If you run the test cases independently and accumulate all the coverage results, you can determine if your model adheres to the modified condition and decision coverage standard. For more information about the DO-178C/DO-331 standard, see “DO-178C/DO-331 Checks” (Simulink Check). For an example of MCDC coverage data in a model coverage report, see “MCDC Analysis” on page 6- 24. For an example of accumulated coverage results, see “Cumulative Coverage” on page 6-25. Cyclomatic Complexity Cyclomatic complexity is a measure of the structural complexity of a model. It approximates the McCabe complexity measure for code generated from the model. The complexity measure can be different for the generated code than for the model due to code features that this analysis does not consider, such as consolidated logic and error checks. To compute the cyclomatic complexity of an object (such as a block, chart, or state), model coverage uses the following formula: c = ∑ 1 N (on− 1) N is the number of decision points that the object represents and on is the number of outcomes for the nth decision point. The calculation considers a vectorized operation or a Multiport switch block as 1 Model Coverage Definition 1-4
Page
15
a single decision point. The tool adds 1 to the complexity number for atomic subsystems and Stateflow charts. For an example of cyclomatic complexity data in a model coverage report, see “Cyclomatic Complexity” on page 6-21. Lookup Table Coverage Lookup table coverage (LUT) examines blocks, such as the 1-D Lookup Table block, that output information from inputs in a table of inputs and outputs, interpolating between or extrapolating from table entries. Lookup table coverage records the frequency that table lookups use each interpolation interval. A test case achieves full coverage when it executes each interpolation and extrapolation interval at least once. For each lookup table block in the model, the coverage report displays a colored map of the lookup table, indicating each interpolation. If the total number of breakpoints of an n-D Lookup Table block exceeds 1,500,000, the software cannot record coverage for that block. For an example of lookup table coverage data in a model coverage report, see “N-Dimensional Lookup Table” on page 6-27. Note Configure lookup table coverage only at the start of a simulation. If you tune a parameter that affects lookup table coverage at run time, the coverage settings for the affected block are not updated. Signal Range Coverage Signal range coverage records the minimum and maximum signal values at each block in the model, as measured during simulation. Only blocks with output signals receive signal range coverage. The software does not record signal range coverage for control signals, signals used by one block to initiate execution of another block. See “Control Signals”. If the total number of signals in your model exceeds 65535, or your model contains a signal whose width exceeds 65535, the software cannot record signal range coverage. For an example of signal range coverage data in a model coverage report, see “Signal Range Analysis” on page 6-35. Note When you create cumulative coverage for reusable subsystems or Stateflow constructs with single range coverage, the cumulative coverage has the largest possible range of signal values. For more information, see “Obtain Cumulative Coverage for Reusable Subsystems and Stateflow® Constructs” on page 5-34. Signal Size Coverage Signal size coverage records the minimum, maximum, and allocated size for all variable-size signals in a model. Only blocks with variable-size output signals are included in the report. If the total number of signals in your model exceeds 65535, or your model contains a signal whose width exceeds 65535, the software cannot record signal size coverage. Types of Model Coverage 1-5
Page
16
For an example of signal size coverage data in a model coverage report, see “Signal Size Coverage for Variable-Dimension Signals” on page 6-36. For more information about variable-size signals, see “Variable-Size Signal Basics”. Objectives and Constraints Coverage The Simulink Coverage software collects model coverage data for the following Simulink Design Verifier™ blocks and MATLAB® for code generation functions: Simulink Design Verifier blocks MATLAB for code generation functions Test Condition sldv.condition Test Objective sldv.test Proof Assumption sldv.assume Proof Objective sldv.prove If you do not have a Simulink Design Verifier license, you can collect model coverage for a model that contains these blocks or functions, but you cannot analyze the model using the Simulink Design Verifier software. By adding one or more Simulink Design Verifier blocks or functions into your model, you can: • Check the results of a Simulink Design Verifier analysis, run generated test cases, and use the blocks to observe the results. • Define model requirements using the Test Objective block and verify the results with model coverage data that the software collected during simulation. • Analyze the model, create a test harness, and simulate the harness with the Test Objective block to collect model coverage data. • Analyze the model and use the Proof Assumption block to verify any counterexamples that the Simulink Design Verifier identifies. If you specify to collect Simulink Design Verifier coverage: • The software collects coverage for the Simulink Design Verifier blocks and functions. • The software checks the data type of the signal that links to each Simulink Design Verifier block. If the signal data type is fixed point, the block parameter must also be fixed point. If the signal data type is not fixed point, the software tries to convert the block parameter data type. If the software cannot convert the block parameter data type, the software reports an error and you must explicitly assign the block parameter data type to match the signal. • If your model contains a Verification Subsystem block, the software only records coverage for Simulink Design Verifier blocks in the Verification Subsystem block; it does not record coverage for any other blocks in the Verification Subsystem. If you do not specify to collect Simulink Design Verifier coverage, the software does not check the data types for any Simulink Design Verifier blocks and functions in your model and does not collect coverage. For an example of coverage data for Simulink Design Verifier blocks or functions in a model coverage report, see “Simulink Design Verifier Coverage” on page 6-37. 1 Model Coverage Definition 1-6
Page
17
Saturate on Integer Overflow Coverage Saturate on integer overflow coverage examines blocks, such as the Abs block, with the Saturate on integer overflow parameter selected. Only blocks with this parameter selected receive saturate on integer overflow coverage. Saturate on integer overflow coverage records the number of times the block saturates on integer overflow. A test case achieves full coverage when the blocks saturate on integer overflow at least once and does not saturate at least once. For an example of saturate on integer overflow coverage data in a model coverage report, see “Saturate on Integer Overflow Analysis” on page 6-34. Relational Boundary Coverage Relational boundary coverage examines blocks, Stateflow charts, and MATLAB function blocks that have an explicit or implicit relational operation. • Blocks such as Relational Operator and If have an explicit relational operation. • Blocks such as Abs and Saturation have an implicit relational operation. For these model objects, the metric records whether a simulation tests the relational operation with: • Equal operand values. This part of relational boundary coverage applies only if both operands are integers or fixed-point numbers. • Operand values that differ by a certain tolerance. This part of relational boundary coverage applies to all operands. For integer and fixed-point operands, the tolerance is fixed. For floating-point operands, you can either use a predefined tolerance or you can specify your own tolerance. The tolerance value depends on the data type of both the operands. If both operands have the same type, the tolerance follows the following rules: Data Type of Operand Tolerance Floating point, such as single or double max(absTol, relTol* max(|lhs|,|rhs|)) • absTol is an absolute tolerance value you specify. Default is 1e-05. • relTol is a relative tolerance value you specify. Default is 0.01. • lhs is the left operand and rhs the right operand. • max(x,y) returns x or y, whichever is greater. Types of Model Coverage 1-7
Page
18
Data Type of Operand Tolerance Fixed point Value corresponding to least significant bit. For more information, see “Precision” (Fixed-Point Designer). To find the precision value, use the lsb (Fixed-Point Designer) function. Integer 1 Boolean N/A Enum N/A If the two operands have different types, the tolerance follows the rules for the stricter type. If one of the operands is boolean, the tolerance follows the rules for the other operand. The strictness decreases in this order: 1 Floating point 2 Fixed point 3 Integer If both operands are fixed point but have different precision, the smaller value of precision is used as tolerance. You specify the value of absolute and relative tolerances for relational boundary coverage of floating point inputs when you select this metric in the Coverage metrics section in the“Coverage Pane” on page 3-2 of the Configuration Parameters dialog box. For more information on: • How this coverage metric appears in reports, see “Relational Boundary” on page 6-32. • Which model objects receive this coverage, see the table in “Model Objects That Receive Coverage” on page 2-2. • How to obtain coverage results from the MATLAB command-line, see “Collect Relational Boundary Coverage for Supported Block in Model”. 1 Model Coverage Definition 1-8
Page
19
Simulink Optimizations and Model Coverage In the Configuration Parameters dialog box, there are three Simulink optimization parameters that can affect your model coverage data: Inlined Parameters To transform tunable model parameters into constant values for code generation, in the Configuration Parameters dialog box, on the Math and Data Types pane, set Default parameter behavior to Inlined. When the parameters are transformed into constants, Simulink may eliminate certain decisions in your model. You cannot achieve coverage for eliminated decision, so the coverage report displays 0/0 for those decisions. Block Reduction To achieve faster execution during model simulation and in generated code, in the Configuration Parameters dialog box, select the Block reduction parameter. The Simulink software collapses certain groups of blocks into a single, more efficient block, or removes them entirely. One of the model coverage options, Force block reduction off, allows you to ignore the Block reduction parameter when collecting model coverage. If you do not select the Block reduction parameter, or if you select Force block reduction off, the Simulink Coverage software provides coverage data for every block in the model that collects coverage. If you select the Block reduction parameter and do not set Force block reduction off, the coverage report lists the reduced blocks that would have collected coverage. Conditional Input Branch Execution The Conditional input branch execution parameter can cause lower than expected Simulink Coverage results. Simulink Optimizations and Model Coverage 1-9
Page
20
Case 1: Upstream Switch Block Completely Optimized Out A Constant block set to false connected to the control input on C_Switch2 causes the true case of C_Switch2 to not occur. Conditional input branch execution optimizes C_Switch1 out as a result. Simulink Coverage reports 0% coverage on C_Switch1. Because the C_Switch1 block is dead logic, the coverage report generates a Blocks Eliminated from Coverage Analysis section. Case 2: Upstream Switch Block Partially Optimized Out A Step block converted to the boolean data type outputs false and true before and after the Step time, respectively. 1 Model Coverage Definition 1-10
The above is a preview of the first 20 pages. Register to read the complete e-book.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
AI guide
【One-Line Pitch】
A practical reference for engineers who need to measure how thoroughly their Simulink models and generated code are exercised by tests, covering metric definitions, configuration, result analysis, and reporting. Read it if you are setting up coverage-driven verification for embedded control software and want the official MathWorks workflow rather than trial and error.
【Book Arc】
- **Opening (~0%–15%)**: Front matter, revision history, and the conceptual core — what model coverage means and the full menu of metrics (execution, decision, condition, MCDC, cyclomatic complexity, lookup-table, signal range, and signal size). This stage gives you the vocabulary the rest of the manual assumes.
- **Early (~15%–30%)**: A block-by-block reference of which Simulink blocks receive which coverage types, followed by how to configure coverage options and manage, aggregate, and accumulate results in the Results Explorer. Solves the "what do I turn on, and where do I find the numbers" problem.
- **Early–Middle (~30%–45%)**: Code coverage for generated C/C++ — statement, condition, decision, MCDC, relational boundary, function and function-call coverage — plus SIL/PIL modes and S-function limitations. Then the practical analysis chapters: cascaded logic and MCDC, canvas highlighting, referenced-model instances, and tracing results to requirements and test cases.
- **Middle (~45%–60%)**: Coverage for the trickier constructs — MATLAB Function blocks, custom C/C++ and S-functions, Stateflow charts, state transition tables, atomic subcharts, truth tables, and variant blocks — followed by the report types (model summary, subsystem, code coverage, top-level) and how to read each section.
- **Late (~60%–85%)**: Filtering out justified gaps, scripting coverage analysis from the command line, extracting and operating on coverage data, parallel simulation with parsim, and component verification workflows.
- **Ending (~85%–100%)**: Requirements-based testing and traceability, tying coverage results back to requirements and test reports to close the verification loop.
【Book Arc note】The excerpts are dominated by tables of contents and chapter headings; the progression above reflects the manual's structure rather than detailed prose, which the sample does not include.
【Key Takeaways】
- **Coverage is a family of metrics, not one number** (Opening): execution, decision, condition, MCDC, cyclomatic complexity, lookup-table, signal range, and signal size each answer a different question about test thoroughness. Choosing the right metric for your safety or quality goal is the first decision the manual forces.
- **Block-level coverage support is uneven** (Early): the block reference tells you which Simulink blocks are instrumented and which are explicitly excluded, so you can predict gaps before running a campaign instead of being surprised by them.
- **Model coverage and code coverage are distinct layers** (Early–Middle): the same design can look well covered at the model level while generated code shows untested statements or boundaries. SIL/PIL modes let you check the compiled artifact, with documented limitations for S-functions and in-the-loop blocks.
- **MCDC and cascaded logic need special attention** (Middle): the manual devotes dedicated analysis to condition/decision combinations and logical operator cascades, because naive test sets often satisfy decision coverage while missing MCDC obligations.
- **Stateflow and MATLAB Functions are first-class citizens** (Middle): charts, transition tables, atomic subcharts, and truth tables each have their own coverage semantics and report settings, as do MATLAB Function blocks and custom C/C++ embedded in them.
- **Aggregation and cumulative coverage make results meaningful across runs** (Early–Middle): reusable subsystems, referenced-model instances, and multi-simulation design studies require accumulating results so a component isn't judged on a single test.
- **Filtering is a legitimate part of the workflow** (Late): filter rules and files let you exclude justified dead logic or defensive code, keeping the coverage number honest rather than artificially inflated.
- **Everything is scriptable** (Late): command-line functions for retrieving, extracting, and operating on coverage data, plus parsim for parallel runs, turn coverage from a GUI activity into a repeatable pipeline step.
- **Coverage closes the loop with requirements** (Ending): tracing results to requirements and associated test cases, and scoping reports to linked tests, is what makes coverage evidence for verification and validation rather than just a metric.
【Reading Tips】
- **Don't read linearly.** Treat it as a reference: read the metric definitions chapter once end to end, then jump to the chapters matching your current task (configuration, Stateflow, scripting, reporting).
- **Use the block reference as a lookup table.** Skim the long block-by-block list and only deep-read entries for blocks actually in your model; this is where most of the page count sits.
- **Deep-read the MCDC, cascaded-logic, and filtering chapters.** These are where practitioners most often get stuck and where the manual's guidance has the most practical payoff.
- **Pair GUI and command-line chapters.** Learn the Results Explorer workflow first, then the scripting functions, so you can automate whatever you configured by hand.
- **Take away a checklist, not facts.** The durable output is your team's coverage configuration, filter policy, and reporting cadence — the manual supplies the options, you supply the standard.
【Coverage Limits】
This guide is synthesized from stratified excerpts that are largely front matter, tables of contents, and chapter headings; detailed procedural steps, examples, and dialog-level instructions are not represented here. Verify specific settings and workflows against the actual R2021b manual before relying on them.
Passage locations
Page 2
nd Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand nam...
View in text
Page 4
. . . . . . . . . . . . . . . . 2-16 MATLAB System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16 MinMax . . . ....
View in text
Page 6
al Operator Cascade Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 Analyzing MCDC for Cascaded Logic Blocks . . . . . . . . . . ....
View in text
Page 7
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11 Coverage Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....
View in text
Recommended for You
{{#thumbnailUrl}}
{{/thumbnailUrl}}
{{^thumbnailUrl}}
{{/thumbnailUrl}}
Loading recommended books...
Failed to load, please try again later
Tip the Site
Scan the WeChat Pay or Alipay code to tip. No login required.
WeChat Pay
Alipay