主要内容

Scoped, Global, and Port-Scoped Simulink Function Blocks Overview

定义功能的可见性可以帮助您在集成引用模型时避免名称空间冲突。一个金宝app仿真软件的功能block defines the visibility of its function in relationship to the subsystem or model containing the block as either scoped, global, or port-scoped. By default,金宝app仿真软件的功能块被瞄准。

  • 功能可见性。一个scoped function is visible in its hierarchy. A function caller located at the same level as the function, or one or more levels below can refer to the function. A global function is visible across a model hierarchy. This means that a function caller located anywhere in the current model or in the parent model hierarchy can refer to the function. A port-scoped function is visible only to a particular exporting function port in the current model, and is not visible elsewhere in the model hierarchy. The function can be called only from outside the current model, and only through the exporting function port.

  • Function accessibility由函数的可见性和函数呼叫者相对于Simulink功能块的位置确定。金宝app对于函数调用器,一个函数上方一个层次级别,请使用虚拟子系统块名称或模型块名称限定函数名称。

  • Function exportingrefers to functions exported from models. A function with global visibility, placed anywhere in an export-function model, is exported to the top level of a model hierarchy in addition to the model interface. A function with scoped visibility at the root level of an export function model is exported to the model interface. In both these cases, you can access the exported function outside of the model. A function with port-scoped visibility must be placed at the root level of an export-function model, and can be accessed by function callers in other export-function models only through a connection between function ports in the respective models.

Use theFunction visibilitythe的参数扳机a块金宝app仿真软件的功能block to set the function visibility to eitherscoped,global, orport。For a port-scoped function, specify the name of the port in theScope to portfield.

Summary of Simulink Function Block Visibility and Access

Function visibility Function accessibility Function exporting
Virtual Subsystem

scoped

功能名称不必是唯一的

在层次结构或父级内的功能呼叫者。

function caller inside Subsystem block hierarchy – unqualified,fcn()。请参阅在层次结构的函数中分析Scoped Simulink Function Blocks in Subsystems

function caller at parent level – qualified with subsystem block name,subsystem.fcn()。See Resolve to a Function by Qualification inScoped Simulink Function Blocks in Subsystems

Does not apply

global

功能名称必须是唯一的

function caller at any level of hierarchy down or up.

function caller at any level of hierarchy – unqualified,fcn()

Function at any level of model exported to the global name space of the top-level model

port不允许可见性

Does not apply

Does not apply

原子子系统

scoped

功能名称不必是唯一的

function caller only inside hierarchy

function caller inside Subsystem block hierarchy – unqualified,fcn()。请参阅在层次结构的函数中分析Scoped Simulink Function Blocks in Subsystems

function caller at parent level – not allowed

Does not apply

global不允许可见性

功能调用不允许

Does not apply

port不允许可见性

Does not apply

Does not apply

Model

scoped

功能名称不必是唯一的

在层次结构或父级内的功能呼叫者。

function caller inside Subsystem block hierarchy – unqualified,fcn()。请参阅在层次结构的函数中分析模型中的Sco金宝appped Simulink功能块

function caller at parent level - qualified with Model block name,model_block.fcn()。See Resolve to a Function by Qualification in模型中的Sco金宝appped Simulink功能块

Function at the root level of a model exported to the model interface

global

功能名称必须是唯一的

function caller at any level of hierarchy down or up.

function caller at any level of hierarchy – unqualified,fcn()

Function at any level of model exported to the global name space of the top-level model

port

功能名称必须是唯一的among port-scoped functions scoped to that port

Function caller associated with invoking function port connected to exporting function port to which function is scoped. Qualified with invoking port name,portname。fcn()

Function not visible except through exporting function port

See Also

Blocks

相关话题