基于OPC通讯协议的自动化仿真平台(实践篇) .docx

上传人:韩长文 文档编号:5020651 上传时间:2020-01-29 格式:DOCX 页数:34 大小:919.26KB
返回 下载 相关 举报
基于OPC通讯协议的自动化仿真平台(实践篇) .docx_第1页
第1页 / 共34页
基于OPC通讯协议的自动化仿真平台(实践篇) .docx_第2页
第2页 / 共34页
基于OPC通讯协议的自动化仿真平台(实践篇) .docx_第3页
第3页 / 共34页
基于OPC通讯协议的自动化仿真平台(实践篇) .docx_第4页
第4页 / 共34页
基于OPC通讯协议的自动化仿真平台(实践篇) .docx_第5页
第5页 / 共34页
点击查看更多>>
资源描述

《基于OPC通讯协议的自动化仿真平台(实践篇) .docx》由会员分享,可在线阅读,更多相关《基于OPC通讯协议的自动化仿真平台(实践篇) .docx(34页珍藏版)》请在三一文库上搜索。

1、基于OPC通讯协议的自动化仿真平台基于OPC通讯协议的自动化仿真平台(实践篇)(昆明电器科学研究所 技术开发中心)摘要:本文以实例形式,讲解了OPC通讯协议分布式COM的具体配置方法。如何进行OPC DCOM配置在配置之前,首先我们给出需要搭建的仿真平台的示意图: Matlab仿真器CIMPLICITY接现场PLC通讯协议OPC ClientOPC ServerDCOM其配置步骤如下:l 在CIMPLICITY中安装OPC Server并配置l 配置DCOM(并在客户端创建一个与主机中相同的账户)l 在Matlab中的OPC 客户端配置OPC 第一部分: 在Matlab中OPC的使用方法 (1

2、)1. Understanding OPC Data Access Servers理解OPC数据访问服务器The OPC Toolbox is an OPC Data Access client application, capable of connecting to any OPC Data Access compliant server. By utilizing the OPC Foundation Data Access standard, the OPC Toolbox does not require any knowledge about the internal config

3、uration and operation of the OPC server. Instead, the Data Access Standard provides the common mechanism for the server and client to interact with each other. OPC工具箱是一个OPC数据访问客户端应用程序,可以连接到任何一个OPC 数据访问应允的服务器。使用OPC基金会数据访问标准,OPC工具箱不需要任何有关交互式配置和OPC服务器操作的知识。取而代之,数据访问标准,为服务器和客户端间相互作用提供公共的机理。An OPC Data A

4、ccess Server is identified by a unique server ID. The server ID is unique to the computer on which the server is located. A combination of the host name of the server computer, and the server ID of the OPC server, provides a unique identifier for an OPC server on a network of computers. 一个OPC数据访问服务器

5、被唯一的服务器ID号所识别。服务器ID号对于每一个定位的计算机是唯一的。一个由服务器主机名、OPC服务器ID的组合,为每一个在计算机网络上的OPC服务器提供唯一的辨识。1.1. OPC Server Name SpacesOPC服务器名字空间All OPC servers are required to publish a name space, consisting of an arrangement of the name of every server item (also known as an item ID) associated with that server. The nam

6、e space provides the internal map of every device and location that the server is able to monitor and/or update. 所有的OPC服务器都需要一个公布的名字空间,由每个服务器项(即项的ID号)的名字空间所组成,这些服务器项又与服务器相对应。名字空间为提供每一个设备及其定位提供一个树状子图,可以监视和(或)刷新。The following figure shows a portion of the name space on a typical OPC server.下图所示为一个典型OP

7、C服务器名字空间的一部分。Figure 1-1: Example of OPC Server and Name Space图1-1:OPC服务器和名字空间的例子A server item represents a value on the OPC server that a client may be interested in. A server item could represent a physical measurement device (such as a temperature sensor), a particular component of a device (such

8、as the set-point for a controller), or a variable or storage location in a supervisory control and data acquisition (SCADA) system. Each server item is uniquely represented on the server by a fully qualified item ID. The fully qualified item ID is usually made up of the path to that server item in t

9、he tree, with each node name separated by a period character. In Figure 1-1, the fully qualified item ID for the highlighted server item might be Area01.UnitA.FIC01.PV. 一个服务器项表示OPC服务器上的一个客户端可能感兴趣的值。一个服务器可以表示一个物理检测设备(例如一个温度传感器),一个设备的特殊组件(如控制器的设定点), 在一个监督控制和数据采集系统(SCADA)中的变量或局部访问。每一个服务器项在服务器上,由一个完全许可的

