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.

QUICKopc Client application missing the values and not retaining back

More
07 May 2018 05:39 #6302 by support
An introductory note: Although the error message mentions queue overflow as one of the possible causes, it is quite unlikely that it is the actual cause in this case. Better to refer to the error as read timeout, as it says at the beginning of the message.

The timeout can happen e.g. when the network connection is broken, but it should disappear after it is reconnected. We have tried to reproduce the fact that the error does not resolve itself after some time, and found one instance in which it could happen. It has to do with the situation when the client code in QuickOPC tries to obtain error messages from the OPC server for the errors it received, but because the server is not accessible, each of these calls takes too long and, when in an internal loop with many items, causes what appears as "indefinite" period of timeouts.

We have made a fix for this particular case. The fix is available in QuickOPC (2018.1) installation that is now currently on our Web site (and also the packages on NuGet). The version and build are 5.52.184.1 or higher.

Can you please rebuild your application with the new build. Everything else should stay the same. We cannot know, however, if the fix we have made actually addresses the situation you are encontering, or something different.

Regards

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

More
24 Apr 2018 07:33 - 24 Apr 2018 07:43 #6261 by SENTHILKUMAR
how to clear the queue overflow error?
Last edit: 24 Apr 2018 07:43 by SENTHILKUMAR. Reason: we can continue in another thread as you decided

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

More
23 Apr 2018 17:36 - 23 Apr 2018 17:37 #6258 by support
I will try to reproduce it, but there is not a substantial difference from what we tested already anyway - and we haven't seen this problem.
Last edit: 23 Apr 2018 17:37 by support.

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

More
20 Apr 2018 16:26 #6251 by SENTHILKUMAR
Dear z,

Final we arrived the situation of Quick OPC Client Hang UP issue. please check the below scenario at ur premise.

Condition : OPC Client and OPC Server running in different computers

in our code,we mentioned below

Variable declaration

static readonly EasyDAClient easyOPCClient = new EasyDAClient();

easyOPCClient is declared as a global static variable to use through out the program. and also as you suggested, we are using the same instance always in our application without disposing it. end of the application we are disposing the same.

Variable Initialization :


EasyDAClient.SharedParameters.TopicParameters.SlowdownWeight = 0.0f;
EasyDAClient.SharedParameters.TopicParameters.SpeedupWeight = 0.0f;


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;
EasyDAClient.SharedParameters.ClientParameters.UseCustomSecurity = false;


Reading OPC Values

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);

