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
05 Sep 2018 10:04 #6632 by support
Replied by support on topic Problem with mapping arrays
We have no such benchmarks.

Subscription should be better than a cyclic reading. If the server supports it, you can even enable "queuing" on the subscription, so that multiple subsequent changes can be transferred at once if needed.

Regards

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

More
04 Sep 2018 09:54 #6631 by ab
Replied by ab on topic Problem with mapping arrays
Thank you for your answer. I think now I know everything I need about array mapping.

One more thing interests me, so let me take a small offtopic instead of setting up a new topic.

Have you ever done the test of readout performance of tags from S7 1500 by OPC UA built into the PLC? I am interested, for example, how small refresh time it is possible to get, reading for example 1000 int tags. Approximately 50, 100, 200, 500ms? We often encounter situations where the client wants to read a large number of parameters from the PLC, they change rather rapidly, and the relationships between changes in various parameters and the order of their changes are important to us. That is why we want to read the most frequent and accurate moment of their change from the PLC. In addition, in PLC it is implemented PackML so we have to handle all tags that it imposes on us and in some cases we also have a long list of alarms and warnings that can have, for example, 20,000 items. We usually worked on the S7 300 and after a long fight with a very extensive system we are able to go down with refresh times about 50ms for key data and 200ms for less important information. Now we are moving to S7 1500 and we would like to use the built-in OPC UA server.
Therefore, I would like to ask you if you have experience in reading large amounts of data from OPC UA with S7 1500 and whether we need to pay special attention to something when creating a program in plc so that the reading is as efficient as possible. Any tips for inexperienced OPC UA users? With a large amount of data, we should be careful with the subscription, or is it a better option than a cyclic reading?

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

More
04 Sep 2018 08:04 #6630 by support
Replied by support on topic Problem with mapping arrays
Hello.
You are really stretching it out far - in good sense :-)

I understand what you are asking for. Currently, the answer is negative - QuickOPC does the heavy lifting of encoding/decoding custom data types from/to UAGenericObject, but it is up to you write code that handles it.

We have considered several approaches to improve upon the current UAGenericObject, such as
1) use 'dynamic' types
2) "map" existing classes to UAGenericObject (this is what you suggested)
3) allow the software to generate the classes for (2) automatically, too.

All these have their advantages and disadvantages. They are on list for some possible enhancement, but are not currently in any concrete short- or mid-term plan. The fact is, only a limited number of users need OPC UA Complex Data, and for them the, existing UAGenericObject is already a big helper. I understand what you need, and the more interest in this feature we spot, the more likely it is it gets implemented soon; but I cannot give any promise.

Best regards

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

More
03 Sep 2018 11:04 #6629 by ab
Replied by ab on topic Problem with mapping arrays
Hello

Thanks to your help, I managed to solve the problem with reading arrays. It works without any problems for simple types. Now I would like to read tables that are custom UTD type.

For example, I have an array of UDT_Test types in PLC, which consists of string, inta, short, string, etc. I created a class that suits this UDT and I tried to use mapping but I always get null as a value of each element in array. I came to the conclusion that this is because quickopc can't cast read value to type of my class. Instead of mapping my class, I mapped an array into an array of objects, and then instead of null, I had values. It appears that the data is read from the PLC as a UAGenericObject.

Is there any possibility of automatically mapping such array to my class? Do I have to use any special attributes? Maybe this is not possible and UDT tables will always be returned as a UAGenericObject and you have to get data from them yourself and remap to your objects?

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

More
07 Aug 2018 12:44 - 07 Aug 2018 12:45 #6599 by support
Replied by support on topic Problem with mapping arrays
Thank you for the details.
You are confusing two things here.

One is the fact that the variable might be a two-dimensional array "as configured in the server", and the fact that besides the variable for the array itself (StateCumulativeTime), the server provides separate nodes for each element of the array, and the nodes have two indexes - such as StateCumulativeTime[0, 0]. This is completely server-specific behavior. From the point of OPC UA specification the extra nodes have no relation to the base node, and they do not "form" any array. They are just a bunch of separate nodes with names that "happen to look like" a two-dimensional array. These nodes, as I understand it, show correctly in all clients (including QuickOPC), and when you read them, you get a scalar value of the chosen single element - and, that also works in QuickOPC.

