04/06/2014
This tool is used OPC NET API AE. This tool is very simple. Connect OPC Server, receive alarm and save into CSV file. the source code is almost same as OPC Foundation sample code.
I setup this tool and connect OPC Server successful and start to receive alarms. After work a period time, tool stop to receive alarm. But OPC Server and DCS both work fine. After restart this tool, it can receive alarms.
- After connect OPC Server successful, one method will check OPC connection status and Event Subscript status very 1 minute, both all normal. But cannot receive alarm.
- And then I add one function. If this tool does not receive alarm more than 10 minutes, it will automatic reconnect OPC Server. After run this function, reconnect OPC Server successful , but create subscript event failed. The error is DCOM error. Please see below.
2016-07-18,00:00:11,WARNING,Setup OPC Server Connection,———–Trying to setup OPC Server connection.————
2016-07-18,00:00:11,INFORMATION,OPCConnectionMonitor,Not receving alarms for long time, Auto Restarting OPC Connection: 10.130.36.37
2016-07-18,00:00:18,INFORMATION,AeController.SetupOPCServerConnection(),opcae://10.130.36.37/Yokogawa.ExaopcAECS1.1 connected.
2016-07-18,00:00:19,INFORMATION,AeController.PrintSubscriptionInfo(),BufferTime :0
2016-07-18,00:00:19,INFORMATION,AeController.PrintSubscriptionInfo(),MaxSize :1000
2016-07-18,00:00:19,INFORMATION,AeController.PrintSubscriptionInfo(),KeepAlive :10
2016-07-18,00:00:19,INFORMATION,AeController.PrintInformation(),Print information successfully.
2016-07-18,00:00:19,INFORMATION,OpcEvtHandler.Connect(),Staring browsing areas.
2016-07-18,00:00:19,WARNING,OpcEvtHandler.Connect(),Failed to browse areas on OPC server opcae://10.130.36.37/Yokogawa.ExaopcAECS1.1.: E_FAIL
IOPCEventServer.CreateAreaBrowser
2016-07-18,00:00:19,INFORMATION,OpcEvtHandler.Connect(),Staring browsing areas.
2016-07-18,00:00:20,WARNING,OpcEvtHandler.Connect(),Failed to browse areas on OPC server opcae://10.130.36.37/Yokogawa.ExaopcAECS1.1.: E_FAIL
IOPCEventServer.CreateAreaBrowser
2016-07-18,00:00:27,INFORMATION,OpcEvtHandler.GetReadyToReceiveEvts(),ready to register event change handler. Register EvtHandler failed, Error: System.Runtime.InteropServices.COMException (0x80010111): OLE received a packet with an invalid header. (Exception from HRESULT: 0x80010111)
at OpcRcw.Comn.IConnectionPoint.Advise(Object pUnkSink, Int32& pdwCookie)
at OpcCom.ConnectionPoint.Advise(Object callback)
at OpcCom.Ae.Subscription.Advise()
at OpcCom.Ae.Subscription.add_EventChanged(EventChangedEventHandler value)
at Opc.Ae.Subscription.add_EventChanged(EventChangedEventHandler value)
at OpcEvtHandler.RegisterNewEvtHandler(String& msg).
- I do one more testing the function that AE Collector tool reconnect OPC Server after does not receive alarm more than 10 minutes.
It is successful. It does not have DCOM error.
(1). Setup AE Collector tool and connect OPC Server. And then it starts to receive alarms.
(2). Stop DCS test function, so DCS does not general alarm and AE Collector tool also cannot receive alarms. And then check the log file
2016-07-20,17:36:31,INFORMATION,OPCConnectionMonitor,Not receving alarms for long time, Auto Restarting OPC Connection: 192.168.6.10
2016-07-20,17:36:34,INFORMATION,AeController.SetupOPCServerConnection(),opcae://192.168.6.10/Yokogawa.ExaopcAECS1.1 connected.
2016-07-20,17:36:34,INFORMATION,AeController.PrintSubscriptionInfo(),BufferTime :0
2016-07-20,17:36:34,INFORMATION,AeController.PrintSubscriptionInfo(),MaxSize :1000
2016-07-20,17:36:34,INFORMATION,AeController.PrintSubscriptionInfo(),KeepAlive :10
2016-07-20,17:36:34,INFORMATION,AeController.PrintInformation(),Print information successfully.
2016-07-20,17:36:34,INFORMATION,OpcEvtHandler.Connect(),Staring browsing areas.
2016-07-20,17:36:34,INFORMATION,OpcEvtHandler.GetReadyToReceiveEvts(),ready to register event change handlerfinish register event change handler
2016-07-20,17:36:34,INFORMATION,AeController.SetupOPCServerConnection(),opcae://192.168.6.10/Yokogawa.ExaopcAECS1.1 finished subscription.
(3). Start DCS test Function again, AE Collector tool can automatic receive alarms.
Based on point 3, the reconnect OPC function is working. Source code does not have problem.
So now problem is
- Why this tool stop receive alarm from OPC Server.
- About reconnect OPC Server function, why the DCOM error happen?
- It is source code problem or environment problem
1 Guest(s)