for (int i = 0; i < vtqResults.Length; i++)
{
if(vtqResults.Succeeded && vtqResults.Vtq.HasValue)
{
Console.WriteLine(" value of {2} - {0} is {1} with quality {3}",subarray, vtqResults.Vtq.Value ,GloabalVariables.AliasCollection[GloabalVariables.TagCollection.IndexOf(Convert.ToString(subarray.NodeId))], vtqResults.Vtq.Quality);
// LogWriter(" value of " + subarray + " is " + vtqResults.Vtq.Value);
GloabalVariables.ItemBuffer.Add(Convert.ToString(subarray.NodeId));
GloabalVariables.ValueBuffer.Add(Convert.ToString(vtqResults.Vtq.Value));
GloabalVariables.DatatypeBuffer.Add(Convert.ToString(vtqResults.Vtq.ValueType));
// GloabalVariables.QualityBuffer.Add(Convert.ToString(vtqResults.Vtq.Quality));

}
else
{
ErrorLogWriter(" error while reading " + subarray.NodeId + " - " + vtqResults.ErrorCode + " - " + vtqResults.ErrorMessageBrief + "-" + vtqResults.StatusInfo);
if(vtqResults.ErrorCode == 0)
{
GloabalVariables.ErrorItemBuffer.Add(subarray.NodeId);
// GloabalVariables.QualityBuffer.Add(Convert.ToString(vtqResults.Vtq.Quality));

our Observation on Error causing situation:

whenever
1. OPC Server disconnected exactly while executing (or)
2. OPC Server stopped working (or)
3. LAN Connection disconnected between OPC CLIENT AND OPC SERVER

at the line of code:
DAVtqResult[] vtqResults = easyOPCClient.ReadMultipleItems(ServerDetail, subarray);

The application continuously waiting at this point . the control of the application freezed at this point whenever LAN Discooneted or OPC Server Stopped at this point eventhougfh we defied . another poossibliiy is stop the OPC Server eacatly at the Readmultiple Itesm method.

whenever this hang up Scenarion occurs, THE APPLICATION IS NOT able to retain and remain stay at that point itself.that is readmultiple item method.



please guide what could we do to is issue. why the application control is not comming out when the



Moreover,

whenever we are reading OPC tags values, readmulipleitems method, it can handle only 700 tags. not more than that.

please prvoide us solution to overcome hag up issue.

Note : subcription totally not working with OSI PI Soft server.



}


}


Eventhough read timeout is defined as 30 seconds and it was not retaining the application application got freezed at this situation. please provide a solution to over cpme the issue

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

More
19 Mar 2018 08:14 #6158 by support
Hello,
I am glad that you have better results with the subscriptions.

As to the increase in memory (Task manager), most likely there is no memory leak at all. For an explanation and test related to this (although it is with OPC UA), see www.opclabs.com/forum/ua-general/2278-internal-long-running-test-results .

Basically, in .NET you cannot expect the memory follow your wishes. It is managed by the .NET CLR and is not deterministic. Specifically, two memory consumption numbers taken at different times do not show anything. The memory consumption may easily drop down later.

If you are still concerned, run PerfMon together with your app, and collect the necessary statistics over the long run (as shown in the link above, it usually has to be many days, over a week is preferred). It would only be suspicious if the graph then shows a clean upward trend.

Regards

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

More
18 Mar 2018 04:27 - 19 Mar 2018 08:06 #6156 by SENTHILKUMAR
Dear Z,

thanks for continuing support. as per your guidance, we started using OPC DA subscription. the application working fine and no more issue of *pp Error or thread terminations. and also application also running continuously for last 15 days.

In this 15 days, we observed process memory is increasing in the task manager. while we starting the application we observed the process memory was around





the process memory keeps increasing. for your observation, we attached screenshots.

the subscribe function we are using is below
static void SubscribeOPCTagValues()
        {
            int count = GloabalVariables.TagCollection.ToArray().Length;
            string[] TagSubArray = GloabalVariables.TagCollection.ToArray();
            var argumentArray = new DAItemGroupArguments[count];
            //server descriptor need to define
            try
            {
                if (GloabalVariables.TriggerSubscribe)
                {
                    LogWriter(" Start subscribing");
 
                    easyOPCClient.ItemChanged += easyDAClient_ItemChanged;
 
                    for (int i = 0; i < count; i++)
                        argumentArray[i] = new DAItemGroupArguments(HostName, ServerClass, GloabalVariables.TagCollection[i], 10000, null);
 
                    easyOPCClient.SubscribeMultipleItems(argumentArray);
                }
            }
            catch(Exception e)
            {
                Console.WriteLine("Error while subscribe items" + e.Message);
                ErrorLogWriter("Error while subscribe items  "+e.Message);
            }
            finally
            {
                GloabalVariables.TriggerSubscribe = false;
            }
 
 
 
 
            return;
        }
the event handler
static void easyDAClient_ItemChanged([NotNull] object sender, [NotNull] EasyDAItemChangedEventArgs e)
        {
            string string1;
            string[] splitString1;
            Console.WriteLine("{0}: {1}", e.Arguments.ItemDescriptor.ItemId, e.Vtq);
 
 
 
 
            if(e.Exception != null)
            {
                Console.WriteLine(" Error at Event Handler" + e.Exception);
                ErrorLogWriter(" Error at Event Handler" + e.Exception);
            }
            else
            {
                //LogWriter(e.Arguments.ItemDescriptor.ItemId + " " + e.Vtq.ToString());
                string1 = Convert.ToString(e.Vtq);
                splitString1 = string1.Split(' ');
                GloabalVariables.SystemTime = DateTime.Now;
               // Console.WriteLine("The time of subscribe :" + GloabalVariables.SystemTime);
                if (GloabalVariables.TotalTagsSubcribed < GloabalVariables.TagCollection.Count)
                {
                    GloabalVariables.ReadableTags.Add(GloabalVariables.TagCollection.IndexOf(e.Arguments.ItemDescriptor.ItemId));
                    if (string1.Length > 30)
                    {
 
                        GloabalVariables.QualityCollection.Add("GOOD");
 
 
                        if (splitString1[1] == "{System.Boolean}")
                        {
                            GloabalVariables.BooleanTagCollection.Add(e.Arguments.ItemDescriptor.ItemId);
                            if (splitString1[0] == "False")
                                GloabalVariables.BooleanValueCollection.Add(false);
                            else
                                GloabalVariables.BooleanValueCollection.Add(true);
                        }
                        else
                        {
                            GloabalVariables.DoubleTagCollection.Add(e.Arguments.ItemDescriptor.ItemId);
                            GloabalVariables.DoubleValueCollection.Add(Convert.ToDouble(splitString1[0]));
 
                        }
                        GloabalVariables.TotalTagsSubcribed++;
 
                    }
                }
                else
                {
                    int BoolIndex = GloabalVariables.BooleanTagCollection.IndexOf(e.Arguments.ItemDescriptor.ItemId);
 
 
                    if(BoolIndex < 0)
                    {
                        int DoubleIndex = GloabalVariables.DoubleTagCollection.IndexOf(e.Arguments.ItemDescriptor.ItemId);
                        GloabalVariables.DoubleValueCollection[DoubleIndex] = Convert.ToDouble(splitString1[0]);
                    }
                    else
                    {
                        if (splitString1[1] == "{System.Boolean}")
                        {
 
                            if (splitString1[0] == "False")
                                GloabalVariables.BooleanValueCollection[BoolIndex] = false;
                            else
                                GloabalVariables.BooleanValueCollection[BoolIndex] = true;
                        }
 
                    }
                    GloabalVariables.TotalTagsSubcribed++;
                    if(GloabalVariables.TotalTagsSubcribed > GloabalVariables.ReadableTags.Count)
                    {
                        Console.WriteLine(" The length of Total readable tags {0}", GloabalVariables.ReadableTags.Count);
                       // Console.WriteLine(" Total subscribed count  {0}", GloabalVariables.TotalTagsSubcribed);
                        GloabalVariables.TotalTagsSubcribed = GloabalVariables.ReadableTags.Count + 1;
 
                    }
                }
 
 
 
            }
 
        }
 

we could not understand why process memory need to increase. we checked with visual studio memory utilty, there also memory keeps increasing.

we are unsubscribing while quiting the appllicaytion. please find below unsubscribe

static void UnSubscribeOPCTagValues()
        {
 
            try
            {
                if (!GloabalVariables.TriggerSubscribe)
                {
                    LogWriter("UNsubscribing");
                    easyOPCClient.UnsubscribeAllItems();
                    easyOPCClient.ItemChanged -= easyDAClient_ItemChanged;
                    Thread.Sleep(1000);
                }
            }
            catch(Exception e)
            {
                Console.WriteLine("Error while unsubscribe items  " + e.Message);
                ErrorLogWriter("Error while unsubscribe items  " + e.Message);
            }
            finally
            {
                GloabalVariables.TriggerSubscribe = true;
            }
 
            return;
        }
please clarify us why process memory is increasing?

how to avoid the issue in OPC-DA SUBSCRIPTION?
Attachments:
Last edit: 19 Mar 2018 08:06 by support.

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

More
15 Feb 2018 10:20 #6050 by support
Hello,
here are my replies:

will you please share of code using subscribeMultipleItem method and required initialization parameters to avoid further communication regarding error or missed out parameters,


The documentation and the product are filled with examples. Some of them:

1. initialization parameters like asynchronous , security, shared instances, update rates

We have discussed the update rates. Synchronous/asynchronous setting does not apply to subscriptions (they are always asynchronous). Security settings depend on the installation and we cannot know which ones are right for you. For the remaining settings, do not change them at the beginning, keep them at their defaults. Only change them when there is a reason for it.

2. piece of code using subscribemultipleItem Method

See above.

3. Arguments infor related to subcribeMultipleMethod

There is a Reference documentation you should study. E.g.:

4. while quiting the application, clearing of buffer and disposing of opc DA instance and other take care conditions

Call easyDAClient.UnsubscribeAllItems. That should be sufficient.

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

More
13 Feb 2018 23:05 #6045 by SENTHILKUMAR
Dear Z,

clarifying in much better way :

almost you got my idea. the OPC server has alive counter to check the status alive. the alive counter from 0 - 59 and resets to zero. then cycle continues. the counter increments for every seconds.

as per your explanation, we understood below that

if we need every 10 seconds 1000 OPC data points (or tag values) from OPC server, in our code , we need to keep update rates as 5 seconds or lower, the OPC client can subscribe the values of OPC tags .

will you please share of code using subscribeMultipleItem method and required initialization parameters to avoid further communication regarding error or missed out parameters,

please below our needs in detail

1. initialization parameters like asynchronous , security, shared instances, update rates

2. piece of code using subscribemultipleItem Method

3. Arguments infor related to subcribeMultipleMethod

4. while quiting the application, clearing of buffer and disposing of opc DA instance and other take care conditions

thanks for continuing your long support.

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

More
13 Feb 2018 19:39 - 13 Feb 2018 19:42 #6044 by support
Hello, here are my replies to the second post of yours.

the subscription works only on change of OPC Tag values.


Yes. But all changes are guaranteed to go through (or, if it's not possible, you will receive an error; but nothing will be "silently lost").

our system has counter, the counter will be running every seconds. it will starts from 0 to 59 and resets to zer0 and cycle continues.

is it possible to subscribe 1000 tags with reference to system counter (0 - 59 ) explained above?

I do not quite understand the question, but the answer is likely to be Yes - it is possible to subscribe to any OPC tags, and 1000 is not too high a number. It is not clear to me what the role of the counter is - are you planning it for some kind of keep-alive check? If so, what do you mean by "... tags with reference .... to the counter"? What do you mean by 'reference' here?

and also we had a new requirement of OPC server values need to log in database. we need to log 1000 data ( from OPC Server) in database for every 10 seconds . so we are planning to subscribe 1000 tags at ten seconds interval with reference to system Counter (0 -59 explained above).

Again, it's unclear what the counter is supposed to do here. You can subscribe with 10 seconds update rate to 1000 tags without any counter. The "update rate" means, roughly, that the server should send the changes no sooner. So if you want to be sure you capture each change in 10 seconds interval, your update rate should rather be 5 seconds or lower.



Note: "Change" is detected for each OPC item separately. If your idea was somehow that the counter changing every second would cause other item values be sent with it, then this will not work. But there also should be no need for something like that. A change is sent when there is one. So you just need to specify the desired update rate with the items you are interested in. If they are not changing frequently, then even with relatively fast update rate, the communication will not get overwhelmed, because only the true changes are being transferred.


Regards
Last edit: 13 Feb 2018 19:42 by support.

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

More
13 Feb 2018 07:01 - 13 Feb 2018 07:02 #6040 by support
Hello. Here are the replies to your first post.

please confirm whether subscription will have the queue size issue?

There was no queue size issue with Read either. You probably got confused by the fact that the error text mentions the queue overflow as one of possible reasons. But it is very unlikely that this was the actual cause, especially given the occurrence of the other error (*ppErrors message).

if yes whats maximum size of the queue we need to define?

See above - do nothing.

How subscription differs from ReadMultipleMethod?

This is explained here: www.opclabs.com/resources/technology-opc/about-opc/opc-glossary

whether *pp error was handled in Subscription concept?

The particular error was related to Read-s only, so precisely the same error cannot appear with just subscriptions. And the hope is that nothing similar will appear either.


I will reply to your other post later.

Regards
Last edit: 13 Feb 2018 07:02 by support.

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

Moderators: support
Time to create page: 0.286 seconds

      

 Recommend this on Google