Main Content

Getting Started with Panels

A panel floats above the model canvas and follows you through the model hierarchy. Use panels to monitor signals, tune parameters, and debug from anywhere in your model without adding collections of dashboard blocks throughout the model.

In the video, a panel floats over the Fault-Tolerant Fuel Control System model to the lower right. Then, the pointer double-clicks the panel, and the panel is collapsed to a small rectangle. The pointer double-clicks the small rectangle, and the panel is restored.

You can use panels to model real dashboards, for example, the dashboard in your car. To model displays and controls on the panel, such as gauges, lamps, knobs, buttons, and switches, you can promote blocks to the panel from the Dashboard library, the Customizable Blocks library, and the Aerospace Blockset™ Flight Instruments library.

Note

To use panels saved in a referenced model, open the referenced model as a top model.

By default, the first panel you create in a model has a single tab. To model multiple dashboards, you can make multiple panels or add tabs to a panel. For more information, see Create Tabbed Panels.

When you want more of the canvas to be visible so that you can inspect or edit the model in the canvas, you can collapse or hide a panel.

This example shows you how to create, edit, and manage the visibility of a panel for testing a fuel control system.

Open Example Model

Open the sldemo_fuelsys model from the Model a Fault-Tolerant Fuel Control System example.

openExample('simulink_automotive/ModelingAFaultTolerantFuelControlSystemExample')

The sldemo_fuelsys model has a Dashboard subsystem that contains controls and indicators for interactively simulating the model. Navigate inside the Dashboard subsystem.

The subsystem contains four areas: Inputs, Fault Injection, Fuel (g/s), and Air/Fuel Ratio.

The Dashboard subsystem contains four areas. The Input area contains a Toggle Switch block with the annotation Engine Speed (rad/s). The Fault Injection area contains four pairs of Slider Switch blocks and Lamp blocks, respectively with the annotations Throttle Angle, Engine Speed, EGO, and MAP. The Fuel (g/s) area contains a Half Gauge block and a Dashboard Scope block. The Air/Fuel Ratio area contains a Quarter Gauge Block, a Gauge block, and a Dashboard Scope block.

In this example, you create a panel that contains the control blocks from the Input and Fault Injection areas.

For an example of how you can use such a panel, see Use Panels to Monitor Signals and Control Parameters.

Create Panels

To create a new panel, do one of these:

  • Directly promote a group of selected blocks to a new panel. Use this approach to create your first panel in a model.

  • Create an empty panel and populate it. The option for creating empty panels becomes available after you create your first panel.

For example, create the first panel in the Dashboard subsystem by promoting the dashboard block in the Inputs area to a new panel:

  1. Select the block.

  2. Pause on the ellipsis that appears above the block.

    Note

    If you select one or more blocks by dragging a selection box, the ellipsis appears at the location where you release your pointer.

  3. In the action bar that appears, click Promote to Panel .

    The video shows the Inputs area containing a Toggle Switch block. The pointer selects the Toggle Switch block. Above the block, an ellipsis appears. The pointer pauses on the ellipsis. The action bar expands. The pointer clicks Promote to Panel.

The Toggle Switch block promotes to the panel, but the annotation Engine Speed (rad/s) does not.

You can promote blocks to a panel only from the Dashboard library, the Customizable blocks library, and the Aerospace Blockset Flight Instruments library. When you try to promote a selection containing dashboard blocks and other blocks, only the dashboard blocks promote to the panel.

When you use panels, the blocks in the panel are not associated with the model in the same way as blocks in the canvas. You cannot programmatically interact with blocks in panels using get_param, set_param, gcb, or gcbh. Otherwise, blocks promoted to panels retain their interactive behavior. You can connect dashboard blocks in a panel using connect mode, inspect block properties using the Property Inspector, and modify connections during simulation. For more information about connect mode, see Connect Blocks Without Signal Lines.

When you add your first panel to the model, in the Simulink® Toolstrip, the Panels tab appears.

The Panels tab stays visible unless you save and close the model when it does not contain any panels. If you save and close a model without panels, when you reopen the model, the Panels tab is no longer visible. To restore the tab, promote one or more dashboard blocks to a panel.

Now that a panel exists in this model, you can create an empty panel. On the Panels tab, in the Create section, click Add Empty Panel. An empty panel appears.

To delete the panel, select it and press Delete.

Populate and Edit Panels

When the simulation is not running, you can edit panels and the blocks they contain.

To edit panels and their contents, you can use the options available:

  • In the Simulink Toolstrip, on the Panels tab, in the Edit section

  • In edit mode

