Professional OPC
Development Tools

logos

Custom fields of events from OPC UA

More
05 Aug 2018 15:16 #6589 by support
I found two things:

1. You certainly need to qualify the "TEXT01" browse name with the namespace, because it is not in the OPC UA standard namespace. You have done this in some earlier source you have sent (where you have used "2:TEXT01"), but not in the recent post. Please put the namespace back. (Note that it would be better to use the namespace URI, in form "[nsu=...;s=TEXT01]", but both shoud work).

2. But, I have found yet another problem on our side, where the namespaces in the browse path nodes were not properly parsed/interpreted. So, you also need to download even newer QuickOPC and re-build with it; it is on our Web and NuGet again as of now. It should be 5.53.315.1 or later.

Best regards

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

More
03 Aug 2018 11:11 #6586 by sergsedeln
Do not worry about namespace that tells `OPCAEServer`
I use Matrikon UA Tunneler to convert OPC AE (Classic) to OPC UA interface.

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

More
03 Aug 2018 11:01 - 03 Aug 2018 11:02 #6585 by sergsedeln
Hello,

So on the callbeck OnMessageArrived as you do it in your sample code I do all fields and values listing:
        static void OnMessageArrived(object sender, EasyUAEventNotificationEventArgs e)
        {
            logger.Info(e.ToString());
 
            if (e.EventData == null)
            {
                return;
            }
            logger.Info("All fields:");
            foreach (KeyValuePair<UAAttributeField, ValueResult> pair in e.EventData.FieldResults)
            {
                UAAttributeField attributeField = pair.Key;
                ValueResult valueResult = pair.Value;
                logger.Info("  {0} -> {1}", attributeField, valueResult);
            }
        }

Notice the line
logger.Info("  {0} -> {1}", attributeField, valueResult);

And here is the logger output for the fields the message has:
2018-08-03 12:11:48.1219|INFO|OpcUaSubscriberConsoleApplication.Program|All fields:
2018-08-03 12:11:48.1219|INFO|OpcUaSubscriberConsoleApplication.Program|  NodeId="BaseEventType", NodeId -> Success; nsu=opc.com://seskhsiopc1/PCS7.OPCAEServer/c6539839-7990-4c09-ada9-d6c841aeec7e/AE;ns=2;s=7:OS53000:0:5500-P1000000:2147483648:Level {OpcLabs.EasyOpc.UA.AddressSpace.UANodeId}
2018-08-03 12:11:48.1219|INFO|OpcUaSubscriberConsoleApplication.Program|  NodeId="BaseEventType"/SourceName -> Success; OS530::550-P1000 {System.String}
2018-08-03 12:11:48.1369|INFO|OpcUaSubscriberConsoleApplication.Program|  NodeId="BaseEventType"/Message -> Success; Hög nivå pumpgrop tippficka {System.String}
2018-08-03 12:11:48.1369|INFO|OpcUaSubscriberConsoleApplication.Program|  NodeId="BaseEventType"/Severity -> Success; 1 {System.Int32}
2018-08-03 12:11:48.1544|INFO|OpcUaSubscriberConsoleApplication.Program|  NodeId="nsu=opc.com://seskhsiopc1/PCS7.OPCAEServer/c6539839-7990-4c09-ada9-d6c841aeec7e/AE;s=2:2147483655"/TEXT01 -> Success; (none) {}
2018-08-03 12:11:48.1544|INFO|OpcUaSubscriberConsoleApplication.Program|  NodeId="BaseEventType"/EventType -> Success; nsu=opc.com://seskhsiopc1/PCS7.OPCAEServer/c6539839-7990-4c09-ada9-d6c841aeec7e/AE;ns=2;s=4:2147483648:Level {OpcLabs.EasyOpc.UA.AddressSpace.UANodeId}

Notice the custom value I try to fetch
NodeId="nsu=opc.com://seskhsiopc1/PCS7.OPCAEServer/c6539839-7990-4c09-ada9-d6c841aeec7e/AE;s=2:2147483655"/TEXT01 -> Success; (none) {}
Last edit: 03 Aug 2018 11:02 by sergsedeln.

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

More
03 Aug 2018 09:50 #6584 by support
Hello,

where is the "none ({})" output coming from? Can you please post the piece of code that outputs it here?
I am trying to determine how you handle the values in the FieldResults dictionary.

Note that I actually have an idea about where the problem comes from - but I'd like to have the answer to above first, to be sure.