10、ID项唯一表示。完全许可的ID项通常由在树状图中的到服务项的路径所组成,每一个节点的名字被一个节点符所分隔。在图1-1中,高亮度显示的完全许可的ID项可能是Area01.UnitA.FIC01.PV。Most OPC servers provide a hierarchical name space, where server items are arranged in a tree-like structure. The tree can contain many different categories (called branch nodes), each with one or mor

11、e branches and/or leaf nodes. A leaf node contains no other branches, and often represents a specific server Item. The fully qualified item ID of a server item is simply the path to that leaf node, with a server-dependent separator. 大部分OPC 服务器提供一个等级式的名字空间,其中服务器项被安排在一个树状结构中。树状结构可以包含很多不同的类别(叫做分支节点),其中

12、的每一个节点都有一个或多个分支和(或)叶子节点。Some OPC servers provide only a flat name space, where server items are all arranged in one single group. You could consider a flat name space as a name space containing only leaf nodes. 一些OPC服务器仅提供一个平面名字空间,其中很多项都被整理在一个单独的组里。你可以把一个平面名字空间看作一个包含很多叶子节点的名字空间。It is possible to con

13、vert a hierarchical name space into a flat name space. It is not always possible to convert a flat name space into a hierarchical name space. 它可以把一个等级式的名字空间转化为一个平面式的名字空间。但一个平面式的名字空间却不一定可以转化为一个等级式的名字空间。For information on how to obtain the name space of an OPC server, see Browsing the OPC Server Name

14、Space.如何得到OPC服务器的名字空间的相关信息,可以流览OPC Server Name Space。2. Understanding the OPC Toolbox Object Hierarchy理解OPC工具箱对象等级The OPC Toolbox is implemented using three basic objects, designed to help you manage connections to servers and collections of server items. The three objects are arranged in a specific

15、 hierarchy, shown in the following figure.OPC工具箱被装载在树状基础对象中,被设计来帮助你管理到服务器和服务器项收集的连接。树状对象被组织在一个特殊的等级结构中,如下图所示。OPC Toolbox Object HierarchyOPC工具箱对象等级结构1. OPC Data Access Client objects (opcda client objects) represent a specific OPC client instance that can communicate with only one server. You define

16、 the server using the Host and ServerID properties. The Host property defines the computer on which the server is installed. The ServerID property defines the Program ID (ProgID) of the server, created when the server was installed on that host. The opcda client object acts as a container for multip

17、le group objects, and manages the connection to the server, communication with the server, and server name space browsing. OPC数据访问客户端对象(opcda client objects)表示了一种特殊的OPC客户端接口可以与唯一的一个OPC服务器通讯。你使用主机和服务器ID属性定义一个服务器。主机属性定义了安装了服务器的主机。服务器ID属性定义了服务器的程序ID(ProgID),当服务器被安装在主机上时被创建。OPC数据访问(opcda)客户端对象作为一个多组对象的容

18、器,管理了到服务器的连接,服务器间的通讯和服务器名字空间的浏览。2. Data Access Group objects (dagroup objects) represent containers for one or more server items (data points on the server.) A dagroup object manages how often the items in the group must be read, whether historical item information must be stored, and also manages c

19、reation and deletion of items. Groups cannot exist without an opcda client object. You create dagroup objects using the addgroup function of an opcda client object. 数据访问组对象(dagroup对象)表述了一个或多个服务器对象的容器(服务器上的数据点。)一个数据访问组(dagroup)管理在组里的项被访问得有多频繁,是否历史项信息必须被存储,同时也管理项的创建和删除。组不能独立于opcda服务端对象外而存在。可以使用一个opcda

20、服务端对象的addgroup功能创建dagroup对象。3. Data Access Item objects (daitem objects) represent server items. Items are defined by an item ID, which uniquely defines that server item in the servers name space. A daitem object has a Value, a Quality, and a TimeStamp, representing the information collected by the

21、server from an instrument or data point in a SCADA system. The Value, Quality, and TimeStamp properties represent the information known to the server when the server was last asked to access information from that instrument. 数据访问项对象(daitem对象)表述了服务器项。项被项ID定义,仅仅在服务器名字空间里定义了服务器项。一个daitem对象有一个值、一个性质和一个时

