西门子OPC配置

合集下载

通过ETHERNET建立SIMATICNETOPC服务器与PLC的S7连接

通过ETHERNET建立SIMATICNETOPC服务器与PLC的S7连接

通过ETHERNET建立SIMATICNETOPC服务器与PLC的S7连接概述:OPC(OLE for Process Control)是一种通信协议,用于实时数据的交换和控制命令的传输。

SIMATIC NET OPC服务器是西门子公司的一款软件,可与PLC的S7系列进行通信。

本文将介绍如何通过ETHERNET建立SIMATIC NET OPC服务器与PLC的S7连接。

步骤:1.配置PLC和OPC服务器的网络设置在PLC的设置中,需要配置IP地址、子网掩码和网关,确保与OPC服务器处于同一网络中,并具有唯一的IP地址。

在OPC服务器的设置中,需要配置与PLC相同的子网掩码和网关。

2.安装SIMATICNETOPC服务器软件3.配置OPC服务器在OPC服务器软件中,选择“配置”选项,然后选择“添加设备”。

在弹出的对话框中,选择适用于PLC的通信模块,并按照提示进行设置。

4.配置OPC服务器与PLC的通信参数在OPC服务器软件中的设备配置界面,选择PLC设备并点击“属性”。

在属性界面中,配置与PLC通信所需的参数,包括PLC的IP地址、端口号、协议类型等。

5.连接PLC与OPC服务器在OPC服务器软件中,选择“设备连接”。

在弹出的对话框中,选择与PLC的连接方式,常见的有以太网、串行口等,这里选择以太网连接。

然后,输入PLC的IP地址并点击“连接”。

6.测试连接是否正常在OPC服务器软件中,选择“网络状况监视器”。

在监视器界面中,可以查看PLC和OPC服务器之间的连接状态。

如果显示连接正常,表示PLC和OPC服务器已成功建立连接。

7.配置OPC服务器与其他应用程序的通信如果需要将OPC服务器的数据传输给其他应用程序,可以在OPC服务器软件中配置相应的设置。

选择“标记配置”选项,配置要传输的标记、数据类型等参数。

然后,选择“退出配置”选项,保存设置并启动OPC服务器。

总结:通过ETHERNET建立SIMATICNETOPC服务器与PLC的S7连接需要进行的步骤包括配置PLC和OPC服务器的网络设置、安装SIMATICNETOPC服务器软件、配置OPC服务器、配置OPC服务器与PLC的通信参数、连接PLC 与OPC服务器、测试连接是否正常以及配置OPC服务器与其他应用程序的通信。

西门子Dsl数控系统OPCUA的配置与应用

西门子Dsl数控系统OPCUA的配置与应用

OPCUA技术的挑战与机遇
挑战:需要解决数据传输的安全性 问题
机遇:OPCUA技术可以应用于更 多的工业领域,提高生产效率
添加标题
添加标题
添加标题
添加标题
挑战:需要提高数据传输的效率和 稳定性
机遇:OPCUA技术可以促进工业 4.0的发展,实现智能制造
感谢您的观看
汇报人:abc
OPCUA服务器的配置
安装OPCUA服 务器:下载并安 装OPCUA服务 器软件
配置OPCUA服 务器:设置服务 器名称、IP地址、 端口号等参数
添加设备:将西 门子Dsl数控系 统添加到 OPCUA服务器 中
测试连接:测试 OPCUA服务器 与西门子Dsl数 控系统的连接是 否正常
OPCUA客户端的配置
解决方案:采用西 门子Dsl数控系统 OPCUA,实现远 程监控和故障诊断
应用效果:提高了 生产效率,降低了 维护成本,提高了 产品质量
西门子Dsl数控系 统OPCUA的未来 发展
OPCUA技术的发展趋势
跨平台兼容性: 支持多种操作 系统和硬件平

安全性提升: 加强数据加密 和身份验证, 提高系统安全
西门子Dsl数控系 统OPCUA的应用
OPCUA在数控加工中的应用
实时监控:通过OPCUA接口,可以实时监控数控加工设备的运行状态和加工进度。
数据采集:OPCUA接口可以采集数控加工设备的各种数据,如加工时间、加工速度、 加工精度等。
远程控制:通过OPCUA接口,可以实现对数控加工设备的远程控制,如启动、停止、调 整加工参数等。
案例二:某航空制造企业的应用案例
企业背景:某航空制造企业,主要生产飞机零部件 应用需求:需要实现数控系统的远程监控和故障诊断 解决方案:采用西门子Dsl数控系统OPCUA进行远程监控和故障诊断 实施效果:提高了生产效率,降低了维护成本,提高了产品质量

西门子 HMI 产品 OPC UA 应用实例 3 - 服务器为 WinCC V13 SP1 RT P

西门子 HMI 产品 OPC UA 应用实例 3 - 服务器为 WinCC V13 SP1 RT P

