Main Content

モデルのレイアウトの構成

モデル要素の位置や向きを変更してブロック線図を整理できます。

  • 信号線をドラッグして移動できます。

  • ブロックを移動、回転、反転できます。

  • Subsystem ブロックなどの一部のブロックについて、端子の順序を変更できます。

ブロック線図のレイアウトは手動で変更することも、自動で調整することもできます。

ブロックをサブシステムに整理する方法の詳細については、サブシステムへのブロックのグループ化を参照してください。信号線をまとめる方法の詳細については、バーチャル バスへの信号またはメッセージのグループ化を参照してください。

自動調整によるモデルのレイアウトの改善

ブロック線図のレイアウトと外観を改善するには、[書式設定] タブで [自動調整] をクリックします。

ヒント

あるいは、Ctrl+Shift+A を押します。

このオプションは以下を実現します。

  • 入力から始まって出力で終わるように、ブロック線図内のブロックを左から右に配置する

  • Constant ブロックなどのブロックのサイズを変更して、長いパラメーター値を表示する

  • 同様のブロック間でブロック サイズを標準化する

  • ブロックを移動させて信号線をまっすぐにする

モデルでのブロック線図の自動調整はプログラムで行うこともできます。

  1. 関数 load_system を使用してモデルを読み込みます。

  2. 関数 Simulink.BlockDiagram.arrangeSystem を使用してブロック線図を自動調整します。

あるいは、個々の信号線の形状の改善を試すこともできます。信号線を選択し、操作バーから、[ラインの自動ルーティング] を選択します。モデル要素間により適したルートを使用できる場合、ラインは再描画されます。

[ラインの自動ルーティング] を使用することで、複数のラインの改善を試すことができます。操作バーから [ラインの自動ルーティング] にアクセスするには、ブロックを選択するか、要素を囲むボックスをドラッグして複数のモデル要素を選択します。

複数のモデル要素の同時移動

複数のモデル要素をそれらの空間関係を維持したまま移動するには、次のようにします。

  1. モデル要素を囲む選択ボックスをドラッグして選択します。

  2. 選択ボックスの端を新しい位置にドラッグしてモデル要素を移動します。

選択ボックスの内容は 1 つのユニットとして移動します。選択ボックス内のライン、ブロック、およびその他の要素の関係は、移動したときと変わりません。選択ボックス外のライン セグメントが再配線されます。

たとえば、次のモデルについて考えます。

The model contains two subsystems that connect to two Outport blocks with multiple signal lines. The signal lines pass through Bus Creator blocks. Two of the lines have bends.

曲ったラインが含まれる選択ボックスをドラッグした場合、含まれているラインの曲がりは選択を移動したときと変わりません。

A selection box is drawn around two Bus Creator blocks, two Outport blocks, and part of the signal lines entering these blocks, including multiple line bends. The content of the selection box is moved to the right, but the line routing inside the selection box is unchanged.

ラインが曲がっていない選択ボックスをドラッグした場合、選択ボックスを移動すると、ラインの曲がりが変わる可能性があります。

The selection box is drawn around the same blocks as before, but not around the bends in the signal lines entering the blocks. The content of the selection box is moved to the right. The line bends are changed.

複数のラインを同時に移動するには、移動するライン セグメントを囲む選択ボックスをドラッグします。

A selection box is drawn around two line segments in the model.

ブロックの反転または回転

ブロックまたはブロックのグループの向きを変更するには、ブロックを 90 度ごとにインクリメントして回転するか、またはブロックを反転します。ブロックを回転または反転すると、ブロックがループ内で相互に接続されているフィードバック ループなど、ブロック線図内でより適切にフィットするようになります。ブロックの入力端子と出力端子を合わせるように、またはモデル キャンバスをより活用するために、ブロックを回転させる必要がある場合もあります。

次の図は、フィードバック ループ図を簡潔にするために反転された Gain ブロックを示します。

Feedback loop diagram with one of the gain blocks flipped horizontally

ブロックを回転するには、そのブロックを選択します。[書式設定] タブで [時計回りに 90 度回転] または [反時計回りに 90 度回転] をクリックします。

ヒント

あるいは、次のようにします。

  • ブロックを時計回りに回転するには、Ctrl+R を押します。

  • ブロックを反時計回りに回転するには、Ctrl+Shift+R を押します。

ブロックは左から右以外の向きの信号線に配置すると自動的に回転します。たとえば、下から上に向かう信号にブロックを配置すると、ブロックは信号に合わせて回転します。

