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,
RequestedNodeId =
new NodeId(
"Controllers", InstanceNamespaceIndex),
TypeDefinitionId = ObjectTypeIds.FolderType
};
CreateObject(
Server.DefaultRequestContext, settings);
settings = new CreateObjectSettings()
{
ParentNodeId =
new NodeId(
"Controllers", InstanceNamespaceIndex),
RequestedNodeId =
new NodeId(
"AirConditioner1", InstanceNamespaceIndex),
TypeDefinitionId =
new NodeId(yourorganisation.BA.ObjectTypes.AirConditionerControllerType, TypeNamespaceIndex)
};
CreateObject(
Server.DefaultRequestContext, settings);
settings = new CreateObjectSettings()
{
ParentNodeId =
new NodeId(
"Controllers", InstanceNamespaceIndex),
RequestedNodeId =
new NodeId(
"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.