I will do my best to describe what is happening. I am trying to figure out someone else's code here and I am quite a novice when it comes to Python scripting.
The person who wrote this originally is using a script to get a list of inverters from a custom property. Then it creates a list of tags and then queries the tags. When I look at the props where the script is bound, I can see the tag names but the values are null. I am hoping someone can help me in the right direction to start diagnosing this issue. I will paste the script and some screenshots that will hopefully be helpful. The table that is supposed to display looks like it has an overlay issue but it is not clear.
def transform(self, value, quality, timestamp):
invList = value.instances
#queryTags = ["ACTIVE_POWER","DC_POWER","DC_CURRENT_IN_A","AC_CURRENT","VAB","VBC","VCA","INVERTER_DC_VOLTAGE","STATUS_1","NORMALIZED_STATE","TOTAL_ALARM_COUNT","CURTAILMENT"]
queryTags = ["GRID_POWER_P","DC_INPUT_POWER","DC_INPUT_CURRENT","GRID_CURRENT_AVG","GRID_VOLT_RS","GRID_VOLT_ST","GRID_VOLT_TR","DC_VOLTAGE_PV_VDC","STATUS_1","NORMALIZED_STATE","TOTAL_ALARM_COUNT","EVENT_STATE","CURTAILMENT","NUM_RUNNING_MODULES","NUM_OUT_OF_SERVICE_MODULES"]
queryLen = len(queryTags)
tags = []
#build tag list
for inv in invList:
for q in queryTags:
tags.append('Inverters/'+inv+'/'+q)
#read values
results = system.tag.readBlocking(tags)
retList = []
#evaluate values
def eval(val):
if val == None:
return ''
return {'value':val.value,'style':{'classes':'tblErr' if str(val.getQuality()) != 'Good' else ''}}
#custom code to highlight NUM_RUNNING_MODULES column if value in cell is < 6
def evalModules(val,num):
if val == None:
return ''
return {'value':val.value,'style':{'classes':' tblErr' if str(val.getQuality()) != 'Good' else ('tblFault' if val.value != num else '')}}
#end of custom code to highlight NUM_RUNNING_MODULES column if value in cell is < 6
#built results
for i in range(len(invList)):
ind = i * queryLen
retList.append(
{'Inverter':invList[i],
'Active_Power': eval(results[ind]),
'DC_POWER': eval(results[ind+1]),
'DC_CURRENT_IN_A': eval(results[ind+2]),
'AC_CURRENT': eval(results[ind+3]),
'VAB': eval(results[ind+4]),
'VBC': eval(results[ind+5]),
'VCA': eval(results[ind+6]),
'DC_VOLTAGE': eval(results[ind+7]),
'STATUS_1': eval(results[ind+8]),
'NORMALIZED_STATE': eval(results[ind+9]),
'TOTAL_ALARM_COUNT_UNACK':eval(results[ind+10]),
'EVENT_STATE':eval(results[ind+11]),
'CURTAILMENT':eval(results[ind+12]),
'NUM_RUNNING_MODULES':evalModules(results[ind+13],6),
'NUM_OUT_OF_SERVICE_MODULES':evalModules(results[ind+14],0)
})
return retList
The table has a binding on the Prop "data" and as you can see from the image below, it gathers the inverter name but the tag data is null. I have verified the data is good in the tag browser.
Below is an image of what the table looks like currently. There is no indication as to what the red triangle with exclamation mark is indicating.
Any help would be appreciated. Please be kind. I am still learning.