主要内容

systemcomposer.analysis.Instance

元素分析实例

自从R2019a

描述

一个实例对象代表了一个实例系统的作曲家™模型元素。

相关对象包括:

创建

使用的创建架构的一个实例实例化函数。

实例=实例化(model.Architecture,“LatencyProfile”,“NewInstance”,“函数”@calculateLatency,“参数”,“3”,“严格的”,真的,“NormalizeUnits”假的,“方向”,“预订”)

属性

全部展开

实例的名称,指定为一个特征向量。

例子:“NewInstance”

数据类型:字符

对象的功能

getValue 从元素实例的属性值
setValue 设置元素实例的属性值
hasValue 发现如果元素实例的属性值
isArchitecture 发现如果实例的建筑实例
isComponent 发现如果实例组件实例
isConnector 发现如果实例连接器实例
isPort 发现如果实例的端口实例

例子

全部折叠

创建一个实例的分析对于一个系统的布线延迟。使用的材料是铜、光纤和无线网络。

创建延迟概要与原型和属性

创建一个系统作曲家简介基地,连接器,组件和端口的刻板印象。根据需要添加属性和默认值每一个构造型进行分析。

形象= systemcomposer.profile.Profile.createProfile (“LatencyProfileC”);

添加一个基本原型的属性。

latencybase = profile.addStereotype (“LatencyBase”);latencybase.addProperty (“延迟”类型=“替身”);latencybase.addProperty (“dataRate”类型=“替身”DefaultValue =“10”);

增加一个连接器原型的属性。

connLatency = profile.addStereotype (“ConnectorLatency”,父母=“LatencyProfileC.LatencyBase”);connLatency.addProperty (“安全”类型=“布尔”DefaultValue =“真正的”);connLatency.addProperty (“linkDistance”类型=“替身”);

添加一个组件原型的属性。

nodeLatency = profile.addStereotype (“NodeLatency”,父母=“LatencyProfileC.LatencyBase”);nodeLatency.addProperty (“资源”类型=“替身”DefaultValue =“1”);

添加一个端口原型的属性。

portLatency = profile.addStereotype (“PortLatency”,父母=“LatencyProfileC.LatencyBase”);portLatency.addProperty (“queueDepth”类型=“替身”DefaultValue =“4.29”);portLatency.addProperty (“假”类型=“int32”);

使用分析函数实例化

创建一个新的模型和应用的概要文件。在模型中创建组件、端口和连接。刻板印象应用到模型元素。最后,使用分析函数实例化。

模型= systemcomposer.createModel (“archModel”,真正的);拱= model.Architecture;

概要文件应用到模型。

model.applyProfile (“LatencyProfileC”);

创建组件、端口和连接。

componentSensor = addComponent(拱门,“传感器”);sensorPorts = addPort (componentSensor.Architecture, {“MotionData”,“SensorPower”},{“在”,“出”});componentPlanning = addComponent(拱门,“计划”);planningPorts = addPort (componentPlanning.Architecture, {“命令”,“SensorPower”,“MotionCommand”},{“在”,“在”,“出”});componentMotion = addComponent(拱门,“运动”);motionPorts = addPort (componentMotion.Architecture, {“MotionCommand”,“MotionData”},{“在”,“出”});c_sensorData =连接(拱门,componentSensor componentPlanning);c_motionData =连接(拱门,componentMotion componentSensor);c_motionCommand =连接(拱门,componentPlanning componentMotion);

清理画布上。

万博1manbetxSimulink.BlockDiagram.arrangeSystem (“archModel”);

批处理模式应用到模型元素。

batchApplyStereotype(拱,“组件”,“LatencyProfileC.NodeLatency”);batchApplyStereotype(拱,“端口”,“LatencyProfileC.PortLatency”);batchApplyStereotype(拱,“连接器”,“LatencyProfileC.ConnectorLatency”);

实例化使用分析函数。

实例=实例化(model.Architecture,“LatencyProfileC”,“NewInstance”,= = @calculateLatency函数,参数“3”,严格的= true, NormalizeUnits = false,方向=“预订”)
实例与属性= ArchitectureInstance:规格:1×1 systemcomposer.arch。一个rchitecture] IsStrict: 1 NormalizeUnits: 0 AnalysisFunction: @calculateLatency AnalysisDirection: PreOrder AnalysisArguments: '3' ImmediateUpdate: 0 Components: [1×3 systemcomposer.analysis.ComponentInstance] Ports: [0×0 systemcomposer.analysis.PortInstance] Connectors: [1×3 systemcomposer.analysis.ConnectorInstance] Name: 'NewInstance'

检查组件、端口和连接器实例

从组件的属性、端口和连接器实例。

defaultResources = instance.Components (1) .getValue (“LatencyProfileC.NodeLatency.resources”)
defaultResources = 1
defaultSecure = instance.Connectors (1) .getValue (“LatencyProfileC.ConnectorLatency.secure”)
defaultSecure =逻辑1
defaultQueueDepth = instance.Components (1) .Ports (1) .getValue (“LatencyProfileC.PortLatency.queueDepth”)
defaultQueueDepth = 4.2900

概述

模型汽车电气系统作为一个典型的建筑模型和运行一个原始的分析。模型中的元素可以大致归纳为一个源或负载。源和负载的各种属性设置为刻板印象的一部分。下面的例子使用了迭代规范的方法API遍历模型的每个元素使用原型属性和运行分析。

结构的模型

发电机指控电池在引擎运行时。电池和发电机的电气负载车辆的支持,像ECU,收音机,和身体的万博1manbetx控制。电感加载像汽车和其他线圈InRushCurrent原型属性定义。基于每个组件上的属性设置,进行以下分析:

  • KeyOffLoad

  • 所需的天数KeyOffLoad30%的电池放电。

  • CrankingInRush电流。

  • 起动电流。

  • 电池的能力开始基于电池的车辆在0°F冷起动安培(CCA)。放电时间是计算基于Puekert系数(k),用来描述放电率之间的关系和电池的可用容量。

负荷模型和运行分析

scExampleAutomotiveElectricalSystemAnalysis archModel = systemcomposer.loadModel (“scExampleAutomotiveElectricalSystemAnalysis”);

实例化电池大小类使用的分析函数来存储分析结果。

objcomputeBatterySizing = computeBatterySizing;

使用迭代器运行分析。

archModel.iterate (“由上而下的”、@computeLoad objcomputeBatterySizing)

显示分析结果。

objcomputeBatterySizing.displayResults
总KeyOffLoad: 158.708 mA所需天数KeyOffLoad 30%的电池放电:55.789。总CrankingInRush电流:70总起动电流:104指定的CCA电池足以启动汽车(0 F。
ans = computeBatterySizing属性:totalCrankingInrushCurrent: 70 totalCrankingCurrent: 104 totalAccesoriesCurrent: 71.6667 totalKeyOffLoad: 158.7080 batteryCCA: 500电池容量:850 puekertcoefficient: 1.2000

scExampleAutomotiveElectricalSystemAnalysis_m_01.png

关闭模式

bdclose (“scExampleAutomotiveElectricalSystemAnalysis”);

更多关于

全部展开

版本历史

介绍了R2019a