https:///cs/cn/zh/view/109477770C o p y r i g h t ãS i e m e n sA G C o p y r i g h t y e a r A l l r i g h t s r e s e r v e d 目录1概述 (32)组态WinCC V13 SP1 RT Professional OPC UA 服务器 .................................. 43组态TP1500 Comfort OPC UA 客户端 . (7)C o p y r i g h t ãS i e m e n sA G C o p y r i g h t y e a r A l l r i g h t s r e s e r v e d 1概述本文档介绍西门子 HMI 产品的 OPC UA 应用。

该应用以WinCC V13 SP1 RT Professional 作为 OPC UA 服务器,客户端使用TP1500 Comfort 精智面板。

并且采用安全的通信方式。

TP1500 Comfort 使用 X3以太网接口进行通信连接。

注意:本文档着重说明 OPC UA 应用的关键配置。

对于涉及到的软件(例如WinCC V13 SP1)的基本操作将不会详细说明。

如果不熟悉这些软件的基本操作,请参阅其它相关文档。

本实例使用的硬件及软件参见表1-1。

硬件软件服务器PC Windows7 Ultimate 64-bit SP1WinCC Professional V13 SP1客户端TP1500 Comfort Windows7 Ultimate 64-bit SP1WinCC Professional V13 SP1(Comfort 及Advanced 版本也支持)表1-1实例所使用的硬件及软件C o p y r i g h t ãS i e m e n sA G C o p y r i g h t y e a r A l l r i g h t s r e s e r v e d 2组态WinCC V13 SP1 RT Professional OPC UA 服务器为了使用 WinCC V13 SP1 RT Professional OPC UA 服务器,必须保证 WinCC V13 SP1 Runtime Professional 软件已经安装。

西门子S7-300转以太网模块连接 KepWare OPC方法

西门子S7-300转以太网模块连接 KepWare OPC方法

西门子S7-300转以太网模块连接 KepWare OPC方法北京华科远创科技有限研发的远创智控转以太网模块,型号有MPI-ETH-YC01和PPI-ETH-YC01,以太网模块适用于西门子S7-200/S7-300/S7-400、SMART S7-200、西门子数控840D、840DSL、合信、亿维PLC的PPI/MPI/PROFIBUS转以太网。

用于西门子S7-200/S7-300/S7-400程序上下载、上位监控、设备联网和数据采集。

支持与 S7-200SMART 、S7-1200/1500、S7-200/300/400的以太网接口进行通讯的功能和ModbusTCP主从站功能。

直通型和桥接型可拨码选择,直通型的九针母口,可以连西门子和Proface触摸屏和主站,桥接型的九针母口可以连非西门子触摸屏。

不占用PLC编程口,即编程软件/上位机软件通过以太网对PLC数据监控和采集的同时,触摸屏可以通过扩展RS485口与PLC进行通讯。

PLC以太网模块可以连非西门子触摸屏,如昆仑通态、威纶、台达、步科等。

一、转以太网模块模块连接S7300西门子 S7-300/400 通过模块连接 KepWare OPC,可以采用西门子S7TCP 驱动。

1、添加通道1)、打开 Kepware OPC Configuration,增加一个通道,填入通道名称,点击【下一步】;2)、选择【Siemens TCP/IP Ethernet】驱动,点击【下一步】;3)、【Network Adapter】选择计算机网卡;4)、根据需要选择模式(可默认),完成通道参数设置;2、添加设备1)、增加设备,填入设备名称,点击【下一步】;2)、【Device model】选择 S7-300,下一步;3)、【Device ID】填入模块的 IP 地址,下一步;4)、其他参数可以默认,完成设备设置。

3、添加变量1)、按下图单击框①,弹出 Tag Properties 窗口,在框②设置变量,点击框③的选择变量,单击,然后点击确定;4、变量测试1)、在 OPC 客户端验证通讯。

通过COMLS7方式建立SIMATICNETOPC服务器与200SMART的连接

通过COMLS7方式建立SIMATICNETOPC服务器与200SMART的连接

通过COMLS7方式建立SIMATICNETOPC服务器与200SMART的连接SIMATICNET是西门子公司提供的一种用于工业自动化系统的通信模块。

其中的OPC功能模块使得SIMATICNET具备了与其他设备进行数据交换的能力。

而200SMART则是一种智能控制器,可以通过与OPC服务器的连接,实现数据的共享和控制。

要建立SIMATICNETOPC服务器与200SMART的连接,需要以下步骤:1.确保SIMATICNET和200SMART已正确安装和配置。

2.在SIMATICNET中配置OPC服务器。

打开SIMATICNET软件,在菜单栏上选择“OPC服务器”选项。

在弹出的对话框中,选择“新建OPC服务器”,然后按照向导的指示完成配置。

在配置过程中,你需要指定OPC服务器的名称和监听端口。

3.在200SMART的设置中启用OPC功能。

进入200SMART的控制面板,找到OPC设置,并勾选启用OPC功能的选项。

