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.

Non-simple data types

More
18 Feb 2011 11:54 #278 by Emilio
Replied by Emilio on topic Re: Non-simple data types
Thanks for your answers. I only logged in right now and I've noticed the two new answers from you, that's why I'm reply so late. In fact it is exactly as you said, I wanted to inform you about the array problem because it might have been hiding something unwanted at your side. I even do not have to rebuild my code because I can deal both cases (also the old "wrong" one) independently of Read/Subscribe. Anyway I will obviously download the new version.
For the time being I have no other issues, all the real OPC DA Servers used by us deliver data in the standard (the easiest) types, already tested and working well.
Nice weekend and thanks!
Best regards,
Emilio

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

More
12 Feb 2011 14:47 #277 by support
Replied by support on topic Re: Non-simple data types
As to the necessity of conversion of CY and DECIMAL for OPC-UA, the behavior is correct. The design is such that all types are converted to CLS-compliant types so that any .NET programming language can consume them (CLS is Common Language Specification, see e.g. "What is the Common Language Specification?"). The fact that you want to transfer the types to/from OPC-UA is application-specific, and is therefore your responsibility to provide proper conversions.
I have to thank you very much for your fedback, and especially the difference between ReadItem and subscription which you have described. It seemed innocent at first look, but in fact it allowed me to discover a series of hidden bugs - mostly related to types conversions and especially with arrays, but also others. I have fixed them all, and the updated component and associated Bonus Pack are now available on this site (it is build 5.04.75.1).
With arrays, the proper behavior is to return .NET array of specific element type - not just array of Objects. For example, accessing "Simulation.ReadValue_ArrayOfCY" item is now giving System.Decimal[] (not System.Object[]) for both reading and via subscription. Note that this may need a change in your existing code, if you are relying on the old (incorrect) behavior.
I am also attaching the output from the enhanced ConsoleDataTypes example, showing how the various data types work.
out.txt

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

More
10 Feb 2011 10:47 #272 by support
Replied by support on topic Re: Non-simple data types
In the case of reading Simulation.Register_DISPATCH, similarly to the original problem with reading arrays, the initial value contained in Register_DISPATCH was VT_EMPTY, and this one cannot be converted to IDispatch, and that's why the exception occurred - in my view, correctly.
I have now changed the Simulation OPC Server so that the initial value of Register_DISPATCH is VT_DISPATCH, with a "null" interface pointer. This one actually works well even with your existing QuickOPC.NET build (and converts to "null" .NET object).
I have also added reading and displaying of Register_DISPATCH to the ConsoleDataTypes example in Bonus Pack.
Both these changes will be in builds 5.04.74.1 and later, which will be posted to this site soon, most likely during today.
support

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

More
08 Feb 2011 13:59 #271 by Emilio
Replied by Emilio on topic Re: Non-simple data types
Hello Mr. Zahradnik,
I just post this for your info (it's not a problem for me): I had to convert CY and DECIMAL, and ArrayOfCY, because OPC UA Variants cannot accept these types (there is no automatic conversion). The conversion is fine now, but I've noticed "on the way" that if I Read or Subscribe the following item:
"Simulation.ReadValue_ArrayOfCY"
I get two different data types back.
By reading (ReadItem) -> {System.Object[]}
By subscribing -> {System.Decimal[]}
I implemented both conversions, to Double[], and it works fine.
Best regards,
Emilio

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

More
08 Feb 2011 10:25 #270 by Emilio
Replied by Emilio on topic Re: Non-simple data types
Hello again, I only saw right now your reply. With VT_EMPTY there are still problems, example by reading the Simulation.Register_DISPATCH, I get the following exception:

A first chance exception of type 'OpcLabs.EasyOpc.OpcException' occurred in EasyOpcDANet.dll
2/8/2011 11:18:44 AM: EXCEPTION: OPC operation failure at OpcLabs.EasyOpc.DataAccess.EasyDAClient.CheckComResult(Int32 hResult, IErrorInfo* pErrorInfo)
at OpcLabs.EasyOpc.DataAccess.EasyDAClient.ReadItem(ServerDescriptor serverDescriptor, DAItemDescriptor itemDescriptor)
at OpcLabs.EasyOpc.DataAccess.EasyDAClient.ReadItem(String machineName, String serverClass, String itemId, VarType dataType)
at OpcLabs.EasyOpc.DataAccess.EasyDAClient.ReadItem(String machineName, String serverClass, String itemId)


My call is like in the following: DAVtq vtq = OpcDaClient.ReadItem(var.MachineName, var.ServerClass, var.ItemId);
Best regarrds, Emilio

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

More
08 Feb 2011 10:16 #269 by Emilio
Replied by Emilio on topic Re: Non-simple data types
Hello,
I must apologize for my too quick answer yesterday...I did again some test and I noticed that the three types CY, DATE and DECIMAL work fine!
If I write a complete DATE into the simulation server then I can read it correctly from my .NET client. About CY and DECIMAL, I get exception but not from the QuickOPC.NET, rather from the OPC UA Libraries, because I do not convert these types properly.
I have at the moment no further issues concerning the QuickOPC.NET, it works just fine.
Thanks for supporting, best regards,
Emilio

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

More
07 Feb 2011 13:39 #268 by support
Replied by support on topic Re: Non-simple data types
Hello,
thanks for positive feedback. On my part, I would still like ot make sure that there is no problem with VT_EMPTY. Which item are you reading? Can you send the details of the exception? Are you getting exception diirectly in the ReadItem call, or in some code that is processing the result? Can you post that part of your code?
Thank you
Zbynek Zahradnik

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

More
07 Feb 2011 08:57 #267 by Emilio
Replied by Emilio on topic Re: Non-simple data types
Hello, I downloaded the new version 5.04.66.1 and I could test (succesfully) all the array types. Also if I write into the old one, as you mentioned, then I can read everything correctly. I have a minor issue concerning the DATE type, which is however not a problem at the moment: I only pass the Variant "as it is" to the OPC UA Node and I get a Date about 100 years ago...probably I have to set something in some property in order to get the matching date.
I tell you only for your info, because it does not disturb me at all, that I still get exceptions when I read a VT_EMPTY item, by using the standard ReadItem().
This is anyway not a problem for me because I catch exceptions and I re-map values and qualities according to our rules, but maybe it's useful info for you.
Thanks a lot and best regards,
Emilio

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

More
07 Feb 2011 07:21 #266 by Emilio
Replied by Emilio on topic Re: Non-simple data types
Hello Mr. Zahradnik, thanks for your quick answer. You got exactly my problem, whenever OPC DA client shows VT_EMPTY, then I receive an exception from within QuickOPC.NET. Actually at the moment we need only simple types, and they work fine. I'm only trying to implement as much as possible now to avoid having unexpected problems later. I will download the new QuickOPC.NET and try it again.
Thank you and best regards,
Emilio

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

More
06 Feb 2011 09:18 #264 by support
Replied by support on topic Re: Non-simple data types
I should add that the simulation server has been extended by new OPC items providing the supported types without a need to write into them first. For most part, they contain ramping values between 0 and 10; arrays contain 21 elements (0-20) that all ramp in the same way.

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

Moderators: support
Time to create page: 0.067 seconds