2

I am a beginner in OPC UA server development. I am working on .NET environment to create an server with my own Information Model which is created on UAModeler.

when I instantiate the nodes available in my information model, only those which are set as Mandatory are successfully instantiated. I am trying to find a way how can I instantiate the remaining nodes also which are by purpose set as Optional for Modeling rule.

Below snippet of my code from Node Manager class :

`Console.WriteLine("Loading the Im 2.1 Model."); ImportUaNodeset(Assembly.GetEntryAssembly(), "informationmodel_2.0.xml"); Console.WriteLine("IM Sucessfully Loaded");

            CreateObjectSettings settings = new CreateObjectSettings()
            {
                ParentNodeId = UnifiedAutomation.UaBase.ObjectIds.ObjectsFolder,
                ReferenceTypeId = UnifiedAutomation.UaBase.ReferenceTypeIds.Organizes,
                RequestedNodeId = new NodeId("IM", DefaultNamespaceIndex),
                BrowseName = new QualifiedName("Departments", DefaultNamespaceIndex),
                TypeDefinitionId = UnifiedAutomation.UaBase.ObjectTypeIds.FolderType

            };
            ObjectNode controllersNode = CreateObject(Server.DefaultRequestContext, settings);

            settings = new CreateObjectSettings()
            {
                ParentNodeId = controllersNode.NodeId,
                ReferenceTypeId = UnifiedAutomation.UaBase.ReferenceTypeIds.Organizes,
                RequestedNodeId = new NodeId(DepartmentA, DefaultNamespaceIndex),
                BrowseName = new QualifiedName(DepartmentA, DefaultNamespaceIndex),
                TypeDefinitionId = new NodeId(My.MyIm.ObjectTypes.BodyshopProductionEquipmentType, DefaultNamespaceIndex)

            };

            CreateObject(Server.DefaultRequestContext, settings);
            
            ProductionDataNode = FindInMemoryNode(new NodeId(DepartmentA + ".ProductionData", DefaultNamespaceIndex)) as VariableNode;
            CounterPerTypeNode = FindInMemoryNode(new NodeId(DepartmentA + ".ProductionData.CounterPerType", DefaultNamespaceIndex)) as VariableNode;`
           

any suggestions or similar solved examples would be highly appreaciated.

thanks

Ali Lazzal
  • 21
  • 2

1 Answers1

2

I have no experience with the unified-automation-sdk but in the OPCFoundation Stack you have to create the nodes manually.

This is typically done in CreateAddressSpace method of Node Manager class, see Boiler example.

Modelling Role optional indicates that the server has to decide if the creation is required or not.

koepalex
  • 176
  • 6