Hi,
I am creating a server for training purposes and would like to know how to create instances on the OPC UA server of the types which have a modelling rule optional.
I have used the OptionalBrowsePaths property in CreateObjectSettings to define which optional types I want to create, but this only works for the immediate children.
I would like to create instances of ALL optional types in the model including the children's children...
Can somebody please explain how to do this?
Thanks
Optional Types of Children and their children
Moderator: uasdknet
-
- Jr. Member
- Posts: 1
- Joined: 23 Apr 2019, 19:30
-
- Full Member
- Posts: 9
- Joined: 14 Feb 2018, 10:49
Re: Optional Types of Children and their children
Hi Darren,
You can do this by specifying the children of children in OptionalBrowsePaths as follows (example adding optional TransitionTime of ActiveState of AlarmConditionType):
Basically, you use the AbsoluteName.ToString to construct the browse path to the optional children of children to include.
You can do this by specifying the children of children in OptionalBrowsePaths as follows (example adding optional TransitionTime of ActiveState of AlarmConditionType):
Code: Select all
var alarmConditionObject = CreateObject(Server.DefaultRequestContext, new CreateObjectSettings
{
ParentNodeId = ...,
ReferenceTypeId = ReferenceTypeIds.HasCondition,
RequestedNodeId = ...,
BrowseName = ...,
TypeDefinitionId = ObjectTypeIds.AlarmConditionType,
OptionalBrowsePaths = new List<string> { "LatchedState", "Reset", AbsoluteName.ToString("ActiveState","TransitionTime") }
});
-
- Full Member
- Posts: 9
- Joined: 14 Feb 2018, 10:49
Re: Optional Types of Children and their children
Found out how to do this...
Done by specifying the children of children in OptionalBrowsePaths as follows (example adding optional TransitionTime of ActiveState of AlarmConditionType):
Basically, you use the AbsoluteName.ToString to construct the browse path to the optional children of children to include.
Done by specifying the children of children in OptionalBrowsePaths as follows (example adding optional TransitionTime of ActiveState of AlarmConditionType):
Code: Select all
var alarmConditionObject = CreateObject(Server.DefaultRequestContext, new CreateObjectSettings
{
ParentNodeId = ...,
ReferenceTypeId = ReferenceTypeIds.HasCondition,
RequestedNodeId = ...,
BrowseName = ...,
TypeDefinitionId = ObjectTypeIds.AlarmConditionType,
OptionalBrowsePaths = new List<string> { "LatchedState", "Reset", AbsoluteName.ToString("ActiveState","TransitionTime") }
});