systemcomposer.arch.PhysicalConnector
物理端口之间的连接器
Description
一个物理渠道
对象代表系统Composer™模型之间物理端口之间的连接器。此类从systemcomposer.arch.baseconnector
。This class is derived fromSystemComposer.arch.element
。
特性
姓名
-姓名of connector
character vector
姓名of connector, specified as a character vector.
Example:'newConnector'
数据类型:char
父母
-一个rchitecture that owns connector
architecture object
一个rchitecture that owns connector, specified as aSystemComposer.arch.architecture
object.
Ports
-连接端口
端口对象的数组
连接端口,指定为SystemComposer.arch.architecturePort
orsystemcomposer.arch.componentport
objects.
UUID
-通用唯一标识符
character vector
通用唯一标识符为了model connector, specified as a character vector.
Example:'91D5DE2C-B14C-4C76-A5D6-5DDDD0037C52DF'
数据类型:char
外脉
-唯一的外部标识符
character vector
唯一的外部标识符,,,,specified as a character vector. The external ID is preserved over the lifespan of the model connector and through all operations that preserve theUUID
。
数据类型:char
Model
-父母model
模型对象
家长系统作曲家的连接器模型,指定为systemcomposer.arch.Model
object.
SimulinkHandle
-Simulink handle
数值
金宝app®连接器的手柄,指定为double
。此属性对于几个相关的工作流程和使用都是必需的金宝app需求工具箱™蜜蜂。
Example:hander = get(对象,'simu金宝applinkhandle')
数据类型:double
SimulinkModelHandle
-Simulink handle to parent model
数值
Simulink handle to parent System Composer model of connector, specified as adouble
。此属性对于几个相关的工作流程和使用都是必需的金宝app需求工具箱蜜蜂。
Example:hander = get(对象,'simu金宝applinkmodelhandle')
数据类型:double
对象功能
applystereotype |
将刻板印象应用于架构模型元素 |
getStereotypes |
获取对建筑模型元素的刻板印象 |
拆卸电脑 |
从模型元素中删除刻板印象 |
setProperty |
设置对应于应用于元素的刻板印象的属性值 |
getProperty |
Get property value corresponding to stereotype applied to element |
getPropertyValue |
Get value of architecture property |
getevalidpropertyvalue |
Get evaluated value of property from element |
getStereotypeProperties |
在元素上获取刻板印象属性名称 |
getSourceElement |
得到的数据元素选择欺诈的源端口nection |
getDestinationElement |
Gets data elements selected on destination port for connection |
hasStereotype |
Find if element has stereotype applied |
Hasproperty |
Find if element has property |
getQualifyName |
获取模型元素合格名称 |
destroy |
删除模型元素 |
Examples
以编程方式构建体系结构模型
Build an architecture model programmatically using System Composer™.
构建模型
To build a model, add a data dictionary with data interfaces, data elements, a value type, and a physical interface, then add components, ports, and connections. Create a profile with stereotypes and properties and then apply those stereotypes to model elements. Assign an owned interface to a port. After the model is built, you can create custom views to focus on specific considerations. You can also query the model to collect different model elements according to criteria you specify.
添加组件,端口,连接和接口
创建模型并提取其体系结构。
model = systemcomposer.createmodel(“ Mobilerobotapi”);Arch = model.Architecture;
创建一个接口数据字典并添加数据接口。将数据元素添加到数据接口。将值类型添加到接口数据字典中。将数据元素的类型分配给值类型。使用物理域类型添加物理接口和物理元素。将数据字典链接到模型。
dictionary = systemcomposer.createDictionary(“ sensorinterfaces.sldd”);interface = dictionary.addInterface("GPSInterface");element = interface.addElement(“信号强度”);valueType = dictionary.Addvaluetype(“ SignalStrengthtype”,,,,Units=“D b”,,,,Description="GPS Signal Strength");element.setType(valueType);物理界面= dictionary.AddphysicalInterface("PhysicalInterface");物理电子= addElement(物理接口,"ElectricalElement",type ="electrical.electrical");linkDictionary(model,“ sensorinterfaces.sldd”);
将更改保存到接口数据字典中。
字典
保存模型。
model.save
打开模型。
systemcomposer.openmodel(“ Mobilerobotapi”);
查看接口编辑器中的接口。
一个dd components, ports, and connections. Set the physical interface to the physical ports, which you will connect later.
零件Sensor = addComponent(arch,“传感器”);sensorPorts = addPort(componentSensor.Architecture,{'MotionData',,,,'SensorPower'},{'在',,,,'身体的'});sensorports(2).setInterface(yxulyInterface)componentplanning = addcomponent(拱门,,"Planning");planningports = addport(componentplanning.architecture,{'Command',,,,'SensorPower1',,,,“运动仪”},{'在',,,,'身体的',,,,'out'});planningports(2).setInterface(yxulyInterface)componentMotion = addcomponent(拱门,"Motion");MotionPorts = AddPort(ComponentMotion.Architecture,{“运动仪”,,,,'MotionData'},{'在',,,,'out'});
在'MotionData'
港口。一个dd an owned data element under the owned data interface. Assign the data element "回转”
至a value type with units set todegrees
。
ownedInterface = motionPorts(2).createInterface(“ datainterface”);ownedelement = ownedinterface.addelement(“回转”);subInterface = ownedElement.createOwnedType(Units="degrees");
查看接口编辑器中的接口。Select the'MotionData'
港口on the运动
零件。在接口编辑器中,从字典视图至端口接口视图。
使用接口规则和默认名称规则连接组件。接口规则连接共享相同接口的组件上的端口。默认情况下,名称规则连接共享同名的组件上的端口。
c_sensordata = connect(Arch,ComponentSEnsor,componentplanning,rule =“界面”);c_motionData = connect(arch,componentMotion,componentSensor); c_motionCommand = connect(arch,componentPlanning,componentMotion);
一个dd and Connect Architecture Port
在体系结构上添加一个体系结构端口。
archPort = addPort(arch,"Command",,,,“在”);
这连接
command requires a component port as an argument. Obtain the component port, then connect.
compPort = getPort(componentPlanning,"Command");c_Command = connect(archPort,compPort);
保存模型。
model.save
一个rrange the layout by pressıngCtrl+Shift+A或使用此命令。
金宝appsimulink.blockdiagram.arangesystem(“ Mobilerobotapi”);
Create and Apply Profile with Stereotypes
Profiles are XML files that can be applied to any model. You can add stereotypes with properties to profiles and then populate the properties with specific values. Along with the built-in analysis capabilities of System Composer, stereotypes help you optimize your system for performance, cost, and reliability.
创建个人资料并添加刻板印象
Create a profile.
profile = systemcomposer.createprofile("GeneralProfile");
创建适用于所有元素类型的刻板印象。
ElemStype = Addstereotype(配置文件,"projectElement");
为不同类型的组件创建刻板印象。您可以根据您的设计需求选择这些类型。
pcompstype = addstereotype(配置文件,“物理组合”,appliesto =“零件”);sCompSType = addStereotype(profile,"softwareComponent",appliesto =“零件”);
为连接创建刻板印象。
sconnstype = addstereotype(配置文件,"standardConn",appliesto ="Connector");
添加属性
一个dd properties to the stereotypes. You can use properties to capture metadata for model elements and analyze nonfunctional requirements. These properties are added to all elements to which the stereotype is applied, in any model that imports the profile.
addProperty(elemSType,'ID',type =“ uint8”);addProperty(elemSType,'描述',type =“细绳”);addProperty(pCompSType,'成本',type ="double",,,,Units=“美元”);addProperty(pCompSType,'Weight',type ="double",,,,Units=“G”);AddProperty(scompstype,“ DEVELCOST”,type ="double",,,,Units=“美元”);AddProperty(scompstype,“ develtime',type ="double",,,,Units=“小时”);addProperty(sConnSType,'unitCost',type ="double"',Units=“美元”);addProperty(sConnSType,“单位重量”,type ="double",,,,Units=“G”);addProperty(sConnSType,'length',type ="double",,,,Units="m");
Save Profile
profile.save;
一个pply Profile to Model
一个pply the profile to the model.
应用程序(模型,"GeneralProfile");
一个pply stereotypes to components. Some components are physical components, while others are software components.
applystereotype(组合规划,“ GeneralProfile.softWareComponent”)applystereotype(compententSensor,"GeneralProfile.physicalComponent")applystereotype(componentMotion,"GeneralProfile.physicalComponent")
一个pply the connector stereotype to all connections.
batchapplystereotype(Arch,'连接器',,,,“ GeneralProfile.StandardConn”);
将一般元素刻板印象应用于所有连接器和端口。
batchapplystereotype(Arch,'零件',,,,“ GeneralProfile.Projectelement”);batchapplystereotype(Arch,'连接器',,,,“ GeneralProfile.Projectelement”);
为每个组件设置属性。
setProperty(componentsensor,'GeneralProfile.projectElement.ID',,,,'001');setProperty(componentsensor,'GeneralProfile.Projectelement.Description',,,,''“所有传感器的中央单元”'');setProperty(componentsensor,'general -profile.physicalcomponent.cost',,,,'200');setProperty(componentsensor,'general -profile.physicalcomponent.ueight',,,,'450');setProperty(componentplanning,'GeneralProfile.projectElement.ID',,,,'002');setProperty(componentplanning,'GeneralProfile.Projectelement.Description',,,,'''Planning computer''');setProperty(componentplanning,'GeneralProfile.softwareComponent.develCost',,,,'20000');setProperty(componentplanning,'general -profile.softwarecomponent.develtime',,,,'300');setProperty(componentMotion,'GeneralProfile.projectElement.ID',,,,'003');setProperty(componentMotion,'GeneralProfile.Projectelement.Description',,,,'''Motor and motor controller''');setProperty(componentMotion,'general -profile.physicalcomponent.cost',,,,'4500');setProperty(componentMotion,'general -profile.physicalcomponent.ueight',,,,'2500');
Set the properties of connections to be identical.
连接ions = [c_sensorData c_motionData c_motionCommand c_Command];为了k = 1:长度(连接)setProperty(连接(k),,,'GeneralProfile.standardConn.unitCost',,,,'0.2');setProperty(连接(k),,'GeneralProfile.standardConn.unitWeight',,,,'100');setProperty(连接(k),,'GeneralProfile.standardConn.Lengths',,,,'0.3');结尾
一个dd Hierarchy
一个dd two components namedController
and范围
在 - 的里面运动
零件。Define the ports. Connect the components to the architecture and to each other, applying a connector stereotype. Hierarchy in an architecture diagram creates an additional level of detail that specifies how components behave internally.
MotionArch = ComponentMotion.Architecture;MotionController = MotionArch.AddComponent('控制器');ControllerPorts = AddPort(MotionController.Architecture,{“控制蛋白”,,,,“控制”},{'在',,,,'out'});controllerCompPortIn = motionController.getPort(“控制蛋白”);contranceerCompportout = MotionController.getPort(“控制”);motionsCope = MotionArch.AddComponent('Scope');scopePorts = addPort(motionScope.Architecture,{'scopein',,,,``瞄准''},{'在',,,,'out'});scopecompportin = motionscope.getport('scopein');scopecompportout = motionscope.getport(``瞄准'');c_planningController = connect(motionPorts(1),controllerCompPortIn);
For outport connections, the data element must be specified.
c_planningscope = connect(scopecompportout,Motionports(2),,“目标元素”,,,,“回转”);c_planningConnect = connect(controllerCompportout,scopecompportin,'GeneralProfile.standardConn');
保存模型。
model.save
一个rrange the layout by pressıngCtrl+Shift+A或使用此命令。
金宝appsimulink.blockdiagram.arangesystem('mobileRobotAPI/Motion');
创建模型参考
Model references can help you organize large models hierarchically and define architectures or behaviors once that you can then reuse. When a component references another model, any existing ports on the component are removed, and ports that exist on the referenced model will appear on the component.
Create a new System Composer model. Convert theController
组件成一个参考组件,以引用新模型。在Controller
零件,,,,you must update the referenced model"mobileMotion"
。
ReferenceModel = SystemComposer.CreateModel("mobileMotion");referencearch = referencemodel.architecture;newcomponents = addComponent(Referencearch,“陀螺仪”);referencemodel.save linkTomodel(MotionController,,,"mobileMotion");
保存模型。
referenceModel.save model.save
制作变体组件
你可以转换规划
零件至a variant component using themakevariant
功能。原始组件被嵌入变体组件中,作为可用变体选择之一。您可以在变体组件中设计其他变体选择并切换活动选择。变体组件允许您在架构模型中以编程方式选择行为设计来执行贸易研究和分析。
[variantComp,choice1] = makeVariant(componentMotion);
添加一个名为Motion的其他变体选择一个lt
。第二个参数定义了名称,第三个参数定义了标签。标签标识了选择。主动选择由标签控制。
选择2 = addChoice(variantComp,{'MotionAlt'},{'MotionAlt'});
Create the necessary ports on Motion一个lt
。
motionAltPorts = addPort(choice2.Architecture,{“运动仪”,,,,'MotionData'},{'在',,,,'out'});
Make Motion一个lt
活动变体。
setActiveChoice(variantComp,'MotionAlt')
一个rrange the layout by pressıngCtrl+Shift+A或使用此命令。
金宝appsimulink.blockdiagram.arangesystem(“ Mobilerobotapi/计划”);
保存模型。
model.save
清理
Run this script to remove generated artifacts before you run this example again.
cleanUpArtifacts
更多关于
定义
学期 | Definition | 一个pplication | 更多信息 |
---|---|---|---|
architecture | 系统作曲家architecture代表组件系统以及它们如何在结构和行为上相互接口。您可以使用替代视图表示特定的体系结构。 |
不同类型的体系结构描述了系统的不同方面:
|
在视觉上撰写体系结构 |
model | 系统作曲家modelis the file that contains architectural information, including components, ports, connectors, interfaces, and behaviors. |
在模型上执行操作:
系统作曲家模型存储为SLX文件。 |
创建体系结构模型with Interfaces and Requirement Links |
零件 | 一个零件是在体系结构中实现明确功能的系统的一个非平凡,几乎独立且可更换的部分。组件定义了构建元素,例如功能,系统,硬件,软件或其他概念实体。组件也可以是子系统或子函数。 |
组件表示为块,是可以将可重复使用的伪像的体系结构模型的一部分。 |
零件s |
港口 | 一个港口是代表与环境相互作用的组件或体系结构上的节点。一个端口允许从其他组件或系统的信息流进行。 |
这re are different types of ports:
|
Ports |
连接or | Connectorsare lines that provide connections between ports. Connectors describe how information flows between components or architectures. |
一个连接or allows two components to interact without defining the nature of the interaction. Set an interface on a port to define how the components interact. |
Connections |
学期 | Definition | 一个pplication | 更多信息 |
---|---|---|---|
物理子系统 | 一个物理子系统is a Simulink subsystem with Simscape™ connections. |
一个物理子系统with Simscape connections uses a physical network approach suited for simulating systems with real physical components and represents a mathematical model. |
使用SIMSCAPE描述组件行为 |
物理端口 | 一个物理端口represents a Simscape physical modeling connector port called a连接端口(Simscape)。 |
使用物理端口在体系结构模型中连接组件或在Simulink子系统中启用物理系统。金宝app |
在组件上定义物理端口 |
物理连接器 | 一个物理连接器可以代表特定物理领域的非方向保护连接。连接器也可以代表物理信号。 |
Use physical connectors to connect physical components that represent features of a system to simulate mathematically. |
DC电机的Simscape行为的体系结构模型 |
physical interface | 一个physical interface定义流过物理端口的信息的种类。相同的接口可以分配给多个端口。物理接口是相当于一个的复合接口 |
Use a physical interface to bundle physical elements to describe a physical model using at least one physical domain. |
Specify Physical Interfaces on Ports |
physical element | 一个physical elementdescribes the decomposition of a physical interface. A physical element is equivalent to a |
Define the |
使用SIMSCAPE描述组件行为 |
版本历史记录
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
您单击了与此MATLAB命令相对应的链接:
运行该命令通过输入MATLAB逗号nd Window. Web browsers do not support MATLAB commands.
Select a Web Site
选择一个网站以获取可用的翻译内容,并查看本地事件和优惠。根据您的位置,我们建议您选择:。
You can also select a web site from the following list:
如何获得最佳网站性能
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。
一个mericas
- 一个mérica Latina(Español)
- Canada(English)
- United States(English)