22、间标签,表述了,从一个设备或数据采集系统(SCADA)中地一个数据点,由服务器收集的信息。值、性质和时间标签属性,表述了对于服务器的信息,知道服务器最后一个经由设备访问信息的请求。A dagroup object can only exist within an opcda client object. Similarly, a daitem object can only exist within a dagroup object. You create dagroup objects using the addgroup method of an opcda client object.

23、You create daitem objects using the additem method of the dagroup object.一个dagroup对象仅能依存于一个opcda服务端对象而存在。类似地,一个daitem对象仅能依存于一个dagroup对象而存在。可以使用addgroup对象的additem来创建daitem对象。3. How OPC Toolbox Objects Relate to OPC Servers如何把OPC工具箱对象与OPC服务器联系起来The OPC Toolbox uses objects to define the server that th

24、e client must connect to, and the arrangement of items in groups. The following figure shows the relationship between the OPC Toolbox objects and an OPC server.OPC工具箱使用对象来定义客户必须连接的服务器,并把项组织在一个组里。下图所示为OPC工具箱对象与OPC服务器的关系。Figure 1-2: Relationship Between OPC Toolbox Objects and OPC Server图1-2:OPC工具箱对象与

25、OPC服务器的关系The opcda client object establishes the connection between the OPC Toolbox and the OPC server, using OPC Data Access Specification standards. The standards are based on Microsoft COM/DCOM interoperability standards. opcda客户端对象,使用OPC数据访问特别标准,建立了OPC工具箱对象与OPC服务器之间的连接。标准是基于COM/DCOM可互操作标准的。The d

26、aitem objects represent specific server items. Note that a client typically requires only a subset of the entire name space of a server in order to operate effectively. In Figure 1-2, only the PV and SP items of FIC01, and the LIT01 item, are required for that particular group. Another group may onl

27、y contain a single daitem object, representing a single server item.Daitem对象表述了特殊服务器项。注意一个典型的客户端仅需求一个服务器完整名字空间的子集以便能有效操作。在图1-2中,仅FIC01的PV和SP项,及LIT01项,被特殊的组请求。其它组仅可以装载一个单独的daitem对象,表述了一个单独的服务器对象。Note The dagroup object has no equivalent on the OPC server. However, the server keeps a record of each gr

28、oup that a client has created, and uses that group name to communicate to the client information about the items in that group.注意:dagroup对象在OPC服务器上并不等价。尽管如此,服务器保留了一个客户端创建的每个组的纪录,并使用组名来通讯,以获得有关组中项的客户端信息。4. Preparing to Use the OPC Toolbox准备使用OPC工具箱Before you can communicate with OPC servers on your n

29、etwork, you need to prepare your workstation (and possibly the OPC server host computer) to use the technologies on which the OPC Toolbox is built. These technologies, described in About OPC, allow you to browse for and connect to OPC servers on your network, and allow those OPC servers to interact

30、with your MATLAB session using the OPC Toolbox. The specific steps are described in the following sections: Installing the OPC Foundation Core Components describes how you can install the OPC Foundation Core Components, which allow you to browse for OPC servers from your workstation. Configuring DCO

31、M describes steps that you or your system administrator will need to take on your local workstation and on the OPC server computers to enable interaction between the OPC Toolbox and the OPC servers on those host computers. Installing the Matrikon OPC Simulation Server describes how to download and i

32、nstall the Matrikon OPC Simulation Server. This optional step allows you to run the examples provided in this guide.具体步骤被描述在如下的章节中:安装OPC基金会核组件,允许在你的工作站中浏览OPC服务器。配置DCOM描述了,你和你的系统管理员需要把你的本地工作站及OPC服务器电脑,在那些主机中,授权OPC 工具箱与OPC服务器的互作用。安装Matrikon OPC仿真服务器,描述了如何下载并安装Matrikon OPC仿真服务器。这个可选的步骤允许你启动一个例子来提供向导作用。

33、4.1. Installing the OPC Foundation Core Components安装OPC基金会核组件The OPC Foundation has provided a set of tools for browsing other computers on your network for OPC servers, and for communicating with the OPC servers. These tools are called the OPC Foundation Core Components, and are shipped with the OP

34、C Toolbox. OPC基金会已经提供了一组工具,在你的网络或OPC服务器上浏览其它电脑,用于与OPC服务器通讯。这些工具叫做OPC基金会核组件,已经和OPC工具箱一起装载。To install the OPC Foundation Core Components, you use the opcregister function. You can also use the opcregister function to remove or repair the OPC Foundation Core Components installation. Installing, repairi

35、ng, and removing the OPC Foundation Core Components follows the same steps: 1. If you are repairing or removing the OPC Foundation Core Components, make sure that you do not have any OPC Toolbox objects in memory. Use the opcreset function to clear all objects from memory. opcreset;2. Run opcregiste