The other thing is the actual value provided by the server for the "base" array node, i.e. StateCumulativeTime. You show that you get a one-dimensional array in QuickOPC. You do *not* show what value you get for it in any other OPC UA client. You even wrote "I couldn't read its value" - what did you mean - using which client? And what was the error you got? And have you tried yet another other client?

If you cannot read the thing in other OPC UA clients, and you get one-dimensional array in QuickOPC, what leads you to believe it should be two-dimensional then? It is quite possible that server ships out the value as one-dimensional array. So I am looking for your argument to the contrary. Maybe you have a UA client when you have received it as two-dimensional? - if so, please post a screenshot.

If the thing can be reproduced with KepServer configuration not requiring an external hardware or software, please provide the configuration and we will have a look at the case here. I tend to think, however, that there is nothing wrong in QuickOPC. Have you asked Kepware whether the node is supposed to provide on- or two-dimensional value?

Regards
Last edit: 07 Aug 2018 12:45 by support.

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

More
07 Aug 2018 08:37 #6598 by ab
Replied by ab on topic Problem with mapping arrays
I tried several opc client. All of them on items list shows that StateCumulativeTime is two dimensional array. You can see it on opc2.png.

I couldn't read its value. So I used yours EasyOPC - UA Demo Application. On opc3.png you can see effects. When i read value of StateCumulativeTime I get value: System.Int32[], when I read StateCumulativeTime[0,0] i get proper value.

I'm courious, why StateCumulativeTime which is two dimensional array is not recognized as array, but all its elements are recognized as elements of arrar with proper indexes?
Attachments:

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

More
06 Aug 2018 15:37 #6597 by support
Replied by support on topic Problem with mapping arrays
OK, I was hoping that the variable has a fixed number of dimensions. But it has not - ValueRank == 0 means that it can be either a scalar, or an array with any numbed of dimensions.

The questions is then, whether the server is truly sending it out as one-dimensional array, or whether it sends a two-dimensional array value and it somehow gets interpreted as on-dimensional in QuickOPC.

Have you tried with some other OPC UA client (not OPC DA Classic!), and if so - with which client, and what was the observed value?

Thank you

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

More
06 Aug 2018 12:19 #6596 by ab
Replied by ab on topic Problem with mapping arrays
var vr = easyUAClient.Read(uAEndpointDescriptor, "nsu=KEPServerEX;ns=2;s=PLC1500.Device1.Program_blocks.UM01_przyklad.Data.UM01_PackTags.Admin.StateCumulativeTime", UAAttributeId.ValueRank);

ValueRank:
- HasBadStatus = false
- HasGoodStatus = true
- HasUncertainStatus = false
- HasValue = true
- Value = 0x00000000
- ValueType = {Name = "Int32" FullName = "System.Int32"}

var ad = easyUAClient.Read(uAEndpointDescriptor, "nsu=KEPServerEX;ns=2;s=PLC1500.Device1.Program_blocks.UM01_przyklad.Data.UM01_PackTags.Admin.StateCumulativeTime", UAAttributeId.ArrayDimensions);

ArrayDimensions:
- HasBadStatus = true
- HasGoodStatus = false
- HasUncertainStatus = false
- HasValue = true
- Value = null
- ValueType = null

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

More
06 Aug 2018 12:01 #6595 by support
Replied by support on topic Problem with mapping arrays
Good.

Can you please read out (using EasyDAClient.Read) the ValueRank and ArrayDimensions attributes of the same node? (passing the corresponding attribute IDs to the Read; www.opclabs.com/files/onlinedocs/QuickOpc/Latest/User%27s%20....EasyOpc.UA.UAAttributeId.html ).

Thank you

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

More
06 Aug 2018 10:36 #6594 by ab
Replied by ab on topic Problem with mapping arrays
UpdateFailure event did the job. In exception I get information that it is impossible to cast from int32 to int64. I had to change long to int and everything works fine.

Now I want to test two dimensional array and I have tag that is int[6,18].

After read using EasyUAClient.Read i get one dimensional array int[108] as result.

When I use mapping UpdateFailure event is raised with exception: InnerException = {"Object of type 'System.Int32[]' cannot be converted to type 'System.Int32[,]'."}

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

Moderators: support
Time to create page: 0.062 seconds