主要内容

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

HasInterfaceElement

创建查询,以便根据指定的子约束条件,在接口上选择带有接口元素的架构元素

    说明

    query = HasInterfaceElement(subconstraint) 创建了一个查询 queryfindcreateView 函数利用该查询选择具有满足给定子约束 subconstraint 的接口元素的架构元素。

    示例

    示例

    全部折叠

    导入包含所有 System Composer™ 查询的命名空间。

    import systemcomposer.query.*

    打开无钥匙进入系统的 Simulink® 工程文件。

    openProject("scKeylessEntrySystem");

    加载架构模型。

    model = systemcomposer.loadModel("KeylessEntryArchitecture");

    Name 中包含 c 的所有接口元素创建一个查询,并运行该查询。

    constraint = HasPort(HasInterface(HasInterfaceElement(contains(Property("Name"),"c"))));
    elements = find(model,constraint,Recurse=true,IncludeReferenceModels=true)
    elements = 10×1 cell
        {'KeylessEntryArchitecture/Engine Control System'                         }
        {'KeylessEntryArchitecture/Door Lock//Unlock System/Door Lock Controller' }
        {'KeylessEntryArchitecture/Sound System'                                  }
        {'KeylessEntryArchitecture/Lighting System'                               }
        {'KeylessEntryArchitecture/Sound System/Sound Controller'                 }
        {'KeylessEntryArchitecture/FOB Locater System/FOB Locater Module'         }
        {'KeylessEntryArchitecture/Engine Control System/Keyless Start Controller'}
        {'KeylessEntryArchitecture/Lighting System/Lighting Controller'           }
        {'KeylessEntryArchitecture/FOB Locater System'                            }
        {'KeylessEntryArchitecture/Door Lock//Unlock System'                      }
    
    

    输入参数

    全部折叠

    限制查询的条件,指定为 systemcomposer.query.Constraint 对象。

    输出参量

    全部折叠

    查询,以 systemcomposer.query.Constraint 对象的形式返回。

    详细信息

    全部折叠

    版本历史记录

    在 R2019b 中推出