主要内容

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

HasInterface

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

    说明

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

    示例

    示例

    全部折叠

    导入包含所有 System Composer™ 查询的包。

    import systemcomposer.query.*

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

    openProject("scKeylessEntrySystem");

    加载架构模型。

    model = systemcomposer.loadModel("KeylessEntryArchitecture");

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

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

    输入参数

    全部折叠

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

    输出参量

    全部折叠

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

    详细信息

    全部折叠

    版本历史记录

    在 R2019b 中推出