To make any of these changes, enter edit mode:

  • Move blocks from the panel to the canvas.

  • Move blocks from one panel to another panel.

  • Move blocks and annotations within a panel.

  • Resize blocks in a panel.

  • Annotate a panel.

To enter edit mode:

  1. Click the panel.

  2. Pause on the ellipsis that appears.

  3. In the action bar that expands, click Edit Panel .

To exit edit mode, click the canvas.

Promote Block to Existing Panel

You can promote blocks to an existing panel regardless of whether the panel already contains blocks.

For example, promote the blocks from the Fault Injection area to the panel you created in Create Panels:

  1. Enter edit mode.

  2. Drag the borders of the panel outwards until all the blocks in the Fault Injection area fit inside the panel borders.

  3. Drag the panel away from the Fault Injection area so that the panel and area no longer overlap. To drag the panel, click and hold down your pointer on the panel name or on any empty spot inside the panel, then move the pointer.

  4. Drag the blocks in the Fault Injection area into the panel.

  5. To exit edit mode, click the canvas.

Panel containing the dashboard blocks from the Inputs and Fault Injection areas

Move Block from Panel to Canvas

To move a block to the canvas, enter edit mode and drag the block from the panel to the canvas.

For example, move one of the blocks from the panel you created in Promote Block to Existing Panel to the canvas. To promote the block to the panel again, in edit mode, drag the block back onto the panel. To exit edit mode, click the canvas.

Move Block from One Panel to Another Panel

To move a block from one panel to another panel, enter edit mode, then drag the block to the other panel.

For example, move blocks from the panel you created in Promote Block to Existing Panel into a new panel:

  1. To create a blank panel, in the Simulink Toolstrip, on the Panels tab, in the Create section, click Add Empty Panel.

  2. Enter edit mode.

  3. Resize the panel to be as large as the panel you created in Promote Block to Existing Panel.

  4. Move blocks from the panel you created in Promote Block to Existing Panel to the new panel by dragging them from one to the other.

  5. Move the blocks back.

  6. To exit design mode, click the canvas.

Annotate Panels

You can add text annotations to a panel.

For example, consider the annotations in the Dashboards subsystem in the Inputs and Fault Injection areas. Replicate these annotations in the panel you created in Promote Block to Existing Panel:

  1. Enter edit mode.

  2. To add an annotation, double-click the panel where you want to add the annotation. For this example, click in the upper left of the panel. Alternatively, create the annotation anywhere in the panel and then drag it to the upper left of the panel.

  3. Type Inputs.

  4. Select the text. In the formatting menu above the text, click Bold.

    Panel in edit mode with bold annotation in the upper left containing the word Inputs

  5. Press Enter.

  6. Add a second bold annotation with the text Fault Injection. Position it at the left edge of the panel, above the blocks from the Fault Injection area.

    Panel in edit mode with Fault Injection annotation

  7. Add the annotations for the dashboard blocks.

    Panel in edit mode with same annotations as the Inputs and Fault Injection areas

  8. To exist edit mode, click the canvas.

To edit an annotation after you create it, double-click the annotation.

To delete an annotation, double-click the annotation and delete all of the text in it.

To move an annotation to a different panel, in edit mode, drag the annotation onto the other panel.

Resize Panels

To promote a block to a panel, the block must fit inside the dashed line that appears along the inside of the panel perimeter when you enter edit mode. If your panel is too small to fit the block you want to promote, resize the panel.

Empty panel in edit mode with dashed line along the inside of its perimeter, and the region inside the dashed line marked as the maximum size of blocks that you can add to the panel

To resize a panel and its contents together, such that the contents scale proportionally to the panel:

  1. If you are in edit mode, click the canvas to exit edit mode.

  2. Drag one of the corners of the panel.

When you are not in edit mode and you resize the panel, the panel maintains its aspect ratio. As you resize the panel, the blocks in the panel scale proportionally.

For example, resize the panel you created in Promote Block to Existing Panel with its contents.

Inputs and Fault Injection panel on the left is shown resized on the right. The resized panel is smaller, the block icons are smaller, and the font of the blocks and annotations is smaller.

To resize a panel without resizing its contents:

  1. Enter edit mode.

  2. Click and drag one of the corners of the panel.

When you are in edit mode and you resize the panel, the panel does not maintain its aspect ratio. You cannot drag a corner further inwards when doing so would cut off a block or an annotation.

For, resize the panel you created in Promote Block to Existing Panel without its contents.

Inputs and Fault Injection panel on the left is shown resized on the right. The resized panel is wider, but the blocks icons are the same size as in the panel shown on the left, and the font size is the same as well.

Rename Panels

The Simulink Editor names panels when you create them. The editor follows the naming sequence Panel, Panel1, Panel2,Panel3, and so on. You can modify these names.