36、r with the action you would like to perform. If you do not supply an option, the function assumes that you want to install the components. Otherwise, use repair to repair an installation (reinstall the files), or remove to remove the components. opcregister(install)3. You will be prompted to type Ye

37、s to confirm the action you want to perform. You must type Yes exactly as shown, without any quotes. This confirmation question is used to ensure that you acknowledge the action that is about to take place. 4. The OPC Foundation Core Components will be installed, repaired, or removed from your syste

38、m. 5. If you receive a warning about having to reboot your computer, you must quit MATLAB and restart your computer for the changes to take effect.Note If you get an error message stating that your version of the Microsoft Installer is incorrect, you will need to download the Microsoft Installer 2.0

39、 from the Microsoft Web site (http:/). Microsoft Installer 2.0 ships with Windows XP, and with Windows 2000 Service Pack 2 or later.4.1.1. Configuring DCOM配置DCOMDCOM is a client-server based architecture for enabling communication between two applications running on distributed computers. The OPC Da

40、ta Access Specification utilizes DCOM for communication between the OPC Client (for example, the OPC Toolbox) and the OPC server. In order to successfully use DCOM, those two computers must share a common security configuration so that the two applications are granted the necessary rights to communi

41、cate with each other. DCOM是一个架构上的client-server,它允许运行在分布式电脑上的两个应用程序之间实现通讯。OPC特定数据访问(OPC Data Access Specification)使用DCOM实现两个 OPC Client之间的通讯。例如,OPC工具箱和OPC server之间。为成功地使用DCOM,这两个电脑必须共享一个公共安全配置,以便保证两个应用程序之间通讯的必要权利。This section describes two typical DCOM configuration options to allow the OPC Toolbox t

42、o work. Other DCOM options may provide sufficient permissions for the OPC Toolbox to work with an OPC server; the options described here are known to work with tested vendors OPC servers. 这一节描述两个典型的DCOM配置选项,允许OPC工具箱可以工作。其它DCOM选项,可以提供足够的特许使OPC工具箱与一个 OPC server工作。在这里描述的选项被用以与测试过的vendors OPC servers一起工

43、作。There are two configuration types described in this section: 在这一节中我们给出两个配置类型: Security between the client and server negotiated on a dedicated named user basis. You do not have to be logged in as the named user in order to use this mechanism; all communications between the client and the server ar

44、e performed using the dedicated named user, independently of the user making the OPC requests. 在一个特定命名用户基础上的client和server间的安全性。不需要以用户名登陆,来使用这个机制。所有在client与server间的通讯,如同使用特定命名用户名来工作,独立于使用OPC请求。 No security between the client and server. Use this option only if you are connecting to an OPC server on a

45、 dedicated, private network. This configuration option has been known to cause some services in Microsoft Windows to fail. 在client与server间没有安全性。使用这个选项仅当,你在一个特定的、私有的网络上连接一个OPC server。这个配置选项引起在Microsoft Windows中的服务失败。You should use the named user configuration, unless your system administrator indicat

46、es that no security is required for OPC access.除非你的系统管理员指出OPC访问不需要安全性;否则你必须使用命名的用户配置。Caution If your OPC server software comes with DCOM setup guidelines, you should follow the instructions provided by the OPC server vendor. The guidelines provided in this section are generic and may not suit your s

47、pecific network and security model.担心:如果你的OPC服务器软件和DCOM安装准则一起,你必须遵循由OPC服务器销售员提供的指导。在这一节中提供的准则通常是一般的情况,可能不适于你特殊的网络或安全模型。4.1.2. Configuring DCOM to Use Named User Security使用命名的用户安全性配置DCOMNote The following instructions apply to the Windows 2000 operating system. Users of Windows NT and Windows XP shou

48、ld be able to adapt these instructions in order to configure DCOM on their systems.注意:以下准则是为Windows 2000操作系统提供的。Windows NT和Windows XP的用户必须能适应这些准则,以便在他们的系统中配置DCOM。In order to configure DCOM to use named user security, you will have to ensure that both the server machine and client machine have a common user who is granted DCOM access rights on both the server and client machines. You should consult the following sections for information on configuring each machine: 为命名的用户安全性配置DCOM,你必须同时保证服务器机器与客户端机器有一个公共的用户。而这个公共用户,他保证服

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 研究报告 > 商业贸易


经营许可证编号:宁ICP备18001539号-1