Communication with Siemens RF185C via OPC-UA

I want to communicate with a Siemens RF185C module via OPC-UA to be able to read and write an RFID tag via OPC Method.
Who has a software example of this in ST?
Lot of thanks.

The RF185C follows the AutoID Companion specification.


A sample task Client03a can be found in the OpcUa_Sample project, which is availabe in the \AS412\Samples folder.

Thanks Corné for the response.
However, when I try to connect with the settings below I get the error OpcUa_BadNodeIdUnknown 0x80340000

	UA_ScanMethod_ObjectNodeID.NamespaceIndex := 4;
	UA_ScanMethod_ObjectNodeID.Identifier := 'rfr310';
	UA_ScanMethod_ObjectNodeID.IdentifierType := UAIdentifierType_String;

	UA_ScanMethod_MethodNodeID.NamespaceIndex := 4;
	UA_ScanMethod_MethodNodeID.Identifier := 'rfr310.Scan';
	UA_ScanMethod_MethodNodeID.IdentifierType := UAIdentifierType_String;

Hi there,
have you configured all nessecary steps before trying reading the nodes?

	SesConInf.SecurityMsgMode							:=	UASecurityMsgMode_None;
	SesConInf.SecurityPolicy							:=	UASecurityPolicy_None;
	SesConInf.TransportProfile							:=	UATP_UATcp;
	SesConInf.UserIdentityToken.UserIdentityTokenType	:=	UAUITT_Username;
	SesConInf.UserIdentityToken.TokenParam1				:=	'username';
	SesConInf.UserIdentityToken.TokenParam2				:=	'password';
	SesConInf.SessionTimeout							:=	T#1m;
	SesConInf.MonitorConnection							:=	T#10s;

Correct port on the IP? (As client you need 4840, whereas the server publishes on 4841).
Also, how sure are you about the NSI?

I usually use a dedicated action to read the NSI for me and use it later on.

	UA_GetNS(
		Execute			:=	ExeGetNS,
		ConnectionHdl	:=	ConHdl,
		NamespaceUri	:=	'http://br-automation.com/OpcUa/PLC/PV/',
		Timeout			:=	T#5s);
	IF	UA_GetNS.Busy = FALSE	THEN
		IF	UA_GetNS.Done = TRUE	THEN
			NSIndex		:=	UA_GetNS.NamespaceIndex;
			ExeGetNS	:=	FALSE;
			StateOPCUA	:=	GETHDLS;
		ELSIF	UA_GetNS.Error = TRUE	THEN
			ErrorPointer	:=	"Namespace Error";
			ErrorID			:=	UA_GetNS.ErrorID;
			NSIndex			:=	0;
			ExeGetNS		:=	FALSE;
		END_IF;
	END_IF;

Beware, that you have to define in the UA_Read function the exact amount of nodes and their names, before you try connecting. I do believe you have to define the correct vars you want to read the OPC-UA “Identifiers” into, otherwise this will also lead to an error.

Try following this B&R Online Help step-by-step that helped me a lot getting started.

Hi Julian, the UA_Connect is not the problem because that works fine.
When I use a get handle for required method, the error message appears

I use this code for the MethodGetHandle and than comes the error code:

(* UA_MethodGetHandle - get a handle for required methode *)
UA_ScanMethod_ObjectNodeID.NamespaceIndex := 4;
UA_ScanMethod_ObjectNodeID.Identifier := 'rfr310';
UA_ScanMethod_ObjectNodeID.IdentifierType := UAIdentifierType_String;

UA_ScanMethod_MethodNodeID.NamespaceIndex := 4;
UA_ScanMethod_MethodNodeID.Identifier := 'rfr310.Scan';
UA_ScanMethod_MethodNodeID.IdentifierType := UAIdentifierType_String;

UA_ScanMethodGetHandle (Execute := UA_ScanMethodGetHandle_Execute,
	ConnectionHdl := UA_Connect_0_ConnectionHdl,
	ObjectNodeID := UA_ScanMethod_ObjectNodeID,
	MethodNodeID := UA_ScanMethod_MethodNodeID,
	Timeout := T#60s);
IF (UA_ScanMethodGetHandle.Busy = 0) THEN
	UA_ScanMethodGetHandle_Execute := 0;
	IF (UA_ScanMethodGetHandle.Done = 1) THEN
		ErrorID := 0;
		UA_ScanMethod_MethodHdl := UA_ScanMethodGetHandle.MethodHdl;
	END_IF
	IF (UA_ScanMethodGetHandle.Error = 1) THEN
		ErrorID := UA_ScanMethodGetHandle.ErrorID;
		UA_ScanMethod_MethodHdl := 0;
	END_IF
END_IF

Okay.
Have you tried connection to the Siemens device with UaExpert (pretty good and free OPC-UA tool)? Maybe your object or method identifier is wrongly set here. Otherwise at first glance everything looks OK.
With UaExpert you could have a look into the method, the correct identifieres and try again.

I also use UaExpert and then I can read or write the tags via the Scan-Method and the WriteTag-Method.

The Information Model for this sensor seems different and can be checked with UaExpert.
See following link to pdf.

What is shown in UaExpert in Readpoint_11?

UaExpert use Readpoint_11

It seems that this Read_point _1 is defined as Numeric and not as String, so the sample has to be adapted to reflect this.

UA_ScanMethod_ObjectNodeID.NamespaceIndex := 4;
UA_ScanMethod_ObjectNodeID.Identifier := ‘5002’;
UA_ScanMethod_ObjectNodeID.IdentifierType := UAIdentifierType_Numeric;

Could you also look at the method Scan and adapt accordingly.

UA_ScanMethod_MethodNodeID.NamespaceIndex := 4;
UA_ScanMethod_MethodNodeID.Identifier := ‘??’;
UA_ScanMethod_MethodNodeID.IdentifierType := UAIdentifierType_Numeric;

Hi Corné, when I connect with this identifier I get the message: OpcUa_BadMethodInvalid 0x80750000: The method ID does not refer to a method for the specified object.
However, if I connect with the identifier number 7010 of the Scan method, I do not get an error message. So I am one step further.
So it seems that you can only reach the reader via identifier numbers. That is in contrast to what is stated in the B&R example.
If I then do a MethodCall I get the following error message: OpcUa_BadConfigurationError 0x80890000: There is a problem with the configuration that affects the usability of the value.

If I look at the AutoID standard (AutoID Devices) the InputArguments and OutputArguments from this Scan method seems different.

You probably need to adjust the datatype of the variables used as Input and OutputArguments.
These variables need to exist in the B&R PLC.
Just call the method in UaExpert and look at the arguments.

Thanks Corné,
I gif you the screenshots from de connection to the Scan method, in- and outputarguments