Large models often contain many levels of hierarchy, complicated
signals, and complex mode logic. You can use Model Slicer to understand which parts
of your model are significant for a particular behavior. This example shows how to
use Model Slicer to explore the behavior of the
sldvSliceClimateControlExample
model. You first select an
area of interest, and then highlight the related blocks in the model. In this
example, you trace the dependency paths upstream of Out1
to
highlight which portions of the model affect its
behavior.
Open the model and highlight the functional dependencies of a signal in the system:
Add the example folder to the search path.
addpath(fullfile(docroot,'toolbox','simulink','examples'))
Open the sldvSliceClimateControlExample
model.
sldvSliceClimateControlExample
To open the Model Slice Manager, on the Apps tab, under Model Verification, Validation, and Test gallery, click Model Slicer.
When you open the Model Slice Manager, Model Slicer compiles the model. You then configure the model slice properties.
In the Model Slice Manager, click the arrow to expand the Slice configuration list.
Set the slice properties:
Name: Out1Slice
Color:
(magenta)
Signal Propagation:
upstream
Model Slicer can also highlight the constructs downstream of or bidirectionally from a block in your model, depending on which direction you want to trace the signal propagation.
Add Out1
as a starting point. In the model, right-click
Out1
and select Model Slicer > Add as
Starting Point.
The Model Slicer now highlights the upstream constructs that affect
Out1
.
If you create two slice configurations, you can highlight the intersecting portions of their highlights. Create a new slice configuration and view the intersecting portions of the slice configuration you created above and the new slice configuration:
Create a new slice configuration with the following properties
Name: Out3Slice
Color:
(red)
Signal Propagation:
upstream
Starting point:
Out3
In the Model Slice Manager, select both the Out1Slice
slice
configuration and the Out3Slice
slice configuration.
Model Slicer highlights portions of the model as follows:
The portions of the model that are exclusively upstream of
Out1
are highlighted in cyan.
The portions of the model that are exclusively upstream of
Out3
are highlighted in red.
The portions of the model that are upstream of both
Out1
and Out3
are highlighted in
black.
After you highlight a portion of your model, you can then refine the highlighted model to an area of interest. Or, you can create a simplified standalone model containing only the highlighted portion of your model.
To view the details of the highlighted model in web view, click Export to
Web. The web view HTML file is stored in <current
folder>\<model_name>\webview.html
.