西门子opc服务器的说明文档
- 格式:pdf
- 大小:495.80 KB
- 文档页数:42
OPC设置说明1.客户机和服务机的用户名和密码设置必须一致用户名为Administrator 密码如1232.客户机和服务机的工作组一致3.. 客户机和服务机的防火墙都关闭4.在服务机sywbh上注册sykj.opcda2 。
注意用SYKJOPC.exe进入点击“注册服务”按钮。
然后退出5.用OPC_DCOM_set 批处理文件设置OPC配置,点击进入。
服务机选择“1”,再按回车,直到结束提示,按任意键关闭窗口。
在当前目录下系统自动产生opc3个文件。
3个OPC文件可以删除。
见下图1和图2图1图2客户机选择“2”,再按回车,直到结束提示,按任意键关闭窗口。
在当前目录下系统自动产生“自动化安全配置管理”窗口。
完成后关闭下图的两个窗口。
图37配置OPC注册完成后,客户机和服务机电脑必须重新启动。
无论在客户机还是服务机上,在网上邻居查看工作组的计算机,则会出现相应的客户机和服务机的电脑名称。
见图4。
图4中sywbh 是服务机,YF2是客户机。
在sywbh 电脑上,点击YF2电脑,则直接进入,无需输入密码。
这是OPC配置后引起的。
同理在YF2 电脑上,点击sywbh电脑,也直接进入。
图47.用模拟软件查看通信效果:. 在客户机上启用西门子OPC Scut 来启动QCS 3200 软件,并查看数据。
方法见图5,图6,图7,图8。
图6中的IP地址为服务机的IP地址。
此图为192.168.1.100 (可以需要改变)OPC 的名称为sykj.opcda2 这个不可更改。
图5图6图7中产生192.168.1.100 的电脑名称(此为服务机名)。
点击连接。
如果连接成功,则服务机的QCS3200会自动启动,并产生图8的建立组名的窗口。
图7图9中建立KK的连接组。
连接成功后见图10 有数据并显示的状态为“good”。
图9图10图11也可以利用opclink实现模拟通信的测试见图12图12上部分查看通信状况,下部分显示具体的数据。
1.修改本机IP为固定IP2.双击Station Configurator.exe。
3.点击Station Name…,将站名改为s7con(这个名字要与下面SIMATIC PC Station的名字相同),点OK4.在插槽1处单机右键,选择Add6.点击OK7.在插槽3中右键,并点击Add9.点击OK10.点击OK11.打开SIMATIC NCM Manager.exe点击新建,写入工程名与存放位置,点击OK12.在工程处右键,选择Insert New Object - > SIMATIC PC Station13.在新建的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,单击New20.单击OK21.单击OK22.单击编译并保存23.选择Configure NetWork24.单击OPC Server25.在第一条位置右键,选择Insert New Connection26.点击OK27.在Local ID处填入工位名,在右下角填入工位IP,点击确定28.点击编译并保存29.选取第一项,点OK30.点右上角红叉退出31.回到项目程序,选择Options - > Set PG/PC Interface…32.选择要使用的网卡,点OK33.点确定34.点OK35.选中s7con,点击下载36.点Yes37.点OK38.在右下角系统托盘图表中找到Station Configurator并双击39.红框内图标一致则为连接成功。
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 软件已经安装。
SIMATIC NET v6.0 OPC SERVER通讯配置说明需要准备:计算机、 PROFIBUS网卡、 SIMATIC NET 6、 S7-300/400 (带PROFIBUS 接口)STEP7或NCM PC、SIEMENS授权SIK/SIMATIC NET PROFIBUS-S7支持的通讯方式:Product Includes the OPC Server for ..._______________________________________________________________________DP-5613 PROFIBUS-DPS5-compatible communication (FDL)_______________________________________________________________________S7-5613 S7communication _______________________________________________________________________communication FMS-5613 FMS_______________________________________________________________________SOFTNET-S7 PROFIBUS S7 communication_______________________________________________________________________SOFTNET-DP PROFIBUS-DPS5-compatible communication (FDL)_______________________________________________________________________SOFTNET-DP Slave PROFIBUS-DP (slave)_______________________________________________________________________CP 5613 FO / 5614 FO / PROFIBUS-DP (master)CP 5613 / 5614 and S5-compatible communication (FDL)with DP-Base Software Access to DP slave of the CP 5614_______________________________________________________________________communication S7-1613 S7S5-compatible communication (SR)_______________________________________________________________________TF-1613 S5-compatible communication (SR)_______________________________________________________________________SOFTNET-S7 Ind. Ethernet S7 communicationS5-compatible communication (SR)_______________________________________________________________________S7 RedConnect Fault-tolerant S7 communication_______________________________________________________________________PROFInet OPC Server OPC PROFInet Communication1、配置SOFTNET-PC站在成功安装软件SOFTNET和硬件通讯卡并重启机器后,可见如下调试向导:单击“Next”继续。
OPC设置说明文档maxDNA OPC C/S配置说明关键词:maxDNA OPC;DCOM;配置;说明书第一章maxDNA OPCServer中配置DCOM的目的OPC的服务器端组件与客户端程序通常会位于不同的计算机中,它们之间的通讯需要依靠DCOM来进行,为保障通讯能够正常进行,需要在服务器端与客户端进行DCOM的设置。
第二章创建用于通讯的用户2.1创建用户的目的创建通讯用户是为了使服务器端与客户端用户具有可兼容的操作权限,以使DCOM通讯能够正确进行。
2.2创建用户的方法在“控制面板”中选择“管理工具”,双击“计算机管理”图标,可看见如图2-1的计算机管理控制台程序。
图2-1 服务器运行界面1.启用Guest用户。
选择Guest用户,在右键菜单中选择“属性”,在如图2-2的对话框中检查“帐户已停用”选项是否被钩掉,如是选中状态,则去掉前面的对钩。
图2-2 Guest属性2.在用户中新建一个用于DCOM通讯的用户,如图2-3所示。
图2-3 新建用户将新建的用户添加到Administrators组,使该用户具有管理员权限,如图2-4所示。
图2-4 设置用户所属的组注意事项:1、在OPC服务器端和客户端分别建立同样的上述用户,用户名及密码可任选,但一定要保证两端一致。
2、在OPC客户端用所建立的用户登录,OPC服务器端可使用其它用户登录。
第三章maxDNA Station下的DCOM配置3.1配置DCOM在“运行”中输入“dcomcnfg”,如图3-1所示。
图3-1 运行命令运行命令出现如图3-2的控制台界面。
图3-2 控制台界面在“我的电脑”中选择属性,可使用右键菜单或点击工具栏中红色框所标示的按钮,可出现如图3-3的对话框图3-3 “我的电脑”属性对话框“默认属性”页选择“默认属性”页,在该页中确定“默认身份验证级别”选择为“无”。
此页其它选项如图3-3中所示设置。
再选择“COM安全”页,如图3-4所示。
OPC使用说明范文OPC(OLE for Process Control)是一种通信协议,用于在工业控制系统中传输数据和信息。
它是一种基于标准的方式,用于在不同的自动化设备之间进行通信和交换数据。
OPC协议的设计目的是建立一个开放的、厂商中立的通信标准,以便不同类型的自动化设备能够相互通信和交换数据。
在过去的几十年里,工业控制系统通常使用专有的通信协议来实现设备之间的通信,这导致了厂商之间的互操作性问题。
而OPC协议的出现解决了这个问题,使得不同厂商的设备能够无缝地集成在一起。
OPC协议的架构:OPC协议主要由两部分组成:OPC客户端和OPC服务器。
OPC客户端是用来连接和访问OPC服务器的软件组件,它可以从OPC服务器中读取、写入和订阅实时数据。
OPC客户端可以是各种第三方软件,如监控软件、数据采集软件等。
OPC服务器是一个中间件,负责将不同厂商和不同类型的设备转换成统一的OPC标准。
OPC服务器可以连接到各种类型的控制设备,如PLC、DCS、SCADA等,并提供一组标准的接口和方法供OPC客户端使用。
OPC服务器还负责管理实时数据的缓存、订阅和发布。
OPC协议的特点:1.开放性和中立性:OPC协议是一个开放的标准,任何厂商都可以使用它来实现设备之间的通信。
它不受特定厂商或设备类型的限制,能够在不同的自动化系统中实现互操作性。
2.灵活性和可扩展性:OPC协议支持多种数据传输方式,如本地通信、以太网、无线通信等。
它还支持不同的数据格式,如二进制、ASCII、XML 等。
同时,OPC协议也支持设备之间的点对点通信和多对多通信。
3.高效性和实时性:OPC协议使用高效的通信方式,能够在短时间内传输大量的数据。
它还支持实时数据传输,可以即时地更新和处理实时数据。
4.安全性和可靠性:OPC协议提供了许多安全机制,如认证、加密、数字签名等,以保护数据的安全和完整性。
同时,OPC协议还支持故障恢复和数据冗余,能够确保通信的可靠性和稳定性。
OPC服务器设置1:概述在本章节中,我们将介绍OPC服务器设置的目的和范围,以及本文档的组织结构和使用方法。
2:前提条件在本章节中,我们将列出执行本文档所需的前提条件,例如操作系统要求、硬件要求和软件依赖项。
3:安装OPC服务器在本章节中,我们将提供安装OPC服务器的详细步骤。
包括和安装OPC服务器软件,配置安装选项,并完成安装向导。
4:配置OPC服务器在本章节中,我们将介绍如何配置OPC服务器。
包括打开服务器配置工具,设置通信协议、端口和服务选项,以及配置安全性和权限。
5:添加OPC服务器项在本章节中,我们将演示如何添加OPC服务器项。
包括选择服务器项,定义标签和属性,以及设置数据访问权限。
6:测试和验证在本章节中,我们将讨论测试和验证OPC服务器设置的方法。
包括使用OPC客户端工具进行连接和访问测试,以及检查服务器日志和报告错误。
7:故障排除在本章节中,我们将提供一些常见问题和故障排除方法。
包括解决连接问题、数据访问错误和性能问题的建议。
8:维护和更新在本章节中,我们将介绍维护和更新OPC服务器设置的方法。
包括备份和恢复配置、升级软件版本和更改设置的步骤。
9:附件本文档附带以下附件,供参考和进一步了解:- OPC服务器安装程序- OPC服务器配置示例文件- OPC服务器项配置示例文件附件1: OPC服务器安装程序附件2: OPC服务器配置示例文件附件3: OPC服务器项配置示例文件法律名词及注释:在本文档中使用的法律名词及其相应注释如下:- OPC: OLE for Process Control,一种工业自动化控制系统的标准协议。
项目10 S7-200的OPC Access通信10.1 学习目标通过本项目的学习与训练,使学生在了解PC Access服务器软件OPC服务器软件的基础上,全面掌握S7-200的PC Access服务器软件,并达到以下目标。
10.1.1 知识目标了解PC Access软件的功能,知道PC Access与Windows操作系统的兼容性要求,主要的硬件连接及相关注意事项。
10.1.2 技能目标能熟练操作PC Access软件,正确设置PC Access参数,合理选择适当的连接方式建立PC Access与PLC的连接,并独立完成S7-200与PC Access服务器、PC Access服务器与Microsoft Excel的通信设置及数据交换。
10.2 知识准备10.2.1 PC Access概述1. PC Access简介西门子推出的PC Access软件是专门用于S7-200 PLC的OPC服务器(Server)软件,可以与任何标准的OPC 客户端(Client)通信并提供数据信息。
PC Access软件自带OPC客户机测试端,用户可以方便的检测其项目的通信质量及配置的正确性。
PC Access可以用于连接西门子或者第三方的支持OPC技术的上位软件(如WinCC、WinCC flexible、Microsoft Excel等),目前最高支持的数据访问规范为DA V2.05。
PC Access目前的最新版本是PC Access V1.0 SP3,可以在Windows操作系统下运行,兼容性要求如表10-1所列。
表10-1 PC Access软件与Windows操作系统的兼容性Windows操作系统PC Access版本Win 2000SP3 Win 2000SP4Win XPWin XPSP1Win XPSP2Win XPSP3VistV1.0.0 未验证兼容未验证兼容未验证未验证未验证V1.0.1 未验证兼容未验证兼容兼容未验证未验证V1.0.2.26 兼容兼容兼容兼容兼容未验证未验证V1.0.3.35 兼容兼容兼容兼容兼容兼容兼容2. PC Access支持的通信及连接方式PC Access V1.0 SP3支持S7-200的所有通信方式,如: ①通过RS 232/PPI 多主站电缆、USB/PPI 多主站电缆、在PC 机上安装CP5611或CP5512扩展卡和MPI 电缆,连接PC 机和S7-200,建立PPI 网络。
仪峰DCS系统OPC配置手册一.如何安装OPC二.OPC服务器的系统设置(Windonws2000)三.OPC客户端的系统设置(Windonws2000)四.OPC服务器的系统设置(WindonwsXP)五.OPC客户端的系统设置(WindonwsXP)六.OPC服务器如何发布OPC信号点七.OPC客户端如何接收OPC信号点八.补充说明一.DCS中安装OPC1.DCS软件注册OPC运行C:\Program Files\csyf\tools\install.bat 运行C:\Program Files\csyf\tools\YFOPCsvr.reg 具体操作如下图:首先打开Tools文件夹如下:再次双击鼠标运行Install.bat文件最后双击鼠标运行YFOPCsvr.reg如下图:选择“是”点击“确定”,完成注册过程。
2.如何在DCS中开启OPC服务器打开文件C:\Program Files\csyf\ini\system.ini找到如下位置:[Host]Name=ClinetSystem=0UserID=3OPCStove=True \\值修改为“True”表示发布单炉数据OPCServer=True \\值修改为“True”表示开启OPC服务器3.如何在在DCS中开启OPC客户端打开文件C:\Program Files\csyf\ini\system.ini找到如下位置:[OPCDATA]ISOPCC=True \\值修改为“True”表示开启OPC客户端preOPCTagName=ServerIP=128.128.1.140 \\填写对方OPC服务器的IP地址ServerName=SUPCON.JXServer.1 \\填写对方OPC服务器的服务名称按以上设置完成以后,运行DCS程序的时候,OPC服务器和客户端程序都会自动运行。
二.OPC服务器的系统设置(Windonws2000)特别注意:1.Windows2000操作系统必须使用专业版+SP4补丁2.在操作系统下创建一个新的用户名和密码,例如用户名:CSYF 登录密码:11(密码最好不为空)。
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.。