Regards

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

More
03 Aug 2018 07:52 #6583 by sergsedeln
Hello

Yes, now it works, thanks! Will it be too selfish to ask one more thing but I'd really appreciate your consultation.

The OPC UA A&C are generating a lot of custom data fields from PCS7 (Siemens) and when I am trying to include them into filter as described above, I am always getting value:
none ({})

Here is my code snippet:
_opcClient.SubscribeEvent(
                opcUaServerAddress,
                UAObjectIds.Server,
                samplingPeriod,
                new UAAttributeFieldCollection
                    { 
                        // Select specific fields using standard operand symbols
                        UABaseEventObject.Operands.NodeId,
                        //UABaseEventObject.Operands.SourceNode,
                        UABaseEventObject.Operands.SourceName,
                        //UABaseEventObject.Operands.Time,
 
                        // Select specific fields using an event type ID and a simple relative path
                        UAFilterElements.SimpleAttribute(UAObjectTypeIds.BaseEventType, "/Message"),
                        UAFilterElements.SimpleAttribute(UAObjectTypeIds.BaseEventType, "/Severity"),
 
                         UAFilterElements.SimpleAttribute(
                             new UANodeId(
                            "nsu=opc.com://seskhsiopc1/PCS7.OPCAEServer/c6539839-7990-4c09-ada9-d6c841aeec7e/AE;ns=2;s=9:0"),
                            "/TEXT01"),
 
                        UAFilterElements.SimpleAttribute(UAObjectTypeIds.BaseEventType, "/EventType")
                });

Notice the
/TEXT01
property. Somehow I am able to see them in UAExpert client but not to get programatically.

Is the code above looks OK for you or am I doing the subscription wrong? OOf course maybe all is depend on PCS7 namespaces and Matrikon UI Tunneler but just an expert view on if it look OK or not would help.

Thanks!
Attachments:

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

More
02 Aug 2018 12:23 #6574 by support
The fixed build of QuickOPC 2018.2 is now on our Web and NuGet. It is 5.53.314.1 or later.

Regards

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

More
01 Aug 2018 20:04 #6569 by sergsedeln
It works now, thanks!

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

More
01 Aug 2018 15:51 #6568 by support
I have tested this with our own example, and found that we have a bug in the component. The nature of the bug is, however, different from what you were seeing. In my test, the problem was that no event notifications (aside from the initial Success, indicating that a connection was made) were called.

We will fix - I will place a post here to inform you.

In the meantime, the workaround is to place the following, always as the *last* element, to the Select clauses:
UAFilterElements.SimpleAttribute(UAObjectTypeIds.BaseEventType, "/EventType")
Best regards
The following user(s) said Thank You: sergsedeln

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

More
31 Jul 2018 18:25 #6563 by sergsedeln
I think it can be something with certificates.. I will check.

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

More
31 Jul 2018 18:16 - 03 Aug 2018 07:55 #6562 by sergsedeln
Hello

Yes, in the easyUAClient_EventNotification callback, when the message arrives, and I do Console.WriteLine(e) to see it's simple string representation, I see
*** Failure -2144993280 (0x80260000): OPC-UA service result - An error specific to OPC-UA service occurred.

Can it be because I subscribe for the properties in a wrong way. I have the following collection defined:
new UAAttributeFieldCollection
                    {
                        // Select specific fields using standard operand symbols
                        UABaseEventObject.Operands.NodeId,
                        UABaseEventObject.Operands.SourceNode,
                        UABaseEventObject.Operands.SourceName,
                        UABaseEventObject.Operands.Time,
 
                        // Select specific fields using an event type ID and a simple relative path
                        UAFilterElements.SimpleAttribute(UAObjectTypeIds.BaseEventType, "/Message"),
                        UAFilterElements.SimpleAttribute(UAObjectTypeIds.BaseEventType, "/Severity"),
                        UAFilterElements.SimpleAttribute(UAObjectTypeIds.AlarmConditionType, "/2:BIG COUNTER"),
                        UAFilterElements.SimpleAttribute(UAObjectTypeIds.AlarmConditionType, "/2:TEXT01"),
                    }

But funny thing if I just copy/paste the sample from the link above that is using only the base event fields, it is still showing same errors.

Please see the console screenshot attached.
Attachments:
Last edit: 03 Aug 2018 07:55 by sergsedeln.

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

Moderators: support
Time to create page: 0.309 seconds

      

 Recommend this on Google