0
Answered

OPCUA and custom types

acour 3 years ago in OPCUA4Unity updated by Stupiddog 3 years ago 13

Hi,

I'm currently learning how to use game4Automation for a project and I'd like to read custom data types from the OPCUA server.

In the demonstration server, there is a Work Order variable (ns2, s=Demo.WorkOrder.WorkOrderVariable) which contains a StatusComments array recognized as an ExtensionMethod by game4automation. This array can be read as a byte[] array, but is there any better way to do this? It is pretty messy and not easy at all to work with.

Thanks for your answer!

Answer

Answer

Hi, I just checked your problem.

Currently I don't see an easy solution.


 You might check out the solutions of Traeger which gives you a more advanced access to OPCUA via C# (see https://docs.traeger.de/en/software/sdk/opc-ua/net/client.development.guide). 


If you want to switch to the solution of Trager we can refund you the money if you would like.

BAD, I'M UNSATISFIED

The support started real fine, but I haven't gotten any news in four weeks now.

Satisfaction mark by acour 3 years ago
Answered

No sorry, because it is hard to know what kind of data structure is inside a custom type all we can provide so far is that you transform the byte array to your types. Do you have any better idea?

Not really, just wanted to make sure I wasn't missing anything. I 'm not really used to work with bytes, maybe that's just it. I'll try to work with that. 

Thank you for your quick answer!

After some tests, I'm realizing I'm not sure how to use thiese binary Array. Do you know where I can find an example of mapping? I tried using the BinaryFormatter, but I can't make it work.

When importing nodes, it seems that my root node WorkOrderVariable will have the values of the custom type WorkOrderStatusType, while StatusComments contains an array of bit, each refering to an entry in the array StatusComment of type WorkOrderStatusType.

What should I read? I tried using the BinaryReader to get the different fields and got at best a noised Actor name.

Here are screenshots of the object I'm interested in viewed with UAExpert, of the different gameobjects generated by Gamautomation and my hierarchy. 

Thanks for your answer.






Hello acour,which opc did you use?I tried some times but all failed,I used some different opc but it not works,can you tell me how to do it?

You wil need to check how the byte array looks like, where is the string starting and ending. Are there bytes inside the byte array which define the end of each string?. There seems a string, a timestamp and another string included. You can transfer an array of bytes to a string with methods like this: https://www.geeksforgeeks.org/different-ways-to-convert-char-array-to-string-in-c-sharp/

I finally managed to read those structures, thank you!

Last problem (or so I hope) about structures: now I have to write an updated structure on the server. I tried to use the WriteNode function. I tried to convert it to binary, following the structure I get when reading, but it doesn't seem to be the intended way to write, as I can see the value being changed from ExtensionObject to ByteArray in UAExpert.

Can you help me with this last one? Thank you in advance! 

For the moment I don't know how to proceed here. If you write an object I don't know the reason why the type is being changed. What you are doing is more than the standard features and functions we provide. It would need some work on our side to check where the problem is. Maybe you did a mistake in how you pass the Extension object. But really hard to say without having the same setup. If you could somehow give us a full setup (OPCUA test Server with needed data structure and a reduced part of your code where we can check what is happening) we can check it. But this is so special that we would need some support budget if the effort on our side is to high.

Thank you for your answer.
I sent a minified version of my project in the "send" section of the site so you can take a look at what I'm doing.

Hopefuly we can figure out what I'm doing wrong!

Hi,

I sent two packages, one two weeks ago and a fixed version on monday via this link: https://game4automation.com/send

When should I hope to receive a review of my project?

Thank you in advance for your answer.

Hi, honestly I totally missed you upload. You should do it again.


But what you are doing is reading a not officially supported data type and structure. This is pure development and our for free support is only if you have bugs in standard feature and functions. But still - please send me the upload again (it might be already deleted) and I will have a look ino it.

Hi,

I sent the package again yesterday.

Thank you for your time.

Answer

Hi, I just checked your problem.

Currently I don't see an easy solution.


 You might check out the solutions of Traeger which gives you a more advanced access to OPCUA via C# (see https://docs.traeger.de/en/software/sdk/opc-ua/net/client.development.guide). 


If you want to switch to the solution of Trager we can refund you the money if you would like.