Login  •  Register


Create Instance from UA Modeler-method  Topic is solved

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

Create Instance from UA Modeler-method

Postby maudax » 02 May 2019, 09:09

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
Newbie
Newbie
 
Posts: 2
Joined: 02 May 2019, 01:11

Re: Create Instance from UA Modeler-method  Topic is solved

Postby maudax » 03 May 2019, 16:27

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
maudax
Newbie
Newbie
 
Posts: 2
Joined: 02 May 2019, 01:11


Return to .NET based OPC UA SDK

Who is online

Users browsing this forum: No registered users and 0 guests

cron