配置 OPC UA

<< 点击显示目录 >>

主页  mappVision帮助助手 > 机器视觉帮助 > mapp Vision  > 编程 > > 核心库 > ViBase  > 用例 > 产品转换用例 > 动态设计人机界面应用程序 >

配置 OPC UA

此处列出的步骤和说明在自动化帮助中的 mapp View 部分有更详细的描述。

在学习了 mapp View 帮助文档中的 "入门 "部分后,任何不清楚的地方都可以迎刃而解。

之后:

1.必要时,在 CPU 配置中启用 OPC UA 服务器。)

2.在配置视图的Connectivity/OpcUA包中添加并打开文件名为OpcUaMap.uad的 OPC UA 默认视图配置、

3.在 OPC UA 默认视图中选择根条目,点击属性窗口中的添加角色,添加角色Everyone 2),3)

opcuaaddrole

这样就满足了将 PCUC 程序所需的变量作为 OPC UA 变量的要求。通过 OPC UA 变量和 mapp View widget 之间的值绑定,以前静态的示例 HMI 应用程序可以变成动态的。

首先通过快捷菜单选择下列程序变量,将其作为 OPC UA 变量启用。

IsIdle : BOOL
InfoText : &STRING
ApplicationListIndex : UINT
IsAnApplicationSelected : BOOL
DoGenerateList : BOOL
DoLoadApplication : BOOL
DoClearData : BOOLBOOL
ListApplication : ViBaseListApplication
ListApplication.Error : BOOL
ListApplication.StatusID:DINT
LoadApplication : ViBaseLoadApplication
LoadApplication.Done : BOOL
LoadApplication.Error : BOOL
VisionApplicationName : STRING

IsIdle : BOOL
InfoText : &STRING
ApplicationListIndex : UINT
IsAnApplicationSelected : BOOL
DoGenerateList : BOOL
DoLoadApplication : BOOL
DoClearData : BOOLBOOL
ListApplication : ViBaseListApplication
ListApplication.Error : BOOL
ListApplication.StatusID:DINT
LoadApplication:ViBaseLoadApplication
LoadApplication.Done : BOOL
LoadApplication.Error : BOOL
VisionApplicationName : STRING

应用程序列表ViBaseFormatPlainTextType[0...9] 应用程序列表

ApplicationList : ViBaseFormatPlainTextType[0:ViBaseFormatItemCollectionType[0...9] 应用程序列表
ListRefreshCounter : SINT

opcuaenablevariables_variantea

opcuaenablevariables_varianteb

带有小部件 Table 的变量 A

带有下拉框部件的变量 B

对于只应在 OPC UA 绑定模式 "只读"下链接到 HMI 应用程序的变量,属性窗口中的默认设置 "全部继承"和<授权/从父节点继承>就足够了。

对于以下应在 OPC UA 绑定模式下以读/写方式链接到 HMI 应用程序的变量必须在属性窗口中设置<Authorization / Inherit none>(授权/无继承),并且必须为角色Everyone 启用权限:

ApplicationListIndex : UINT
DoGenerateList : BOOL
DoLoadApplication : BOOL
DoClearData : BOOLBOOL

ApplicationListIndex : UINT
DoGenerateList : BOOL
DoLoadApplication : BOOL
DoClearData : BOOLBOOL
VisionApplicationName : STRING

opcuaenablewrite_variantea

opcuaenablewrite_varianteb

带有小部件 Table 的变量 A

带有下拉框部件的变体 B

对于带有小部件 DropDownBox 的变体 B,必须另外为数组变量 ApplicationList 设置选项Show arrayelements 为True:ViBaseFormatItemCollectionType[0...9] 的选项设置为 True:

opcuaenableapplistarray_varianteb

这样,就为在示例人机界面应用程序中添加必要的 OPC UA 值绑定和事件绑定做好了准备。

1) 这也是 mapp Vision 人机界面应用程序的先决条件

2) 本示例人机界面应用程序不需要用户登录。

3) 还假设创建了默认用户 Anonymous 并将其分配给 Everyone 角色。

如果要在 HMI 应用程序中添加登录功能,例如使用小工具登录,以便只有登录的特定角色用户(如管理员)才能在 HMI 应用程序中执行产品更改,则该角色必须为所述 OPC UA 变量配备相应的权限。

在这种情况下,还建议使用 permissionOperate 和 permissionView 属性,使 HMI 应用程序的部件仅对该角色可见或可操作。

