Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

different NodeIds but with the same BrowseName #188

Open
Fabolo64 opened this issue Aug 29, 2024 · 3 comments
Open

different NodeIds but with the same BrowseName #188

Fabolo64 opened this issue Aug 29, 2024 · 3 comments

Comments

@Fabolo64
Copy link

Fabolo64 commented Aug 29, 2024

I'm trying to compile an UANodeSet file exported from SIEMENS interface inside TIA Portal:

image

it seems it should be possible:

image

it contains several array UAVariables with different NodeId, problem is SIEMENS creates an UAVariable for each element of an array, but gives them the same BrowseName across different arrays, i.e. all first elements of an array have this kind of BrowseName="2:[0]"

image

this get rejected by compiler:

[ArgumentException] An item with the same key has already been added. Key: x0_

========================
at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value)
at ModelCompiler.ModelGenerator2.WriteIdentifiers(
etc.

I'm using compile command v104

Is it possible to have different NodeIds but with the same BrowseName?

@Fabolo64 Fabolo64 changed the title compile exported SIEMENS Interface File different NodeIds but with the same BrowseName Aug 29, 2024
@opcfoundation-org
Copy link
Contributor

The tool automatically creates a symbolic name by replacing invalid characters with x or .
So [0] => x0
, [1] => x1_, etc.

Are there multiple places in the NodeSet where [0] browse name exists?
If so please ensure uniqueness by specifying a ParentNodeId

@Fabolo64
Copy link
Author

Fabolo64 commented Sep 2, 2024

Thanks for your answer,
yes, there are multiple places with same BrowseName, all NodeIds are indeed unique, parent and children, but relationship is done via a reference in references collection in the parentNode:

<Reference ReferenceType="HasComponent">ns=2;i=855</Reference>>

so no ParentNodeId is present in the "offending" child.

<UAVariable NodeId="ns=2;i=855" BrowseName="2:[0]" DataType="BOOL" AccessLevel="3">

This is an xml file exported by TIA Portal=>OPC interfaces functionality, as is. I guess I'll need to automate some editing, to inject a ParentNodeId in my Component nodes...

@opcfoundation-org
Copy link
Contributor

You need to set the ParentNodeId attribute on the UAVariable representing the child.
You can also set the SymbolicName attribute to something that is unique in the file and better than 'x0_'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants