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.

Custom fields of events from OPC UA

More
14 Aug 2018 08:11 - 14 Aug 2018 08:13 #6616 by support
Namespace URIs should stay the same between sessions. That's what gives the nodes or browse names their semantics. But namespace indices are just an implementation detail, and the server is free to change them between the sessions.

The fact that so many OPC UA users hard-code the namespace indices in their client code is very bad, and we are fighting that bad custom at every possibility.

QuickOPC allows you to work with namespace URIs, and let the translation to namespace indices be done "invisibly" by the component. That way, the namespace indices are resolved again with new sessions.

Please read:
opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...indices%20in%20Node%20Ids.html
and
opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...%20in%20qualified%20names.html

Best regards
Last edit: 14 Aug 2018 08:13 by support.

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

More
14 Aug 2018 06:29 #6615 by sergsedeln
Quick Update:

The situation seems improved a bit. As I use Matrokon Tunneler to convert OPC AE to OPC UA and it works only via remote connection, I decided to try UAGateway v1.4.6 converter to do same convertion and then use my code to read custom fields.

And it works perfectly fine! Apparently this is Martikon Tunneler issue then. I contacted them to provide assistance too.

My guess is maybe (maybe!) for some fields they change namespace in run time for every session? as some fields are returned well and some are don't. I will wait for their answer but seems like no problems with Quick OPC then!

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

More
14 Aug 2018 05:34 #6614 by support
Hello,
you should not need anything special on the target machine.

For Wireshark hints, see kb.opclabs.com/Collecting_information_for_troubleshooting . If you go that way, it would be good so have two "sniffs" - one with UAExpert, and one with QuickOPC. They both should depict the same situation - i.e. QuickOPC and UAExpert from the same machine, and connect to the very same target server.

Best regards

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

More
13 Aug 2018 18:03 #6613 by sergsedeln
Yes, I use there UAExpert 1.4.4 by Unified Automation. And I see them well there.

I will install Wireshark, should I sniff for specific packets, if you can point?

Also if I need to install any specific Microsoft Visual C++ environment on the target machine? On my laptop I have all versions of Microsoft Visual C++ from 2005 to 2017. Even though I use .NET C# I remember the case when I needed to have those installed for another projects.

On target machine I have it from 2008 to 2017. Looks fine actually.

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

More
13 Aug 2018 17:51 #6612 by support
Do you have some other OPC Client to try this with?

If everything else fails, we could put in Wireshark, and analyze the traffic between the server and the client.

Regards

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

More
13 Aug 2018 17:21 #6611 by sergsedeln
Yes, there is no any exceptions in the valueResult property. I will contact OPC UA Manufacturer for this issue.

I will post here the solution once I find one.

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

More
13 Aug 2018 16:23 #6610 by support
I do not know the reason currently, but since some of the fields are filled in and some not. it looks more like that this is how they have come from the OPC server.

Anyway, just to be sure, can you please check the valueResult.exception of each of the "field results"? (or, display the full valueResult, which would include the exception info if there is one).

Regards

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

More
13 Aug 2018 13:40 - 13 Aug 2018 13:42 #6609 by sergsedeln
Hello

I got one more issue when I deployed it to production machine. It somehow returns empty strings for the same fields I managed to fetch during development and debugging.

I have a Windows 10 machine (64 bits) and I am fetching this from OPC UA server for instance
  "BACKCOLOR": 8421376,
  "BIG COUNTER": "648966464760702,0422",
  "CLASSID": 8,
  "CLASSNAME": "Operational message class",
  "COUNTER": 453510,
  "CPUNR": 0,
  "DURATION": 0,
  "TEXT01": "531T5205M1/MOT",
  "TEXT02": "Vedlinje",
  "TEXT03": "FÖRDELNINGSTRANSPORTÖR TILL HUGG : Förreglad motor",

When I publish same code to the machine where OPC UA server is running (Windows SERVER 2012, Virtual Machine on vSphere) I see this
  "BACKCOLOR": 8421376,
  "BIG COUNTER": "648966464760702,0422",
  "CLASSID": 8,
  "CLASSNAME": "",
  "COUNTER": 453510,
  "CPUNR": 0,
  "DURATION": 0,
  "TEXT01": "",
  "TEXT02": "",
  "TEXT03": "",

Notice, that CLASSNAME, TEXT01, TEXT02, TEXT03 fields are missing, and they are returned as {null} from the OPC UA when I run it on the same machine.

this is my code to parse fields received in the message
foreach (KeyValuePair<UAAttributeField, ValueResult> pair in eventData)
            {
                UAAttributeField attributeField = pair.Key;
                ValueResult valueResult = pair.Value;
 
                var propertyName = String.Join("_", attributeField.Operand.QualifiedNames);
                if (valueResult.Value != null)
                    result[propertyName] = JToken.FromObject(valueResult.Value);
                else
                    result[propertyName] = JToken.FromObject(""); // mandatory to have all properties
            }

Can it be related to OS? I will run some tests without JToken but it seems like anyway the field may be not received correctly from production machine (same PC as OPC is running at) and my debug laptop (remote PC)

Do you have any tips?
Last edit: 13 Aug 2018 13:42 by sergsedeln.

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

More
06 Aug 2018 09:55 #6593 by support
That's great - I am glad that it works.
Thanks for your detailed reports.

Best regards

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

More
05 Aug 2018 17:44 #6590 by sergsedeln
Hello!

Thanks a lot! It works as expected! See screenshot attached.

For your information, I managed to get the values by including the following filter clauses:
// ... some code omited
 
// add custom fields (TEXT01, etc.)
filterCollection.Add(UAFilterElements.SimpleAttribute(UAObjectTypeIds.BaseEventType, "/2:TEXT01"));
filterCollection.Add(UAFilterElements.SimpleAttribute(UAObjectTypeIds.BaseEventType, "/2:TEXT02"));
filterCollection.Add(UAFilterElements.SimpleAttribute(UAObjectTypeIds.BaseEventType, "/2:TEXT03"));
 
// subscribe
_opcClient.SubscribeEvent(
  _opcUaServerAddress,
  UAObjectIds.Server,
  samplingPeriod,
  filterCollection);

I am not sure what I can use BaseEventType to read those but it gets all the info I need. Thanks a lot for your support!
Attachments:

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

Moderators: support
Time to create page: 0.066 seconds