主要内容

systemcomposer.query.Constraint

查询约束

    描述

    约束对象代表所有系统作曲家™查询约束。

    对象的功能

    AnyComponent 创建查询选择所有组件模型
    IsStereotypeDerivedFrom 创建查询选择原型来自限定名称
    HasStereotype 创建查询来选择建筑元素与原型基于指定的子约束
    HasPort 创建查询来选择建筑元素与端口组件基于指定的子约束
    HasInterface 创建查询来选择建筑元素与接口基于子约束指定的端口上
    HasInterfaceElement 创建查询来选择建筑元素与界面元素在界面基于指定的子约束
    IsInRange 创建查询来选择属性值的范围
    财产 创建查询选择non-evaluated值对象属性或原型属性元素
    PropertyValue 创建查询来从对象或原型属性,然后选择属性评估属性值

    例子

    全部折叠

    使用查询系统中找到组件作曲家模型。

    系统的导入包包含所有作曲家查询。

    进口systemcomposer.query。*

    打开模型。

    scKeylessEntrySystem模型= systemcomposer.loadModel (“KeylessEntryArchitecture”);

    系统中找到所有的软件组件。

    con1 = HasStereotype(属性(“名称”)= =“SoftwareComponent”);[compPaths, compObjs] = model.find (con1)
    compPaths =5 x1细胞{' KeylessEntryArchitecture /门锁/ /解锁系统/门锁控制器}{' KeylessEntryArchitecture /发动机控制系统/无钥匙启动控制器}{' KeylessEntryArchitecture / FOB定位系统/ FOB定位模块的}{KeylessEntryArchitecture /照明系统照明控制器的}{KeylessEntryArchitecture /音响/声音控制器的}
    compObjs =1×5对象1 x5组件数组属性:IsAdapterComponent架构ReferenceName名字父母港口OwnedPorts OwnedArchitecture参数位置模型SimulinkHandle SimulinkModelHandle UUID ExternalUID金宝app

    在搜索包含参考模型。

    softwareComps = model.find (con1 IncludeReferenceModels = true)
    softwareComps =9 x1细胞{' KeylessEntryArchitecture /门锁/ /解锁系统/门锁控制器}{KeylessEntryArchitecture /门锁/ /解锁系统/前驱动门锁传感器/检测门锁状态”}{KeylessEntryArchitecture /门锁/ /解锁系统/前通过门锁传感器检测门锁状态”}{KeylessEntryArchitecture /门锁/ /解锁系统/后驱动门锁传感器/检测门锁状态”}{KeylessEntryArchitecture /门锁/ /解锁系统/后通过门锁传感器检测门锁状态”}{' KeylessEntryArchitecture /发动机控制系统/无钥匙启动控制器}{' KeylessEntryArchitecture / FOB定位系统/ FOB定位模块的}{KeylessEntryArchitecture /照明系统照明控制器的}{KeylessEntryArchitecture /音响/声音控制器的}

    系统中找到所有的基本组件。

    con2 = HasStereotype (IsStereotypeDerivedFrom (“AutoProfile.BaseComponent”));baseComps = model.find (con2)
    baseComps =18 x1细胞{' KeylessEntryArchitecture / FOB定位系统/ FOB定位模块的}{' KeylessEntryArchitecture /发动机控制系统/启动/停止按钮”}{KeylessEntryArchitecture /音响/仪表盘议长的}{KeylessEntryArchitecture /照明系统照明控制器的}{KeylessEntryArchitecture /门锁/ /解锁系统/门锁控制器}{' KeylessEntryArchitecture /发动机控制系统/无钥匙启动控制器}{KeylessEntryArchitecture /音响/声音控制器的}{KeylessEntryArchitecture / FOB定位系统/中心接收机的}{KeylessEntryArchitecture / FOB定位系统/前接收机的}{KeylessEntryArchitecture / FOB定位系统/后方接收机的}{KeylessEntryArchitecture /门锁/ /解锁系统/前司机门锁传感器}{KeylessEntryArchitecture /门锁/ /解锁系统/前通过门锁传感器}{KeylessEntryArchitecture /门锁/ /解锁系统/后司机门锁传感器}{KeylessEntryArchitecture /门锁/ /解锁系统/后通过门锁传感器}{KeylessEntryArchitecture /门锁/ /解锁系统/前司机门锁执行机构}{KeylessEntryArchitecture /门锁/ /解锁系统/前通过门锁执行机构'}{KeylessEntryArchitecture /门锁/ /解锁系统/后司机门锁执行机构}{KeylessEntryArchitecture /门锁/ /解锁系统/后通过门锁执行机构'}

    找到所有组件使用的接口KeyFOBPosition

    con3 = HasPort (HasInterface(属性(“名称”)= =“KeyFOBPosition”));con3_a = HasPort(属性(“InterfaceName”)= =“KeyFOBPosition”);keyFOBPosComps = model.find (con3)
    keyFOBPosComps =10 x1细胞{“KeylessEntryArchitecture /门锁/ /解锁系统”}{KeylessEntryArchitecture /门锁/ /解锁系统/门锁控制器}{KeylessEntryArchitecture /发动机控制系统的}{' KeylessEntryArchitecture /发动机控制系统/无钥匙启动控制器}{“KeylessEntryArchitecture / FOB定位系统”}{' KeylessEntryArchitecture / FOB定位系统/ FOB定位模块的}{KeylessEntryArchitecture /照明系统的}{KeylessEntryArchitecture /照明系统照明控制器的}{KeylessEntryArchitecture /音响系统的}{KeylessEntryArchitecture /音响/声音控制器的}

    找到所有的组件WCET小于或等于什么5女士

    con4 = PropertyValue (“AutoProfile.SoftwareComponent.WCET”)< = 5;model.find (con4)
    ans =1 x1单元阵列{“KeylessEntryArchitecture /音响/声音控制器”}

    您可以指定单位自动单位转换。

    con5 = PropertyValue (“AutoProfile.SoftwareComponent.WCET”)< =价值(5“女士”);query1Comps = model.find (con5)
    query1Comps =3 x1细胞{“KeylessEntryArchitecture /音响/声音控制器”}{' KeylessEntryArchitecture / FOB定位系统/ FOB定位模块的}{KeylessEntryArchitecture /照明系统照明控制器的}

    找到所有的组件WCET大于1毫秒或者有一个大于成本10美元

    con6 = PropertyValue (“AutoProfile.SoftwareComponent.WCET”)>价值(1,“女士”)| PropertyValue (“AutoProfile.Base.Cost”)>价值(10,“美元”);query2Comps = model.find (con6)
    query2Comps =2 x1细胞{' KeylessEntryArchitecture /发动机控制系统/无钥匙启动控制器的}{KeylessEntryArchitecture /门锁/ /解锁系统/门锁控制器'}

    关闭模式。

    model.close

    更多关于

    全部展开

    版本历史

    介绍了R2019b