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.
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
.
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:
Select the block.
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.
In the action bar that appears, click 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:
Click the panel.
Pause on the ellipsis
that appears.
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:
Enter edit mode.
Drag the borders of the panel outwards until all the blocks in the
Fault Injection
area fit inside the panel borders.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.Drag the blocks in the
Fault Injection
area into the panel.To exit edit mode, click the canvas.
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:
To create a blank panel, in the Simulink Toolstrip, on the Panels tab, in the Create section, click Add Empty Panel.
Enter edit mode.
Resize the panel to be as large as the panel you created in Promote Block to Existing Panel.
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.
Move the blocks back.
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:
Enter edit mode.
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.
Type
Inputs
.Select the text. In the formatting menu above the text, click Bold.
Press Enter.
Add a second bold annotation with the text
Fault Injection
. Position it at the left edge of the panel, above the blocks from theFault Injection
area.Add the annotations for the dashboard blocks.
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.
To resize a panel and its contents together, such that the contents scale proportionally to the panel:
If you are in edit mode, click the canvas to exit edit mode.
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.
To resize a panel without resizing its contents:
Enter edit mode.
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.
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
:
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.
In the Name text box, replace the selected text with
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:
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.
Select an image and click Open.
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.
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.
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.
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.
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:
If you are in edit mode, exit edit mode.
To create a copy, press Ctrl and drag the panel.
Make the panels overlap by dragging one under or over the other. They do not need to overlap completely.
Select the panel in the front of the stack.
Click Send to Back
. The panel in the front of the stack moves to the back of the stack.
Select the panel at the back of the stack.
Click Bring to Front
. The panel at the back of the stack moves to the front of the stack.