メインコンテンツ

モデルのリファクタリング

モデリング クローンとパターンを特定してモデルを変換

モデル トランスフォーマーおよびクローン検出器アプリを使用してモデルをリファクタリングし、モデルのコンポーネント化、可読性、および再利用性を改善します。

モデル トランスフォーマーを使用して次を実行します。

  • Variant Source ブロックまたは Variant Subsystem ブロックへの変換の条件を満たすモデル化パターンを特定します。Variant Subsystem ブロックと Variant Source ブロックを使用すると、バリアント選択と呼ばれるさまざまな条件式でのモデルの再利用が可能になります。アクティブなモデルでは、ユーザーのバリアント選択に従ってアクティブにした固定構造および可変コンポーネントが組み合わされています。

  • 削除の条件を満たすデータ ストア ブロックを特定します。データ ストア ブロックを削除すると、データの依存関係が明示的になるため、モデルの可読性が改善されます。

  • 共有 Prelookup ブロックおよび複数の Interpolation ブロックへの変換の条件を満たす n-D Lookup Table ブロックを特定します。この変換により、シミュレーションの効率が向上します。

  • モデル化パターンの単一の Interpolation Using Prelookup ブロックへの変換条件を満たす複数の Interpolation Using Prelookup ブロックを特定します。この変換により、生成されたコードの効率が向上します。

  • In Bus Element ブロックおよび Out Bus Element ブロックへの変換の条件を満たす Bus Creator ブロックおよび Bus Selector ブロックを特定します。この変換により、バスの処理が簡素化され、モデル内のブロック数が削減され、可読性が改善されます。

クローン検出器を使用して、次を実行します。

  • クローンを特定し、それらのクローンをライブラリ内のサブシステム ブロックへのリンクに置き換えたモデルを作成します。クローンをライブラリ ブロックへのリンクに置き換えると、コンポーネントの再利用が可能になり、モデル間の整合性が確保されます。

  • サブシステム参照を使用して、モデル内のクローンを特定して置換します。

関数

すべて展開する

mdltransformerモデル トランスフォーマーを開く
Simulink.ModelTransform.BusTransformation.identifyIdentify Bus Selector and Bus Creator blocks to transform (R2022b 以降)
Simulink.ModelTransform.BusTransformation.refactorReplace Bus Selector and Bus Creator blocks with In Bus Element and Out Bus Element blocks (R2022b 以降)
Simulink.ModelTransform.CommonSourceInterpolation.identifyCandidates変換に適格な Interpolation Using Prelookup ブロックを特定する (R2021b 以降)
Simulink.ModelTransform.CommonSourceInterpolation.refactorModelInterpolation Using Prelookup ブロックを置き換える (R2021b 以降)
clonedetectionクローン検出器アプリを開く
Simulink.CloneDetection.findClonesFind clones in a model
Simulink.CloneDetection.replaceClonesReplace clones in a model
Simulink.CloneDetection.checkEquivalencyCheck equivalency of clone-replaced model and original model
Simulink.CloneDetection.highlightCloneHighlight clone in a Simulink model (R2021b 以降)
Simulink.CloneDetection.generateReportGenerate clone detection report (R2023b 以降)
Simulink.CloneDetection.addExclusionsExclude component from clone detection (R2025a 以降)
Simulink.CloneDetection.getExclusionsGet list of components excluded from clone detection (R2025a 以降)
Simulink.CloneDetection.deleteExclusionsRemove component from clone detection exclusion list (R2025a 以降)

クラス

すべて展開する

Simulink.ModelTransform.BusTransformation.ResultResults of identified Bus Selector and Bus Creator blocks (R2022b 以降)
Simulink.ModelTransform.CommonSourceInterpolation.Results適格な Interpolation Using Prelookup ブロックの検索結果 (R2021b 以降)
Simulink.ModelTransform.CommonSourceInterpolation.RefactorResultsリファクタリングされたモデル結果 (R2021b 以降)
Simulink.CloneDetection.Settings 関数 findClones の条件
Simulink.CloneDetection.Resultsクローンの検索結果
Simulink.CloneDetection.ReplacementConfigConditions for clone replacement function
Simulink.CloneDetection.ReplacementResultsResults of replace clones
Simulink.CloneDetection.EquivalencyCheckResultsResults of equivalency check

トピック

モデル トランスフォーマー

クローン検出器

注目の例