Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

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

QUICKopc Client application missing the values and not retaining back

More
08 Feb 2018 00:47 - 08 Feb 2018 08:33 #5993 by SENTHILKUMAR
1. we could not understant why vtqresult become NUll?
2. how hang up issue reduced after inserting the below code?
easyOPCClient.InstanceParameters.Timeouts.ReadItem = 30000;//set 30 seconds timeout for read item
easyOPCClient.InstanceParameters.Mode.AllowAsynchronousMethod = false;
easyOPCClient.InstanceParameters.UpdateRates.ReadAutomatic = Timeout.Infinite;
easyOPCClient.InstanceParameters.UpdateRates.WriteAutomatic = Timeout.Infinite;

can you advice what will be advisable value for below parameter when OPC server is in local network?
easyOPCClient.InstanceParameters.Timeouts.ReadItem

presently we are reading OPC values at the interval of 10 seconds. by assumption We mmade the value as 30 seconds
easyOPCClient.InstanceParameters.Timeouts.ReadItem = 30000
Last edit: 08 Feb 2018 08:33 by support.

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

More
08 Feb 2018 00:39 #5992 by SENTHILKUMAR

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

More
08 Feb 2018 00:38 #5991 by SENTHILKUMAR

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

More
07 Feb 2018 18:41 #5985 by support
Ad 2: What do you mean by saying that the value of vtqResults is blank? There is no such thing in .NET. The value can either be a null reference, or it can be non-null, in which case it is an object of specific type.

Is it null? Or is it something else? What then?

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

More
07 Feb 2018 17:08 - 08 Feb 2018 08:33 #5984 by SENTHILKUMAR
1. how to avoid code hanging at
DAVtqResult[] vtqResults = easyOPCClient.ReadMultipleItems(ServerDetail, subarray);

whether the steps followed is right mentioned below to code hang
easyOPCClient.InstanceParameters.Timeouts.ReadItem = 30000;//set 30 seconds timeout for read item
easyOPCClient.InstanceParameters.Mode.AllowAsynchronousMethod = false;
easyOPCClient.InstanceParameters.UpdateRates.ReadAutomatic = Timeout.Infinite;
easyOPCClient.InstanceParameters.UpdateRates.WriteAutomatic = Timeout.Infinite;

2. How to avoid value missing. i.e., in the below line, vtqReqsults become blank after certain time. the time might me 5 min , 10 min or 2 Hours also. after 2 hours , the value will be blank.

vtqResults = easyOPCClient.ReadMultipleItems(ServerDetail, subarray);

if any more clarification required, let us know. we are awaiting for your reply.
Last edit: 08 Feb 2018 08:33 by support.

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

More
07 Feb 2018 17:00 - 08 Feb 2018 08:32 #5983 by SENTHILKUMAR
Dear Z,

please refer the code attached in earlier post.

