Create Instance from UA Modeler-method

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
maudax
Jr. Member
Jr. Member
Posts: 2
Joined: 02 May 2019, 01:11

Create Instance from UA Modeler-method

Post by maudax »

Hello everybody,

I created an ObjectType "Infomodell" with UA Modeler. It has a method "createVar1" as component which shall create an instance of a variable "Var1". I created the object instance and implemented the method as described in the tutorials.

When I try to create the instance in the method "createVar1" I get an not-found-error because the Infomodell-class isn't derived from the BaseNodeManager. The namespace, the nodeId and the method "CreateVariable" can't be found. This is syntax from the UA Modeler.

Code: Select all

        
public partial class Infomodell : BaseObjectModel, IInfomodellMethods
    {
        public StatusCode createVar1(
            RequestContext context,
            Infomodell model,
            string in1,
            )
        {
                CreateVariableSettings variableSettings;  

                variableSettings = new CreateVariableSettings()
                {
                    BrowseName = new QualifiedName("Var1", TypeNamespaceIndex),
                    DisplayName = new LocalizedText("Var1"),
                    ParentNodeId = node.NodeId,
                    ParentAsOwner = false,
                    Value = "ValueofVar1",
                    ReferenceTypeId = UnifiedAutomation.UaBase.ReferenceTypeIds.HasComponent,
                    TypeDefinitionId = UnifiedAutomation.UaBase.VariableTypeIds.DataItemType,
                    DataType = UnifiedAutomation.UaBase.DataTypeIds.String,
                    ModellingRuleId = UnifiedAutomation.UaBase.ObjectIds.ModellingRule_Mandatory,
                    RequestedNodeId = new NodeId(1234, TypeNamespaceIndex)
                };
                CreateVariable(Server.DefaultRequestContext, variableSettings);
...
         }
How do I get the method "createVar1" in the BaseNodeManager-class so I can use its functions?

maudax
Jr. Member
Jr. Member
Posts: 2
Joined: 02 May 2019, 01:11

Re: Create Instance from UA Modeler-method

Post by maudax »

The solution ist to delete the structure that was created by the UAModeler :o

Had to insert the CallMethodEventHandler right in the NodeManager-class.

cheerio

Post Reply