Search code examples
xmldata-modelingdatamodelopcopc-ua

opc ua XML file creation


While writing an XML file to import into the Model Compiler for OPC UA, I could not find any documentation that specifies how the values of "i" are chosen. I am referencing code produced by a modeling tool to help me with the general formatting.

For example in this snippet of code:

      <Alias Alias="Boolean">i=1</Alias>
    <Alias Alias="Byte">i=3</Alias>
    <Alias Alias="UInt16">i=5</Alias>
    <Alias Alias="Float">i=10</Alias>
    <Alias Alias="String">i=12</Alias>
    <Alias Alias="DateTime">i=13</Alias>
    <Alias Alias="ByteString">i=15</Alias>
    <Alias Alias="Organizes">i=35</Alias>
    <Alias Alias="HasModellingRule">i=37</Alias>
    <Alias Alias="HasTypeDefinition">i=40</Alias>
    <Alias Alias="HasSubtype">i=45</Alias>
    <Alias Alias="HasComponent">i=47</Alias>
    <Alias Alias="NumericRange">i=291</Alias>
</Aliases>
<Extensions>
    <Extension>
        <ua:ModelInfo Tool="UaModeler" Hash="uA8gb4iKYIgjKYj3GAUpcQ==" Version="1.6.0"/>
    </Extension>
</Extensions>
<UAObjectType NodeId="ns=1;i=1002" BrowseName="1:Alarm">
    <DisplayName>Alarm</DisplayName>
    <References>
        <Reference ReferenceType="HasSubtype" IsForward="false">i=58</Reference>
        <Reference ReferenceType="HasComponent">ns=1;i=6006</Reference>
        <Reference ReferenceType="HasComponent">ns=1;i=6001</Reference>
        <Reference ReferenceType="HasComponent">ns=1;i=6002</Reference>
        <Reference ReferenceType="HasComponent">ns=1;i=6003</Reference>
        <Reference ReferenceType="HasComponent">ns=1;i=6007</Reference>
        <Reference ReferenceType="HasComponent">ns=1;i=6005</Reference>
        <Reference ReferenceType="HasComponent">ns=1;i=6004</Reference>
        <Reference ReferenceType="HasComponent">ns=1;i=6008</Reference>
        <Reference ReferenceType="HasComponent">ns=1;i=6010</Reference>
        <Reference ReferenceType="HasComponent">ns=1;i=6009</Reference>
    </References>

What is the underlying logic behind the way the values of "i" are chosen?


Solution

  • If you are referencing nodes from the standard namespace (ns=0), all node IDs come from the OPC UA specification, and you just use them. You cannot add new ones, and the if there is any logic behind the IDs in the standard namespace, this logic is and should stay irrelevant to you. Same applies if you are referring to nodes defined by someone else elsewhere - such as those that are in namespaces defined in OPC UA companion specifications for various problem domains.

    If you are creating your own namespace (as you probably are, here under ns=1) then you can define the node IDs (in the example, node IDs with integer identifiers) any way you like, and use any logic that you find useful (or no logic at all - as long as your nodes remain unique). Also note that you can use other forms of node IDs, such as string (s=), GUID (g=) or opaque.