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
06 Feb 2011 09:11 #263 by support
Replied by support on topic Re: Non-simple data types
Hello. I have fixed the issues mentioned in my previous post, and some more. The new QuickOPC.NET build (5.04.66.1) is available in the Downloads section, together with an updated Bonus Pack. The Bonus Pack now contains a new example in C# (ConsoleDataTypes) which demonstrates that various less common data type (mainly, arrays) work.
One specific data type that is still not currently supported is VT_ARRAY | VT_DECIMAL, as there appears to be some kind of Windows bug in marshalling this.
If you still experience problems, let me know. If you are interested in data types that still not covered, such as structures (VT_RECORD), we can discuss that, however I need to look into practicality of it - mainly, whether any significant OPC Data Access server actually relies on them.
Best regards, ZZ
P.S. 1: Here is the ConsoleDataTypes source:

using OpcLabs.EasyOpc.DataAccess;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleDataTypes
{
class Program
{
static void ReadAndDisplay(string itemId)
{
Console.WriteLine();
Console.WriteLine("Reading \"{0}\"...", itemId);
var client = new EasyDAClient();
DAVtq Vtq = client.ReadItem("OPCLabs.KitServer.2", itemId);
Console.WriteLine("Vtq.ToString(): {0}", Vtq.ToString());
Array AnArray = Vtq.Value as Array;
if (AnArray != null)
{
Console.Write("Array elements: ");
foreach (object Element in (Array)Vtq.Value) Console.Write("{0} ", Element);
Console.WriteLine();
}
}
static void Main(string[] args)
{
ReadAndDisplay("Simulation.Register_EMPTY");
ReadAndDisplay("Simulation.Register_NULL");
ReadAndDisplay("Simulation.ReadValue_I2");
ReadAndDisplay("Simulation.ReadValue_I4");
ReadAndDisplay("Simulation.ReadValue_R4");
ReadAndDisplay("Simulation.ReadValue_R8");
ReadAndDisplay("Simulation.ReadValue_CY");
ReadAndDisplay("Simulation.ReadValue_DATE");
ReadAndDisplay("Simulation.ReadValue_BSTR");
ReadAndDisplay("Simulation.ReadValue_BOOL");
ReadAndDisplay("Simulation.ReadValue_DECIMAL");
ReadAndDisplay("Simulation.ReadValue_I1");
ReadAndDisplay("Simulation.ReadValue_UI1");
ReadAndDisplay("Simulation.ReadValue_UI2");
ReadAndDisplay("Simulation.ReadValue_UI4");
ReadAndDisplay("Simulation.ReadValue_INT");
ReadAndDisplay("Simulation.ReadValue_UINT");
ReadAndDisplay("Simulation.ReadValue_ArrayOfI2");
ReadAndDisplay("Simulation.ReadValue_ArrayOfI4");
ReadAndDisplay("Simulation.ReadValue_ArrayOfR4");
ReadAndDisplay("Simulation.ReadValue_ArrayOfR8");
ReadAndDisplay("Simulation.ReadValue_ArrayOfCY");
ReadAndDisplay("Simulation.ReadValue_ArrayOfDATE");
ReadAndDisplay("Simulation.ReadValue_ArrayOfBSTR");
ReadAndDisplay("Simulation.ReadValue_ArrayOfBOOL");
//ReadAndDisplay("Simulation.ReadValue_ArrayOfDECIMAL");
ReadAndDisplay("Simulation.ReadValue_ArrayOfI1");
ReadAndDisplay("Simulation.ReadValue_ArrayOfUI1");
ReadAndDisplay("Simulation.ReadValue_ArrayOfUI2");
ReadAndDisplay("Simulation.ReadValue_ArrayOfUI4");
ReadAndDisplay("Simulation.ReadValue_ArrayOfINT");
ReadAndDisplay("Simulation.ReadValue_ArrayOfUINT");
Console.WriteLine();
Console.WriteLine("Press Enter to continue...");
Console.ReadLine();
}
}
}


P.S. 2: Below is a sample output from the ConsoleDataTypes example:

Reading "Simulation.Register_EMPTY"...
Vtq.ToString(): (null) {} @2/6/2011 10:07:00 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.Register_NULL"...
Vtq.ToString(): {System.DBNull} @2/6/2011 10:07:00 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_I2"...
Vtq.ToString(): 1 {System.Int16} @2/6/2011 10:07:01 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_I4"...
Vtq.ToString(): 1 {System.Int32} @2/6/2011 10:07:01 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_R4"...
Vtq.ToString(): 1.405063 {System.Single} @2/6/2011 10:07:01 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_R8"...
Vtq.ToString(): 1.50662899017334 {System.Double} @2/6/2011 10:07:01 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_CY"...
Vtq.ToString(): 1.6082 {System.Decimal} @2/6/2011 10:07:01 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_DATE"...
Vtq.ToString(): 12/31/1899 5:02:03 PM {System.DateTime} @2/6/2011 10:07:01 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_BSTR"...
Vtq.ToString(): 1.85722827911377 {System.String} @2/6/2011 10:07:01 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_BOOL"...
Vtq.ToString(): True {System.Boolean} @2/6/2011 10:07:01 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_DECIMAL"...
Vtq.ToString(): 2.0603609085083 {System.Decimal} @2/6/2011 10:07:02 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_I1"...
Vtq.ToString(): 2 {System.Int16} @2/6/2011 10:07:02 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_UI1"...
Vtq.ToString(): 2 {System.Byte} @2/6/2011 10:07:02 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_UI2"...
Vtq.ToString(): 2 {System.Int32} @2/6/2011 10:07:02 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_UI4"...
Vtq.ToString(): 3 {System.Int64} @2/6/2011 10:07:02 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_INT"...
Vtq.ToString(): 3 {System.Int32} @2/6/2011 10:07:02 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_UINT"...
Vtq.ToString(): 3 {System.Int64} @2/6/2011 10:07:02 AM; Good GoodNonspecific LimitOk (192)
Reading "Simulation.ReadValue_ArrayOfI2"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:02 AM; Good GoodNonspecific LimitOk (192)
Array elements: 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
Reading "Simulation.ReadValue_ArrayOfI4"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:03 AM; Good GoodNonspecific LimitOk (192)
Array elements: 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
Reading "Simulation.ReadValue_ArrayOfR4"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:03 AM; Good GoodNonspecific LimitOk (192)
Array elements: 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949 3.120949
Reading "Simulation.ReadValue_ArrayOfR8"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:03 AM; Good GoodNonspecific LimitOk (192)
Array elements: 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686 3.23325634002686
Reading "Simulation.ReadValue_ArrayOfCY"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:03 AM; Good GoodNonspecific LimitOk (192)
Array elements: 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661 3.3661
Reading "Simulation.ReadValue_ArrayOfDATE"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:03 AM; Good GoodNonspecific LimitOk (192)
Array elements: 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM 1/2/1900 11:14:48 AM
Reading "Simulation.ReadValue_ArrayOfBSTR"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:03 AM; Good GoodNonspecific LimitOk (192)
Array elements: 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592 3.57116222381592
Reading "Simulation.ReadValue_ArrayOfBOOL"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:03 AM; Good GoodNonspecific LimitOk (192)
Array elements: True True True True True True True True True True True True True True True True True True True True True
Reading "Simulation.ReadValue_ArrayOfI1"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:03 AM; Good GoodNonspecific LimitOk (192)
Array elements: 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
Reading "Simulation.ReadValue_ArrayOfUI1"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:03 AM; Good GoodNonspecific LimitOk (192)
Array elements: 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
Reading "Simulation.ReadValue_ArrayOfUI2"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:04 AM; Good GoodNonspecific LimitOk (192)
Array elements: 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
Reading "Simulation.ReadValue_ArrayOfUI4"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:04 AM; Good GoodNonspecific LimitOk (192)
Array elements: 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
Reading "Simulation.ReadValue_ArrayOfINT"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:04 AM; Good GoodNonspecific LimitOk (192)
Array elements: 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
Reading "Simulation.ReadValue_ArrayOfUINT"...
Vtq.ToString(): System.Object[] {System.Object[]} @2/6/2011 10:07:04 AM; Good GoodNonspecific LimitOk (192)
Array elements: 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
Press Enter to continue...

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

