批量新增报警点

Navigation:  Python > TagMgr类管理 > tagmgr模块 >

批量新增报警点

Previous pageReturn to chapter overviewNext page

 

方法定义

 

add_alarm_tags(self, props)

 

 

方法参数说明

 

参数名称

参数说明

参数类型

默认值

props

多个点属性列表,列表元素为每个点的属性字典。

例如:

[{'tagname': 'amtag0',

'tagtype': 'int32',

'sourcetagname': 'int8'

},{'tagname': 'amtag1',

'tagtype': 'int32',

'sourcetagname': 'int8'

}]

字典类型的list

 

 

异常

 

如果调用失败,抛出hyperdb.HDError异常

 

返回值

 

hyperdb.hd_sucess

 

注意事项

 

1.输入的字典属性dictionary attributes应该包括AlarmTagProp的参数

 

2.创建计算点之前,确保普通点的存在,例如:上述例子中的“'int8'”

 

方法调用

 

def AddAlarmTags(self):

   props = [{'tagname': 'amtag0',

           'tagtype': 'int32',

           'sourcetagname': 'int8'

           },

           {'tagname': 'amtag1',

           'tagtype': 'int32',

           'sourcetagname': 'int8'

           }]

   try:

       tagalarmids = self.myTagMgr.add_alarm_tags(props=props)

   except Exception as e:

       print("add_alarm_tags error: ", e.errcode)

   else:

       print("adding alarm tags succeeds")