根据实际需要,你也可以选择配置其他的参数,如OPC服务器的IP地址和端口号。

4.在SIMATICNET中创建OPC连接。

打开SIMATICNET软件,在菜单栏上选择“OPC服务器”选项。

在弹出的对话框中,选择“新建连接”,然后按照向导的指示完成操作。

在配置过程中,你需要输入连接的名称、选择连接的类型和指定目标设备(即200SMART)的IP地址和端口号。

5.完成连接设置后,可以通过SIMATICNET软件进行监控和控制。

你可以实时查看200SMART的状态、读取和写入数据等。

此外,你还可以配置报警和事件触发等功能以满足你的需求。

需要注意的是,建立SIMATICNETOPC服务器与200SMART的连接需要确保网络连接的稳定性和安全性,并且两者的通信协议和参数设置必须一致。

在实际操作中,你可能还需要进一步调试和优化连接以确保其正常运行。

总结起来,通过SIMATICNETOPC服务器与200SMART的连接,可以实现数据的共享和控制,提高工业自动化系统的效率和可靠性。

西门子PLC的以太网通讯及OPC通讯介绍

西门子PLC的以太网通讯及OPC通讯介绍

西門子PLC的以太網通訊及OPC通訊介紹1.以太網通訊CAL有很多地方用到以太網通訊,L2,焊機與PLC間通訊等,表檢的成像原理為:在金屬板帶表面沒有缺陷時,反射的光在明視場下很強,而在暗視場的散射光很弱;如有缺陷,則明視場的光強減弱,而暗視場的光強增加。

根據這個原理,通過檢測攝像頭裡光強的變化,可檢測出材料表面上的一些物理缺陷。

CAL 僅僅用到了它的檢測破孔這一個功能。

下面再來看西門子的以太網通訊,使用以太網通訊處理器可能的連接方式:我們可以看到不同的通訊方式在PLC裏面需要調用不同的功能塊。

像S7-Connection方式連接的,需要調用SFB12/FB12等來讀取發送數據息,而TCP等連接的,需要FC5等來讀取發送數據。

下面簡單介紹下每種連接特點:Send/receive: iso 連接:ISO傳輸服務通過組態連接提供SEND/REVEICE interface服務在以太網上傳輸數據,此時服務使用的是ISO協議。

此通訊速度較快,可是不能實現網絡路由,只能用於局域網通訊。

Send/receive: iso-On-TCP 連接:突破了局域網的限制,可以路由到公網上去;數據重發功能和基於第2層的CRC校驗保證了數據傳輸的完整性和可靠性。

Send/receive: TCP 連接:TCP/IP提供面向連接的數據通訊,數據並不會被打包因而並沒有數據包確認位,在這TCP服務提供了統一的sccket接口到每一個終端,因而數據塊可以整體發送,這裡區別於iso-On-TCP 連接。

Send/receive: UDP連接:UDP提供簡單數據傳輸,無需確認,與TCP同屬第4層協議。

與TCP相比,UDP屬於無連接的協議,數據報文無需確認。

S7通信:S7協議是西門子S7家族的標準通信協議,使用S7應用接口的通信不依賴特定的總線系統(Ethernet,PROFIBUS,MPI)。

接口位於ISO-OSI參考模型的第7層,下面圖模型各層的通信方式。

西门子opc服务器的说明文档

西门子opc服务器的说明文档

Edition: 3C79000–G7076–C225–01OPC Server InterfaceManualThis manual is based on version 2.0 of the OPCspecification from the OPC Foundation.This manual is available only in English.ComputingThis manual contains notices which you should observe to ensure your own personal safety, as well as to!Dangerindicates that death, severe personal injury or substantial property damage will result if proper precau-tions are not taken.!Warningindicates that death, severe personal injury or substantial property damage can result if proper precau-tions are not taken.!Cautionindicates that minor personal injury or property damage can result if proper precautions are not taken.Notedraws your attention to particularly important information on the product, handling the product, or to aparticular part of the documentation.Qualified PersonnelOnly qualified personnel should be allowed to install and work on this equipment. Qualified persons aredefined as persons who are authorized to commission, to ground, and to tag circuits, equipment, and sys-tems in accordance with established safety practices and standards.Correct UsageNote the following:!WarningThis device and its components may only be used for the applications described in the catalog or thetechnical descriptions, and only in connection with devices or components from other manufacturerswhich have been approved or recommended by Siemens.This product can only function correctly and safely if it is transported, stored, set up, and installed cor-rectly, and operated and maintained as recommended.TrademarksSIMATIC R, SIMATIC HMI R and SIMATIC NET R are registered trademarks of SIEMENS AG.Some of other designations used in these documents are also registered trademarks; the owner’s rightsmay be violated if they are used by third parties for their own purposes.iOPC Server Interface C7900–G7076–C225–01Contents1OPC Custom Interface1-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.1Creating and Using an OLE Object in C/C++1-2. . . . . . . . . . . . . . . . . . . . . . . . 1.2Additional Information about the Interface Description for the OPC Custom Interface 1-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3The “OPC Server ” Object 1-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4Objects of the “OPC Group ” Class 1-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.5IDataObject Interface 1-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2OPC Automation Interface 2-1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.1Creating and Using an OLE Object in Visual Basic 2-2. . . . . . . . . . . . . . . . . . .2.2Object Model for the Automation Interface 2-5. . . . . . . . . . . . . . . . . . . . . . . . . .2.3The “OPCServer ” Object 2-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.4The “OPCBrowser ” Object 2-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.5The “OPCGroups ” Collection Object 2-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.6The “OPCGroup ” Object 2-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.7The “OPCItems ” Collection Object 2-15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.8The “OPCItem ” Object 2-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Figures1-1OPC Server Object 1-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2OPC Group Object 1-11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3IAdviseSink (Client) and IDataObject (Server) Interfaces 1-16. . . . . . . . . . . . . . 2-1Activating the Reference for the Automation Interface 2-2. . . . . . . . . . . . . . . . 2-2Object Model for the Automation Interface 2-5. . . . . . . . . . . . . . . . . . . . . . . . . . Tables1-1Objects and Interfaces of the OPC Custom Interface 1-5. . . . . . . . . . . . . . . . 2-1Properties of the “OPCServer ” Object 2-6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2Properties of the “OPCBrowser ” Object 2-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3Properties of the “OPCGroups ” Object 2-10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4Properties of the “OPCGroup ” Object 2-12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5Properties of the “OPCItems ” Collection Object 2-15. . . . . . . . . . . . . . . . . . . . . 2-6Properties of the “OPCItem ” Object 2-17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .OPC Server Interface C7900–G7076–C225–011-1OPC Server Interface C7900–G7076–C225–01OPC Custom InterfaceChapter Overview This chapter shows how to use the OPC custom interface. It also lists theinterfaces and methods of the OPC customer interface. This is not a detailedinterface description but contains supplementary information and notes relatingspecifically to the Computing software.There is now an extended version of the OPC custom interface, specification 2.0.Version 2.0 supplements the existing OPC custom interface in several aspectsparticularly those simplifying the handling of asynchronous communication.The interfaces of Version 1.0 of the OPC interface are completely upwardscompatible with Version 2.0.1OPC Custom Interface1-2OPC Server Interface C7900–G7076–C225–011.1Creating and Using an OLE Object in C/C++The following sections illustrate step-by-step how you can call the methods of aninstance of an OLE class in C++. Note the difference between the term “Class” inOLE and in C++:S OLE Classes: A Windows object is an instance of an OLE class. The term OLE class differs from the class in C++.S C++ Classes: A class in C++ is a type definition. An OLE class is, however, an object description and does not contain types.Class Identification CodeEach OLE class can be identified uniquely by a 128-bit long identification code, theCLSID. This is used by the operating system for the unique assignment of a DLLor EXE file that implements this class. A client that wishes to use an object of aclass requires only the CLSID.ProgIDTo simplify the identification of OPC servers, there is normally a readable name,the ProgID assigned in the CLSIDs. While a CLSID is always unique due to thealgorithm for compilation, it is possible that a ProgID exists more than once. Justlike the CLSID, the ProgID is specified by the vendor of an OPC server.The ProgID for the OPC server of Computing is: OPCServer.WinACCreating a COM ObjectA COM object is created in five steps:1.Initialize COM.2.Query the CLSID.3.Create an Object.4.Call an OPC function.5.Release the interfaces used.Step 1: Initialize COMBefore you can use the functions of COM, the COM library must be initialized withthe following call:HRESULT r1;r1 = CoInitialize(NULL);OPC Custom Interface1-3OPC Server Interface C7900–G7076–C225–01Step 2: Query the CLSIDIf the name of an object is known, the CLSID can be queried using the OLEfunction “CLSIDFromProgID ”.Example: The following program section illustrates how to query the CLSID for the OPC server for Computing.CLSID clsid; // Get the CLSID from the Namer1 = CLSIDFromProgID((L”OPCServer.WinAC”),&clsid);Step 3: Create an ObjectIf a client wants to use an object, it transfers the CLSID to the operating systemand requests an object instance. Regardless of where the server is located, theobject request is always directed to COM.The “CoCreateInstance ” function creates an object belonging to the required class.This function includes certain intermediate steps via the “IClassFactory ” interface.Creating an object using IClassFactory is more efficient when several objects of a class must be created.Example: The following lines show how an object of the class “OPC server ” withreference to the “IUnknown ” interface can be created.IUnknown * pOPCUnknown;r1 = CoCreateInstance (clsid, NULL, CLSCTX_LOCAL_SERVER,IID_IUnknown, (void**) &pOPCUnknown );Step 4: Call an OPC FunctionIn this step, a method of the “IOPCServer ” interface of the created object will beused to learn the status of the server. First, a pointer to the “IOPCServer ” interface is made available via “IUnKnown ”. Finally, the “GetStatus ” method is called.Example: The program shown below outputs the status of the server and thevendor information. If the “GetStatus ” method is called successfully, the OPCserver allocates the memory areas for the return information via the “IMalloc ”interface. The user must release these memory areas again.IOPCServer *pOPCServer;OPCSERVERSTATUS *pss;r1 = pOPCUnknown–>QueryInterface(IID_IOPCServer,(void**)&pOPCServer);r1 = pOPCServer –>GetStatus(&pss);printf(”Status.szVendorInfo = %ls\n”, pss–> szVendorInfo);// Remember to release the memory returned by the methodpIMalloc–>Free(pss–>szVendorInfo);pIMalloc–>Free(pss);OPC Custom Interface1-4OPC Server Interface C7900–G7076–C225–01Step 5: Release the Interfaces UsedObjects include reference counters to detect when the object is no longer requiredand can remove itself from memory. Each time the “QueryInterface” function iscalled, the reference counter is incremented. To release the object, the countermust be reset.Example: Using the following commands, the reference counter for the interfaces“IUnknown” and “IOPCServer” is reset.pOPCServer–>Release();pOPCUnknown–>Release();OPC Custom Interface1-5OPC Server Interface C7900–G7076–C225–011.2Additional Information about the Interface Description for theOPC Custom InterfaceA comprehensive description of the OPC interfaces is beyond the scope of thismanual. This is supplied as a file along with this product as an original Englishdocument from the OPC Foundation. The documents are located in the ”DOC ”directory in the product directory of the OPC server for Computing.The following supplementary information about the interfaces lists the objects ofOPC, their interfaces and the methods defined in these interfaces and points outparticular characteristics of the OPC server for Computing.Return ValuesAll the listed methods return a result of the type HRESULT.Overview of the Objects and InterfacesTable 1-1Objects and Interfaces of the OPC Custom InterfaceOPC Custom Interface1-6OPC Server Interface C7900–G7076–C225–011.3The “OPC Server ” ObjectThe OPC server class has various attributes that contain information about the status, the version etc. of an OPC server object. The OPC server class also has methods with which a client can manage the objects of the OPC group class. A client application addresses only an object of this class directly using COM mechanisms. The other objects are created by corresponding OPC methods.The methods of the IOPCServer interface are used to manage the objects in the OPC group class. Using the methods of the IOPCBrowseServerAddressSpace interface, it is possible to investigate the address area of the server.Figure 1-1 illustrates the “OPC server ” object with its interfaces.Figure 1-1OPC Server Object IOPCServer InterfaceThis interface contains methods to manage groups within a server object. It is also possible to obtain information about the current status of the server.AddGroup ( szName, bActive, dwRequestedUpdateRate, hClientGroup,pTimeBias, pPercentDeadband, dwLCID, phServerGroup,pRevisedUpdateRate, riid, ppUnk )Creates a group in the server object.Notes:SThe ”pTimeBias ” parameter is not evaluated by the OPC server for Computing.S“LCID ” is irrelevant for the OPC server for Computing.SThe “UpdateRate ” is specified by the configuration parameter “Minimum Update Rate ” as a multiple of the configuration value.SThe “pPercentDeadband ” parameter is only effective for variables of the real (VT_R4) type.S If the “szName ” parameter is empty, a name is generated beginning with the underscore character (for example, “_123456”). User-defined names should therefore not begin with the underscore character.CreateGroupEnumerator ( dwScope, riid, ppUnk )Creates various enumerators for the group.Note: Since there are no public groups in the OPC server for Computing, the returnvalues for the parameter ”dwScope””...PRIVATE” and ”...PUBLIC” are identical.GetErrorString ( dwError, dwLocale, ppString )Supplies the error message for a specific error code.Note: The OPC server for Computing supports German and English error texts.Errors detected by the Windows operating system are explained in the language inwhich the operating system was installed.GetGroupByName ( szName, riid, ppUnk )Supplies an additional interface pointer for the name of a private group, in otherwords the reference counter is incremented.GetStatus ( ppServerStatus )Supplies the status information of the server.Note: The return value of the OPC server for Computing is the name and theversion of the OPC server.RemoveGroup ( hServerGroup, bForce )Deletes a group on the server.Note: The OPC server for Computing does not support the use of the ”bForce”parameter. It is not possible to delete groups to which references are still active.IOPCBrowseServerAddressSpace InterfaceThis interface contains methods with which the address area of the server can bequeried. The address area contains all the OPC items known to the server.BrowseAccessPaths ( szItemID, ppIEnumString )This provides the possibility of querying the access path of an ItemID.Note: Not required with the OPC server for Computing.BrowseOPCItemIDs ( dwBrowseFilterType, szFilterCriteria, vtDataTypeFilter, dwAccessRightsFilter, ppIEnumString )Supplies a string of the type ”IEnumString” whose content is specified by the call parameters. The position from which the list is created can be set using the”ChangeBrowsePosition” method.Notes:S“BRANCH” excludes the filters for Type and AccessRights.S The rules for creating a filter are as follows:–Asterisk (*) Any character string, including empty strings–Plus (+) Any character string, however at least one character–Question marks (?) Any single character–Square brackets ( [ ] ) One single character from the specified setS To use one of the filter characters, this must be preceded by a back slash (\).ChangeBrowsePosition ( dwBrowseDirection, szString )Allows you to browse through the address area. You can change to the higher level or to a branch.GetItemID ( szItemDataID, szItemID )Creates a complete ItemID in the hierarchical address area. This function is necessary since browsing itself only provides the designations below the current node.Note: The description of GetItemID in OPC specification is inconsistent with the description of ChangeBrowsePosition. With ChangeBrowsePosition, it is not possible to specify a complete ItemID. For this reason, the OPC server for Computing only currently supports the command GetItemID for single leaves (LEAF).QueryOrganization ( pNameSpaceType )Supplies the structure of the address area. The address area can be organized with a flat or hierarchical structure.Note: The structure of the address area of the OPC server for Computing is structured hierarchically.IOPCCommon Interface (Version 2.0)This interface of version 2.0 of the OPC Custom Interface contains methodsallowing the language settings and the name of the client to be made known to theserver.SetLocaleID (dwLcid)Sets the language code of the server. The language code specifies the language inwhich the server outputs text.Note: The OPC server for Computing supports English and German.GetLocaleID (pdwLcid)Fetches the language code of the server.Note: The OPC server for Computing supports English and German.QueryAvailableLocaleIDs (pdwLcid)Provides all the available language codes of the server.Note: The OPC server for Computing supports English and German.GetErrorString (dwError, ppString)Provides the error text for a specific error code in the set language.SetClientName (szName)Transfers a descriptive text for the client to the server. The descriptive text can beused for any purpose by the server, for example for logging in trace files.IConnectionPointContainer InterfaceThis interface is a standard COM interface for reporting asynchronous events viaconnection points. For more detailed information about using connection points,refer to the documentation of OLE/COM.IOPCItemProperties (V 2.0) InterfaceThis interface of version 2.0 contains methods allowing specific server informationto be queried about an item.QueryAvailableProperties (szItemID, pdwCount, ppPropertyIDs,ppDescriptions, ppvtDataTypes )Returns a list of available properties for an item.GetItemProperties (szItemID, dwCount, pdwPropertyIDs, ppvData, ppErrors )Provides the values of the properties of an item transferred in a list of PropertyIDs.LookupItemIDs (szItemID, dwCount, pdwPropertyIDs, ppszNewItemIDs, ppErrors);Provides (whenever possible for the propertyID) a list of ItemIDs for a list of PropertyIDs. These ItemIDs can be included in a group simplifying and speeding up access to the data.Note: The OPC server for Computing does not support this function. The call is rejected with error message 0x8004001 (not implemented).1.4Objects of the “OPC Group” ClassThe “OPC Group” class manages the individual process variables, the OPC items.Using these group objects, a client can form semantically meaningful units of OPCitems and execute operations with them.Figure 1-2 illustrates an object of the “OPC Group” class and its interfaces.Figure 1-2OPC Group ObjectIOPCItemMgt InterfaceThis interface provides methods to manage more than one item in a group.Time StampWith each value read, OPC supplies a time stamp. This indicates when this valuewas received or when it was changed. Since the SIMATIC systems do not use atime stamp, the time at which the value is received on the server is used as thetime stamp.AddItems ( dwNumItems, pItemArray, ppAddResults, ppErrors )Adds one or more items to a group.Notes:S A unique name of an item for the OPC server for Computing is as follows: Examples MD0:RealEB0DB1.DBD0This name can be specified completely in the ItemID. The AccessPath must then be empty.S As an alternative, the part of the name in square brackets can be included in the AccessPath.Example: AccessPath:“”MD0:RealS It is possible to add the same OPC item to the same group more than once. In this case each of these items nevertheless has its own server handle.The server handles of the items are only unique within a group and not for all items of all groups.S Valid data types are as follows: VT_UI1, VT_UI2, VT_UI4, VT_I1, VT_I2, VT_I4, VT_R4, VT_BOOL, VT_BSTRCreateEnumerator ( riid, ppUnk )Creates an enumerator for the items of a group.RemoveItems ( dwNumItems, phServer, ppErrors )Deletes one or more items from a group.SetActiveState ( dwNumItems, phServer, bActive, ppErrors )Sets the active state of one or more items in a group.SetClientHandles ( dwNumItems, phServer, phClient, ppErrors )Sets the client handle of one or more items in a group.SetDatatypes ( dwNumItems, phServer, pRequestedDatatypes, ppErrors ) Sets the requested data type of one or more items in a group.Note: See AddItemValidateItems ( dwNumItems, pItemArray, bBlobUpdate,ppValidationResults, ppErrors )Checks the validity of an OPC item, for example whether it was added to a groupwithout any error occurring, and supplies information such as the canonical datatype.Note: See AddItemIOPCGroupStateMgt InterfaceThe IOPCGroupStateMgt interface provides methods with which groups can bemanaged. It is possible to edit group-specific parameters and to copy groups.CloneGroup ( szName, riid, ppUnk )Creates a copy of a group. All group attributes are copied except for the following:S The active state is set to FALSES A new server handle is assignedNote: The “szName” parameter can be empty. In this case a unique name isgenerated (see AddGroup).GetState ( pUpdateRate, pActive, ppName, pTimeBias, pPercentDeadband,pLCID, phClientGroup, phServerGroup )Fetches the status of the group. The client application must inform the OPC serverwhere the results are to be stored using a pointer.Notes:S The “pTimeBias” parameter has no significance for the OPC server forComputing.S The “pPercentDeadband” parameter has no significance for the OPC server for Computing.S The “LCID” parameter, in other words language-specific textual values in read/write, has no significance for SIMATIC variables.SetName ( szName )Allows the name of a group to be changed. The name must always be unique.SetState ( pRequestedUpdateRate, pRevisedUpdateRate, pActive,pTimeBias, pPercentDeadband, pLCID, phClientGroup )SetState allows various properties of the group to be changed.Notes:S The “pTimeBias” parameter has no significance for the OPC server forComputing.S The “pPercentDeadband” parameter has no significance for the OPC server for Computing.S The “LCID” parameter, in other words language-specific textual values in read/write, has no significance for SIMATIC variables.S The “UpdateRate” is specified by the configuration parameter “Minimum Update Rate” as a multiple of this value.IOPCSyncIO InterfaceThis interface provides methods for synchronous reading and writing. Synchronousmeans that the client waits until the read or write operation is completed and onlythen continues execution.The use of synchronous calls is recommended when the client requires the resultfor further processing. Other clients are not blocked since the OPC server forComputing starts a separate thread for each client.In general, it is advisable to use the IData interface for processing variablechanges (or IAdviseSink on the client side). This interface guarantees the highestpossible data throughput and also reduces the actual number of calls to theabsolute minimum (only when changes occur).Read ( dwSource, dwNumItems, phServer, ppItemValues, ppErrors )Reads the values, status information or time stamp of one or more items in agroup. The values can be read from the cache of the server or directly from thehardware. Reading from the cache is, however, only possible when the group isactivated.Note: The call is monitored by the timeout monitoring on the server. Thecorresponding configuration parameter is “Read/Write Timeout”.Write ( dwNumItems, phServer, pItemValues, ppErrors )Writes values for one or more items of a group to the hardware.Note: The call is monitored by the timeout monitoring on the server. Thecorresponding configuration parameter is ”Read/Write Timeout”.IOPCAsyncIO InterfaceThis interface of the Group class provides methods for asynchronous reading andwriting of items. Asynchronous means that the client triggers a read or writeoperation and then continues operation. Asynchronous operations provide atransaction ID. When the server has completed the read or write operation, theclient receives a message sent to its IAdviseSink interface.Cancel ( dwTransactionID )Cancels an outstanding job.Read ( dwConnection, dwSource, dwNumItems, phServer, pTransactionID,ppErrors )Sends an asynchronous read command. The result is sent to the IAdviseSinkinterface of the client.Note: The call is monitored by the timeout monitoring on the server. Thecorresponding configuration parameter is “Read/Write Timeout”. If the timeoutmonitoring is aborted, there is a callback with hrStatus=E_ABORT.Refresh ( dwConnection, dwSource, pTransactionID )Requests a current value for every active OPC item.Write ( dwConnection, dwNumItems, phServer, pItemValues,pTransactionID, ppErrors )Sends an asynchronous write command.Note: The call is monitored by the timeout monitoring on the server. Thecorresponding configuration parameter is “Read/Write Timeout”. If the timeoutmonitoring is aborted there is a callback with hrStatus=E_ABORT.1.5IDataObject InterfaceThe IDataObject interface is the standard interface of OLE for data transmission. Itcontains methods for establishing a message connection between the client and aserver group.Description of the MechanismIf the server wants to send a message to a client, the client must provide a partnerfor the server. This partner is the IadviseSink interface of the client. A server sendsa message to a client by calling the OnDataChange method of the IAdviseSinkinterface of the client.Representation of the MechanismFigure 1-3 illustrates how the “IAdviseSink” interface on the client and“IDataObject” on the server interact.Figure 1-3IAdviseSink (Client) and IDataObject (Server) InterfacesDAdvise (pFmt, adv, pSnk, pConnection);Establishes a connection between a server and the client. If a client wants toreceive a message, it must establish a connection using this method. It transfers apointer to its IAdviseSink interface to the server.DUnadvise (Connection)Terminates an existing connection between a client and server.OPC Custom InterfaceIEnumOPCItemAttributes InterfaceThis interface based on the IEnum standard interface returns the items of a group.The interface is supplied only by “IOPCItemMgr:CreateEnumerator”. It is notobtainable with QueryInterface.Clone (ppEnumItemAttributes);Creates an identical copy of the enumerator.Next (celt, ppItemArray, pceltFetched);Fetches the next OPC item of the group.Note: The OPC server for Computing does not support engineering units. EUTypeand EUInfo are therefore irrelevant.Reset (void);Resets the list to the first item of the group.Skip (celt);Skips a number of items in the list.IAsyncIO2 Interface (Version 2.0)This interface in version 2.0 provides methods for asynchronous reading andwriting of items. Asynchronous means that the client triggers a read or writeoperation and then continues operation. Version 2 of the interface forasynchronous communication uses connection points. This simplifies theprocessing of the transferred data.Read (dwCount, phServer, dwTransactionID, pdwCancelID, ppErrors)Sends an asynchronous read command. The result is sent to the client via aconnection point.Note: The call is monitored by the timeout monitoring on the server. If the set timeis exceeded, this is indicated by the status E_ABORT.Write (dwCount, phServer, pItemValues, dwTransactionID, pdwCancelID,ppErrors)Sends an asynchronous write command. The message indicating completion ofthe job comes via the specified connection point.Note: The call is monitored by the timeout monitoring on the server. If the set timeis exceeded, this is indicated by the status E_ABORT.。

西门子官方更新版通过ETHERNET建立SIMATICNETOPC服务器与PLC的S7连接

西门子官方更新版通过ETHERNET建立SIMATICNETOPC服务器与PLC的S7连接

西门子官方更新版通过ETHERNET建立SIMATICNETOPC服
务器与PLC的S7连接
一、准备工作
1、安装环境
在建立服务器与PLC S7之间的连接之前,需要先确认客户端和服务器之间的硬件配置。

服务器本身需要装有Windows操作系统(支持XP、Vista、7、Server版本),也可以用其他双核的操作系统;客户端需要装有OPC服务器和Simatic Net Driver,另外,两者之间需要建立一条由电缆连接的网络,以及必要的网络设备。

2、软件安装
(1)安装Simatic Net Driver
首先安装基于Ethernet的Simatic Net Driver,它能够将PLC的数据发送出来,以便实现OPC服务器和PLC的通信。

(2)安装OPC服务器
然后安装OPC服务器,它是服务器与客户端之间通信的桥梁,可以实现客户端到服务器之间的任意数据传输,而Simatic Net Driver则可以将服务器的数据转换为PLC可识别的数据格式,实现PLC与OPC服务器之间的通信。

二、建立服务器和PLCS7之间的连接
1、设置IP地址
当准备工作完成后,现在可以建立服务器和PLCS7之间的连接,首先要确认两者之间网络连接的IP地址,并且确保同一网段,两者之间的IP 地址一定不能重复,以防止地址冲突。

