Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

モデリング スタイル

hisl_0032: モデル オブジェクト名

ID: タイトルhisl_0032: モデル オブジェクト名
説明

以下のタイプのモデル要素の場合:

  • 信号ラベル

  • パラメーター

  • ブロック

  • 名前付き Stateflow® オブジェクト (状態、ボックス、Simulink® 関数、グラフィカル関数、真理値表)

以下のタイプのアーキテクチャ モデル オブジェクトの場合:

  • コンポーネント

  • 端子

  • コネクタ

  • インターフェイス

  • ステレオタイプ

使用:

  • 文字: a-zA-Z0-9 およびアンダースコア (_)

  • 32 文字未満の文字列。

実行不可:

  • 名前を数値から開始する。

  • 文字列の先頭または末尾にアンダースコアを使用する。

  • 1 つを超えるアンダースコアを連続して使用する。

  • 予約済みの識別子を使用する。

メモ

予約名:

  • MATLAB® キーワード

  • C、C++、コード生成用の予約キーワード。完全な一覧については、予約キーワード (Simulink Coder)を参照してください。

  • int8 , uint8

  • int16, uint16

  • int32, uint32

  • int64, uint64

  • inf, Inf

  • NaN, nan

  • eps

  • intmin, intmax

  • realmin, realmax

  • pi

  • infinity

  • Nil

根拠

無効な文字は、生成コードでの識別子の生成時にコード ジェネレーターで削除またはマングルされる可能性がある。

モデル アドバイザー チェックCheck model object names (Simulink Check)
参考

MAB のガイドライン:

参考文献

  • MISRA C:2012, Rule 5.1

  • MISRA C:2012, Rule 21.2

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

  • DO-331, Section MB.6.3.2.e – ‘Low-level requirements conform to standards’

    DO-331, MB.6.3.3.e 'Software architecture conforms to standards’

  • DCL37-C. 予約済み識別子の宣言や定義をしない

最終更新R2023a

推奨

  • ブロック名: My_Controller

  • 信号名: a_b

非推奨

  • ブロック名: My Controller

  • 信号名: 12a__b

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 (1c) 'Enforcement of strong typing'
    ISO 26262-6, Table 1 (1d) - 'Use of defensive implementation techniques'
    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'

  • 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)
最終更新R2017b

非推奨

次の例で、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'

  • 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

最終更新R2021b

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

推奨

非推奨