Example #1
0
def getargarray(sample_req):
    array = []
    for slot_name in sample_req.__slots__:
        slot = getattr(sample_req, slot_name)
        if hasattr(slot, '_type'):
            array_to_merge = getargarray(slot)
            array.extend(array_to_merge)
        else:
            if isinstance(slot, list):
                arg = ua.Argument()
                arg.Name = slot_name
                arg.DataType = ua.NodeId(getobjectidfromtype("array"))
                arg.ValueRank = -1
                arg.ArrayDimensions = [1]
                arg.Description = ua.LocalizedText("Array")
            else:
                arg = ua.Argument()
                arg.Name = slot_name
                arg.DataType = ua.NodeId(
                    getobjectidfromtype(type(slot).__name__))
                arg.ValueRank = -1
                arg.ArrayDimensions = []
                arg.Description = ua.LocalizedText(slot_name)
            array.append(arg)

    return array
Example #2
0
 def from_fb(self, input_xml, output_xml):
     # gets the method input arguments
     for entry in input_xml:
         if 'OpcUa' in entry.attrib:
             var_specs = entry.attrib['OpcUa'].split('.')
             if self.method_name in var_specs:
                 # gets the name
                 var_name = entry.attrib['Name']
                 # gets the type
                 arg = ua.Argument()
                 arg.Name = entry.attrib['Name']
                 arg.DataType = utils.UA_NODE[utils.UA_TYPES[
                     entry.attrib['Type']]]
                 arg.ValueRank = 0
                 # adds the argument to the list
                 self.inputs[var_name] = arg
     # gets the method output arguments
     for entry in output_xml:
         if 'OpcUa' in entry.attrib:
             var_specs = entry.attrib['OpcUa'].split('.')
             if self.method_name in var_specs:
                 # gets the name
                 var_name = entry.attrib['Name']
                 # gets the type
                 arg = ua.Argument()
                 arg.Name = entry.attrib['Name']
                 arg.DataType = utils.UA_NODE[utils.UA_TYPES[
                     entry.attrib['Type']]]
                 arg.ValueRank = 0
                 # adds the argument to the list
                 self.outputs[var_name] = arg
def getargarray(goal_class):
    array = []
    for slot_name in goal_class.__slots__:
        if slot_name != 'header':
            slot = getattr(goal_class, slot_name)
            if hasattr(slot, '_type'):
                array_to_merge = getargarray(slot)
                array.extend(array_to_merge)
            else:
                if isinstance(slot, list):
                    rospy.logdebug("Found an Array Argument!")
                    arg = ua.Argument()
                    arg.Name = slot_name
                    arg.DataType = ua.NodeId(
                        ros_services.getobjectidfromtype("array"))
                    arg.ValueRank = -1
                    arg.ArrayDimensions = []
                    arg.Description = ua.LocalizedText("Array")
                else:
                    arg = ua.Argument()
                    if hasattr(goal_class, "__name__"):
                        arg.Name = goal_class.__name__ + slot_name
                    else:
                        arg.Name = slot_name
                    arg.DataType = ua.NodeId(
                        ros_services.getobjectidfromtype(type(slot).__name__))
                    arg.ValueRank = -1
                    arg.ArrayDimensions = []
                    arg.Description = ua.LocalizedText(slot_name)
                array.append(arg)

    return array
Example #4
0
    def parse_method(self, parent, idx, method):
        node = NodeData()
        for key, val in method.items():
            self._set_attr(key, val, node)
        input_args = []
        output_args = []
        for i in range(len(node.input)):
            if 'type' in node.input[i]:
                argu = ua.Argument()
                #argu.DataType = getattr(ua.VariantType, node.input[i]['type']).value
                argu.DataType = ua.NodeId(
                    getattr(ua.VariantType, node.input[i]['type']).value)
                if 'name' in node.input[i]:
                    argu.Name = node.input[i]['name']
                logger.info("argu name:%s", argu.Name)
                input_args.append(argu)
        for i in range(len(node.output)):
            if 'type' in node.output[i]:
                argu = ua.Argument()
                #argu.DataType = getattr(ua.VariantType, node.input[i]['type']).value
                argu.DataType = ua.NodeId(
                    getattr(ua.VariantType, node.output[i]['type']).value)
                if 'name' in node.output[i]:
                    argu.Name = node.output[i]['name']
                logger.info('output arg:%s', argu)
                output_args.append(argu)
            else:
                output_args.append(
                    getattr(ua.VariantType, node.output[i]).value)

        rpc = make_rpc(self.adapter, node.rpc_name, self.plugin_id)
        parent.add_method(idx, node.rpc_name, rpc.rpc_func, input_args,
                          output_args)
Example #5
0
 def from_xml(self, method_xml):
     # first parse the inputs and the outputs
     for argument in method_xml[0]:
         if argument.attrib['type'] == 'Output':
             # gets the name
             var_name = argument.attrib['name']
             # gets the type
             arg = ua.Argument()
             arg.Name = argument.attrib['name']
             arg.DataType = utils.UA_NODE[utils.UA_TYPES[
                 argument.attrib['DataType']]]
             arg.ValueRank = int(argument.attrib['ValueRank'])
             # adds the argument to the list
             self.outputs[var_name] = arg
         elif argument.attrib['type'] == 'Input':
             # gets the name
             var_name = argument.attrib['name']
             # gets the type
             arg = ua.Argument()
             arg.Name = argument.attrib['name']
             arg.DataType = utils.UA_NODE[utils.UA_TYPES[
                 argument.attrib['DataType']]]
             arg.ValueRank = int(argument.attrib['ValueRank'])
             # adds the argument to the list
             self.inputs[var_name] = arg
