0
Answered

OPCUA Node Connection Error

Pavian 3 weeks ago in OPCUA4Unity updated by Support 2 weeks ago 8

Hi, I'm trying to read and write value of nodes from OPCUA Server using realvirtual Pro 2022, and here is the situation:

1.OPCUA server connection works good, read and write also works good on OPC Watch.

Image 1198

2.In Unity Editor (2022LTS 3.45 + realvirtual Pro 2022), it also successfully Import all the 63 Objects of Top node 'ns=3;i=2269' (LNGDT_FI3080.PV)

Image 1199

3.However, there is no value has been properly imported for ALL of the nodes. (ex, IP_INPUT_VALUE)

Image 1200

4.I checked the Node ID in OPC watch for the same object (IP_INPUT_VALUE), and I see the different type of the Node ID; 

1) OPC Watch: ns=3;b=AAAAAAAAAADgCAAAAABZdMsDAAA= (Hexadecimal String)

2) Unity Editor:  ns=3;bs=0x0000000000000000E008000000005974CB030000 (ByteString)

Image 1201

5.So I changed the Node ID in Unity Editor from ByteString to Hexadecimal String, still doesn't work. Is there any way to fix this problem?

Image 1202

GOOD, I'M SATISFIED
Satisfaction mark by Pavian 2 weeks ago
+1
Under review

Currently the nodes don't support ByteStrings. You would need to change things in the code to be able to display them I think. What is your use case for ByteStrings?

I see... I use Aspen IP21 as a OPC UA Server and it provides node ID as a Hexadecimal but it automatically convert to ByteString format as shown in my article. Is there any way to read nodes for with quick code fix?

Ooops, I said it the other way around... 'OPC UA Server and it provides node ID as a ByteString but it automatically convert to Hexadecimal format as shown in my article'

+1

Honestly I don't know for the moment. Never had this kind of IDs. Did you checked what happens if you read a node manually with this code: 
var myvar = Interface.ReadNodeValue ("ns=2;s=Demo.Dynamic.Scalar.UInt64")

Thankyou for your support and I tried with a simple code to read node from Node ID as shown below: 


using UnityEditor;
using UnityEngine;
using realvirtual;

public class ReadNode_Float : MonoBehaviour
{

public OPCUA_Interface Interface;
public string NodeId_Float;

// Update is called once per frame
void Update()
{
var myvar3 = Interface.ReadNodeValue (NodeId_Float);
Debug.Log("Node Float :" + myvar3);
}
}

1.Node ID: ns=0;i=2367

In this case, is successfully read node from Node ID

Image 1210

2.Node ID: ns=3;b=AAAAAAAAAADgCAAAAABZdMsDAAA= (Hexadecimal String) / ns=3;bs=0x0000000000000000E008000000005974CB030000 (ByteString)

with Node ID type Hexa / BS, it fail to read node and returns NULL.

Image 1211

Image 1213

3. I also aksed Aspentech about changing type of Node ID - but since its generation method is fixed, it is not possible to change th data type for Node ID...

FYI, below article is how Node ID is generated in Aspen IP21 OPC UA Server


Image 1214

Is there a chance for improvement in the next update?

+1
Answered

Hi, since this is a very special request we are currently not planning to implement this as a standard. If you would like, you could exchange our scripts to achieve what you would like to do.

Thank you very much for your response. I fully understand that this is a unique case, and I agree that replacing the code as you suggested would be the best solution. Could you please guide me on what specific code needs to be replaced and how to do it?

+1

All relevant communication stuff is done in OPCUA_Interface.cs. If I understand your request correctly you need to read nodes based on the Hexadezimal string. We are using LibUA as a basis library (https://github.com/nauful/LibUA).. You would also need to check if the underlying library is supporting the Hexadezimal string. I am sorry, for the moment I can't tell you more without doing a deep dive on our side into this issue.