为避免日志中的错误记录,用户 Anonymous 的角色 Everyone 至少应被授予所述 OPC UA 变量的订阅权限。

对于带有部件 DropDownBox 的变体 B,还必须为 OPC UA 变量 VisionApplicationName 和 ApplicationListIndex 设置匿名用户 Everyone 角色的写入权限。


The steps and instructions listed here are described in more detail in the mapp View section in Automation Help.

Any ambiguities can be resolved after studying section "Getting started" in the mapp View help documentation.

After:

1.If necessary, the OPC UA server has been enabled in the CPU configuration.1).

2.The OPC UA default view configuration with the filename OpcUaMap.uad has been added and opened in the Connectivity/OpcUA package in the Configuration View,

3.In the OPC UA default view, the root entry has been selected and by clicking on Add role in the property window role Everyone has been added 2),3)

opcuaaddrole

the requirements have been met to enable the required variables of the PCUC program from chapter as OPC UA variables. With value bindings between OPC UA variables and mapp View widgets, the previously static sample HMI application can be made dynamic.

The following program variables are first enabled as OPC UA variables by selection via the shortcut menu.

IsIdle : BOOL
InfoText : &STRING
ApplicationListIndex : UINT
IsAnApplicationSelected : BOOL
DoGenerateList : BOOL
DoLoadApplication : BOOL
DoClearData : BOOL
ListApplication : ViBaseListApplication
ListApplication.Error : BOOL
ListApplication.StatusID : DINT
LoadApplication : ViBaseLoadApplication
LoadApplication.Done : BOOL
LoadApplication.Error : BOOL
VisionApplicationName : STRING

IsIdle : BOOL
InfoText : &STRING
ApplicationListIndex : UINT
IsAnApplicationSelected : BOOL
DoGenerateList : BOOL
DoLoadApplication : BOOL
DoClearData : BOOL
ListApplication : ViBaseListApplication
ListApplication.Error : BOOL
ListApplication.StatusID : DINT
LoadApplication : ViBaseLoadApplication
LoadApplication.Done : BOOL
LoadApplication.Error : BOOL
VisionApplicationName : STRING

ApplicationList : ViBaseFormatPlainTextType[0..9]

ApplicationList : ViBaseFormatItemCollectionType[0..9]
ListRefreshCounter : SINT

opcuaenablevariables_variantea

opcuaenablevariables_varianteb

Variant A with widget Table

Variant B with widget DropDownBox

For variables that should only be linked to the HMI application in OPC UA binding mode Read only, default settings Inherit all and <Authorization / Inherit from parent> in the properties window are sufficient.

For the following variables that should be linked to the HMI application in OPC UA binding mode Read/Write, <Authorization / Inherit none> must be set in the properties window and permission Write must be enabled for role Everyone:

ApplicationListIndex : UINT
DoGenerateList : BOOL
DoLoadApplication : BOOL
DoClearData : BOOL

ApplicationListIndex : UINT
DoGenerateList : BOOL
DoLoadApplication : BOOL
DoClearData : BOOL
VisionApplicationName : STRING

opcuaenablewrite_variantea

opcuaenablewrite_varianteb

Variant A with widget Table

Variant B with widget DropDownBox

For variant B with widget DropDownBox, option Show array elements must additionally be set to True for array variable ApplicationList : ViBaseFormatItemCollectionType[0..9] in the properties window:

opcuaenableapplistarray_varianteb

With this, the preparations are made to add the necessary OPC UA value bindings and event bindings to the sample HMI application.

1) This is also a prerequisite for the mapp Vision HMI application

2) This sample HMI application does not require a user login.

3) It is also assumed that the default user Anonymous is created and assigned to role Everyone.

If login functionality should be added to the HMI application, e.g. using widget Login so that only logged-in users of a certain role (e.g. administrators) can perform the product change in the HMI application, this role must be equipped with corresponding permissions for the described OPC UA variables.

In this case, it is also recommended to use attributes permissionOperate and permissionView to make the widgets of the HMI application visible or operable only for this role.

To avoid error entries in the logbook, role Everyone of user Anonymous should at least be granted Subscribe rights for the described OPC UA variables.

For variant B with widget DropDownBox, write permission for role Everyone of user Anonymous must additionally be set for OPC UA variables VisionApplicationName and ApplicationListIndex.