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
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.
- sergsedeln
- Topic Author
- Offline
- Premium Member
- Posts: 15
- Thank you received: 0
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.
- sergsedeln
- Topic Author
- Offline
- Premium Member
- Posts: 15
- Thank you received: 0
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) {}
Please Log in or Create an account to join the conversation.
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.
- sergsedeln
- Topic Author
- Offline
- Premium Member
- Posts: 15
- Thank you received: 0
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
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!
Please Log in or Create an account to join the conversation.
Regards
Please Log in or Create an account to join the conversation.
- sergsedeln
- Topic Author
- Offline
- Premium Member
- Posts: 15
- Thank you received: 0
Please Log in or Create an account to join the conversation.
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")
Please Log in or Create an account to join the conversation.
- sergsedeln
- Topic Author
- Offline
- Premium Member
- Posts: 15
- Thank you received: 0
Please Log in or Create an account to join the conversation.
- sergsedeln
- Topic Author
- Offline
- Premium Member
- Posts: 15
- Thank you received: 0
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.
Please Log in or Create an account to join the conversation.