Hauptinhalt

hisl_0062: Global variables in graphical functions

R2026b

Use of data with a global scope in graphical functions

Usage: High-Integrity System Modeling

Guideline ID: hisl_0062

Rules

hisl_0062: Global variables in graphical functions

For data with a global scope used in a function, do not use the data in the calling expression if a value is assigned to the data in that function.

Rationale

Enhance readability of a model by removing ambiguity in the values of global variables.

Verification

Check global variables in graphical functions (Simulink Check)

Example

Consider a graphical function graphicalFunction that modifies the global data G.

Graphical function graphicalFunction that modifies global data G

Example — Correct

Recommended subsystem showing correct usage of global variables in graphical functions

Example — Incorrect

Not recommended subsystem showing incorrect usage of global variables in graphical functions

Industry Standards

  • IEC 61508–3, Table A.3 (3) 'Language subset'

  • IEC 61508–3, Table A.4 (4) 'Modular approach'

  • IEC 61508–3, A.4 (5) 'Design and coding standards'

  • IEC 62304, 5.5.3 - Software Unit acceptance criteria

  • ISO 26262-6, Table 1 (1b) 'Use of language subsets'

  • ISO 26262-6, Table 1 (1f) 'Use of unambiguous graphical representation'

  • ISO 26262-6, Table 1 (1h) 'Use of naming conventions'

  • ISO 26262-6, Table 6 (1e) - 'Avoid global variables or else justify their usage'

  • EN 50128, Table A.4 (11) 'Language Subset'

  • EN 50128, Table A.12 (1) 'Coding Standard'

  • EN 50128, Table A.12 (2) 'Coding Style Guide'

  • EN 50657, Table A.4 (11) 'Language Subset'

  • EN 50657, Table A.12 (1) 'Coding Standard'

  • EN 50657, Table A.12 (2) 'Coding Style Guide'

  • EN 50716, Table A.12 (1) 'Coding Standard'

  • EN 50716, Table A.12 (2) 'Coding Style Guide'

  • DO-331, Section MB.6.3.2.g 'Algorithms are accurate'

  • MISRA C:2012, Rule 13.2

  • MISRA C:2023, Rule 13.2

  • MISRA C:2012, Rule 13.5

  • MISRA C:2023, Rule 13.5

  • EXP30-C. Do not depend on the order of evaluation for side effects

Version History

Introduced in R2010b