1.13k likes | 1.54k Views
WW TSS-12 Understanding and Troubleshooting OPC Connectivity. Presented by: Gary Alldredge Dr. Peter von Tluck October, 2012. Introduction.
E N D
WW TSS-12 Understanding and Troubleshooting OPC Connectivity Presented by: Gary AlldredgeDr. Peter von Tluck October, 2012
Introduction • This presentation will give you a better understanding of what OPC is, how it works internally, and how to troubleshoot problems when integrating OPC communications into Wonderware products. • We will discuss some OPC configuration best practices, review some of the common problems we see in customer systems, and share how we typically solve those problems.
What is OPC? • OPC is an acronym for OLE (Object Linking and Embedding) for Process Control • Open yet secure connectivity via open standard specifications for interfacing process control (hardware) and manufacturing automation applications (software) • Originally based on Microsoft’s OLE COM and DCOM technologies providing a framework for third party development
OPC Standards • Standards are formed by the OPC Foundation. Before standards, every hardware vendor had to provide a customer driver to communicate to their devices. This was costly and difficult to configure and maintain. http://www.opcfoundation.org
OPC Standards • There are a variety of different OPC Standards that are used in different ways and have different behaviors and interface methods. • OPC Data Access: The original standards. Real-time data from PLCs, DCS, etc. to HMI and other display clients. Currently supported by Wonderware OPC products. • OPC Alarms & Events: On-demand alarm and event notification • OPC Batch: Specialized for batch processes • OPC Data eXchange: Server/server communication instead of client/server
OPC Standards • OPC Historical Data Access: OPC access to historical archive data • OPC XML-DA: Exposing plant floor data via XML. Leverages SOAP and Web Services. • OPC Unified Architecture (UA): New multi-spec standard, not based on COM, for cross-platform communications. Future support is planned for Wonderware products (planned for end of the year)
OPC Data Access Specification • This is currently the only specification available within Wonderware products; however, there are different revisions of the specification. • 1.0: Initial specification • DA 1.0a: Data Access (DA) name adopted to differentiate from other spec types being developed. Limited support by Wonderware. • DA 2.0-2.05a: Numerous modifications and clarifications. Most commonly utilized revision. Supported by Wonderware. • DA 3.0: Further modifications and clarifications. Relatively new and not widely utilized yet. Not currently supported by Wonderware. • Not all clients and servers are backwards compatible. 3rd party products do exist to mediate revision compatibility.
OPC Server Activation Methods • An OPC Client uses one of two activation methods • Out-of-Process (Out-of-Proc; other terms: “exe” or “local”) • An Out-of-Proc server is implemented as an exe. The executable is a separate process from the client. • Can be used for local or remote connections • Allows for multiple concurrent clients • In-Process (In-Proc; other term: “DLL”) • An In-Proc server is implemented in a Windows DLL and is mapped directly into the address space of the process that uses it. • Local connection by only one client
OPC Data AccessCommunications Mechanisms • There are four different mechanisms for data requests and retrieval • Asynchronous Calls • Client issues a read or write request and the thread is immediately released • The values are returned later • Synchronous calls (not supported by Wonderware products) • Client issues a read or write request and the thread is not released until the values are returned
OPC Data AccessCommunications Mechanisms • Refresh (Pull callback mechanism) • Client issues a refresh call, OPC server returns current values asynchronously • Useful when switching from one view to another • Subscription (Push callback mechanism) • Lowers transactional overhead • Client requests items of interest. Using event-based triggers, server notifies client only when changes occur.
OPC Enumeration vs. Operation • There is a significant difference when you are browsing for servers and items during configuration-time versus launching and accessing data during run-time. • OPCEnum (enumeration) • Browse for available OPC servers on a node • Browse items on that server • Operation • Connect to the OPC Server or Launch the OPC Server • Access the OPC server • Request data to be polled • Sometimes only one or the other works, sometimes both or neither.
COM: ProgID vs. CLSID • There are two different ways to uniquely identify an OPC Server • ProgID: PROGrammaticIDentifier • Human readable name of component • This is what is seen when browsing for a list of OPC Servers • CLSID: CLasSIDentifer (also referred to as GUID) • Actual internal identifier used by interacting programs • Can be located in Component Services, DCOM properties for OPC Server. Appears on General tab as “Application ID.” • Can be manually entered in OPC client if ProgID is not able to be browsed due to broken OPCEnum. (Include the curly brackets)
Example Subscription OPC Communications Scenario • Client connects to server • Client adds OPC group with requested update rate and deadband • Client adds items • Server validates items and returns success or failure • Server polls field device • Server sends initial update data type and VTQ. (Value, Time, Quality) • Server polls the device at the requested rate for those items • Server responds to client with VTQ when there is a change in the VTQ Asynchronous read/write calls can be made at any time after subscription is established
Wonderware OPC Client Solutions:FactorySuite Gateway (FSGateway) • Supports OPC DA 2.05a • Planned future support for OPC-UA • Configured via DAServer Manager in the System Management Console (SMC) • Supports Suitelink, OPC, DDE clients • Supports activation of OPC serverin-proc and out-of-proc
Wonderware OPC Client Solutions:OPCClient ArchestrA Device Integration Object • Supports OPC DA 2.05a • Planned future support for OPC UA • Configured via ArchestrA IDE, deployed to platforms • Provides data to ArchestrA galaxy objects via Message Exchange (MX) protocol • Supports activation of OPC server in-proc and out-of-proc • Supports Block Reads and Writes
Wonderware OPC Client Solutions:OPCLink - Legacy • Supports OPC DA 1.0a and 2.05a • Configured via its own user interface • Supports Suitelink, DDE clients • Item prefix is required to specify data type • Supports activation of OPC server in-proc and out-of-proc • Legacy application not supported on current Operating Systems
Wonderware OPC Server Solutions:FSGateway • Connects to various data sources • Suitelink • DDE • InTouch View Application • ArchestrA Galaxy objects (a Platform must be deployed locally) • OPC servers • Supports only Out-Of-Proc activation by clients • Can be an OPC, Suitelink, or DDE server • Cannot be OPC and DDE server at the same time • DDE limitations on newer Operating Systems (see readme)
Wonderware OPC Server Solutions:All Wonderware DAServers • Connect to various 3rd party field devices • Modbus • Rockwell • GE • Siemens • Many others • Supports only Out-Of-Proc activation • Toolkit available for custom DAS development to connect to other devices • Can be an OPC, Suitelink, or DDE server
Sample OPC Configuration • Tips and Tricks
FSGateway OPC Configuration:Create an OPC Object • Server Node: Computer Name or IP address hosting the OPC Server • Server Name: ProgID or ClSID • Reconnection Attempts: Number of times FSGateway attempts to reconnect to the OPC Server • Reconnect Period: Delay between reconnect attempts (use -1 for unlimited reconnect attempts) • Activate Server Out of Proc: If checked OPC server is activated out of proc. If unchecked OPC server is activated in-proc
FSGateway OPC Configuration:Create an OPC Group Object • Use Group Name as Access Path: The name of the OPC group object is used as the OPC Access Path for all items added to the OPC Group. • Read Only: Makes all items in the OPC Group read only. Unchecking this box only removes FSGateway imposed read-only qualifications, not read-only items in the device. • Demand Read After Poke: Forces FSGateway to read back all written values after the write has been processed.
FSGateway OPC Configuration:Device Item Alias • Device Items list is not required • Right column is OPC server’s required item syntax • Allows you to shorten item names • Allows FSGateway items to be browseable by OPC Clients • Good tool for confirming proper item syntax • Good tool for determining proper syntax for Item Prefix
Why Can’t I Read Data • From My OPC Server?
Death by DCOM • DCOM security issues are by far the most common OPC-related issues we encounter • DCOM components are generally secure by default • Resolving DCOM security is particularly difficult when dealing with multi-node configurations that are not on a domain
DCOM Preparation for OPC:Windows Security • Temporarily disable Windows Firewall • Setup transactional users • All users and passwords must match • Should be in Administrators group • Common domain user is preferred • Use loosened security to get setup, then tighten later
DCOM Preparation for OPC:Simple File Sharing • Disable Simple File Sharing • Usually a workgroup problem • In Explorer • Tools/Folder Options, View tab • Uncheck ‘Use Simple File Sharing’ • OR in Admin Tools - Local Security policies • Security Options • Set ‘Network Access: Sharing and security model for local accounts’ to ‘Classic’
DCOM Preparation for OPC:Default Properties • DCOMCNFG (Component Services) • My Computer/Properties • Default Properties • Enable Distributed COM (reboot required) • Default Authentication Level = ‘Connect’ • Default Impersonation Level = ‘Identify’ • Default Protocols • Connection-oriented TCP/IP is all that OPC requires
DCOM Preparation for OPC:Components Services Security • DCOMCNFG (Component Services) • My Computer/Properties • COM Security • Access Permissions/Edit Default • Add ‘Everyone’ • Access Permissions/Edit Limits • Add ‘Everyone’, ‘Anonymous Logon’ • Launch and Activation Permissions/Edit Default • Add ‘Everyone’ • Launch and Activation Permissions/Edit Limits • Add ‘Everyone’
DCOM Preparation for OPC:OPCEnum • Security • Access Permissions/Customize • Add ‘Everyone’ • Add ‘Network’ • Launch and Activation Permissions/Edit Default • Add ‘Everyone’ • Add ‘Network’ • General • Authentication Level • None • Identity • The system account
DCOM Preparation for OPC:OPC Server DCOM Security • Locate the specific OPC server DCOM entry • Properties • Authentication level – sometimes needs to be None • Identity • Interactive: OPC server runs as logged-on user. Not recommended since someone needs to be logged in. • Launching User: OPC server runs as user who called for launch. If more than one user calls for launch, multiple OPC server instances will be attempted, which can be a problem. Must be admin user. • This User: OPC server runs as specific user. Required by some OPC server vendors. • System Account: Preferred, but not available if server is not a Windows Service.
DCOM Preparation for OPC:Secure Communications • Apply Security – Often overlooked if focus is on “get it working!” • Re-enable Windows Firewall • Add application exceptions • TCP/135 will need to be open always at a minimum • Tweak COM Security • Remove Anonymous Logon access if desired • Allow or Deny specific accounts
Common OPC Problems • and Solutions
Problem #1:Can’t Browse for List of OPC Servers • Can be particularly difficult on remote servers • Utilizes OPCEnum to retrieve the list • Add Network user via DCOMcnfg • List contains ProgID • Connection to OPC server is not made • Does not mean OPC server is working • If unable to resolve, you can manually enter the CLSID including curly brackets
Problem #1: Troubleshooting Can’t Browse for List of OPC Servers OPCEnum is Not Installed • Verify OPCEnum service is present on all servers and not disabled (manual preferred) • Usually installed along with an OPC client or server as a redistributable No Anonymous Logon access • Required for OPCEnum with work • Check if Anonymous Access is granted in the default Windows COM Security • DCOMCNFG/My Computer/COM Security
Problem #2:Can’t Connect to Remote OPC Server • Unrelated to OPCEnum browsing success • Errors in log like ‘failed to activate remote server’ Possible causes and solutions • Make sure OPC Server service is not disabled • Review DCOM security for problems • User executing FSGateway does not have launch and activate or access privilege • Simple File Sharing is enabled • OPC Server DCOM Identity setting is wrong • Firewall is blocking connection
Problem #3:Connection Made, but Items Bad • Message in log that connection to OPC Server was successful • Sometimes get ‘failed to add item’ errors in the log Possible causes and solutions • Improper item syntax • Try browsing for items and adding to basket • Check Item Prefix settings • End device is not accessible • Check OPC Server for errors • Delayed data-type validation failure • Review DCOM security for problems
Problem #4:Good Item Quality, but No Item Updates • Message in log that connection to OPC Server was successful • No ‘failed to add item’ errors Possible causes and solutions • Subscription-based means no change, no update • Firewall blocking updates • Simple File Sharing enabled • Review DCOM security for problems
Problem #5:Win2008 – Session ID • If FSGateway is configured as Service: Session ID: O, Local system Account • If FS Gateway is running “not as a service” – Started from SMC: Session ID 0, Network Account User • If FSGateway is started from C:\Program Files\Wonderware\DAServer\FSGateway\Bin: Session ID 1, Logged in User Why important?In some cases OPC Servers don´t get started by FSGateway because of the different Session ID.
OPC Trace of FSGateway • To OPC Server • Communications
Whichtoolsareavailable??? • UseLogflags in SMC • OPC Analyzer (OPC Foundation – for members only )
Using OPC Analyzer for Diagnostics • OPC Analyzer from the OPC Foundation helps identify and analyze communication and protocol issues between the OPC client and OPC server. It is mainly used for client/server testing during development. FSGateway/ Intouch OPC Analyzer OPC Server
Using OPC Analyzer for Diagnostics • Configuration
Using OPC Analyzer for Diagnostics • Configuration in FS Gateway
Using OPC Analyzer for Diagnostics • Start FSGateway • Start InTouch with some active items • OPC Analyzer will be started automatically
Advise Items FSGateway • FSGatewayconnects to the OPC Server • FSGateway sets the client name Create Group FSGateway Add Items Connect • FSGateway adds a group to the OPC Server • FSGateway adds item(s) to the Group • OPC Server pushes data changes to FSGateway OPC Server Group (1000 ms) Pump Speed Tank Level Motor Amps Pump Speed = 50 Tank Level = 89.4 Motor Amps = 49.2 Pump Speed = 47 Tank Level = 85.4 Motor Amps = 48.2 Pump Speed = 48 Tank Level = 84.6 Motor Amps = 46.8
Advise One Item • FSGateway connects to the OPC Server Set Client Name FSGateway sends its name to the OPC Server 13:02:58.406 - IOPCCommon::SetClientName General: HRESULT: 0x00000000 S_OK In Parameters: szName: Wonderware FSGateway
Advise One Item 13:02:58.421 - IOPCServer::AddGroup - General: HRESULT: 0x00000000 S_OK In Parameters: szName: OPC.Group bActive: TRUE riid: IID_IOPCItemMgt pPercentDeadband: NULL dwLCID: 0x0 LOCALE_NEUTRAL hClientGroup: 0x1000000 pTimeBias: NULL dwRequestedUpdateRate: 1000 Out Parameters: pRevisedUpdateRate: 1000 phServerGroup: 0x195830 ppUnk: 0x195854 • FSGateway adds a group to the OPC Server