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[];?