For example, rename the panel you created in Promote Block to Existing Panel to Inputs and Fault Injection:

  1. In the Simulink Toolstrip, on the Panels tab, in the Edit section, click Rename Panel. The Property Inspector appears with the Parameters tab open and the Name text box selected.

    The Property Inspector is open to the Parameters tab, and the Name text box contains the word Panel. The word Panel is selected.

  2. In the Name text box, replace the selected text with Inputs and Fault Injection.

    The title box at the top of the panel contains the name Inputs and Fault Injection

Add Background Image to Panel

You can make your panel look like a real dashboard by adding a background image.

For example, add a background image to the panel you created in Promote Block to Existing Panel:

  1. In the Simulink Toolstrip, on the Panels tab, in the Edit section, click Add Background.

    Note

    If the panel already has a background image, click Replace Background.

  2. Select an image and click Open.

    The panel in edit mode with a background image that shows a color gradient from white at the top to grey at the bottom

  3. To exit edit mode, click the canvas.

To delete a background image, select the panel. Then, in the Simulink Toolstrip, on the Panels tab, in the Edit section, click Add Background > Remove Background.

Manage Panel Visibility

When you want more of the canvas to be visible so that you can inspect or edit the model in the canvas, you can collapse or hide your panels.

When you lose track of your panels, you can gather them into the visible model window.

Collapse Panels

When you want the panel to be readily accessible while you work in the canvas, you can collapse the panel. Collapsed panels remain visible in the model, represented by icons.

For example, collapse and then expand the panel you created in Promote Block to Existing Panel:

  • To collapse a panel, double-click an empty area in the panel. The panel is replaced by a small blue rectangular icon. The upper left corner of the icon is located where you clicked.

    Note

    You cannot collapse the panel in edit mode. Double-clicking the panel while in edit mode creates an annotation.

    Collapsed panel icon

  • You can reposition the panel when it is collapsed.

  • To restore the panel, double-click the icon. When you restore the panel, it expands downward and to the right. The top and left edges of the restored panel line up with the top and left edges of the panel in its collapsed state.

Hide Panels

When you want the panel to disappear from view completely but you do not want to delete it, you can hide the panel.

As an example, hide and then restore the panel you created in Promote Block to Existing Panel:

  • To hide the panel, select the panel. Then, in the Simulink Toolstrip, on the Panels tab, in the Manage section, select Manage Panels > Hide Panel

  • To restore the panel, in the Simulink Toolstrip, on the Panels tab, in the Manage section, click Manage Panels. In the Manage Panels menu that appears at the bottom right corner of the model window, you can toggle the visibility of a panel on or off by clicking its image. Click the panel image to unhide the panel.

    Tip

    To hide or unhide all panels in the model, click the eye icon above the Manage Panels menu.

    The manage panels menu shows the Inputs and Fault Injection panel as a small rectangular icon with a light blue tinge over the panel content

Gather Panels into Visible Section of Canvas

Since panels are positioned relative to the canvas and do not scale with zoom actions, panels may move off the edge of the model window in part or in full. To gather all panels in your model into the visible canvas, in the Simulink Toolstrip, on the Panels tab, in the Manage section, click Fit Panels to View.

Note

The Fit Panels to View button does not affect panels that you hide using the Manage Panels menu or the Hide Panel button in the Simulink Toolstrip.

Fit Panels to View also scales all non-collapsed panels up as large as possible within the visible canvas. To fit a single panel to view, you can also press the space bar.

For example, move part of the panel you created in Promote Block to Existing Panel past the edge of the model window.

Model window showing only the upper left corner of the Inputs and Fault Injection panel

Then, in the Simulink Toolstrip, on the Panels tab, in the Manage section, click Fit Panels to View. The panel moves and resizes to fit in the model window.

The model window shows the full Inputs and Fault Injection panel. The panel size is reduced to allow it to fit within the bounds of the canvas.

Move Panel in Front of or Behind Overlapping Panels

If two or more panels overlap forming a stack of panels, you can change which one appears at the front and back of the stack.

For example, make a copy of the panel you created in Promote Block to Existing Panel, move one panel over the other, then switch their order in the stack:

  1. If you are in edit mode, exit edit mode.

  2. To create a copy, press Ctrl and drag the panel.

  3. Make the panels overlap by dragging one under or over the other. They do not need to overlap completely.

  4. Select the panel in the front of the stack.

  5. Click Send to Back . The panel in the front of the stack moves to the back of the stack.

  6. Select the panel at the back of the stack.

  7. Click Bring to Front . The panel at the back of the stack moves to the front of the stack.

Related Topics