2、确认密码
接着要确认服务器和PLCS7之间的通信双方确认使用的密码,这个密码必须为六位数字,只要双方确认一致,即可成功建立连接。

3、启动Simatic Net Driver
此时可以Simatic Net Driver,由这个软件来识别PLC S7。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

1.修改本机IP为固定IP
2.双击Station Configurator.exe。

3.点击Station Name…,将站名改为s7con(这个名字要与下面SIMATIC PC Station的名字
相同),点OK
4.在插槽1处单机右键,选择Add
6.点击OK
7.在插槽3中右键,并点击Add
9.点击OK
10.点击OK
11.打开SIMATIC NCM Manager.exe点击新建,写入工程名与存放位置,点击OK
12.在工程处右键,选择Insert New Object - > SIMATIC PC Station
13.在新建的SIMATIC PC Station处右键,选择Object Properties…
14.更改Name为s7con(这个名字要与上面Station Name…的名字相同)
15.双击Configuration进入硬件配置
16.在右边选取SIMATIC PC Station - > User Application - > OPC Server - > SW V7.0…
17.拖到左上角机架1号插槽
18.在右侧选取SIMATIC PC Station - > CP Industrial Ethernet - > IE General - > SW V7.1…
19.拖到左上方机架3号插槽后会弹出窗口,将IP改为一开始设置的IP,单击New
20.单击OK
21.单击OK
22.单击编译并保存
23.选择Configure NetWork
24.单击OPC Server
25.在第一条位置右键,选择Insert New Connection
26.点击OK
27.在Local ID处填入工位名,在右下角填入工位IP,点击确定
28.点击编译并保存
29.选取第一项,点OK
30.点右上角红叉退出
31.回到项目程序,选择Options - > Set PG/PC Interface…
32.选择要使用的网卡,点OK
33.点确定
34.点OK
35.选中s7con,点击下载
36.点Yes
37.点OK
38.在右下角系统托盘图表中找到Station Configurator并双击
39.红框内图标一致则为连接成功。

相关文档
最新文档