Main Content

モデリング スタイル

hisl_0061: 明確性のための一意の識別子

ID: タイトルhisl_0061: 明確性のための一意の識別子
説明モデルの開発時には、以下に従ってください。
ASimulink® 信号に一意の識別子を使用する。
Bチャート内の複数のスコープで一意の識別子を定義する。
メモコード ジェネレーターは、生成されたコードのシンボルが一意になるように、識別子の衝突を解決します。このプロセスを「名前マングリング」と呼びます。
根拠A、Bグラフィカル モデルの可読性と、モデルと生成コードの識別子間のマッピングを向上させる。
モデル アドバイザー チェックCheck Stateflow charts for uniquely defined data objects (Simulink Check)
参考文献
  • DO-331, Section MB.6.3.2.b 'Low-level requirements are accurate and consistent'

  • IEC 61508-3, Table A.3 (2) ‘Strongly typed programming language’

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

  • IEC 61508-3, Table 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 (1e) - 'Use of well-trusted design principles'

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

  • ISO 26262-6, Table 1 (1g) - 'Use of style guides'

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

  • ISO 26262-6, Table 6 (1d) - 'No multiple use of variable names'

  • EN 50128, Table A.3 (1) - Defensive Programming

  • EN 50128, Table A.4 (8) 'Strongly Typed Programming Language'

  • 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'

参考モデル コンフィギュレーション セットのカスタマイズ (Embedded Coder)
最終更新R2024a

非推奨

次の例で、2 つのステート Scope_1Scope_2 はローカル識別子 IntCounter を使用しています。

識別子 IntCounter は 2 つのステート Scope_1Scope_2 に定義されています。

推奨

このモデルを明確にするには、一意の識別子を作成します。次の例では、ステート Scope_1 はローカル識別子 IntCounter_Scope_1 を使用しています。ステート Scope_2 はローカル識別子 IntCounter_Scope_2 を使用しています。

識別子 IntCounter_Scope_1 はステート Scope_1 に対して定義されています。識別子 IntCounter_Scope_2Scope_2 に対して定義されています。

hisl_0062: グラフィカル関数内のグローバル変数

ID: タイトルhisl_0062: グラフィカル関数内のグローバル変数
説明

グローバル スコープのデータが関数で使用されているときに、その関数のデータに値が代入されている場合は、呼び出し側の式でそのデータを使用しないこと。

根拠グローバル変数の値のあいまいさを除去して、モデルの可読性を向上させる。
モデル アドバイザー チェックCheck global variables in graphical functions (Simulink Check)
参考文献
  • 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'

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

  • MISRA C:2012, Rule 13.2

  • MISRA C:2012, Rule 13.5

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

最終更新R2024a

グローバル データ G を変更するグラフィカル関数 graphicalFunction について考えます。

推奨

非推奨