主要内容

本页采用了机器翻译。点击此处可查看英文原文。

removeStartingPoint

类: SLSlicerAPI.SLSlicer
命名空间: SLSlicerAPI

移除模型切片的起始点

说明

removeStartingPoint(obj,StartingPoint)obj 的模型切片中移除 StartingPoint 中的起始点,以进行依赖性分析。

removeStartingPoint(obj,PortHandle,busElementPath) 删除使用 PortHandle 中的端口句柄和 busElementPath 中的总线元素路径定义的起始点。移除一个巴士元素也会移除所有作为起点添加的与其关联的子元素。

输入参数

全部展开

包含模型切片器配置选项的类。

从模型切片器分析开始的模块或信号线。

发出总线的端口的输出端口句柄。

模型切片器分析从总线元素的路径开始。

示例

使用块句柄移除起始点

打开模型。

open_system('sldvSliceClimateControlExample');
obj = slslicer('sldvSliceClimateControlExample');

移除一个模块句柄作为起点。要获取模块句柄,可以使用 getSimulinkBlockHandle 函数。

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

要从多个块模块开始删除,请使用元胞数组。

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

从起点移除总线元素

以从总线 Limits 中移除总线元素 UpperSaturationLimit 为起点。本示例展示了如何首先添加 UpperSaturationLimit

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

添加总线元素 UpperSaturationLimit 作为起点后,可以通过输入以下命令从起点删除此总线元素。

obj.removeStartingPoint(ph.Outport, "Limits.UpperSaturationLimit");
从起点移除巴士 Limits 也会从起点移除其子巴士 UpperSaturationLimit

使用模块路径移除起始点

移除一个模块路径作为起点。

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

要从起点移除多个模块路径,请使用元胞数组。

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

使用 Simulink 标识符移除起始点

以移除 Simulink® 标识符 (SID) 为起点。要获取 SID,请使用 Simulink.ID.getSID 函数。

removeStartingPoint(obj, 'sldvSliceClimateControlExample:39')

使用线控移除起点

对于连接 Inport 模块和 Outport 模块的线,移除线句柄作为起点。要获取行句柄,请使用 get_param 函数。

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

备选方法

在 Simulink 编辑器中,在 App 选项卡上,点击模型切片器。要移除模块、信号或总线元素作为起点,请右键点击模块、信号或总线元素,然后在模型切片器应用程序部分 中选择“移除起点”按钮

Remove Bus Elements from Starting Points

Figure showing the steps to remove the bus elements from starting point.

版本历史记录

在 R2015b 中推出