Example #6
0
    def test_xml_ext_obj_array(self):
        arg = ua.Argument()
        arg.DataType = ua.NodeId(ua.ObjectIds.Float)
        arg.Description = ua.LocalizedText("Nice description")
        arg.ArrayDimensions = [1, 2, 3]
        arg.Name = "MyArg"

        arg2 = ua.Argument()
        arg2.DataType = ua.NodeId(ua.ObjectIds.Int32)
        arg2.Description = ua.LocalizedText("Nice description2")
        arg2.ArrayDimensions = [4, 5, 6]
        arg2.Name = "MyArg2"

        args = [arg, arg2]

        node = self.opc.nodes.objects.add_variable(2, "xmlexportobj2", args)
        node2 = self._test_xml_var_type(node,
                                        "ext_obj_array",
                                        test_equality=False)
        readArgs = node2.get_value()

        for i, arg in enumerate(readArgs):
            self.assertEqual(args[i].Name, readArgs[i].Name)
            self.assertEqual(args[i].ArrayDimensions,
                             readArgs[i].ArrayDimensions)
            self.assertEqual(args[i].Description, readArgs[i].Description)
            self.assertEqual(args[i].DataType, readArgs[i].DataType)
Example #7
0
def main():
    # setup our server
    server = Server()
    server.set_endpoint("opc.tcp://0.0.0.0:4840/freeopcua/server/")

    # setup our own namespace, not really necessary but should as spec
    server_namespace = "http://examples.freeopcua.github.io"
    address_space = server.register_namespace(server_namespace)

    # get Objects node, this is where we should put our custom stuff
    objects_node = server.get_objects_node()

    # Add the ocp objects (vars, features,...)
    # cresting the first object
    my_first_object = objects_node.add_object(address_space, "MyFirstObject")

    ## Two different methods definitions
    # First
    method_1_node = my_first_object.add_method(address_space,
                                               "method_1_description",
                                               odd_or_even,
                                               [ua.VariantType.Int32],
                                               [ua.VariantType.Boolean])

    # Second
    inarg_1 = ua.Argument()
    inarg_1.Name = "Argument_1"
    inarg_1.DataType = ua.NodeId(ua.ObjectIds.Float32)
    inarg_1.ValueRank = -1
    inarg_1.ArrayDimensions = []
    inarg_1.Description = ua.LocalizedText("Method argument 1 description")
    inarg_2 = ua.Argument()
    inarg_2.Name = "Argument_2"
    inarg_2.DataType = ua.NodeId(ua.ObjectIds.Float32)
    inarg_2.ValueRank = -1
    inarg_2.ArrayDimensions = []
    inarg_2.Description = ua.LocalizedText("Method argument 2 description")
    outarg = ua.Argument()
    outarg.Name = "Result"
    outarg.DataType = ua.NodeId(ua.ObjectIds.Float32)
    outarg.ValueRank = -1
    outarg.ArrayDimensions = []
    outarg.Description = ua.LocalizedText("Output argument description")

    method_2_node = my_first_object.add_method(address_space,
                                               "method_2_description",
                                               multiply, [inarg_1, inarg_2],
                                               [outarg])

    # starting!
    server.start()
    print("Server starting ...")

    while True:
        time.sleep(1)
    def _add_variable_value(self, obj):
        """
        Returns the value for a Variable based on the objects valuetype. 
        """
        if obj.valuetype == 'ListOfLocalizedText':
            return ua.Variant([ua.LocalizedText(txt) for txt in obj.value],
                              None)
        elif obj.valuetype == 'EnumValueType':
            values = []
            for ev in obj.value:
                enum_value = ua.EnumValueType()
                enum_value.DisplayName = ua.LocalizedText(ev['DisplayName'])
                enum_value.Description = ua.LocalizedText(ev['Description'])
                enum_value.Value = int(ev['Value'])
                values.append(enum_value)
            return values
        elif obj.valuetype == 'Argument':
            values = []
            for arg in obj.value:
                argument = ua.Argument()
                argument.Name = arg['Name']
                argument.Description = ua.LocalizedText(arg['Description'])
                argument.DataType = self.to_nodeid(arg['DataType'])
                argument.ValueRank = int(arg['ValueRank'])
                argument.ArrayDimensions = arg['ArrayDimensions']
                values.append(argument)
            return values

        return ua.Variant(obj.value, getattr(ua.VariantType, obj.valuetype))
    def get_args(self):
        nodeid, bname = self.get_nodeid_and_bname()

        input_args = []
        output_args = []

        for row in self.widgets:
            dtype = row[3].get_node()
            name = row[1].text()
            description = row[2].text()

            method_arg = ua.Argument()
            method_arg.Name = name
            method_arg.DataType = dtype.nodeid
            method_arg.ValueRank = -1
            method_arg.ArrayDimensions = []
            method_arg.Description = ua.LocalizedText(description)

            if row[0] == 'input':
                input_args.append(method_arg)
            else:
                output_args.append(method_arg)

        # callback is None, this cannot be set from modeler
        return nodeid, bname, None, input_args, output_args
Example #10
0
    def __init__(self, ua_server, ua_folder, xml_root):
        self.ua_server = ua_server
        self.ua_folder = ua_folder
        self.xml_root = xml_root

        self.fbs = dict()
        self.fbs_inputs = dict()
        self.fbs_outputs = dict()
        self.fb_connections = []
        
        self.inputs = OrderedDict()
        self.outputs = OrderedDict()

        # add inputs and outputs from fbt file
        starting_fb = self.ua_server.config.get_fb(self.ua_server.method_event.split('.')[0])
        self.get_fbs(starting_fb)
        self.add_inputs_outputs()

        # add event input
        arg = ua.Argument()
        arg.Name = self.ua_server.method_event
        arg.DataType = utils.UA_NODE[utils.UA_TYPES['String']]
        arg.ValueRank = 0
        # adds the argument to the list
        self.inputs[self.ua_server.method_event] = arg

        # create method on opc ua server
        self.virtualize()
Example #11
0
    def _vtype_to_argument(vtype):
        if isinstance(vtype, ua.Argument):
            return ua.ExtensionObject.from_object(vtype)

        arg = ua.Argument()
        v = ua.Variant(None, vtype)
        arg.DataType = OPCUAServer._guess_uatype(v)
        return ua.ExtensionObject.from_object(arg)
Example #12
0
def _vtype_to_argument(vtype):
    if isinstance(vtype, ua.Argument):
        return vtype

    arg = ua.Argument()
    v = ua.Variant(None, vtype)
    arg.DataType = _guess_datatype(v)
    return arg
