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.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- QUICKopc Client application missing the values and not retaining back
QUICKopc Client application missing the values and not retaining back
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.
- SENTHILKUMAR
- Topic Author
- Offline
- Platinum Member
- Posts: 35
- Thank you received: 0
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- SENTHILKUMAR
- Topic Author
- Offline
- Platinum Member
- Posts: 35
- Thank you received: 0
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.
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.
- SENTHILKUMAR
- Topic Author
- Offline
- Platinum Member
- Posts: 35
- Thank you received: 0
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;
}
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;
}
how to avoid the issue in OPC-DA SUBSCRIPTION?
Please Log in or Create an account to join the conversation.
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:
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...o%20OPC%20Classic%20Items.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...d%20of%20Event%20Handlers.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...le%20-%20SubscribeFromXml.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...20Console%20-%20XmlLogger.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...orms%20-%20EasyOpcNetDemo.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...dowsForms%20-%20HmiScreen.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...rms%20-%20SubscribeToMany.html
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.1. initialization parameters like asynchronous , security, shared instances, update rates
See above.2. piece of code using subscribemultipleItem Method
There is a Reference documentation you should study. E.g.:3. Arguments infor related to subcribeMultipleMethod
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...nt~SubscribeMultipleItems.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...ItemSubscriptionArguments.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...cess.EasyDAClient_members.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...on~SubscribeMultipleItems.html
Call easyDAClient.UnsubscribeAllItems. That should be sufficient.4. while quiting the application, clearing of buffer and disposing of opc DA instance and other take care conditions
Please Log in or Create an account to join the conversation.
- SENTHILKUMAR
- Topic Author
- Offline
- Platinum Member
- Posts: 35
- Thank you received: 0
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.
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").
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?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?
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.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).
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
Please Log in or Create an account to join the conversation.
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).please confirm whether subscription will have the queue size issue?
See above - do nothing.if yes whats maximum size of the queue we need to define?
This is explained here: www.opclabs.com/resources/technology-opc/about-opc/opc-glossaryHow subscription differs from ReadMultipleMethod?
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.whether *pp error was handled in Subscription concept?
I will reply to your other post later.
Regards
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- QUICKopc Client application missing the values and not retaining back