How to connect remote OPC Server using opcdaauto.dll using C#?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 01:38:40

问题


DLL used : opcdaauto.dll from OPC Foundation

        OPCServer ObjOPCServer;
        OPCGroups ObjOPCGroups;
        OPCGroup ObjOPCGroup;

        ObjOPCServer = new OPCServer();
        string _serverName = "Kepware.KEPServerEX.V5";

        //In place of "", I need to give IP address of machine where OPC Server is present
        ObjOPCServer.Connect(_serverName, ""); 

Then also I am not able to communicate . Any help highly appreciated.

Thanks in advance


回答1:


            OPCServer ObjOPCServer = new OPCServer();
            OPCGroups ObjOPCGroups;
            OPCGroup ObjOPCGroup;
            //string _serverName = "Kepware.KEPServerEX.V5";
            string _serverName = "Matrikon.OPC.OMRON.1";

            ObjOPCServer.Connect(_serverName, "192.168.0.110");
            ObjOPCGroups = ObjOPCServer.OPCGroups;

            ObjOPCGroup = ObjOPCGroups.Add("Group1");
            ObjOPCGroup.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(ObjOPCGroup_DataChange);
            ObjOPCGroup.OPCItems.AddItem("#MonitorACLFile", 1);

            //ObjOPCGroup.OPCItems.AddItem("Channel1.Device1.Tag2", 2);
            ObjOPCGroup.UpdateRate = 1000;
            ObjOPCGroup.IsActive = true;
            ObjOPCGroup.IsSubscribed = true;

Refer : http://revanayya.blogspot.in/2013/12/opcclient-development-using-observer.html



来源:https://stackoverflow.com/questions/21874772/how-to-connect-remote-opc-server-using-opcdaauto-dll-using-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!