<< 点击显示目录 >> 主页 mappView帮助助手 > mappView入门简单Wiki > 从所有客户端获取客户端信息Getting client information from all clients |
•Automation Studio 4.4
•mappView 5.4
此示例显示所有已连接客户端的客户端信息如何绑定到 OPC UA 结构。 然后可以在 PLC 代码中使用此结构或在 mappView 中显示此结构。
•配置 OPC UA 结构
•配置 OPC UA 上客户端信息的列表绑定
userId, isValid, ipAddress, languageId, screenResolution and slotId:
创建一个已创建结构类型的变量“ClientInfo”数组。 我们假设在 mappView 配置中最大可能的客户端数量已设置为 3。 因此,ClientInfo 数组的长度需要为 3。 请注意,所有角色都具有写入变量 ClientInfo 的权限,以保证来自每个客户端的客户端信息可以写入结构
在下面的列表绑定中,所有连接的客户端的客户端信息都绑定到服务器上的一个结构变量。 通过使用“slotId”作为选择器,每个客户端写入与其槽ID对应的数组元素。
<Binding mode="oneWayToSource">
<Source xsi:type="listElement">
<Selector xsi:type="session" refId="::SYSTEM:clientInfo.slotId" attribute="value" />
<be:List xsi:type="be:opcUa" attribute="value" >
<bt:Element index="0" refId="::AsGlobalPV:ClientInfo[0].isValid" />
<bt:Element index="1" refId="::AsGlobalPV:ClientInfo[1].isValid" />
<bt:Element index="2" refId="::AsGlobalPV:ClientInfo[2].isValid" />
</be:List>
</Source>
<Target xsi:type="session" refId="::SYSTEM:clientInfo.isValid" attribute="value" />
</Binding>
<Binding mode="oneWayToSource">
<Source xsi:type="listElement">
<Selector xsi:type="session" refId="::SYSTEM:clientInfo.slotId" attribute="value" />
<be:List xsi:type="be:opcUa" attribute="value" >
<bt:Element index="0" refId="::AsGlobalPV:ClientInfo[0].userId" />
<bt:Element index="1" refId="::AsGlobalPV:ClientInfo[1].userId" />
<bt:Element index="2" refId="::AsGlobalPV:ClientInfo[2].userId" />
</be:List>
</Source>
<Target xsi:type="session" refId="::SYSTEM:clientInfo.userId" attribute="value" />
</Binding>
<Binding mode="oneWayToSource">
<Source xsi:type="listElement">
<Selector xsi:type="session" refId="::SYSTEM:clientInfo.slotId" attribute="value" />
<be:List xsi:type="be:opcUa" attribute="value" >
<bt:Element index="0" refId="::AsGlobalPV:ClientInfo[0].ipAddress" />
<bt:Element index="1" refId="::AsGlobalPV:ClientInfo[1].ipAddress" />
<bt:Element index="2" refId="::AsGlobalPV:ClientInfo[2].ipAddress" />
</be:List>
</Source>
<Target xsi:type="session" refId="::SYSTEM:clientInfo.ipAddress" attribute="value" />
</Binding>
<Binding mode="oneWayToSource">
<Source xsi:type="listElement">
<Selector xsi:type="session" refId="::SYSTEM:clientInfo.slotId" attribute="value" />
<be:List xsi:type="be:opcUa" attribute="value" >
<bt:Element index="0" refId="::AsGlobalPV:ClientInfo[0].languageId" />
<bt:Element index="1" refId="::AsGlobalPV:ClientInfo[1].languageId" />
<bt:Element index="2" refId="::AsGlobalPV:ClientInfo[2].languageId" />
</be:List>
</Source>
<Target xsi:type="session" refId="::SYSTEM:clientInfo.languageId" attribute="value" />
</Binding>
<Binding mode="oneWayToSource">
<Source xsi:type="listElement">
<Selector xsi:type="session" refId="::SYSTEM:clientInfo.slotId" attribute="value" />
<be:List xsi:type="be:opcUa" attribute="value" >
<bt:Element index="0" refId="::AsGlobalPV:ClientInfo[0].screenResolution" />
<bt:Element index="1" refId="::AsGlobalPV:ClientInfo[1].screenResolution" />
<bt:Element index="2" refId="::AsGlobalPV:ClientInfo[2].screenResolution" />
</be:List>
</Source>
<Target xsi:type="session" refId="::SYSTEM:clientInfo.screenResolution" attribute="value" />
</Binding>
<Binding mode="oneWayToSource">
<Source xsi:type="listElement">
<Selector xsi:type="session" refId="::SYSTEM:clientInfo.slotId" attribute="value" />
<be:List xsi:type="be:opcUa" attribute="value" >
<bt:Element index="0" refId="::AsGlobalPV:ClientInfo[0].slotId" />
<bt:Element index="1" refId="::AsGlobalPV:ClientInfo[1].slotId" />
<bt:Element index="2" refId="::AsGlobalPV:ClientInfo[2].slotId" />
</be:List>
</Source>
<Target xsi:type="session" refId="::SYSTEM:clientInfo.slotId" attribute="value" />
</Binding>