More
04 Feb 2011 11:27 #259 by support
Replied by support on topic Re: Non-simple data types
My preliminary checks show that:

The Simulation.Register_ArrayOfI2 initially contains VT_EMPTY, which is by design, but it may be confusing, because you first need to write an array into this item into it in order to get it back. Will think of providing a different item with pre-filled value.
There is a bug inside QuickOPC.NET (tested with 5.04.54.1) that causes an exception be returned when the value is VT_EMPTY (instead of converting it to null). Will fix it.
If you first write an array value into Simulation.Register_ArrayOfI2 using some test client, and then read it back using QuickOPC.NET, it reads just well, and returns an array as expected.

I will fix the issues, make tests with various data types, and supply an example that shows how it all works. Please allow some time before this is finished.
Zbynek Zahradnik

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

More
03 Feb 2011 17:39 #252 by support
Replied by support on topic Re: Non-simple data types
Hello,
QuickOPC.NET should work with most data types available in OPC-Data Access. There is a chapter in the "Concepts" document ("Data Types" - online: www.opclabs.com/onlinedocs/Qui...) that explains this. This is the expected behavior, and it has been tested during the initial development, but we do not have automated tests for this particular part, so the question is whether it works currently in the current version.
I will now proceed by checking into this; I wanted to reply to your ASAP, and let you know what the expected behavior is. I will post again when I have more information. If you can send me the specifics of your tests (which items and data types from the test server you used, and the exception you received), that would be helpful too, although I may find the problem myself too - I just don't know yet.
I am not aware about rules on how to convert these data types between OPC-DA and OPC-UA, but since there already is a UA wrapper and proxy by OPC Foundation and it must be doing these conversions, I suggest to look at how this wrapper does it (hopefulyl it can do it), and use the same approach. If you do not have access to its source code, I may try to look there and figure out what it is doing, although I do not currently have experience with this part of the UA code.
Best regards,
Zbynek Zahradnik

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

More
03 Feb 2011 17:28 #251 by support
From: e.
Sent: Wednesday, February 02, 2011 2:50 PM
To: Zbynek Zahradnik
Subject: Some technical question about QuickOPC.NET [...]

Hello Mr. Zahradnik,

I have some questions concerning the QuickOPC.NET product (we bought a license). I browsed a bit the Forum page and I'm not sure whether I should post these questions to the Forum or not. I decided for writing an email directly to you, but please let me know if you prefer that we use the Forum also for these kind of issues.


We are using the QuickOPC.NET component to get data from existing OPC DA Servers. We then convert these data inside our OPC UA Server and give them back to our OPC UA Clients.
I wanted to find an OPC DA Server that offers already all possible types, and I noticed that the simulation server that comes together with the QuickOPC.NET package has already all possibilities.
By going online first with a standard OPC DA client, I noticed that all the "non simple" value data types were returned as EMPTY, where non simple means everything but numbers and strings.
By reading them with the QuickOPC.NET software, from inside our C# application (the OPC UA Server), I've always got Exceptions. I was actually expecting something like bad-quality, anyway I handle these esceptions so this is not a real problem, however it justifies the following questions:

Do you think that this is a problem in the simulation OPC DA Server, or rather in the QuickOPC.NET component?
If this is a problem in the simulation server, do you already have a version that offers all the possible data types with some simulated value?
I know that you are working already with the UA architecture. Do you know if there exist already some code that maps correctly different variant types to the UA DataTypeIds?


So far I've done this job by hand, but, even because I haven't tested all possibilities, this is still an open issue for the time being. It works fine with numbers and strings, but I would like to test all other possibilities: arrays, records and so on.


Lot of questions...if you have time to take a look at it, I would really appreciate it.

I thank you very much in advance,

Best regards
____________________________________________________________________________
E.

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

Moderators: support
Time to create page: 0.100 seconds