Finally, we are creating instances in Lesson1NodeManager::Startup() as shown in the following code snippet.
Console.WriteLine("Loading the Controller Model.");
ImportUaNodeset(Assembly.GetEntryAssembly(), "buildingautomation.xml");
CreateObjectSettings settings = new CreateObjectSettings()
{
ParentNodeId = ObjectIds.ObjectsFolder,
ReferenceTypeId = ReferenceTypeIds.Organizes,
RequestedNodeId = new NodeId("Controllers", InstanceNamespaceIndex),
BrowseName = new QualifiedName("Controllers", InstanceNamespaceIndex),
TypeDefinitionId = ObjectTypeIds.FolderType
};
CreateObject(Server.DefaultRequestContext, settings);
settings = new CreateObjectSettings()
{
ParentNodeId = new NodeId("Controllers", InstanceNamespaceIndex),
ReferenceTypeId = ReferenceTypeIds.Organizes,
RequestedNodeId = new NodeId("AirConditioner1", InstanceNamespaceIndex),
BrowseName = new QualifiedName("AirConditioner1", InstanceNamespaceIndex),
TypeDefinitionId = new NodeId(yourorganisation.BA.ObjectTypes.AirConditionerControllerType, TypeNamespaceIndex)
};
CreateObject(Server.DefaultRequestContext, settings);
settings = new CreateObjectSettings()
{
ParentNodeId = new NodeId("Controllers", InstanceNamespaceIndex),
ReferenceTypeId = ReferenceTypeIds.Organizes,
RequestedNodeId = new NodeId("Furnace1", InstanceNamespaceIndex),
BrowseName = new QualifiedName("Furnace1", InstanceNamespaceIndex),
TypeDefinitionId = new NodeId(yourorganisation.BA.ObjectTypes.FurnaceControllerType, TypeNamespaceIndex)
};
CreateObject(Server.DefaultRequestContext, settings);
The following figure shows the result in the server’s address space.