Interactively Design and Debug Models Using Panels
You can use a panel containing one or more Dashboard blocks to help you design and debug a model. A panel floats above the model canvas and follows you throughout a model hierarchy. With panels, you can control and monitor components of your model in place, without adding collections of Dashboard blocks throughout the model.
When you use panels, the blocks in the panel are not associated with the model in the same
way as blocks in the canvas. For example, you cannot programmatically interact with blocks in
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
This example uses the Modeling a Fault-Tolerant Fuel Control System example model
sldemo_fuelsys to illustrate the steps required to create panels and how
you can use panels to debug your models. To open the model, use this
Create a New Panel
sldemo_fuelsys model has a
that contains controls and indicators for interactively simulating the model. You can use
panels in addition to or instead of using a
Dashboard subsystem or
including Dashboard blocks throughout your model. For example, you can create three panels,
each containing a subset of the blocks in the
A control panel, including the blocks in the Inputs and Fault Injection areas.
A visualization panel for the
fuelsignal, including the blocks in the Fuel (g/s) area.
A visualization panel for the
air_fuel_ratiosignal, including the blocks in the Air/Fuel Ratio area.
You do not need to separate controls and visualizations into different panels. A single panel can contain both kinds of blocks. For this example, the modular division allows you to have access to the controls while choosing which signal to monitor, depending on the subsystem you need to understand or debug.
Navigate inside the
Dashboard subsystem, and create the controls panel:
Select the blocks inside the areas labeled Inputs and Fault Injection.
To promote the selection of blocks to a panel, pause on the ellipsis that appears at the end of the selection and select Promote to Panel from the menu that appears.
You can only promote Dashboard blocks and blocks in the Aerospace Blockset™ Flight Instruments library to a panel. When you try to promote a selection that contains model elements other than Dashboard blocks, only the Dashboard blocks promote to the panel.
When you promote blocks to a panel, the blocks move from the canvas into the panel. If you want to move a block back into the canvas from a panel, enter edit mode and drag the block out of the panel and into the canvas. To enter edit mode for a panel, select the panel, pause on the ellipsis that appears above the selected panel, and select Edit Panel.
Follow similar steps to create two more panels: one containing the blocks in the Fuel (g/s) area, and another containing the blocks in the Air/Fuel Ratio area.
To use panels saved in a referenced model, open the referenced model as a top model.
Manage Panels in Your Model
When you use panels in your model, the panel remains accessible, floating over the
canvas, no matter where you are in a model hierarchy. For example, navigate to the top level
sldemo_fuelsys model. The panels remain visible and in the same
position, similar to a heads-up display.
You can adjust the size of a panel from the corners. When you resize a panel outside of edit mode, the contents of the panel scale proportionally. To resize a panel without scaling the contents, enter edit mode as described in Edit and Annotate a Panel. You can reposition a panel by selecting an empty area in the panel and dragging.
If you need to inspect or edit your model, you can minimize one or more panels by double-clicking each panel. Minimized panels remain visible in the model, represented by icons. You can move the icon to a convenient place in your model while you edit or inspect the model contents. When you need to use the panel, you can restore the panel by double-clicking the icon.
You can also use the Manage Panels dialog to control panel visibility in the model. To access all panels available in a model or change the visibility of a panel, select Manage Panels from the perspectives controls. You can access the perspectives controls by clicking the lower right corner of the Simulink® Editor.
The Manage Panels dialog is only available when your model includes panels. If there are no panels in your model, the Manage Panels dialog does not show in the perspectives controls.
The Manage Panels dialog hovers over the canvas and displays an icon for each panel in the model. Because this model contains three panels, you see three icons. You can use the Manage Panels dialog to hide or show individual panels in your model, depending on the relevance of each panel to your present workflow. Click an icon to toggle the visibility for the corresponding panel. When panels are hidden, the icon becomes more transparent in the dialog, and the panel is not visible in the model. You can use the menu above the Manage Panels dialog to show or hide all panels in the model.
Because panels are positioned relative to the canvas and do not scale with zoom actions, you may lose track of one or more panels in the model as you design and debug. Use the Fit Visible Panels to View button to gather all visible panels in your model into the visible canvas.
Edit and Annotate a Panel
You can edit and annotate panels using edit mode. To enter edit mode for a panel, select the panel, pause on the ellipsis that appears above the selected panel, and select Edit Panel.
In edit mode, you can resize panels without resizing the panel contents, delete a panel, and change the appearance of a panel. For example, you could specify a background image to use as the panel background, or you can add annotations to label the contents of the panel. You can also add and remove blocks in edit mode by dragging blocks into or out of the panel. When your model has multiple panels, you can move blocks and labels between panels in edit mode.
Add annotations to each panel to label each interactive element. To add an annotation, double-click an empty part of the panel and start typing. Use the rich text menu to modify the annotations. For example, make section labels bold. To edit another panel while in edit mode, select the next panel. Clicking outside of a panel exits edit mode.
When you finish editing and annotating the panel, exit edit mode by selecting the Done Editing option in the menu above the panel or clicking outside of the panel.
Interactively Simulate a Model Using Panels
Now you have modular panels to use while interactively simulating the
sldemo_fuelsys model. Suppose you need to understand and debug the
fuel_rate_control subsystem. In this subsystem, the controls panel and
the panel that visualizes the
fuel signal are most useful. Before
starting a simulation, navigate inside the
and then inside the
Stateflow® chart. Minimize or hide the panel that visualizes the
air_fuel_ratio signal, and arrange the controls panel and fuel panel so
you can see the contents of the chart.
Start a simulation. Once the simulation starts, modify the position for one or more Fault Injection Slider Switch blocks to induce a failure in the system. To modify the value a Dashboard block passes to the model, select the block and then click to select the new value. Observe the changes in the Stateflow chart as the system state changes in response to one or more failures.
If the simulation progresses too quickly, you can use simulation pacing to slow the progression of simulation time relative to clock time. For more information, see Simulation Pacing.
Create Tabbed Panels
Another way to manage multiple panels is by creating a tabbed panel. For example, you
can create a tabbed panel that contains one panel for visualizing the
fuel signal and another for visualizing the
To add a tab to the Fuel panel, select the panel and pause on the ellipsis that appears above it. Then, select Add Tab.
To add blocks to the new tab, enter edit mode by selecting the panel, pausing on the ellipsis above it, and selecting Edit Panel. Drag the contents of the Air/Fuel Ratio panel into the new tab you added to the Fuel panel. Panels do not support selecting more than one element, so you must move the blocks and labels one by one.
You can name the tabs of the panels using the Property Inspector. To show the Property Inspector, in the Modeling tab, under Design, select Property Inspector. Select the panel and type the name in the Property Inspector. The name applies to the active tab. To name the other tab, select the tab and type the name in the Property Inspector.
You can separate panels by dragging a tab away and combine panels by dragging tabs together.