Professional OPC
Development Tools

logos

× If you are developing in .NET, but are using the OPC-UA (OPC Unified Architecture), please post in the QuickOPC-UA category instead.

EasyOPC DA .Net and Common .Net libraries

More
09 Dec 2018 23:18 #6899 by janderscu
It turns out the problem was actually in my test server ... it was corrupting the ID with special characters. I switched to another server to try this out and it worked fine.

Thanks so much for the help!

Please Log in or Create an account to join the conversation.

More
08 Dec 2018 09:22 #6897 by support
Hello,

in OPC Classic specs, strings (including ItemIDs) are Unicode, and in our QuickOPC client component, we use Unicode strings wherever appropriate as well.

So, OPC ItemIDs with any "special" characters *should* work. If they don't, the problem can be a) in your code, b) in QuickOPC, c) in the OPC server.

Can you access the problematic item/channel from any other OPC client? (if so, please send a screenshot).

Best regards

Please Log in or Create an account to join the conversation.

More
07 Dec 2018 15:09 - 08 Dec 2018 09:18 #6896 by janderscu
Mark,
It seems the client.ItemChanged event is throwing an exception for that channel.
Event = System.Runtime.InteropServices.COMException (0xC0040007): The item is no longer available in the server address space =0xC0040007(-1073479673)

So to give a little more detail on my code … I have the primary data retrieval function GetData() that subscribes to each client address and attaches and event handler to the client.ItemChanged event. This event handler is the client_ItemChanged() function. In my simple case to test, I just have one client address and two channels, one of those channels has special character. The code makes it through GetData() and subscribes without error, but then on the first client.ItemChanged event, I get an exception for the “special” channel as is shown above. I verified the channel label that is input into the argumentArray[] is correct. Is it possible that the dll is not able to match that channel name to what it sees on the server due to the characters, and thus returns that error?

Let me know if that code doesn’t read well in the message. I can send as attachment.
Thanks,
Jason
static void GetData()
        {
            var eventHandler = new EventHandler<EasyDAItemChangedEventArgs>(client_ItemChanged);
 
            for (int j = 0; j < addressArray.Count; j++)
            {
                clients[j].ItemChanged += eventHandler;
            }
 
            Console.WriteLine("Subscribing item...");
            int k = 0;
            for(int j=0;j<addressArray.Count;j++)
            {
                var argumentArray = new DAItemGroupArguments[(Int16)chanCountArray[j]];
                string address = (string)addressArray[j];
                string hostname = address.Split(",".ToCharArray())[0];
                string servername = address.Split(",".ToCharArray())[1];
 
                for (int i = 0; i < (Int16)chanCountArray[j]; i++)
                {
                    int requestedUpdateRate = Convert.ToInt32(scanRateCopy * 1000);
                    //MessageBox.Show(labelListCopy.GetValue(k).ToString());
                    argumentArray[i] = new DAItemGroupArguments(hostname.Trim(), servername.Trim(), labelListCopy.GetValue(k).ToString(), requestedUpdateRate, k);
                    k++;
                }
                clients[j].SubscribeMultipleItems(argumentArray);
            }
 
 
            while (true)
            {
                Thread.Sleep(1000);
                if (runFlag == false) break;
            }
 
            for (int j = 0; j < addressArray.Count; j++)
            {
                clients[j].ItemChanged -= eventHandler;
            }
 
        }
 
 
        static void client_ItemChanged(object sender, EasyDAItemChangedEventArgs e)
        {
            if (e.Exception != null)
            {
                Console.WriteLine("Event = {0}", e.Exception);
                buffer[(int)e.State] = 9999.0;
            }
            else
            {
                Console.WriteLine("Event = {0}", e.Vtq.ToString());
                try
                {
                    if (e.Vtq.Quality.IsGood() == true)
                    {
                        buffer[(int)e.State] = Convert.ToDouble(e.Vtq.Value);
                    }
                    else
                    {
                        buffer[(int)e.State] = 9999.0;
                    }
                }
                catch
                {
                    buffer[(int)e.State] = 9999.0;
                }
            }
        }
Last edit: 08 Dec 2018 09:18 by support.

Please Log in or Create an account to join the conversation.

More
07 Dec 2018 09:43 #6895 by support
Hello,

what you have is fairly old version. In the newer version, the assembly names have changed, but the API (object names/methods etc.) have remained without big changes. You can download the newest version from our Web site (it will work in trial mode) and give it a try (referencing the assemblies installed), or reference a NuGet package of QuickOPC.

There have been bug fixes and many improvements in the meantime, but almost certain nothing that would do with "special characters being used in the channel assignments...". Please describe in more details what the issue is.

Best regards

Please Log in or Create an account to join the conversation.

More
06 Dec 2018 20:33 #6894 by janderscu
Hi,
I have recently taken over a software project from a prior programmer that no longer works here. We are needing to update the .net dll's in our custom package that are used for OPC data access. There is an issue we are having with special characters being used in the channel assignments that I hope will be resolved in a newer version. Currently we are using EasyOpcDANet.dll and EasyOpcCommonNet.dll .. both are version 5.04.102.1

Are these still being used in current releases and if so, are there newer versions?

It seems these dll's are being used in isolation and linked directly from our custom software... rather than being installed with a full package from OPCLabs.

Any help would be greatly appreciated.

Thanks.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.275 seconds

      

 Recommend this on Google