we faced the issue at the line specified in the code
Console.WriteLine("OPC Funtion : Trying to connect");
                LogWriter("OPC Funtion : Trying to connect");
 
 
                //iterate over tagarray and create //TagSubArray
                try
                {
                    DAVtqResult[] vtqResults = easyOPCClient.ReadMultipleItems(ServerDetail, subarray);

the program control have not released once get into the below method "easyOPCClient.ReadMultipleItems(ServerDetail, subarray);"

so we added the below statements in the initialize function
easyOPCClient.InstanceParameters.Timeouts.ReadItem = 30000;//set 30 seconds timeout for read item
                easyOPCClient.InstanceParameters.Mode.AllowAsynchronousMethod = false;
                easyOPCClient.InstanceParameters.UpdateRates.ReadAutomatic = Timeout.Infinite;
                easyOPCClient.InstanceParameters.UpdateRates.WriteAutomatic = Timeout.Infinite;


after adding above lines, we observed the program control some what came out of the method. it stopped hanging. ( Not frequent as earlier)


But after some time, it was missing the opc tag values.

DAVtqResult[] vtqResults = easyOPCClient.ReadMultipleItems(ServerDetail, subarray);

the vtqResult become blank after sometime. the time duration of missing data is in random manner. sometime the we get values for 5 min continuously , sometimes 10 minutes, some time 2 hours

the value missing in vtqResult is not predictbale.

so we included another set of commands in the code as shown below
if (GloabalVariables.ErrorMessageCount > (vtqResults.Length - 1))
    {
          GloabalVariables.ErrorMessageCount = 0;
          GloabalVariables.QualityCollection.Clear();
          GloabalVariables.ReadableTags.Clear();
          GloabalVariables.BooleanValueCollection.Clear();
          GloabalVariables.DoubleValueCollection.Clear();
          easyOPCClient.Reset();                                 
          easyOPCClient.Isolated = true;
          easyOPCClient.InstanceParameters.Timeouts.ReadItem = 30000;//set 20 seconds timeout for read item
          easyOPCClient.InstanceParameters.Mode.AllowAsynchronousMethod = false;
          easyOPCClient.InstanceParameters.UpdateRates.ReadAutomatic = Timeout.Infinite;
          easyOPCClient.InstanceParameters.UpdateRates.WriteAutomatic = Timeout.Infinite;
          GloabalVariables.ReInitialise = true;                               
 
      }
but the result is not fruitful. still we are facing the issue
Last edit: 08 Feb 2018 08:32 by support.

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

More
07 Feb 2018 13:58 #5975 by support
Hello,

ad 2.: Please provide more information. What precisely happens? Do you get errors? What precisely are they? Can you send the generated log file(s) you have?

Does the execution of your reading loop "hang" somewhere, OR does the loop continue running, but you get errors every time it executes?

Regards

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

More
07 Feb 2018 11:58 #5972 by support
Hello,

ad 1.: .NET Franmework 4.6. is fine. For other requirements, see opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...ml#Application_Deployment.html . You basically just need to deploy our assemblies, and take care of installing the license.

I will reply to the second issue later.

Best regards

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

More
07 Feb 2018 10:16 #5971 by SENTHILKUMAR
Additional info: quick opc client application running windows server 2016

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

More
07 Feb 2018 10:14 - 07 Feb 2018 12:26 #5970 by SENTHILKUMAR
Dear Z,

Issue : OPC Client Application is running continuously. but at some instance, it missing the communication and its not recovering the communication back.

the required details we shared below

we are owned license for Quick OPC .please find below Quick OPC version detail. Version : 5.51

we have below set of Queries
.
1. Currently the deployment machine has .NET Framework 4.6. whether any other packages need to update in deployment machine??

we had a active license for Quick OPC Application

2. Our OPC Client Application is running continuously. but at some instance, it missing the communication and its not recovering the communication back.. we need your expertise in resolving the issue.

please find below our code.



Variable deceleration :
static readonly EasyDAClient easyOPCClient = new EasyDAClient();


initialize application:
easyOPCClient.Isolated = true;
easyOPCClient.InstanceParameters.Timeouts.ReadItem = 30000;//set 30 seconds timeout for read item
easyOPCClient.InstanceParameters.Mode.AllowAsynchronousMethod = false;
easyOPCClient.InstanceParameters.UpdateRates.ReadAutomatic = Timeout.Infinite;
easyOPCClient.InstanceParameters.UpdateRates.WriteAutomatic = Timeout.Infinite;
reading OPC Values:

Reading OPC Values in infinite loop for every 10 seconds interval. the OPC values logging in text file at an interval of 10 seconds. continuously logging in the text file.

please find below function as it is

        static void ReadOPCTagValues()
        {
 
            int count = GloabalVariables.TagCollection.ToArray().Length;
            string[] TagSubArray = GloabalVariables.TagCollection.ToArray();
            DAItemDescriptor[] subarray = new DAItemDescriptor[GloabalVariables.TagCollection.ToArray().Length];
            var ServerDetail = new OpcLabs.EasyOpc.ServerDescriptor();
 
 
 
 
 
            Console.WriteLine("Variable initialization Completed");
            LogWriter(" OPC Funtion : Varibale initialization completed");
 
 
            try
            {
                for (int i = 0; i < count; i++)
                    subarray[i] = new DAItemDescriptor(TagSubArray[i]);
 
 
 
                Console.WriteLine("Deccriptor creation Completed");
                LogWriter(" OPC Funtion : Deccriptor creation completed");
 
 
                ServerDetail.MachineName = HostName;
                ServerDetail.ObjectId = ServerClass;
                EasyDAClient.SharedParameters.ClientParameters.UseCustomSecurity = false;
            }
            catch(Exception e)
            {
                Console.WriteLine("Deccriptor creation Exception" + e.Message);
                ErrorLogWriter(" OPC Funtion : Deccriptor creation Exception" + e.Message);
            }
            try
            {
 
 
                StreamWriter WriteTagName = new StreamWriter(System.IO.Directory.GetCurrentDirectory().ToString() + @"\TagNamesWithDomain.txt", true);
                WriteTagName.WriteLine(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff") + " Start Cycle : " + countCycle.ToString());
 
               // Client. = true;
                Console.WriteLine("OPC Funtion : Trying to connect");
                LogWriter("OPC Funtion : Trying to connect");
 
 
                //iterate over tagarray and create //TagSubArray
                try
                {
                    DAVtqResult[] vtqResults = easyOPCClient.ReadMultipleItems(ServerDetail, subarray);
                    Console.WriteLine("OPC Funtion :OPC Buffer reading Completed with mesage length " + vtqResults.Length);
                    LogWriter("OPC Funtion :OPC Buffer reading Completed with mesage length " + vtqResults.Length);
                    string string1;
 
                    Console.WriteLine("OPC Funtion :Disposed OPC Instant");
                    LogWriter("OPC Funtion :Disposed OPC Function");
                    for (int i = 0; i < vtqResults.Length; i++)
                    {
                            try
                            {
                                Debug.Assert(vtqResults[i] != null);
                                string1 = Convert.ToString(vtqResults[i].Vtq);
                                Console.WriteLine("Tag index [{0}].Tag Value:{1}", i, vtqResults[i].Vtq);
                                //Console.WriteLine(" lENGTH OF REC MESSAGE : " + string1.Length);
                                LogWriter(Convert.ToString(i) + " " + string1);
 
 
                                if (string1.Length > 30)
                                {
                                    string[] splitString1 = string1.Split(' ');
                                    GloabalVariables.QualityCollection.Add("GOOD");
                                    GloabalVariables.ReadableTags.Add(i);
 
 
                                if (splitString1[1] == "{System.Boolean}")
                                    {
                                        //splitString1[0] = splitString1[0].Substring(0, 1);
                                        if (splitString1[0] == "False")
                                            GloabalVariables.BooleanValueCollection.Add(false);
                                        else
                                            GloabalVariables.BooleanValueCollection.Add(true);
 
 
                                    }
                                    else
                                    {
 
                                        GloabalVariables.DoubleValueCollection.Add(Convert.ToDouble(splitString1[0]));
 
                                    }
 
                                    Console.WriteLine(i + ". " + TagSubArray[i] + ": " + splitString1[0]);
                                    WriteTagName.WriteLine(i + ". " + TagSubArray[i] + ": " + splitString1[0]);
 
                                }
                                else
                                {
                                    GloabalVariables.QualityCollection.Add("BAD");
                                    GloabalVariables.ErrorMessageCount++;                                  
 
                                }
 
                            }
                            catch (IndexOutOfRangeException e)
                            {
                               // GloabalVariables.ErrorMessageCount++;
                                Console.WriteLine("Index out of range exception " + TagSubArray[i] + "  " + e.Message);
                                Console.WriteLine("Recived Message : " + vtqResults[i].Vtq + "LENGTH OF MESSAGE = " + vtqResults[i].Vtq.ToString().Length);
                                ErrorLogWriter("OPC Funtion :" + "IndexOutOfRangeException" + e.Message );
                            }
                            catch (OpcException e)
                            {
                               // GloabalVariables.ErrorMessageCount++;
                                Console.WriteLine("OPC exception " + e.Message);
                                ErrorLogWriter("OPC Funtion :" + "OPC Exception" + e.Message);
                            }
 
                            catch (Exception e)
                            {
                              //  GloabalVariables.ErrorMessageCount++;
                                Console.WriteLine(e.Message);
                                ErrorLogWriter("OPC Funtion :" + "General Exception" + e.Message);
                            }
                            finally
                            {
 
                             if (GloabalVariables.ErrorMessageCount > (vtqResults.Length - 1))
                             {
                                 GloabalVariables.ErrorMessageCount = 0;
                                 GloabalVariables.QualityCollection.Clear();
                                 GloabalVariables.ReadableTags.Clear();
                                 GloabalVariables.BooleanValueCollection.Clear();
                                 GloabalVariables.DoubleValueCollection.Clear();
                                 easyOPCClient.Reset();                                 
                                 easyOPCClient.Isolated = true;
                                 easyOPCClient.InstanceParameters.Timeouts.ReadItem = 30000;//set 20 seconds timeout for read item
                                 easyOPCClient.InstanceParameters.Mode.AllowAsynchronousMethod = false;
                                 easyOPCClient.InstanceParameters.UpdateRates.ReadAutomatic = Timeout.Infinite;
                                 easyOPCClient.InstanceParameters.UpdateRates.WriteAutomatic = Timeout.Infinite;
 
 
                                //clearBuffers();
                                GloabalVariables.ReInitialise = true;                               
 
                             }
 
 
 
                            }         
 
 
 
                    }
                }
                catch (OpcException e)
                {
                    Console.WriteLine("OPC exception " + e.Message);
                    ErrorLogWriter(" Read OPC Value : OPCException" + e.Message);
 
                }
                catch (FileNotFoundException e)
                {
                    Console.WriteLine("OPC exception " + e.Message);
                    ErrorLogWriter(" Read OPC Value : FileNotFoundException" + e.Message);
                }
                catch (Exception e)
                {
                    Console.WriteLine("OPC exception " + e.Message);
                    ErrorLogWriter(" Read OPC Value : General Exception" + e.Message);
                }
 
                WriteTagName.WriteLine(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff") + " End Cycle :" + countCycle.ToString());
                Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff") + "  End Cycle :" + countCycle.ToString());
 
                WriteTagName.Close();
                countCycle++;
                System.Threading.Thread.Sleep(1300);
 
 
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                ErrorLogWriter(" Read OPC Value : General Exception" + e.Message);
 
            }
            finally
            {
 
 
            }
            return;
 
 
 
        }


Closing of application:

while closing the application, we are disposing the OPC DA Client instance.
easyOPCClient.Dispose();

Let us know any other details required.

we are struggling to fix the issue. please kindly share your help to overcome the issue.
Last edit: 07 Feb 2018 12:26 by support.

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

Moderators: support
Time to create page: 0.096 seconds