Example #13
0
 def generate_inputs_outputs(self, fb_name, xml_root, inputs_defined, outputs_defined):
     for element in xml_root:
         for child in element:
             if child.tag == 'InputVars':
                 for var_declaration in child:
                     if 'OpcUa' in var_declaration.attrib:
                         # gets the name
                         var_name = var_declaration.attrib['Name']
                         # checks if it is not a part of the user defined inputs
                         if inputs_defined and (fb_name not in self.fbs_inputs or var_name not in self.fbs_inputs[fb_name]):
                             continue
                         # checks if input already receives value from connection
                         connection = fb_name + '.' + var_name
                         if connection in self.fb_connections:
                             continue
                         # checks if input already receives value from 4diac
                         _, value, _ = self.ua_server.config.get_fb(fb_name).read_attr(var_name)
                         if value is not None:
                             continue
                         # gets the type
                         var_type = var_declaration.attrib['Type']
                         # builds argument
                         arg = ua.Argument()
                         arg.Name = connection
                         arg.DataType = utils.UA_NODE[utils.UA_TYPES[var_type]]
                         arg.ValueRank = 0
                         # adds the argument to the list
                         self.inputs[connection] = arg
             if child.tag == 'OutputVars':
                 for var_declaration in child:
                     if 'OpcUa' in var_declaration.attrib:
                         # gets the name
                         var_name = var_declaration.attrib['Name']
                         # checks if it is a part of the user defined outputs
                         if outputs_defined and (fb_name not in self.fbs_outputs or var_name not in self.fbs_outputs[fb_name]):
                             continue
                         # gets the type
                         var_type = var_declaration.attrib['Type']
                         # builds argument
                         connection = fb_name + '.' + var_name
                         arg = ua.Argument()
                         arg.Name = connection
                         arg.DataType = utils.UA_NODE[utils.UA_TYPES[var_type]]
                         arg.ValueRank = 0
                         # adds the argument to the list                            
                         self.outputs[connection] = arg
Example #14
0
def arg_general(_name, _desc, _type):
    arg = ua.Argument()
    arg.Name = _name
    arg.DataType = ua.NodeId(_type)
    arg.ArrayDimensions = []
    arg.Description = ua.LocalizedText(_desc)
    arg.ValueRank = -1
    return arg
Example #15
0
def _vtype_to_argument(vtype):
    if isinstance(vtype, ua.Argument):
        return vtype
    arg = ua.Argument()
    if isinstance(vtype, ua.VariantType):
        arg.DataType = ua.NodeId(vtype.value)
    else:
        arg.DataType = ua.NodeId(vtype)
    return arg
Example #16
0
    def test_base_data_type(self):
        nint32 = self.opc.get_node(ua.ObjectIds.Int32)
        dtype = nint32.add_data_type(0, "MyCustomDataType")
        dtype2 = dtype.add_data_type(0, "MyCustomDataType2")
        self.assertEqual(ua_utils.get_base_data_type(dtype), nint32)
        self.assertEqual(ua_utils.get_base_data_type(dtype2), nint32)

        ext = self.opc.nodes.objects.add_variable(0, "MyExtensionObject", ua.Argument())
        d = ext.get_data_type()
        d = self.opc.get_node(d)
        self.assertEqual(ua_utils.get_base_data_type(d), self.opc.get_node(ua.ObjectIds.Structure))
        self.assertEqual(ua_utils.data_type_to_variant_type(d), ua.VariantType.ExtensionObject)
 def init_server(self):
     print("inizio settaggio server")       
     self.server=Server()
     #self.server.set_endpoint("opc.tcp://192.168.1.250:4840")
     self.server.set_endpoint("opc.tcp://0.0.0.0:4840")
     self.server.set_server_name("DomoticProject")
     #carico il certificato e la chiave privata
     global base_path        
     file_path_cert=(base_path / "../config/certificati/my_cert.der").resolve()
     file_path_key=(base_path / "../config/certificati/my_private_key.pem").resolve()        
     self.server.load_certificate(file_path_cert)
     self.server.load_private_key(file_path_key)
     self.server.set_security_policy([
         ua.SecurityPolicyType.NoSecurity,
         ua.SecurityPolicyType.Basic256Sha256_SignAndEncrypt,
         ua.SecurityPolicyType.Basic256Sha256_Sign
     ])
     
     #setup namespace
     uri="Domotic"
     self.idx=self.server.register_namespace(uri)
     self.objects=self.server.get_objects_node()
     
     #per contenere le info dei sensori
     self.sensors_o=self.objects.add_object(self.idx, "Sensori")
     self.temperatura_s=self.sensors_o.add_variable(self.idx, "Temperatura", 0.00)
     self.counterbagno_s=self.sensors_o.add_variable(self.idx, "Counter Bagno", 0)
     self.countersalotto_s=self.sensors_o.add_variable(self.idx, "Counter Salotto", 0)
     
     #per contenere le info dei led
     self.luci_o=self.objects.add_object(self.idx, "Luci")        
     self.luci_o_dict={}
     for x in self.keys:
         self.luci_o_dict[x]=self.luci_o.add_variable(self.idx, "Luce "+x, False)
         self.luci_o_dict[x].set_writable()
     
     #per contenere i metodi
     self.method_o=self.objects.add_object(self.idx, "Metodi")
     
     inarg=ua.Argument()
     inarg.Name="stanza"
     inarg.DataType=ua.NodeId(ua.ObjectIds.String)
     inarg.ValueRank=-1
     inarg.ArrayDimensions=[]
     inarg.Description=ua.LocalizedText("stanza su cui applicare il metodo ['salotto', 'camera', 'bagno', 'ingresso']")
     
     self.mymethod1=self.method_o.add_method(self.idx, "Accendi luce", self.accendi_luce, [inarg])        
     self.mymethod2=self.method_o.add_method(self.idx, "Spegni luce", self.spegni_luce, [inarg])
     
     print("server settato")
