主要内容

进出口体系结构

在System Composer™中,架构由三组信息完全定义:

  • 组件信息

  • 端口信息

  • 连接信息

当在此信息中定义或转换为MATLAB®表时,您可以将架构导入系统作曲家。

In this example, the architecture information of a simple unmanned aerial vehicle (UAV) system is defined in a Microsoft® Excel® spreadsheet and is used to create a System Composer architecture model. It also links elements to the specified system level requirement. You can modify the files in this example to import architectures defined in external tools, when the data includes the required information. The example also shows how to export this architecture information from System Composer architecture model to an Excel spreadsheet.

Architecture Definition Data

你可以描述下cture as a network of components and import by defining components, ports, connections, interfaces and requirement links in MATLAB tables. The组件表必须包括每个组件的名称,唯一ID和父组件ID。电子表格还可以包含其他相关信息,以构建引用模型的体系结构层次结构和刻板印象限制符名称。这端口表必须包括端口名称,方向,组件和端口ID信息。端口接口信息也可能需要为组件分配端口。这连接表包括用于连接端口的信息。至少,此表必须包括连接ID,源端口ID和目标端口ID。

systemcomposer.importmodel(importmodelname)功能:

  • 组件表并加载配置文件

  • 创建组件并附加端口

  • 使用连接图创建连接

  • 在端口上设置接口

  • 将元素链接到指定的要求(需要需求Toolbox™许可证)

  • 保存引用的模型

  • 保存体系结构模型

实例化适配器类从Excel阅读。

modelName =“ SimpleUavarchitecture”;

导入modelfromexcel函数读取Excel文件并创建MATLAB表。

importAdapter = importModelfromexcel(“ smalluavmodel.xls”,,,,“组件”,,,,...“港口”,,,,“连接”,,,,“ portinterfaces”,,,,“需求链接”);importAdapter.ReadTableFromeXcel();

导入架构

model = systemcomposer.importmodel(modelName,importadapter.components,...importadapter.ports,importadapter.connections,importadapter.interfaces,...ImportAdapter.requirementLinks);

生成的模型中的自动远程块。

金宝appsimulink.blockdiagram.Arrangesystem(modelName)

导出建筑

您可以将架构导出到MATLAB表,然后将表转换为外部文件。

exportedSet = SystemComposer.exportModel(modelName);

该函数的输出是包含组件表,端口表,连接表,接口表和需求链接表的结构。将此结构保存到Excel文件。

Savetoexcel(“ ExportuavModel”,导出);

也可以看看

||

Related Topics