Windows
记录OPC服务器安装是在Windows环境
OPC服务器安装
OPC服务器有很多种,笔者这里使用MatrikonOPCSimulation.exe
1.下载OPC服务器安装文件

2.安装过程。。。。安装的时候没有截图,这一部分后面再补上来
安装完成后得到如下内容

通常我们要用的就是模拟一个OPC服务器,打开OPC服务器,看到程序的主界面

右键点击alias configuration,添加一个分组


分组添加完成后,可以在组内添加item。选中组后,双击右侧区域的空白行,可以在该组内添加一个item,添加item需要指定一个名称、数据类型、数据初始化值


按照此步骤,添加多个分组,组内多添加几个item数据

OPC数据添加完成后,可以开启OPC客户端实时预览这些数据,为了方便观察数据变化,可以多开几个客户端,通过一个客户端中修改数据,另外的客户端来监测数据的变化

打开OPC客户端后,会默认连接本地的OPC服务器,可以查看到本地OPC服务器的数据信息

可以在将分组拖拽到右侧区域,表示监测这个分组中的所有item数据,也可以一个一个的添加

笔者将上文中创建的2个分组都添加到监听项中

开启2个OPC客户端,监听同样的数据

在OPC客户端中可以看到添加item时输入的初始化值
客户端中双击监听item列表,可以修改这个item的值

一个客户端中修改了数据,在其他客户端中也能监测到这个item的变化

OPC数据导出和导入
通过上文可以完成OPC数据项的创建,但是每次关闭仿真服务器再开启时,创建的数据就会清空,当我们在生产环境中使用时,这是不允许的。所以当我们创建完数据项后,可以对数据项进行导出,以文件形式存储在本地,下次启动OPC服务器时导入这个数据文件就可以使用。

- 在OPC服务器界面创建数据项后,点击导出按钮

-
在导出界面中输入你要存储的文件名称和存储路径,数据项将存储为一个CSV文件
-
导出完成后关闭OPC服务器,在系统文件系统中可以找到对应的CSV文件

- 重新启动OPC服务器,里面是没有数据项的,点击导入按钮

- 在导入界面选择你需要导入的数据项文件

6.确认导入后,在你的OPC数据项中就可以看到之前导出的数据项

7.因此,在使用过程中最重要的数据就是这个数据项
OPC数据结构
通过上文中创建OPC数据项的时候可以发现,OPC服务器中的数据结构是典型的树形结构

网友评论