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.

Multiple threads and QuickOPC

More
22 Jan 2015 10:12 #2627 by support
A.,
Yes, the [QuickOPC] objects should work with multi-threading. Of course I cannot rule a possible bug somewhere; version 5.0x is certainly too old to support.

I will have to know more about the requirements of the application in order to suggest the best performing approach. But, far too often, I can see sub-optimal solutions that develop similarly to this:

1. The customer wants to download a recipe to the technology, based e.g. on a database contents.
2. The read the data from table row by row, and call WriteItemValue
3. They realize that it is too slow.
4. They decide to speed it up by using multiple threads. They write a complicated code that spins off multiple threads, makes the writes, and synchronizes itself. The code is buggy, and due to so much multi-threading, it also sometimes reveal hidden bugs in the component itself.

The proper solution in this case is different – simply call WriteMultipleItemValues with an array that spans through the servers. The component will parallelize it INTERNALLY, and much better than any external code can do. In addition, the code will be much shorter and safer.

Of course I cannot know whether the customer’s situation is alike, but you get the idea – multi-threading is possible, but it is best avoided if method with “Multiple” in their name can be employed.

Best regards

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

More
22 Jan 2015 10:11 #2626 by support
From: A.
Sent: Wednesday, January 21, 2015 2:34 PM
To: ...
Subject: OPC Data.NET Question about Threading

[a customer request]:

We use OPCData .NET 5.0.3 with Win7 64 bit and Visual Studio 2013.
My question is: can we use the OPCData .NET objects on many threads/tasks?

We wrote some code in the past, it was a bit slow since it had a sequential access to many PLCs (10). We tried to speed it up by parallelizing and it was crashing (sometimes, random). Switching back to sequential solved the problem.

Now we need to connect to more PLCs (30) and we definitely need some advice about using the OPCData .NET in many tasks. First of all, is the OPCData .NET component/DLL thread safe? is it allowed to do concurrent read/write and so on?

[end of customer request]

My first thought was that [due to] such an old version that this might be an issue that has been addressed in later builds. From what I know he shouldn’t have any problem running his threads in parallel, is this correct? Would you have any other suggestions as to why he’s having issues?

Thank you for any insight!
A.

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

Moderators: support
Time to create page: 0.045 seconds