Simulink®
Modeling Guidelines for High-Integrity Systems
R2016b
How to Contact MathWorks
Latest news:
Sales and services:
User community:
Technical support:
Phone:
www.mathworks.com
www.mathworks.com/sales_and_services
www.mathworks.com/matlabcentral
www.mathworks.com/support/contact_us
508-647-7000
The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA 01760-2098
Modeling Guidelines for High-Integrity Systems
© COPYRIGHT 2009–2016 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 2009 Online only
April 2010
Online only
September 2010 Online only
April 2011
Online only
September 2011 Online only
March 2012
Online only
September 2012 Online only
March 2013
Online only
September 2013 Online only
Online only
March 2014
October 2014
Online only
March 2015
Online only
September 2015 Online only
March 2016
Online only
September 2016 Online only
New for Version 1.0 (Release 2009b)
Revised for Version 1.1 (Release 2010a)
Revised for Version 1.2 (Release 2010b)
Revised for Version 1.3 (Release 2011a)
Revised for Version 1.4 (Release 2011b)
Revised for Version 1.5 (Release 2012a)
Revised for Version 1.6 (Release 2012b)
Revised for Version 1.7 (Release 2013a)
Revised for Version 1.8 (Release 2013b)
Revised for Version 1.9 (Release 2014a)
Revised for Version 1.10 (Release 2014b)
Revised for Version 1.11 (Release 2015a)
Revised for Version 1.12 (Release 2015b)
Revised for Version 1.13 (Release 2016a)
Revised for Version 1.14 (Release 2016b)
1
2
Contents
Introduction
Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Guideline Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Model Advisor Checks for High-Integrity Modeling
Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1-2
1-3
1-4
Simulink Block Considerations
Math Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0001: Usage of Abs block . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0002: Usage of Math Function blocks (rem and
reciprocal) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0003: Usage of Square Root blocks . . . . . . . . . . . . . . . . .
hisl_0028: Usage of Reciprocal Square Root blocks . . . . . . . .
hisl_0004: Usage of Math Function blocks (natural logarithm
and base 10 logarithm) . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0005: Usage of Product blocks . . . . . . . . . . . . . . . . . . .
hisl_0029: Usage of Assignment blocks . . . . . . . . . . . . . . . .
Ports & Subsystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0006: Usage of While Iterator blocks . . . . . . . . . . . . . .
hisl_0007: Usage of While Iterator subsystems . . . . . . . . . .
hisl_0008: Usage of For Iterator Blocks . . . . . . . . . . . . . . . .
hisl_0009: Usage of For Iterator Subsystem blocks . . . . . . .
hisl_0010: Usage of If blocks and If Action Subsystem blocks
hisl_0011: Usage of Switch Case blocks and Action Subsystem
blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2-2
2-3
2-5
2-7
2-8
2-10
2-13
2-15
2-20
2-21
2-23
2-27
2-29
2-31
2-34
v
hisl_0012: Usage of conditionally executed subsystems . . . .
hisl_0024: Inport interface definition . . . . . . . . . . . . . . . . . .
hisl_0025: Design min/max specification of input interfaces .
hisl_0026: Design min/max specification of output interfaces
Signal Routing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0013: Usage of data store blocks . . . . . . . . . . . . . . . . .
hisl_0015: Usage of Merge blocks . . . . . . . . . . . . . . . . . . . .
hisl_0021: Consistent vector indexing method . . . . . . . . . . .
hisl_0022: Data type selection for index signals . . . . . . . . . .
hisl_0023: Verification of model and subsystem variants . . .
hisl_0034: Usage of Signal Routing blocks . . . . . . . . . . . . . .
Logic and Bit Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0016: Usage of blocks that compute relational operators
hisl_0017: Usage of blocks that compute relational operators
(2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0018: Usage of Logical Operator block . . . . . . . . . . . . .
hisl_0019: Usage of Bitwise Operator block . . . . . . . . . . . . .
Lookup Table Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0033: Usage of Lookup Table blocks . . . . . . . . . . . . . . .
2-36
2-38
2-39
2-41
2-43
2-44
2-48
2-50
2-52
2-53
2-53
2-55
2-56
2-58
2-60
2-62
2-63
2-63
3
Stateflow Chart Considerations
Chart Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisf_0001: Mealy and Moore semantics . . . . . . . . . . . . . . . . .
hisf_0002: User-specified state/transition execution order . . .
hisf_0009: Strong data typing (Simulink and Stateflow
boundary) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisf_0011: Stateflow debugging settings . . . . . . . . . . . . . . . .
Chart Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisf_0003: Usage of bitwise operations . . . . . . . . . . . . . . . .
hisf_0004: Usage of recursive behavior . . . . . . . . . . . . . . . .
hisf_0007: Usage of junction conditions (maintaining mutual
exclusion) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisf_0010: Usage of transition paths (looping out of parent of
source and destination objects) . . . . . . . . . . . . . . . . . . . .
3-2
3-3
3-5
3-7
3-9
3-11
3-12
3-13
3-15
3-16
vi
Contents
hisf_0012: Chart comments . . . . . . . . . . . . . . . . . . . . . . . . .
hisf_0013: Usage of transition paths (crossing parallel state
boundaries) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisf_0014: Usage of transition paths (passing through states)
hisf_0015: Strong data typing (casting variables and
parameters in expressions) . . . . . . . . . . . . . . . . . . . . . . .
3-18
3-19
3-22
3-23
MATLAB Function and MATLAB Code
Considerations
MATLAB Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
himl_0001: Usage of standardized MATLAB function
headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
himl_0002: Strong data typing at MATLAB function
boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
himl_0003: Limitation of MATLAB function complexity . . . .
himl_0005: Usage of global variables in MATLAB functions .
MATLAB Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
himl_0004: MATLAB Code Analyzer recommendations for code
generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
himl_0006: MATLAB code if / elseif / else patterns . . . . . . .
himl_0007: MATLAB code switch / case / otherwise patterns
himl_0008: MATLAB code relational operator data types . .
himl_0009: MATLAB code with equal / not equal relational
operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
himl_0010: MATLAB code with logical operators and
functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-2
4-3
4-4
4-7
4-9
4-13
4-13
4-18
4-20
4-22
4-23
4-25
Configuration Parameter Considerations
Solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0040: Configuration Parameters > Solver > Simulation
time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5-2
5-3
vii
4
5
hisl_0041: Configuration Parameters > Solver > Solver
options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0042: Configuration Parameters > Solver > Tasking and
sample time options . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0036: Configuration Parameters > Diagnostics > Saving .
hisl_0043: Configuration Parameters > Diagnostics > Solver .
hisl_0044: Configuration Parameters > Diagnostics > Sample
Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0301: Configuration Parameters > Diagnostics >
Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0302: Configuration Parameters > Diagnostics > Data
Validity > Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0303: Configuration Parameters > Diagnostics > Merge
block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0304: Configuration Parameters > Diagnostics > Model
initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0305: Configuration Parameters > Diagnostics >
Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0306: Configuration Parameters > Diagnostics >
Connectivity > Signals . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0307: Configuration Parameters > Diagnostics >
Connectivity > Buses . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0308: Configuration Parameters > Diagnostics >
Connectivity > Function calls . . . . . . . . . . . . . . . . . . . . .
hisl_0309: Configuration Parameters > Diagnostics > Type
Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0310: Configuration Parameters > Diagnostics > Model
Referencing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0311: Configuration Parameters > Diagnostics >
Stateflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Optimizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0045: Configuration Parameters > Optimization >
Implement logic signals as Boolean data (vs. double) . . . .
hisl_0046: Configuration Parameters > Optimization > Block
reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
hisl_0048: Configuration Parameters > Optimization >
Application lifespan (days) . . . . . . . . . . . . . . . . . . . . . . .
hisl_0051: Configuration Parameters > Optimization > Signals
and Parameters > Loop unrolling threshold . . . . . . . . . .
hisl_0052: Configuration Parameters > Optimization > Data
initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
viii
Contents
5-4
5-5
5-7
5-7
5-9
5-11
5-14
5-15
5-16
5-17
5-18
5-19
5-20
5-21
5-22
5-23
5-24
5-25
5-26
5-27
5-28
5-29
5-30