Example #18
0
    def test_xml_ext_obj(self):
        arg = ua.Argument()
        arg.DataType = ua.NodeId(ua.ObjectIds.Float)
        arg.Description = ua.LocalizedText(b"Nice description")
        arg.ArrayDimensions = [1, 2, 3]
        arg.Name = "MyArg"

        node = self.opc.nodes.objects.add_variable(2, "xmlexportobj2", arg)
        node2 = self._test_xml_var_type(node, "ext_obj", test_equality=False)
        arg2 = node2.get_value()

        self.assertEqual(arg.Name, arg2.Name)
        self.assertEqual(arg.ArrayDimensions, arg2.ArrayDimensions)
        self.assertEqual(arg.Description, arg2.Description)
        self.assertEqual(arg.DataType, arg2.DataType)
Example #19
0
    def test_export_import_ext_obj(self):
        arg = ua.Argument()
        arg.DataType = ua.NodeId(ua.ObjectIds.Float)
        arg.Description = ua.LocalizedText(b"This is a nice description")
        arg.ArrayDimensions = [1, 2, 3]
        arg.Name = "MyArg"

        v = self.opc.nodes.objects.add_variable(2, "xmlexportobj2", arg)

        nodes = [v]
        self.opc.export_xml(nodes, "export.xml")
        self.opc.delete_nodes(nodes)
        self.opc.import_xml("export.xml")

        arg2 = v.get_value()

        self.assertEqual(arg.Name, arg2.Name)
        self.assertEqual(arg.ArrayDimensions, arg2.ArrayDimensions)
        self.assertEqual(arg.Description, arg2.Description)
        self.assertEqual(arg.DataType, arg2.DataType)
    # get Objects node, this is where we should put our custom stuff
    objects = server.get_objects_node()

    # populating our address space
    myfolder = objects.add_folder(idx, "myEmptyFolder")
    myobj = objects.add_object(idx, "MyObject")
    myvar = myobj.add_variable(idx, "MyVariable", 6.7)
    myvar.set_writable()  # Set MyVariable to be writable by clients
    myarrayvar = myobj.add_variable(idx, "myarrayvar", [6.7, 7.9])
    myarrayvar = myobj.add_variable(idx, "myStronglytTypedVariable",
                                    ua.Variant([], ua.VariantType.UInt32))
    myprop = myobj.add_property(idx, "myproperty", "I am a property")
    mymethod = myobj.add_method(idx, "mymethod", func, [ua.VariantType.Int64],
                                [ua.VariantType.Boolean])

    inargx = ua.Argument()
    inargx.Name = "x"
    inargx.DataType = ua.NodeId(ObjectIds.Int64)
    inargx.ValueRank = -1
    inargx.ArrayDimensions = []
    inargx.Description = ua.LocalizedText("First number x")
    inargy = ua.Argument()
    inargy.Name = "y"
    inargy.DataType = ua.NodeId(ObjectIds.Int64)
    inargy.ValueRank = -1
    inargy.ArrayDimensions = []
    inargy.Description = ua.LocalizedText("Second number y")
    outarg = ua.Argument()
    outarg.Name = "Result"
    outarg.DataType = ua.NodeId(ObjectIds.Int64)
    outarg.ValueRank = -1
            datatype=parameter_struct.data_type)
        test_var.set_writable()
        test_value = get_ua_class(parameter_struct_name)()
        test_value.Value = ua.Variant(23.12)
        test_value.IsValid = True
        test_value.Timestamp = datetime.datetime.now()
        test_value.User = "******"
        test_value.EngineeringUnit = "lol"
        test_var.set_value(test_value)

        objects = ua_server.server.get_objects_node()
        mymachine = objects.add_object(2, "MyCoolMachine")
        myservice = mymachine.add_object(2, "MESServices")
        mymethods = myservice.add_object(2, "Methods")

        batchidarg = ua.Argument()
        batchidarg.Name = "BatchId"
        batchidarg.DataType = parameter_struct.data_type
        batchidarg.ValueRank = -1
        batchidarg.ArrayDimensions = []
        batchidarg.Description = ua.LocalizedText(
            "The BatchID of the batch associated with this cleaning run")
        wateramountarg = ua.Argument()
        wateramountarg.Name = "WaterAmount"
        wateramountarg.DataType = parameter_struct.data_type
        wateramountarg.ValueRank = -1
        wateramountarg.ArrayDimensions = []
        wateramountarg.Description = ua.LocalizedText(
            "The amount of water used for this cleaning run")
        start_cleaning_method = mymethods.add_method(
            2, "StartCleaning", start_cleaning, [batchidarg, wateramountarg],
Example #22
0
uri = "silvia-notebook.opcua.it/freeopcua/server"
idx = server.register_namespace(uri)

objects = server.get_objects_node()

myObj = objects.add_object(idx, "RaspberryPi")
editableVar = myObj.add_variable(idx, "ModifyMe", 1, ua.VariantType.Int64)
sinFunc = myObj.add_variable(idx, "SinExample", 0, ua.VariantType.Float)
core0temp = myObj.add_variable(idx, "Core0Temperature", 0)
sensorTemp = myObj.add_variable(idx, "SensorTemperature", 0)
sensorHum = myObj.add_variable(idx, "SensorHumidity", 0)
myObj.add_method(idx, "BlinkLed", BlinkLed, [ua.VariantType.Int64, ua.VariantType.Int64], [])

editableVar.set_writable()

temp = ua.Argument()
temp.Name = "Temperature"
temp.DataType = ua.NodeId(ua.ObjectIds.Int64)
temp.ValueRank = -1
temp.ArrayDimensions = []
temp.Description = ua.LocalizedText("Output of sensor")
hum = ua.Argument()
hum.Name = "Humidity"
hum.DataType = ua.NodeId(ua.ObjectIds.Int64)
hum.ValueRank = -1
hum.ArrayDimensions = []
hum.Description = ua.LocalizedText("Output of sensor")

myObj.add_method(idx, "ReadHumidityTemperature", ReadHumidityTemperature, [], [temp, hum])

Example #23
0
#Toggle manual operation ON/OFF
def toggle_manual(parent):
    if manualoperation.get_value() == True:
        manualoperation.set_value(False)
        return ua.StatusCode(0)
    elif manualoperation.get_value() == False:
        manualoperation.set_value(True)
        return ua.StatusCode(0)
    else:
        return ua.StatusCode(0x80000000)  # Status code for Bad error


#Define arguments for Irrigate Control and Irrigate Fuzzy Methods
# Define mm_control as an argument to the Irrigate Control Method
mm_control = ua.Argument()
mm_control.Name = "mm_control"
mm_control.DataType = ua.NodeId(ua.ObjectIds.Float)
mm_control.ValueRank = -1
mm_control.ArrayDemisions = []
mm_control.Description = ua.LocalizedText(
    "Irrigation recommendation mm control")

# Define mm_fuzzy as an argument to the Irrigate Fuzzy Method
mm_fuzzy = ua.Argument()
mm_fuzzy.Name = "mm_fuzzy"
mm_fuzzy.DataType = ua.NodeId(ua.ObjectIds.Float)
mm_fuzzy.ValueRank = -1
mm_fuzzy.ArrayDemisions = []
mm_fuzzy.Description = ua.LocalizedText("Irrigation recommendation mm fuzzy")
    def init_methods(self):
        # method: ADD_OBJECTS_DIR
        inarg1 = ua.Argument()
        inarg1.Name = "objects folder"
        inarg1.DataType = ua.NodeId(ua.ObjectIds.String)  # String
        inarg1.ValueRank = -1
        inarg1.ArrayDimensions = []
        inarg1.Description = ua.LocalizedText("Name the new objects folder")

        method_node = self.obj.add_method(self.idx, "ADD_NEW_OBJECTS_FOLDER",
                                          self.add_objects_subfolder, [inarg1])

        # method: ADD_OPC_TAG
        inarg1 = ua.Argument()
        inarg1.Name = "opctag"
        inarg1.DataType = ua.NodeId(ua.ObjectIds.String)  # String
        inarg1.ValueRank = -1
        inarg1.ArrayDimensions = []
        inarg1.Description = ua.LocalizedText("Name new OPC variable")

        inarg2 = ua.Argument()
        inarg2.Name = "variant_type"
        inarg2.DataType = ua.NodeId(ua.ObjectIds.String)  # String
        inarg2.ValueRank = -1
        inarg2.ArrayDimensions = []
        inarg2.Description = ua.LocalizedText("Type of variable")

        inarg3 = ua.Argument()
        inarg3.Name = "parent_node"
        inarg3.DataType = ua.NodeId(ua.ObjectIds.String)  # String
        inarg3.ValueRank = -1
        inarg3.ArrayDimensions = []
        inarg3.Description = ua.LocalizedText(
            "Type in the name of the parent node the new variable should assigned to"
        )

        method_node = self.obj.add_method(self.idx, "ADD_OPC_TAG",
                                          self.register_opc_tag,
                                          [inarg1, inarg2, inarg3])

        # method: SET_PV_LIMIT
        inarg1 = ua.Argument()
        inarg1.Name = "active_power_setpoint"
        inarg1.DataType = ua.NodeId(ua.ObjectIds.Int32)  # Integer
        inarg1.ValueRank = -1
        inarg1.ArrayDimensions = []
        inarg1.Description = ua.LocalizedText(
            "Type in active power setpoint in percent [0 ... 100]")

        inarg2 = ua.Argument()
        inarg2.Name = "parent_node"
        inarg2.DataType = ua.NodeId(ua.ObjectIds.String)  # String
        inarg2.ValueRank = -1
        inarg2.ArrayDimensions = []
        inarg2.Description = ua.LocalizedText(
            "Type in the name of the parent node")

        method_node = self.obj.add_method(self.idx, "SET_PV_LIMIT",
                                          self.set_pv_active_power_setpoint,
                                          [inarg1, inarg2])

        # method: RUN_ONLINE_GRID_PROTECTION
        inarg1 = ua.Argument()
        inarg1.Name = "On/Off"
        inarg1.DataType = ua.NodeId(ua.ObjectIds.Int32)  # Integer
        inarg1.ValueRank = -1
        inarg1.ArrayDimensions = []
        inarg1.Description = ua.LocalizedText(
            "Type in 1 to RUN or 0 to STOP ONLINE_GRID_PROTECTION")

        inarg2 = ua.Argument()
        inarg2.Name = "parent_node"
        inarg2.DataType = ua.NodeId(ua.ObjectIds.String)  # String
        inarg2.ValueRank = -1
        inarg2.ArrayDimensions = []
        inarg2.Description = ua.LocalizedText(
            "Type in the name of the parent node")

        method_node = self.obj.add_method(self.idx,
                                          "RUN_ONLINE_GRID_PROTECTION",
                                          self.run_online_grid_protection,
                                          [inarg1, inarg2])
def create_standard_address_space_Part17(server):
  
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23455, 0)
    node.BrowseName = QualifiedName('AliasNameType', 0)
    node.NodeClass = NodeClass.ObjectType
    node.ParentNodeId = NumericNodeId(58, 0)
    node.ReferenceTypeId = NumericNodeId(45, 0)
    attrs = ua.ObjectTypeAttributes()
    attrs.DisplayName = LocalizedText("AliasNameType")
    attrs.IsAbstract = False
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(45, 0)
    ref.SourceNodeId = NumericNodeId(23455, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(58, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23456, 0)
    node.BrowseName = QualifiedName('AliasNameCategoryType', 0)
    node.NodeClass = NodeClass.ObjectType
    node.ParentNodeId = NumericNodeId(61, 0)
    node.ReferenceTypeId = NumericNodeId(45, 0)
    attrs = ua.ObjectTypeAttributes()
    attrs.DisplayName = LocalizedText("AliasNameCategoryType")
    attrs.IsAbstract = False
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23456, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23457, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23456, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23458, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23456, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23462, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(45, 0)
    ref.SourceNodeId = NumericNodeId(23456, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(61, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23457, 0)
    node.BrowseName = QualifiedName('<Alias>', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23456, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    node.TypeDefinition = NumericNodeId(23455, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("<Alias>")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23457, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23455, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23457, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(11508, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23457, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23458, 0)
    node.BrowseName = QualifiedName('<SubAliasNameCategories>', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23456, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    node.TypeDefinition = NumericNodeId(23456, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("<SubAliasNameCategories>")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23458, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23459, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23458, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23458, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(11508, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23458, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23459, 0)
    node.BrowseName = QualifiedName('FindAlias', 0)
    node.NodeClass = NodeClass.Method
    node.ParentNodeId = NumericNodeId(23458, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    attrs = ua.MethodAttributes()
    attrs.DisplayName = LocalizedText("FindAlias")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23459, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23460, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23459, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23461, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23459, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(78, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23459, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23458, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23460, 0)
    node.BrowseName = QualifiedName('InputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23459, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("InputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNameSearchPattern'
    extobj.DataType = NumericNodeId(12, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    extobj = ua.Argument()
    extobj.Name = 'ReferenceTypeFilter'
    extobj.DataType = NumericNodeId(17, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23460, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23460, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(78, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23460, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23459, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23461, 0)
    node.BrowseName = QualifiedName('OutputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23459, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("OutputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNodeList'
    extobj.DataType = NumericNodeId(23468, 0)
    extobj.ValueRank = 1
    extobj.ArrayDimensions = 0
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23461, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23461, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(78, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23461, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23459, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23462, 0)
    node.BrowseName = QualifiedName('FindAlias', 0)
    node.NodeClass = NodeClass.Method
    node.ParentNodeId = NumericNodeId(23456, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    attrs = ua.MethodAttributes()
    attrs.DisplayName = LocalizedText("FindAlias")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23462, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23463, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23462, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23464, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23462, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(78, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23462, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23463, 0)
    node.BrowseName = QualifiedName('InputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23462, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("InputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNameSearchPattern'
    extobj.DataType = NumericNodeId(12, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    extobj = ua.Argument()
    extobj.Name = 'ReferenceTypeFilter'
    extobj.DataType = NumericNodeId(17, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23463, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23463, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(78, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23463, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23462, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23464, 0)
    node.BrowseName = QualifiedName('OutputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23462, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("OutputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNodeList'
    extobj.DataType = NumericNodeId(23468, 0)
    extobj.ValueRank = 1
    extobj.ArrayDimensions = 0
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23464, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(37, 0)
    ref.SourceNodeId = NumericNodeId(23464, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(78, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23464, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23462, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23468, 0)
    node.BrowseName = QualifiedName('AliasNameDataType', 0)
    node.NodeClass = NodeClass.DataType
    node.ParentNodeId = NumericNodeId(22, 0)
    node.ReferenceTypeId = NumericNodeId(45, 0)
    attrs = ua.DataTypeAttributes()
    attrs.DisplayName = LocalizedText("AliasNameDataType")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(45, 0)
    ref.SourceNodeId = NumericNodeId(23468, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(22, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23469, 0)
    node.BrowseName = QualifiedName('AliasFor', 0)
    node.NodeClass = NodeClass.ReferenceType
    node.ParentNodeId = NumericNodeId(32, 0)
    node.ReferenceTypeId = NumericNodeId(45, 0)
    attrs = ua.ReferenceTypeAttributes()
    attrs.DisplayName = LocalizedText("AliasFor")
    attrs.InverseName = LocalizedText("HasAlias")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(45, 0)
    ref.SourceNodeId = NumericNodeId(23469, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(32, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23470, 0)
    node.BrowseName = QualifiedName('Aliases', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(85, 0)
    node.ReferenceTypeId = NumericNodeId(35, 0)
    node.TypeDefinition = NumericNodeId(23456, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("Aliases")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23470, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23476, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(35, 0)
    ref.SourceNodeId = NumericNodeId(23470, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(85, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23470, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23476, 0)
    node.BrowseName = QualifiedName('FindAlias', 0)
    node.NodeClass = NodeClass.Method
    node.ParentNodeId = NumericNodeId(23470, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    attrs = ua.MethodAttributes()
    attrs.DisplayName = LocalizedText("FindAlias")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23476, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23477, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23476, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23478, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23476, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23470, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23477, 0)
    node.BrowseName = QualifiedName('InputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23476, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("InputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNameSearchPattern'
    extobj.DataType = NumericNodeId(12, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    extobj = ua.Argument()
    extobj.Name = 'ReferenceTypeFilter'
    extobj.DataType = NumericNodeId(17, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23477, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23477, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23476, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23478, 0)
    node.BrowseName = QualifiedName('OutputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23476, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("OutputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNodeList'
    extobj.DataType = NumericNodeId(23468, 0)
    extobj.ValueRank = 1
    extobj.ArrayDimensions = 0
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23478, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23478, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23476, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23479, 0)
    node.BrowseName = QualifiedName('Tags', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23470, 0)
    node.ReferenceTypeId = NumericNodeId(35, 0)
    node.TypeDefinition = NumericNodeId(23456, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("Tags")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23479, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23485, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(35, 0)
    ref.SourceNodeId = NumericNodeId(23479, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23470, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23479, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23485, 0)
    node.BrowseName = QualifiedName('FindAlias', 0)
    node.NodeClass = NodeClass.Method
    node.ParentNodeId = NumericNodeId(23479, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    attrs = ua.MethodAttributes()
    attrs.DisplayName = LocalizedText("FindAlias")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23485, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23486, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23485, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23487, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23485, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23479, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23486, 0)
    node.BrowseName = QualifiedName('InputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23485, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("InputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNameSearchPattern'
    extobj.DataType = NumericNodeId(12, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    extobj = ua.Argument()
    extobj.Name = 'ReferenceTypeFilter'
    extobj.DataType = NumericNodeId(17, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23486, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23486, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23485, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23487, 0)
    node.BrowseName = QualifiedName('OutputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23485, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("OutputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNodeList'
    extobj.DataType = NumericNodeId(23468, 0)
    extobj.ValueRank = 1
    extobj.ArrayDimensions = 0
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23487, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23487, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23485, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23488, 0)
    node.BrowseName = QualifiedName('Topics', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23470, 0)
    node.ReferenceTypeId = NumericNodeId(35, 0)
    node.TypeDefinition = NumericNodeId(23456, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("Topics")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23488, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23494, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(35, 0)
    ref.SourceNodeId = NumericNodeId(23488, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23470, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23488, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23456, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23494, 0)
    node.BrowseName = QualifiedName('FindAlias', 0)
    node.NodeClass = NodeClass.Method
    node.ParentNodeId = NumericNodeId(23488, 0)
    node.ReferenceTypeId = NumericNodeId(47, 0)
    attrs = ua.MethodAttributes()
    attrs.DisplayName = LocalizedText("FindAlias")
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23494, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23495, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23494, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23496, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(47, 0)
    ref.SourceNodeId = NumericNodeId(23494, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23488, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23495, 0)
    node.BrowseName = QualifiedName('InputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23494, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("InputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNameSearchPattern'
    extobj.DataType = NumericNodeId(12, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    extobj = ua.Argument()
    extobj.Name = 'ReferenceTypeFilter'
    extobj.DataType = NumericNodeId(17, 0)
    extobj.ValueRank = -1
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23495, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23495, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23494, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23496, 0)
    node.BrowseName = QualifiedName('OutputArguments', 0)
    node.NodeClass = NodeClass.Variable
    node.ParentNodeId = NumericNodeId(23494, 0)
    node.ReferenceTypeId = NumericNodeId(46, 0)
    node.TypeDefinition = NumericNodeId(68, 0)
    attrs = ua.VariableAttributes()
    attrs.DisplayName = LocalizedText("OutputArguments")
    attrs.DataType = NumericNodeId(296, 0)
    value = []
    extobj = ua.Argument()
    extobj.Name = 'AliasNodeList'
    extobj.DataType = NumericNodeId(23468, 0)
    extobj.ValueRank = 1
    extobj.ArrayDimensions = 0
    value.append(extobj)
    attrs.Value = ua.Variant(value, ua.VariantType.ExtensionObject)
    attrs.ValueRank = 1
    attrs.ArrayDimensions = [0]
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23496, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(68, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(46, 0)
    ref.SourceNodeId = NumericNodeId(23496, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23494, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23499, 0)
    node.BrowseName = QualifiedName('Default Binary', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23468, 0)
    node.ReferenceTypeId = NumericNodeId(38, 0)
    node.TypeDefinition = NumericNodeId(76, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("Default Binary")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(38, 0)
    ref.SourceNodeId = NumericNodeId(23499, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23468, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(39, 0)
    ref.SourceNodeId = NumericNodeId(23499, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23502, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23499, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(76, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23505, 0)
    node.BrowseName = QualifiedName('Default XML', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23468, 0)
    node.ReferenceTypeId = NumericNodeId(38, 0)
    node.TypeDefinition = NumericNodeId(76, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("Default XML")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(38, 0)
    ref.SourceNodeId = NumericNodeId(23505, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23468, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(39, 0)
    ref.SourceNodeId = NumericNodeId(23505, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23508, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23505, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(76, 0)
    refs.append(ref)
    server.add_references(refs)
   
    node = ua.AddNodesItem()
    node.RequestedNewNodeId = NumericNodeId(23511, 0)
    node.BrowseName = QualifiedName('Default JSON', 0)
    node.NodeClass = NodeClass.Object
    node.ParentNodeId = NumericNodeId(23468, 0)
    node.ReferenceTypeId = NumericNodeId(38, 0)
    node.TypeDefinition = NumericNodeId(76, 0)
    attrs = ua.ObjectAttributes()
    attrs.DisplayName = LocalizedText("Default JSON")
    attrs.EventNotifier = 0
    node.NodeAttributes = attrs
    server.add_nodes([node])
    refs = []
    ref = ua.AddReferencesItem()
    ref.IsForward = False
    ref.ReferenceTypeId = NumericNodeId(38, 0)
    ref.SourceNodeId = NumericNodeId(23511, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(23468, 0)
    refs.append(ref)
    ref = ua.AddReferencesItem()
    ref.IsForward = True
    ref.ReferenceTypeId = NumericNodeId(40, 0)
    ref.SourceNodeId = NumericNodeId(23511, 0)
    ref.TargetNodeClass = NodeClass.DataType
    ref.TargetNodeId = NumericNodeId(76, 0)
    refs.append(ref)
    server.add_references(refs)
Example #26
0
def main():
    logging.basicConfig(level=logging.WARN)
    logger = logging.getLogger("opcua.server.internal_subscription")
    logger.setLevel(logging.DEBUG)

    # setup our server
    server = Server()
    server.set_endpoint( Commons.OPC_ENDPOINT )

    # setup our own namespace, not really necessary but should as spec
    server_namespace       = Commons.OPC_NAMESPACE
    address_space          = server.register_namespace( server_namespace )

    # get Objects node, this is where we should put our custom stuff
    objects_node           = server.get_objects_node()

    # populating our address space
    ChargeControllerObject = objects_node.add_object(address_space, Commons.MY_OBJECT_NAME)
    RelayBoxObject         = objects_node.add_object(address_space, "RelayBox")

    panelVoltage           = ChargeControllerObject.add_variable( address_space, "panelVoltage", 0.0 )
    panelCurrent           = ChargeControllerObject.add_variable( address_space, "panelCurrent", 0.0 )
    batteryVoltage         = ChargeControllerObject.add_variable( address_space, "batteryVoltage", 0.0 )
    batteryCurrent         = ChargeControllerObject.add_variable( address_space, "batteryCurrent", 0.0 )
    loadVoltage            = ChargeControllerObject.add_variable( address_space, "loadVoltage", 0.0 )
    loadCurrent            = ChargeControllerObject.add_variable( address_space, "loadCurrent", 0.0 )
    inPower                = ChargeControllerObject.add_variable( address_space, "inPower", 0.0 )
    outPower               = ChargeControllerObject.add_variable( address_space, "outPower", 0.0 )
    batteryStatus          = ChargeControllerObject.add_variable( address_space, "batteryStatus", "" )
    batteryCapacity        = ChargeControllerObject.add_variable( address_space, "batteryCapacity", 0.0 )
    batteryTemperature     = ChargeControllerObject.add_variable( address_space, "batteryTemperature", 0.0 )

    ## To make them writable by the clients
    """
    panelVoltage.set_writable()
    panelCurrent.set_writable()
    batteryCurrent.set_writable()
    batteryVoltage.set_writable()
    loadVoltage.set_writable()
    loadCurrent.set_writable()
    inPower.set_writable()
    outPower.set_writable()
    batteryStatus.set_writable()
    batteryCapacity.set_writable()
    batteryTemperature.set_writable()
    """

    ### Creating a custom EVENT
    eventType = server.create_custom_event_type(
                    address_space,
                    Commons.MY_FIRST_EVENT_NAME,
                    ua.ObjectIds.BaseEventType,
                    [
                        ('batteryVoltage', ua.VariantType.Float),
                        ('outputsEnabled', ua.VariantType.Boolean),
                    ]
                )
    myEventGenerator = server.get_event_generator(eventType, ChargeControllerObject)

    ##creating an array
    plug_A_current_array = ChargeControllerObject.add_variable(address_space, "plug_A_current_array", [6.7, 7.9])
    # the variable could be hard typed
    plug_B_current_array = ChargeControllerObject.add_variable(address_space, "plug_B_current_array", ua.Variant([], ua.VariantType.Float))

    ## creating a property
    prop_charge_controller_producer = ChargeControllerObject.add_property(address_space, "charge_controller_producer", "Epever")
    prop_charge_controller_model    = ChargeControllerObject.add_property(address_space, "charge_controller_model", "Tracer 2210A MPPT")
    prop_panel                      = ChargeControllerObject.add_property(address_space, "panel_info",   "12V 100 W")
    prop_battery                    = ChargeControllerObject.add_property(address_space, "battery_info", "Bosch 12V")

    ## Two different methods definitions
    # First
    plugs_control_node = RelayBoxObject.add_method(address_space, "set_plug_state", set_plug_state, [ua.VariantType.Boolean], [ua.VariantType.Boolean])

    # Second
    inarg = ua.Argument()
    inarg.Name = "inverter_state"
    inarg.DataType = ua.NodeId(ua.ObjectIds.Boolean)
    inarg.ValueRank = -1
    inarg.ArrayDimensions = []
    inarg.Description = ua.LocalizedText("Boolean inverter state")
    outarg = ua.Argument()
    outarg.Name = "Result"
    outarg.DataType = ua.NodeId(ua.ObjectIds.Boolean)
    outarg.ValueRank = -1
    outarg.ArrayDimensions = []
    outarg.Description = ua.LocalizedText("Final Inverter State")

    inverter_control_node = RelayBoxObject.add_method(address_space, "set_inverter_state", set_inverter_state, [inarg], [outarg])


    # starting!
    server.start()
    print( "Server starting ...")

    # creating my machinery objects
    chargeController = cc.EpeverChargeController(produce_dummy_data = DUMMY_DATA)
    outputsEnabled = True

    try:

        while True:
            time.sleep(1)
            data = chargeController.readAllData()

            panelVoltage.set_value( data['panelVoltage'] )
            panelCurrent.set_value( data['panelCurrent'] )
            batteryVoltage.set_value( data['batteryVoltage'] )
            batteryCurrent.set_value( data['batteryCurrent'] )
            loadVoltage.set_value( data['loadVoltage'] )
            loadCurrent.set_value( data['loadCurrent'] )
            inPower.set_value( data['inPower'] )
            outPower.set_value( data['outPower'] )
            batteryStatus.set_value( data['batteryStatus'] )
            batteryCapacity.set_value( data['batteryCapacity'] )
            batteryTemperature.set_value( data['batteryTemperature'] )

            if data['batteryVoltage'] < LOW_BATTERY_VOLTAGE and outputsEnabled:
                outputsEnabled = False;
                myEventGenerator.event.Message = ua.LocalizedText("Battery Voltage is too low. Outputs will be disconnected")
                myEventGenerator.event.batteryVoltage =  ua.Variant(float(data['panelVoltage']), ua.VariantType.Float)
                myEventGenerator.event.outputsEnabled =  ua.Variant( outputsEnabled , ua.VariantType.Boolean)
                myEventGenerator.event.Severity =  ua.Variant( 1 , ua.VariantType.Int32)
                myEventGenerator.trigger()
            elif data['batteryVoltage'] > LOW_BATTERY_VOLTAGE and not outputsEnabled:
                outputsEnabled = True;
                myEventGenerator.event.Message = ua.LocalizedText("Battery Voltage is normal. Outputs will be activated")
                myEventGenerator.event.batteryVoltage =  ua.Variant(float(data['panelVoltage']), ua.VariantType.Float)
                myEventGenerator.event.outputsEnabled =  ua.Variant( outputsEnabled , ua.VariantType.Boolean)
                myEventGenerator.event.Severity =  ua.Variant( 1 , ua.VariantType.Int32)
                myEventGenerator.trigger()

            ## update array variables
            burst = [random.random() for _ in range(1024)]
            plug_A_current_array.set_value(burst)
            plug_B_current_array.set_value(burst)

        embed()
    finally:
        # close connection, remove subcsriptions, etc
        server.stop()
Example #27
0
def get_update_refresh_time_input():
    input_arg = ua.Argument()
    input_arg.Name = "seconds"
    input_arg.DataType = ua.NodeId(ua.VariantType.Int64.value)
    return [input_arg]
Example #28
0
def get_update_refresh_time_output():
    output_arg = ua.Argument()
    output_arg.Name = "result"
    output_arg.DataType = ua.NodeId(ua.VariantType.Boolean.value)
    return [output_arg]
    ret = (ua.Variant(out_extobj, ua.VariantType.ExtensionObject),
           ua.Variant("test", ua.VariantType.String))

    return ret


server = Server()
server.set_endpoint("opc.tcp://0.0.0.0:4840/freeopcua/server/")
server.set_security_policy([ua.SecurityPolicyType.NoSecurity])

obj = server.get_objects_node()
idx = server.register_namespace("http://examples.freeopcua.github.io")

server.load_type_definitions()

inarg_extobj = ua.Argument()
inarg_extobj.Name = "In"
inarg_extobj.DataType = ua.NodeId(12079, 0)
inarg_extobj.ValueRank = -1
inarg_extobj.ArrayDimensions = []
inarg_extobj.Description = ua.LocalizedText("Wanted AxisInformation")

outarg_extobj = ua.Argument()
outarg_extobj.Name = "Out"
outarg_extobj.DataType = ua.NodeId(12079, 0)
outarg_extobj.ValueRank = -1
outarg_extobj.ArrayDimensions = []
outarg_extobj.Description = ua.LocalizedText("Actual AxisInformation")

status = ua.Argument()
status.Name = "Status"