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.

Problem with mapping arrays

More
03 Aug 2018 06:18 #6579 by support
Replied by support on topic Problem with mapping arrays
We will reply. Please wait.

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

More
02 Aug 2018 19:53 #6575 by ab
Hello

I have a problem with reading tables from the OPC UA server.
I do not know why, but if I use mapping objects, their vaules are always zeros after reading from opc.
If I read them directly, the values in the array are valid.
What am I doing wrong?

The following example illustrates the problem.
UAClientMapper mapper = new UAClientMapper();
TestArray device = new TestArray { BrowswerPath = "ObjectsFolder]/PLC1500/Device1/Program_blocks/UM01_przyklad/Data/UM01_PackTags" };
 
UANodeDescriptor uANodeDescriptor = new UANodeDescriptor
{
      BrowsePath = UABrowsePath.Parse(device.BrowswerPath, "KEPServerEX")
};
 
UAEndpointDescriptor uAEndpointDescriptor = new UAEndpointDescriptor("opc.tcp://127.0.0.1:49320");
var uaNodeElementCollection = mapper.Client.BrowseDataNodes(uAEndpointDescriptor);
 
mapper.Map(device, new UAMappingContext
{
      EndpointDescriptor = uAEndpointDescriptor,
      NodeDescriptor = uANodeDescriptor,
      MonitoringParameters = 1000
});
 
mapper.Read();
 
var easyUAClient = new EasyUAClient { Isolated = true };
var a = easyUAClient.Read(uAEndpointDescriptor, "nsu=KEPServerEX;ns=2;s=PLC1500.Device1.Program_blocks.UM01_przyklad.Data.UM01_PackTags.Admin.ModeCumulativeTime");
 
var b = device.ModeCumulativeTime;
 
 
[UAType]
[UANamespace("KEPServerEX")]
public class TestArray : IBrowsePath
{
    public TestArray()
    {
         ModeCumulativeTime = new long[6];
    }
 
    [UAData]
    [UANode]
    public long[] ModeCumulativeTime { get; set; }
 
    public string BrowswerPath { get; set; }
}

After executing the code, the values for the variable "a" are for example [1, 2, 3, 10, 100, 5] and for "b" it are always [0, 0.0,0,0,0], why? It's the same array in opc.

What should mapping look like if we have a two-dimensional array? Can I map an array of objects, for example: MyClass[];?

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

Moderators: support
Time to create page: 0.043 seconds