06/10/2020
Hi,
I am currenttly developping simulator server to generate data using parquet file to be used in DEV/TEST environment.
I was able to generate the nodes and updating variabéles value coming from parquet file.
I would like to update NamespaceIndex to use NS=4 instead of the default one (NS=2)
I tried to force it to 4 when creating the base variable but i can’t browse the nodes using uaExpert.
I got this message: “Item [NS4|String|K4000] failed [ret = BadNodeIdUnknown]”
Any help please;
Kind regards,
Rabah Toulaït
05/30/2017
Namespace indexes must be sequential. You cannot have index 4 unless you have 0 through 3.
Namespace indexes are usually assigned automatically by the server sdk you are using.
If you wish a specific index you must make sure you request indexes in an order that results in the correct index being assigned.
Lastly, you should not be doing this because it sounds like you are hard coding indexes in your configuration files which is strongly discouraged.
The correct way to store configuration always serializes a table of NamespaceURIs and NodeIDs with indexes that reference the serialized table. When the configuration file is loaded the serialized NamespaceURIs are used to find the current index in the Server and any saved NodeIds are then updated to match current index.
06/10/2020
I found only one index (index[0]) in NamespaceIndexes with value set to 2.
What i need is to try to use value 4 instead of 2 but the folder/nodes were not generated with the new value in uaExpert client (did the same change with value 2 and it works).
Is there a way to change the value (not the index itself) to get NodeId with custom value instead of the one configured?
Thanks
05/30/2017
As I said, namespace indexes are set by the server and they have to be sequential.
So if you only have 3 entries in the NamespaceArray then the largest index is 2. Nothing the client can do will change this to 4.
That said, there are various ways to hack the server if you have the code to build it. But you should not designing code that depends on a specific number for a namespace index. You need to come up with a better solution.
06/10/2020
Hi Randy,
My application is an opcua simulator server.
I understand that for each folder/node created uses ns=2 because this is the value configured in the namespaceindexes.
I am trying to find a way to change the configuration to be able to use index 4 because when the simulator generates the variables from the node config file, all variables uses ns=4 (see example below);
so when opcua client will be installed in the iot edge device to use the simulator server, the variables generated should use ns=4 and not ns=2 as it was the case actually (default config.)
Example of configured variable in node config file:
{
“NodeId”: “ns=4;s=K4040.CDU345/DP.Programs.IOT_Data.Process111.Wire”,
“Name”: “Test”,
“DataType”: “String”,
“ValueRank”: 0,
“AccessLevel”: “CurrentReadOrWrite”,
“Description”: “Test”
}
I din’t find how to set and use a new index.
It’s a prerequisite to use the simulator server (input use ns=4 in the variable name and the output from simulator should return ns=4)
Thanks for your help
05/30/2017
We are talking past each other. You need to understand the relationship between NamespaceIndexes and NamespaceUris.
You have configuration files that need to be loaded. When you load these configuration files you should:
- Determine the “NamespaceUri” that corresponds to NamespaceIndex 4 in the configuration file;
- Find the index of the NamespaceUri in the Server’s NamespaceArray;
- Change the NamespaceIndex in NodeIds during load from 4 to whatever the correct NamespaceIndex is.
For example, you have a NamespaceArray and the NamespaceUri for your configuration file is “https://siimulationserver/instances”
[0] https://opcfoundation.org/UA/
[1] http://mycomputer/mycompany/myserver/
[2] http://simulationserver/types
[3] https://siimulationserver/instances
Then 4 must be converted to 3.
So when parse the node config file you change
“NodeId”: “ns=4;s=K4040.CDU345/DP.Programs.IOT_Data.Process111.Wire”
to
“NodeId”: “ns=3;s=K4040.CDU345/DP.Programs.IOT_Data.Process111.Wire”
If the NamespaceArray was
[0] https://opcfoundation.org/UA/
[1] http://mycomputer/mycompany/myserver/
[2] https://siimulationserver/instances
[3] http://simulationserver/types
[4] http://someunrelatedmodel/types
Then 4 must be converted to 2.
Basically, NamespaceIndexes have no meaning without a NamespaceUri – so figure out what the NamespaceUri is first.
1 Guest(s)