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 COM
- Reading, Writing, Subscriptions, Property Access
- Instantiate the client objects multiple times
Instantiate the client objects multiple times
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Yes, definitely. Unless there are some "hidden" problems that we do not know about yet, with pythonnet you get at least three advantages:
1) Cleaner architecture (and a chance for better performance) - the unnecessary COM layer in between QuickOPC and Python goes away.
2) Cleaner and shorter syntax.
3) Ability to use more features of QuickOPC (not everything is directly exposed in COM - but everything in available in .NET).
Best regards
Please Log in or Create an account to join the conversation.
I actually forgot to mention that I successfully used 'extension' methods with 'pythonnet'.
Here is the implementation of 'WriteValue'.
Part of the message is hidden for the guests. Please log in or register to see it.
So you mean that using clr directly is much better than COM objects could be?
Thanks in advance.
Best Regrads!
Please Log in or Create an account to join the conversation.
Never mind, I could refine the code.
I have to test it further but I think it's already worth to show it (pythonnet.github.io) as an alternative way besides win32com.client.
Thanks for your cooperation.
Best Regards.
Part of the message is hidden for the guests. Please log in or register to see it.
Please Log in or Create an account to join the conversation.
So, in the example you posted, you are actually not using the extension methods approach, you are using the "core" ReadMultiple methods. That is fine too, of course.
I do not quite understand your question. What do you mean by that you "have to" do it this way? Have you tried the shorter syntax (and if so, what was the code and what was the problem), or do you know the shorter syntax at all?
Best regards
Please Log in or Create an account to join the conversation.
I really appreciate your help. It works!
Part of the message is hidden for the guests. Please log in or register to see it.
I noticed some things.
In the example , ReadMultiple's method constructor is given an array of UAReadArguments, which can be instantiated with the necessary parameters. In contrast to Python, where as you can see, I first (have to) create the array, then assign a new empty UAReadArguments object to each index, then I have to provide the right EndpointDescriptor, and NodeDescriptor. Could you shed some light on this "behavior"?
// Obtain attribute data. By default, the Value attributes of the nodes will be read.
UAAttributeDataResult[] attributeDataResultArray = client.ReadMultiple(new[]
{
new UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/;i=10845"),
new UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/;i=10853"),
new UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/;i=10855")
});
Thanks for your cooperation in advance.
Best Regards!
Please Log in or Create an account to join the conversation.
And, most likely I know what is causing your problem.
The EasyUAClient object actually only has a handful methods on it - those that do the "core" work. The remaining methods are implement as so-called extension methods over the IEasyUAClient interface that EasyUAClient implements. The extension methods are not methods on EasyUAClient or IEasyUAClient. They are actually static methods on an "unrelated" class, and the IEasyUAClient interface needs to be passed to them as an addition first argument. C# and VB.NET can make the extension methods "appear" as if they were true methods on the object or interface, but most likely pythonnet cannot do that.
Look here: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...c.UA.EasyUAClient_members.html
You will find that for reading, there is only the ReadMultiple method listed under "Public Methods". The ReadValue method you are trying to use, and many other ReadXXXX methods, are listed under "Extension Methods". All these other methods simply transform the inputs and outputs of the ReadMultiple method, but otherwise they do the same thing (reading), so there is no reason for them to exist on the IEasyUAClient interface. And, if you click on the ReadValue method link, it will lead you here:
opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...ClientExtension~ReadValue.html
From there, you can see how you will need to call the ReadValue method in pythonnet: You need to figure out how to call static methods on IEasyUAClientExtension class. I can see something about it, with an example, right here: pythonnet.github.io/ .
You will then then pass in your "client" variable as an additional first argument.
Note: I could not read what is in the image you have attached, it is blurred, but it probably is not needed at this moment..
Best regards
Please Log in or Create an account to join the conversation.
I would like to use pythonnet, and access directly to .NET types.
Part of the message is hidden for the guests. Please log in or register to see it.
I could achieve some results, for instance I could import the EasyUAClient but it throws the below error.
Part of the message is hidden for the guests. Please log in or register to see it.
I enclosed the client object how I can see in PyCharm.
Could you help me figuring out why I cannot access ReadValue.
I tried the C# example as well with no luck.
Part of the message is hidden for the guests. Please log in or register to see it.
Thanks for your help in advance.
Best Regards!
Please Log in or Create an account to join the conversation.
Thank you for pointing the attention to pythonnet. I was not aware of this tool. From my point of view, in principle that should be definitely much better approach, even better than going through COM (pywin32). But, as opposed to pywin32, we have not tried or tested with pythonnet at all yet. So I cannot guarantee whether it will work or well.
Since this looks like a nice tool, at some we will look at it and if it works, even provide some guidance and example. But cannot do that right now - there is other development work ongoing. If you want to try it out, you will be more than welcome!
Regarding your other question which seems to be involved with the performance: Getting value at rates like 100 milliseconds is definitely achievable - but you also need to tell how many such items you will monitor, because the more items the more bandwidth & other resources are needed.
You can use the trial version to test out everything upfront.
Best regards
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-Classic in COM
- Reading, Writing, Subscriptions, Property Access
- Instantiate the client objects multiple times