ブロックを反転するには、そのブロックを選択し、[書式設定] タブで [左右を反転] または [上下を反転] をクリックします。ブロックの端子の向きに基づいて、ブロックを水平または垂直に反転させることができます。たとえば、両側に端子がある場合、ブロックは左から右に反転します。

ヒント

あるいは、ブロックを水平方向に反転するには Ctrl+I を押します。

ブロックのグループを回転または反転するには、複数のブロックを選択してから回転または反転します。ブロックのグループは左右にのみ反転できます。

ブロックのグループを回転または反転した後、信号線を編集してブロック線図の可読性を改善できます。[自動配置] オプションにより、信号の外観が向上する場合があります。(複数の端子がある場合の回転の詳細については、回転または反転したブロックの端子の位置の特定を参照してください)。

たとえば、選択されたこれらのブロックを時計回りに回転するとします。

The model contains two rows of blocks, each consisting of a Constant block connected to a Subsystem block connected to a Gain block. Both Gain blocks connect to a Scope block. The top row of blocks is selected.

ブロックを回転した後に、一部のモデル要素がオーバーラップすることがあります。

The selected row of blocks has rotated and become a vertical column of blocks. The Constant block is at the top in its original orientation. Below the Constant block is the Subsystem block. The Subsystem block is rotated 90 degrees counterclockwise. Below the Subsystem block is the Gain block. The gain block is rotated 90 degrees clockwise. The signal line from the selected Subsystem block to the selected Gain block crosses over the block icon of the unselected Subsystem block.

ブロックと信号を選択した状態で、[書式設定] タブの [自動調整] をクリックします。

The block diagram is rearranged such that the signal line from the selected Subsystem block to the selected Gain block no longer crosses over the block icon of the unselected Subsystem block.

回転または反転したブロックの端子の位置の特定

回転により、ブロック端子は端子の配置に応じて両側から上下に、または上下から両側に移動します。ブロック端子の結果の位置は、そのブロックの "端子の回転タイプ" に依存します。

回転によって、一部のブロックでは端子の再配置が行われ、端子の番号が左から右または上から下への順番になるようにします。回転後に端子の並べ替えが行われるブロックは、"既定の端子の回転" タイプのブロックです。このポリシーによって、制御システムのモデル作成アプリケーションに使用される左-右および上-下のブロック線図の向きルールが維持されます。次の図は、既定の端子の回転ポリシーのブロックを時計回りに回転した結果を示します。

A Subsystem block has two output ports on the left and two input ports on the right. The top input and output ports are labeled with the number 1 on the block icon, and the bottom input and output ports are labeled with the number 2.

マスクされたブロックは、回転後に順番を変えないように端子を指定できます (アイコンを描画するコマンドを参照)。これらのブロックは、"物理的な端子の回転" タイプのブロックです。このポリシーは、図に優先される向きが存在しない物理システムやその他のアプリケーションをモデル化するときに使用するブロックの設計に役立ちます。次の図は、物理的な端子の回転タイプのブロックを時計回りに回転した結果を示します。

A Subsystem block with a mask has two output ports on the left and two input ports on the right. The top input and output ports are labeled with the number 2 on the block icon, and the bottom input and output ports are labeled with the number 1.

ブロックの反転は、端子をブロックの反対側に移動して、ミラー イメージを作成します。端子の回転タイプには関係ありません。

端子の移動

端子は以下のブロックの任意の側に任意の順番で配置することができます。

端子を移動するには、端子をクリックしてドラッグします。

Subsystem ブロックでは、移動のたびに端子インデックスが自動的に振り直されます。Subsystem ブロックでの端子ラベルの編集については、Edit Port Labels on Subsystem Blocksを参照してください。

Subsystem ブロックの任意の側面に端子をドラッグできます。

マスクまたはリンクされた Subsystem ブロックには端子をドラッグできません。

The video shows a Subsystem block with three input ports and three output ports. From top to bottom along the left edge of the block, the input ports are labeled 1, 2, and 3. From top to bottom along the right edge of the block, the input ports are labeled 1, 2, and 3. The pointer moves input port 1 between input ports 2 and 3. When the pointer releases the port, the port labels update so that from top to bottom along the left edge of the block, they again read 1, 2, and 3. The pointer drags what is now input port 2 to the top of the block. When the pointer releases the port, the port labels update so that the top port label is 3, and the two ports along the left edge from top to bottom are 1 and 2. The pointer drags input port 2 to the right edge of the block. The port labels do not change.

関連するトピック