主要内容

addStartingPoint

Class: SLSlicerAPI.SLSlicer
Namespace: SLSlicerAPI

Add block handles, block paths, bus elements, or Simulink Identifiers (SID) as starting point

Description

addStartingPoint(obj,StartingPoint) adds block(s), block path(s), or Simulink® Identifier (SID) as the StartingPoint to the model slice in obj for dependency analysis.

addStartingPoint(obj,PortHandle,busElementPath) adds a bus element as the starting point. Specify the port emitting the bus in PortHandle and the bus element path corresponding to the bus element in busElementPath. You can add the starting point bus element in the form of subsignal1.subsignal2 and so on. You can specify the subsignal up to any level. You should not specify the top-level bus name.

Input Arguments

expand all

Model Slicer configuration, specified as an slslicer object containing Model Slicer configuration options.

Starting point for the model slice, specified as character vector, cell array, or bus. You can specify block names, block paths, or Simulink Identifiers (SID) as the starting point.

Name of the port emitting the bus, specified as cell array of character vectors or string array.

Path for the bus element from which you want to start the Model Slicer analysis, specified as cell array of character vectors or string array.

Examples

Starting Point at Block Handles

Open the model.

open_system('sldvSliceClimateControlExample');

Add a Model Slicer object.

obj = slslicer('sldvSliceClimateControlExample');

Add a block handle as the starting point. To get the block handle, you can use the getSimulinkBlockHandle function.

blkH = get_param('sldvSliceClimateControlExample/Out1','Handle');
addStartingPoint(obj,blkH);

To add multiple block handles as the starting point, use a cell array.

blkH = {get_param('sldvSliceClimateControlExample/Out1','Handle'), ...
    get_param('sldvSliceClimateControlExample/Out2','Handle')};
addStartingPoint(obj,blkH);

Starting Point as Bus Element

Specify the bus element limits as the starting point.

openExample('simulink/ComponentInterfaceSpecificationUsingBusesExample')
obj = slslicer('CounterSystem');
ph = get_param('CounterSystem/Bus Creator2', 'PortHandles');
obj.addStartingPoint(ph.Outport, "Limits");
obj.highlight;

Starting Point at Block Path

Specify a block path as a character vector.

bPath = {'sldvSliceClimateControlExample/Out1'};
addStartingPoint(obj, bPath);

To add multiple block paths as the starting point, use a cell array.

bPath = {'sldvSliceClimateControlExample/Out1',...
'sldvSliceClimateControlExample/Heater/HeaterAct'};
addStartingPoint(obj, bPath);

Starting Point at Simulink Identifier

Specify a Simulink Identifier (SID), a unique designation assigned to a Simulink block or model annotation, as the starting point. To get the SID, use the Simulink.ID.getSID function.

addStartingPoint(obj, 'sldvSliceClimateControlExample:39')

Starting Point at Line Handles

Specify handles of the lines connecting an Inport block to an Outport block. To get the line handle, use the get_param function.

 lh1 = get_param('sldvSliceClimateControlExample/Heater/Heat','LineHandles');
 lh2 = get_param('sldvSliceClimateControlExample/Heater','LineHandles');
 LineHs = [lh1.Inport(1), lh2.Outport(2)];
addStartingPoint(obj,LineHs);

Alternatives

In the Simulink Editor, on the Apps tab, click Model Slicer. To add a block or signal as the starting point, in the model, right-click the bus and in the Model Slicer app section , select the Add as Starting Point button .

To add bus elements as starting points in the model, right-click the bus signal and in the Model Slicer app section, select the Select Bus Elements as Starting Points button . The Select Bus Element(s) dialog box opens, where you can select the bus elements that you want to add as starting points and click Add Starting Point.

Add Bus Elements as Starting Points

Figure showing the steps to add the bus elements as starting point.

Version History

Introduced in R2015b