Author Topic: Getting NULL by OPCComm's ReadAny function  (Read 2938 times)

vikrant

  • Newbie
  • *
  • Posts: 3
    • View Profile
Getting NULL by OPCComm's ReadAny function
« on: September 25, 2013, 02:16:34 AM »
I had earlier used the OPCDAAutoDll to create an OPC client in VB.NET and it worked. I was trying out OPCComm lately, I could create OPCComm without any error but, ReadAny function returned null on any OPC tag ItemID I provide as Address argument.

I am now confused, while using the OPCDAAutoDll I was using the OPC ItemID as tag name, so should ItemID or Address of OPC Tag for OPCComm ReadAny's address arg?

Do we also have to provide the GroupName, or no or any group name will do ??

Look at the pseudo code as follows: I'm using Kepware's Demo OPC server for testing.

Code: [Select]
                OPCComm opcComm = new OPCComm();
                opcComm.OPCServer = "Kepware.KEPServerEX.V5";
                //opcComm.OPCGroup = "Device1.Channel1";

                while (true)
                {
                    foreach (var tag in device.Tags)
                    {
                        try
                        {
                            var data = opcComm.ReadAny("Channel1.Device1.Tag1");
                            tag.UpdateData(new Data { Timestamp = DateTime.Now, Value = data, Quality = "Good" });
                        }
                        catch (Exception ex)
                        {
                            logger.Error("Error reading " + tag.Name + " for device " + device.Name +
                            ". Details: " + ex.Message + " Stack-trace: " + ex.StackTrace);
                        }
                    }     
                }
« Last Edit: September 25, 2013, 07:49:01 AM by vikrant »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5271
    • View Profile
    • AdvancedHMI
Re: Getting NULL by OPCComm's ReadAny function
« Reply #1 on: October 02, 2013, 07:10:14 AM »
Version 3.59 will have an updated OPC driver that may fix this problem. The next version should be available by Monday.