- Posts: 35
- Thank you received: 0
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
- SENTHILKUMAR
- Topic Author
- Offline
- Platinum Member
we had gone through your forum on subscription. we identified below code based on subscription
kb.opclabs.com/QuickOPC.NET:_How_to_log_OPC_Data_Access_item...ges_into_a_SQL_Server_database
for understanding purpose, please confirm, the subscription works only on change of OPC Tag values.
if yes, please confirm below statement.
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?
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).
please guide us how to proceed?.
whether above logic will work out (without any queue error or PP Error).
do you have any other suggestion, please let us know.
Please Log in or Create an account to join the conversation.
- SENTHILKUMAR
- Topic Author
- Offline
- Platinum Member
- Posts: 35
- Thank you received: 0
please confirm whether subscription will have the queue size issue?
if yes whats maximum size of the queue we need to define?
How subscription differs from ReadMultipleMethod?
whether *pp error was handled in Subscription concept?
Please Log in or Create an account to join the conversation.
here are my responses.
Not really (except for a recommendation to rewrite the code using subscriptions, see further below).if any modification required on the code , please do the same and share to us?
There are no specific settings prescribed just for QuickOPC. Follow the procedures for OPC that are to be found on the Web. The precise procedure, however, isn't documented anywhere, because it depends highly on many factors - among others, OS versions and installed updates. Most importantly, however, when you are able to read initially, you have no need to suspect that COM/DCOM settings are causing any of these problems. Just keep them as they are now.Also please share the COM / DCOM settings that should be strictly followed for Quick OPCwe are using generic document for COM/ DCOM Settings?
My understanding is that you are reading approx. 1000 tags once per 10-60 seconds. That's not too high.whether the issue is may be too high tag values?
Yes that's OK. You can even create many instances. You should, however, avoid creating new and new ones perpetually.is it ok that can we create 2 instance to easy easyopcDAclient?
There is no absolute limit, it all depends on resource limitations (memory, CPU, network etc.). If the numbers are as I mentioned above, it's certainly OK.whats the maximum OPC tags that Quick OPC can Handle?
If the question is whether we were able to reproduce the error, the answer is No. That is the biggest issue. If we could reproduce it, we would be able to fix it. We cannot use your code directly, but we have tested with equivalent code (doing repeated reads). If you could at least provide a code that sometimes shows the issue with some OPC server available to us, we could then try it on several computers and hopefully it would show up. Or, if you had a virtual machine image with the server+client that shows the issue and can be transferred to us, we again should then be able to diagnose it and fix it.in your reply,observed that reproducing of the error?
I do not understand this question. Please try to re-formulate.is there any possible method to compare the previous occurence?
I think I cannot tell because I do not have that piece of code. Can you please send it or point me to it. In general, however, no clean-up is actually necessary.are we clearing the instance properly?
But in one piece of your original code, you were calling .Reset - you should not do this at all, and you were also setting some parameters *after* you have already used the EasyDAClient instance for some OPC operations - that is also wrong; any parameters settings should be *before* you call first OPC operation. I already wrote that this should be fixed, so I hope it was.
Yes that's fine.for clearing we simply dispose method.
Nois there any steps need to follow apart from dispose?
I do not understand this question. Please try to re-formulate.is it possible to check available queue data before reading via DAVtq? so that we change can our logic according to the message available
No - not just because it's our proprietary code, but also because it's not just "a function", its tens or hundreds of files and the whole component code that is involved.last option, if there is any possibility to change our Read OPC Function and share to us?
IMPORTANT:
Why precisely are you doing repeated reads? Do you have a reason for not using OPC subscriptions instead?
Can you describe, in very general terms, the purpose and "flow of operations" of your application?
Regards
Please Log in or Create an account to join the conversation.
- SENTHILKUMAR
- Topic Author
- Offline
- Platinum Member
- Posts: 35
- Thank you received: 0
i understood your difficulty. is there any other way to read OPC tag values?
what about subscription option? how it differs from ReadMultipleItem Method?
if there is any bug in the code, please convey the area of code to rectify?
we had a strong belief that issue could be resolved your end until reading the reply.
if any modification required on the code , please do the same and share to us?
Also please share the COM / DCOM settings that should be strictly followed for Quick OPCwe are using generic document for COM/ DCOM Settings?
whether the issue is may be too high tag values?
is it ok that can we create 2 instance to easy easyopcDAclient? whats the maximum OPC tags that Quick OPC can Handle?
in your reply,observed that reproducing of the error?
is there any possible method to compare the previous occurence?
are we clearing the instance properly?
for clearing we simply dispose method.
is there any steps need to follow apart from dispose?
is it possible to check available queue data before reading via DAVtq? so that we change can our logic according to the message available
last option, if there is any possibility to change our Read OPC Function and share to us?
with regards,
senthil
Please Log in or Create an account to join the conversation.
The "Invalid *ppErrors returned..." error may be caused by
- a bug in the OPC Server
- some kind of problem in OPC proxies/stubs or the related system code,
- a bug (memory corruption?) in QuickOPC.
The timeout errors may then be a consequence of the "Invalid *ppErrors returned...". Normally, QuickOPC should be able to recover from transient errors, including timeouts. It is my understanding that this is not happening, i.e. that once you receive a timeout, you keep receiving timeouts "for ever", at least on the same EasyDAClient instance. It looks like that a memory corruption and/or an abnormal thread termination in QuickOPC caused an inability to recover.
So, in the end, I have no good news for you. Your code, although not ideal, is OK in principle. It could be a bug in QuickOPC that is causing this, but we are unable to tell more without actually being able to reproduce it here (can you reproduce something like e.g. with the OPC server that we distribute with the toolkit, or some other server that we can get hold of? If so, we could try to reproduce it here, too).
With this, you could only "mitigate" the negative effects - try to detect the problem and work around it. It looks like that you are already doing so, by creating a new instance of the EasyDAClient. That will work for some time, but it is not clear whether the old instances will not leave behind some memory or threads or other resources. So over time, it would be advisable to restart the process.
I know these are unfortunate news, but without having ability to reproduce and debug the problem here, we cannot determine the precise cause, and therefore we cannot fix it.
Regards
Please Log in or Create an account to join the conversation.
I agree with the first part of the changes (with the reservation that the actual ReadItem timeout value depends on the requirements), but *not* with this one:
//set queue size is 90000 since we have to read 1000 OPC Values and each one length is about 80. so instaed of 80000, we are planning to 10000 additional space. sototally 90000.
easyOPCClient.PullItemChangedQueueCapacity = 90000;
I will also reply to your first post, separately.
Please Log in or Create an account to join the conversation.
- SENTHILKUMAR
- Topic Author
- Offline
- Platinum Member
- Posts: 35
- Thank you received: 0
we are panning to introduce the below line in our code during our initialization of the code.
please find below our initialization module.
//for avoiding restart
EasyDAClient.SharedParameters.TopicParameters.SlowdownWeight = 0.0f;
EasyDAClient.SharedParameters.TopicParameters.SpeedupWeight = 0.0f;
easyOPCClient.InstanceParameters.Timeouts.ReadItem = 6000;//set 8 seconds timeout for read item
easyOPCClient.InstanceParameters.Mode.AllowAsynchronousMethod = false;
easyOPCClient.InstanceParameters.UpdateRates.ReadAutomatic = Timeout.Infinite;
easyOPCClient.InstanceParameters.UpdateRates.WriteAutomatic = Timeout.Infinite;
//set queue size is 90000 since we have to read 1000 OPC Values and each one length is about 80. so instaed of 80000, we are planning to 10000 additional space. sototally 90000.
easyOPCClient.PullItemChangedQueueCapacity = 90000;
please confirm any other initialize function need to add.
Invalid *ppErrors returned by IOPCSyncIO/IOPCAsyncIO/IOPCAsyncIO2/IOPCSyncIO2/IOPCAsyncIO3:
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 your input..
please find attached log files. two types error attached reading OPC server (Vtqresult.vtq). the error were captured using vtq.exception.
type 1 error:
Error while extracting the values from OPC Server Read not completed. This error indicates that it could not be verified that the requested read operation was completed during the timeout period. It is possible that the read operation will actually succeed or fail, but later. Increase the timeout period if you want to obtain positive or negative indication of the operation outcome. Other reason for this error may be that under heavy loads, topic request or response queue is overflowing. Check the event log for queue overflow errors (if event logging is supported by the product and enabled).
type 2 error
Error while extracting the values from OPC ServerInvalid *ppErrors returned by IOPCSyncIO/IOPCAsyncIO/IOPCAsyncIO2/IOPCSyncIO2/IOPCAsyncIO3::Read(...)/Write(...).
after your discussion we modified our code as per below
modified code :
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();
string string1;
DAVtqResult[] vtqResults;
//var easyOPCClient = new EasyDAClient();
//EasyDAClient easyOPCClient = new EasyDAClient();
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
{
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);
// OperationException.
// bool test1234 = vtqResults[0].Vtq.HasValue;
for (int i = 0; i < vtqResults.Length; i++)
{
try
{
Debug.Assert(vtqResults[i] != null);
if (vtqResults[i].Succeeded)
{
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);
// Console.WriteLine(" The Boolean is " + GloabalVariables.BooleanValueCollection[GloabalVariables.BooleanValueCollection.Count-1]);
}
else
{
GloabalVariables.DoubleValueCollection.Add(Convert.ToDouble(splitString1[0]));
// Console.WriteLine("the real value is " + RealValue);
}
Console.WriteLine(i + ". " + TagSubArray[i] + ": " + splitString1[0]);
WriteTagName.WriteLine(i + ". " + TagSubArray[i] + ": " + splitString1[0]);
}
else
{
GloabalVariables.QualityCollection.Add("BAD");
GloabalVariables.ErrorMessageCount++;
}
}
else
{
Console.WriteLine(" Error while extracting the values from OPC Server" + vtqResults[i].Exception.Message);
ErrorLogWriter(" Error while extracting the values from OPC Server" + vtqResults[i].Exception.Message);
GloabalVariables.ErrorMessageCount++;
}
}
catch(OperationException e)
{
Console.WriteLine(" Operation exception :" + e.Message);
ErrorLogWriter("OPC Funtion :" + "Operation exception Exception" + e.Message);
}
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 (Exception e)
{
// GloabalVariables.ErrorMessageCount++;
Console.WriteLine(e.Message);
ErrorLogWriter("OPC Funtion :" + "General Exception" + e.Message);
}
finally
{
if (GloabalVariables.ErrorMessageCount > GloabalVariables.TagCollection.Count)
{
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(OperationException e)
{
Console.WriteLine("OPC exception " + e.Message);
ErrorLogWriter(" Read OPC Value : Operational Exception" + 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());
Console.WriteLine(" the license of Quick OPC {0}", easyOPCClient.LicenseInfo);
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;
}
we included operation exception and vtq exception in our code to get the error.please guide us how to overcome the issue
Please Log in or Create an account to join the conversation.
The current name is TopicParameters indeed.
Regards
Please Log in or Create an account to join the conversation.
- SENTHILKUMAR
- Topic Author
- Offline
- Platinum Member
- Posts: 35
- Thank you received: 0
sorry for late info.
we introduced below line in the code as you guided
EasyDAClient.SharedParameters.TopicParameters.SlowdownWeight = 0.0f;
EasyDAClient.SharedParameters.TopicParameters.SpeedupWeight = 0.0f;
we dont have "topic" in our EasyDAClient.Sharedparameters. instead of that we are using "TopicParameters"
whether it will affect any of our Process?
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