●方法定义
modify_calc_tag_attributes(self, props)
●方法参数说明
参数名称 |
参数说明 |
参数类型 |
默认值 |
props |
多个点属性列表,列表元素为每个点的属性字典。 |
字典类型的list |
|
●异常
如果调用失败,抛出hyperdb.HDError异常
●返回值
hyperdb.hd_sucess
●注意事项
属性字典必须遵循特定的格式,例如:
[
{'tagname':'catag0',
'nCalcPeriod' :6,
'szCalcExpr': '\'srctag\'+2',
'descriptor':'123321'
},
{'tagname':'catag1',
'nCalcPeriod' :7,
'szCalcExpr': '\'srctag\'+3',
'descriptor':'234432' }
]
tagname被用来定位被修改的tag点。有些属性无法修改,例如 'tagname',具体参考iHyperDB中的Tag属性页面。
●方法调用
def ModifyCalcTagAttributes(self):
props = [{'tagname':'catag0',
'nCalcPeriod' :6,
'szCalcExpr': '\'srctag\'+2',
'descriptor':'123321'
},
{'tagname':'catag1',
'nCalcPeriod' :7,
'szCalcExpr': '\'srctag\'+3',
'descriptor':'234432' }]
tagnames = ['catag0', 'catag1']
try:
tag1 = self.myTagMgr.get_tag(tagname=tagnames[0])
except Exception as e:
print("get_tag error: ", e.errcode)
try:
tag2 = self.myTagMgr.get_tag(tagname=tagnames[1])
except Exception as e:
print("get_tag error: ", e.errcode)
print("tagname: ", tag1.tagname, "descriptor: ", tag1.descriptor,"tagname: ", tag2.tagname, "descriptor: ", tag2.descriptor)
try:
self.myTagMgr.modify_calc_tag_attributes(props=props)
except Exception as e:
print("modify_calc_tag_attributes error: ", e.errcode)
else:
print("modifying calc tags' attributes succeeds")
try:
tag1 = self.myTagMgr.get_tag(tagname=tagnames[0])
except Exception as e:
print("get_tag error: ", e.errcode)
try:
tag2 = self.myTagMgr.get_tag(tagname=tagnames[1])
except Exception as e:
print("get_tag error: ", e.errcode)
print("tagname: ", tag1.tagname, "descriptor: ", tag1.descriptor,"tagname: ", tag2.tagname, "descriptor: ", tag2.descriptor)