批量新增计算点

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

批量新增计算点

Previous pageReturn to chapter overviewNext page

 

方法定义

 

add_calc_tags(self, props)

 

 

方法参数说明

参数名

参数说明

参数类型

默认值

props

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

 

例如:

 

[{'tagname': 'catag0',

 

'tagtype': 'int32',

 

'szCalcExpr': '\'srctag\'+1',

 

'szSourceTagName':'srctag',

 

'nCalcMode' : 0,

 

'nCalcPeriod' :5

 

},{'tagname': 'catag1',

 

'tagtype': 'int32',

 

'szCalcExpr': '\'srctag\'+1',

 

'szSourceTagName':'srctag',

 

'nCalcMode' : 0,

 

'nCalcPeriod' :5

 

}]

字典类型的list


 

异常

 

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

 

返回值

 

hyperdb.hd_sucess

 

注意事项

 

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

 

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

 

 

方法调用

 

def AddCalcTags(self):

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

   'tagtype': 'int32',

   'szCalcExpr': '\'srctag\'+1',

   'szSourceTagName':'srctag',

   'nCalcMode' : 0,

   'nCalcPeriod' :5

   },{'tagname': 'catag1',

   'tagtype': 'int32',

   'szCalcExpr': '\'srctag\'+1',

   'szSourceTagName':'srctag',

   'nCalcMode' : 0,

   'nCalcPeriod' :5

   }]

   try:

       tagcalcids = self.myTagMgr.add_calc_tags(props=props)

   except Exception as e:

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

   else:

       print("adding calc tags succeeds")