I want to create nodes (objects & variables) generically and test this against "umati.app". The creation of the nodes themselves works with CreateObjectSettings and CreateObject.
For the configuration, only the type of node should be specified and my program should find and create the correct namespace, BrowseName namespace, ReferenceTypeId, etc. (if available, such as "SignalOn" or "SignalColor" in "StackElementLightType").
I can also find these via reflections, but there are problems with the "MachineTool" node set:
- when creating "StackElementLightType", for example, the obligatory child elements are not automatically created (this was information from Unified Automation that this should be the case)
- through the reflection I know where the object comes from, but not what the BrowseName namespace has to be so that the umati.app client recognizes it correctly
How do I get the information?
Creating umati nodeset generically
Moderator: uasdknet
- Support Team
- Hero Member
- Posts: 3213
- Joined: 18 Mar 2011, 15:09
Re: Creating umati nodeset generically
Hi,
The ObjectType StackElementLightType defined in http://opcfoundation.org/UA/IA/ has children with the ModellingRule Optional. Optional children are not created by default when CreateObject is called. The optional children which shall be created must be specified in the CreateInstanceSettings. This can be done by setting the property OptionalBrowsePaths are ChildrenSettings.
The following code snippet shows how to specify optional children and how set a default value for a child.
The ObjectType StackElementLightType defined in http://opcfoundation.org/UA/IA/ has children with the ModellingRule Optional. Optional children are not created by default when CreateObject is called. The optional children which shall be created must be specified in the CreateInstanceSettings. This can be done by setting the property OptionalBrowsePaths are ChildrenSettings.
The following code snippet shows how to specify optional children and how set a default value for a child.
Code: Select all
var settings = new CreateObjectSettings()
{
BrowseName = new QualifiedName("StackLight", DefaultNamespaceIndex),
RequestedNodeId = new NodeId("StackLight", DefaultNamespaceIndex),
ParentNodeId = UnifiedAutomation.UaBase.ObjectIds.ObjectsFolder,
ReferenceTypeId = UnifiedAutomation.UaBase.ReferenceTypeIds.Organizes,
TypeDefinitionId = AAA.BBB.ObjectTypeIds.BasicStacklightType.ToNodeId(Server.NamespaceUris),
ChildrenSettings = new List<ChildInstanceSettings>()
{
new ChildObjectSettings()
{
BrowsePath = new PathBuilder() { new AbsoluteName(AAA.BBB.BrowseNames.StackLevel, Namespaces.BBB) },
},
new ChildVariableSettings()
{
BrowsePath = new PathBuilder()
{
new AbsoluteName(AAA.BBB.BrowseNames.StackLevel, Namespaces.BBB),
new AbsoluteName(AAA.BBB.BrowseNames.DisplayMode, Namespaces.BBB)
},
Value = new Variant((int)LevelDisplayMode.Blinking)
},
new ChildObjectSettings()
{
BrowsePath = new PathBuilder() { new AbsoluteName(AAA.BBB.BrowseNames.StackRunning, Namespaces.BBB) }
}
}
};
CreateObject(Server.DefaultRequestContext, settings);
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Jr. Member
- Posts: 2
- Joined: 16 Jul 2024, 07:43
Re: Creating umati nodeset generically
Now I'm confused.Support Team wrote: ↑08 Nov 2024, 21:15Hi,
The ObjectType StackElementLightType defined in http://opcfoundation.org/UA/IA/ has children with the ModellingRule Optional. Optional children are not created by default when CreateObject is called. The optional children which shall be created must be specified in the CreateInstanceSettings. This can be done by setting the property OptionalBrowsePaths are ChildrenSettings.
The following code snippet shows how to specify optional children and how set a default value for a child.
Code: Select all
var settings = new CreateObjectSettings() { BrowseName = new QualifiedName("StackLight", DefaultNamespaceIndex), RequestedNodeId = new NodeId("StackLight", DefaultNamespaceIndex), ParentNodeId = UnifiedAutomation.UaBase.ObjectIds.ObjectsFolder, ReferenceTypeId = UnifiedAutomation.UaBase.ReferenceTypeIds.Organizes, TypeDefinitionId = AAA.BBB.ObjectTypeIds.BasicStacklightType.ToNodeId(Server.NamespaceUris), ChildrenSettings = new List<ChildInstanceSettings>() { new ChildObjectSettings() { BrowsePath = new PathBuilder() { new AbsoluteName(AAA.BBB.BrowseNames.StackLevel, Namespaces.BBB) }, }, new ChildVariableSettings() { BrowsePath = new PathBuilder() { new AbsoluteName(AAA.BBB.BrowseNames.StackLevel, Namespaces.BBB), new AbsoluteName(AAA.BBB.BrowseNames.DisplayMode, Namespaces.BBB) }, Value = new Variant((int)LevelDisplayMode.Blinking) }, new ChildObjectSettings() { BrowsePath = new PathBuilder() { new AbsoluteName(AAA.BBB.BrowseNames.StackRunning, Namespaces.BBB) } } } }; CreateObject(Server.DefaultRequestContext, settings);
What is UaModeler showing here?
https://i.ibb.co/y86zbDV/11-11-2024-09-09-08.png
Edith: Funny, can't add BBCode ... nice forum settings
- Support Team
- Hero Member
- Posts: 3213
- Joined: 18 Mar 2011, 15:09
Re: Creating umati nodeset generically
Hi,
we probably need to take a closer look into your complete project including all the models involved.
Most probably the optional children were not defined correctly in your model.
You should create a support ticket request and send project and model files via the website form here:
https://www.unified-automation.com/support.html
we probably need to take a closer look into your complete project including all the models involved.
Most probably the optional children were not defined correctly in your model.
You should create a support ticket request and send project and model files via the website form here:
https://www.unified-automation.com/support.html
Best regards
Unified Automation Support Team
Unified Automation Support Team