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
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
Please Log in or Create an account to join the conversation.
- sergsedeln
- Topic Author
- Offline
- Premium Member
- Posts: 15
- Thank you received: 0
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.
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.
- sergsedeln
- Topic Author
- Offline
- Premium Member
- Posts: 15
- Thank you received: 0
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.
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.
- sergsedeln
- Topic Author
- Offline
- Premium Member
- Posts: 15
- Thank you received: 0
I will post here the solution once I find one.
Please Log in or Create an account to join the conversation.
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.
- sergsedeln
- Topic Author
- Offline
- Premium Member
- Posts: 15
- Thank you received: 0
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?
Please Log in or Create an account to join the conversation.
Thanks for your detailed reports.
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
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!
Please Log in or Create an account to join the conversation.