- Posts: 32
- 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
- Reading, Writing, Subscriptions, Property Access
- EasyUAClient.WriteMultipleValues takes almost 2 seconds to write to an Int16 field
EasyUAClient.WriteMultipleValues takes almost 2 seconds to write to an Int16 field
Thank you for your answer! Now I have enough information to ask MatrikonOPC support.
// Anders
Please Log in or Create an account to join the conversation.
One of the factors is whether QuickOPC is already connected to the server, or not. If it were *not* connected, then when you call WriteMultipleValues, it first has to connect - and that is actually a process that consists of many steps, AND can take relatively long, especially if the server itself has to start first. But, as it looks from your explanation, you have subscriptions to the server running in the meantime, and that means that the connection is kept open for the duration of the subscriptions. (you have not give an appropriate answer for question number 4, though).
If QuickOPC is already connected to the server, the number of necessary operations is lower. But again, in the depends on the previous state, so there are some conditions. Roughly:
1) If this has not been done before (i.e. a first Write after a successful connection), an OPC group has to be created. This is an "IOPCServer::AddGroup" call in OPC Data Access spec.
Following the AddGroup call, several interfaces will be obtained from the group (QueryInterface), and a callback for results of asynchronous operations will be setup (connection point operations).
2) If the affected OPC item has not been used with this group recently (this would be in case of repetitive Write-s to the same item), an OPC "IOPCItemMgt::AddItems" function will be called.
3) (for OPC-DA 2.0; may be different with OPC-DA 1.0-only servers)
3a) If the server supports asynchronous operations, QuickOPC will call "IOPCAsyncIO2::Write". In this case, your call to WriteMultipleValues will wait until the server sends a callback with the completion ("IOIPCDataCallback::OnWriteComplete").
3b) If we failed to establish an async communication with the server, QuickOPC will call the synchronous method instead ("IOPCSyncIO::Write").
In the end, there is just one "main" call that does the Write, but quite a few preparatory operations that need to be made, at least sometimes. Usually (leaving aside the connection time), however, it is the Write itself that takes most time.
Be aware that the fact that the Write takes 1 second may simply be a correct behavior, e.g. with a slow device/protocol/communication line. The method does not return until it knows whether the operation actually succeeded, and that may take time. Standard Modbus works over relatively slow serial connections.
The fact that with some items it works quickly and with some slowly is also a strong indication that the delay is caused by the server. On the client side, all items are the same to us.
Best regards
Please Log in or Create an account to join the conversation.
2. The write always takes this long
3. [*] the ones we have discovered, since they happens within a time critical segment, only has one value (an Integer that is set to 1 or 0). I have assumed that all the writing take this long...
4. I think it takes the same time all the time.
5. Yes, we have some subscriptions. They seem to be working since the reading works perfectly!
// Anders
[*] Hate to say this but the program is written by a long lost programmer and there are many things I would have done differently but ...
Please Log in or Create an account to join the conversation.
1. Is the server on the same computer as client, or remote?
2. With the particular field, does it always take long, or just sometimes?
3. You mentioned WriteMultipleValues - so are you writing multiple values at once indeed? If so, how many? How do you know which field is responsible for the delay then?
4. Does your application make some OPC operations on the same server BEFORE this problematic WriteMultipleValues, or is it essentially a first call after some (longer) time?
5. Do you maintain some OPC subscriptions to the server at the same time?
Thank you
Please Log in or Create an account to join the conversation.
I'm almost sure that the problem is in the OPC Server, but to get support I need to know what the method does and what OPC function it calls (I don't know much about OPC, which is why I use your excellent product).
We have two machines that uses different PLC so the OPC server (MatrikonOPC UCS) have different modules; Mitsubishi PLC and Modbus. The problem only occurs on Modbus!
// Anders
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- Reading, Writing, Subscriptions, Property Access
- EasyUAClient.WriteMultipleValues takes almost 2 seconds to write to an Int16 field