基于OPC通訊協議的自動化仿真平臺_實踐篇_090601_第1頁
基于OPC通訊協議的自動化仿真平臺_實踐篇_090601_第2頁
基于OPC通訊協議的自動化仿真平臺_實踐篇_090601_第3頁
基于OPC通訊協議的自動化仿真平臺_實踐篇_090601_第4頁
基于OPC通訊協議的自動化仿真平臺_實踐篇_090601_第5頁
已閱讀5頁,還剩29頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、基于OPC通訊協議的自動化仿真平臺(實踐篇)(昆明電器科學研究所 技術開發中心)摘要:本文以實例形式,講解了OPC通訊協議分布式COM的具體配置方法。如何進行OPC DCOM配置在配置之前,首先我們給出需要搭建的仿真平臺的示意圖: Matlab仿真器CIMPLICITY接現場PLC通訊協議OPC ClientOPC ServerDCOM其配置步驟如下:l 在CIMPLICITY中安裝OPC Server并配置l 配置DCOM(并在客戶端創建一個與主機中相同的賬戶)l 在Matlab中的OPC 客戶端配置OPC 第一部分 : 在Matlab中OPC的使用方法 (1)1. Underst

2、anding 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 configuration and

3、 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 Access Serve

4、r 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數據訪問服務器被唯一的服務器ID號所

5、識別。服務器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 name space pro

6、vides 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.下圖所示為一個典型OPC服務器名字空間的一部

7、分。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 as the set-

8、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 the tree, wi

9、th 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)中的變量或局部訪問。每一個服務器項在服務器上,由一個完全許可的ID項唯一表示。完全許

10、可的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 more branches

11、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 convert a

13、 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 Space.

14、如何得到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 hiera

15、rchy, 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 the s

16、erver 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 multiple gro

17、up 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 creatio

19、n 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 server's name space. A daitem object has a Value, a Quality, and a TimeStamp, representing the information collected by the s

21、erver 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 clie

23、nt object. 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 ser

24、ver that the 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-

25、2:OPC工具箱對象與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可互

26、操作標準的。The daitem 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 gr

27、oup may only 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

28、 of each group 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 server

29、s on your network, 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 t

30、o interact 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. Conf

31、iguring DCOM 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 dow

32、nload and install 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

34、with the OPC 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. Installi

35、ng, repairing, 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

36、 opcregister 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('instal

37、l')3. You will be prompted to type Yes 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 instal

38、led, repaired, or removed from your system. 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 nee

39、d to download the Microsoft Installer 2.0 from the Microsoft Web site (). 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 o

40、n distributed computers. The OPC Data 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 gran

41、ted the necessary rights to communicate 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

42、 options to allow the OPC Toolbox to 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工

43、作。在這里描述的選項被用以與測試過的vendors' OPC servers一起工作。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

44、communications between the client and the server are 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 thi

45、s option only if you are connecting to an OPC server on a 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 use

46、r configuration, unless your system administrator indicates 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 pro

47、vided in this section are generic and may not suit your specific 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

48、operating system. Users of Windows NT and Windows XP should 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 th

49、at 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,你必須同時保證服務器機器與客戶端機器有一個公共的用戶。而這個公共用戶,他保證服務器機器與客戶端機器上DCOM訪問權。

50、你可以參看隨后一節為每一臺機器配置的信息。· OPC server machine configuration provides the steps that you must perform on each of the machines providing OPC servers. · OPC 服務器機器配置提供的步驟,你必須在每一臺有OPC服務器的機器上實現。· Client machine configuration provides the steps that you must perform on the machine that will run

51、MATLAB and the OPC Toolbox.· 客戶端機器配置提供的步驟,你必須在每一臺要運行MATLAB和OPC工具箱的機器上實現。OPC server machine configuration. On the machines hosting the OPC servers, perform the following steps: OPC 服務器機器配置。OPC服務器主機上,應實現的步驟如下:1. Create a new local user. The name used in these instructions is "opc" but y

52、ou can choose any name you like, as long as you remain consistent throughout these instructions. 創建一個新的本地用戶。在這些設備中使用的名字是“opc”,但你可以選擇任何你喜歡的名字,只要在所有的設備中保持一致就行。2. Click Start and choose Run. At the prompt, type 點擊開始選擇運行。在提示中,鍵入dcomcnfg3. Select the OPC server from the list provided and click on Propert

53、ies to view the properties. 從提供的列表中選擇OPC服務器,點擊屬性來看屬性。4. Under the General tab, select Authentication Level and choose Connect. 在常規標簽中,選擇身份驗證級別,并選擇連接。5. Under the Identity tab choose the radio button labeled This User. Specify the username as "opc" and provide the password for that user. 在識

54、別標簽里,選擇這個用戶。并指明用戶名為“opc”及其密碼。6. If the OPC server runs as a service, make sure that the service runs as the "opc" user (created in Step 1) and not as the system account. 如果OPC服務器以一個服務器啟動,確定以在第一步中創建的用戶名啟動“opc”,而不是系統帳戶。7. Repeat Steps 3-6 for each OPC server installed on the server machine.

55、8. 為每一部安裝了OPC服務端的服務器重復3-6步。9. In the Default Security tab in the Distributed COM Configuration Properties window, ensure that the "opc" user is granted launch permissions and access permissions.在分布式COM配置屬性窗口的默認安全標簽中,確定“opc”用戶被允許啟動并訪問許可。Client machine configuration. On the machine(s) that w

56、ill be running MATLAB and the OPC Toolbox, perform the following steps: 客戶端機器配置。在將要運行MATLAB和OPC工具箱的機器上,執行下列步驟:1. On the client machine(s), create the identical local user with the same name and password permissions as you set up in Step 1 of the OPC server machine configuration. 在客戶端機器,使用相同的名字和密碼許可創

57、建識別本地用戶,如OPC服務器機器配置的第一步。2. Run dcomcnfg (see Step 2 of the OPC server machine configuration) and select the Default Security tab. 運行dcomcnfg(參看OPC服務器機器配置的第二步),選擇默認安全機制標簽。3. Ensure that the "opc" user created in Step 1 is granted launch permissions and access permissions.保證在第一部中創建的“opc”用戶被允

58、許啟動并訪問許可。4.1.3. Configuring DCOM to Use No Security為不使用安全性配置DCOMCaution You should not use this option if you are not in a completely trusted network. Turning off DCOM security means that any user on the network can launch any COM object on your local machine. Consult with your network administrator before following these instructions.當心:如果不是在完全受信任的網絡中,你不可使用這個選項。關閉DCOM安全性,意味著任何在網絡上的用戶可以在你的本地機器上,啟動任何COM對象。在執行下列條例前,咨詢你的網絡管理員。1. On the server machine, click Start and choose Run. At the prompt, type 在服務器機器上,點擊開始選擇運

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論