Custom alarm status/journal viewer in Vision?

I find the built-in alarming to be somewhat limiting, especially in the fixed 5-level priorities, and no way to display Associated Data as a column in the status window.

Is there a better approach than building custom alarm objects? I could theoretically replace "Priority" with Associated Data, and I could create more flexibility in sorting. I could also make a more effective alarm class mechanism using Associated Data and allow the object to dynamically examine alarms by class. Are there any drawbacks to this?

One caveat I can think of is logging... anyone analyzing logs would likely be confused by the built-in priority vs my custom priority. And I'm not sure what kind of performance hit there might be by using a custom alarm object. And I'm not even sure what hurdles I'd have to jump through to pull historical alarm data.

Personally, I probably wouldn't do this. At first, I will admit that I shared your view of the various unmalleable enum classes that comprise much of the data in the Alarm Status Table, and I found the complexity of that component to be a little off putting, but the more I work with it, the more impressed I am. The tool is quite comprehensive, and I can tell that a lot of high quality reasoning went into its design. It's actually quite a bit more flexible than it at first seems.

However, if you want to go down the road of creating your own, I don't believe it would be that difficult to create a generic version that's more approachable from the perspective of customization.

You can use system.alarm.queryStatus([...]) to pull the alarm information into a datset, and from there, you could manipulate the data in anyway you wanted prior to putting it into a table.
Example:

alarms = system.alarm.queryStatus(state=[0, 1, 2]).getDataset()
headers = ["EventID", "State", "DisplayPath", "EventTime", "State", "Priority"]
data = []
for row in range(alarms.rowCount):
	eventID = alarms.getValueAt(row, "EventID")
	source = alarms.getValueAt(row, "Source")
	displayPath = alarms.getValueAt(row, "Source")
	eventTime = alarms.getValueAt(row, "EventTime")
	stateValue = alarms.getValueAt(row, "State")
	priorityValue = alarms.getValueAt(row, "Priority")
	if stateValue == 0:
		state = 'Cleared, Unacknowledged'
	elif stateValue == 1:
		state = 'Cleared, Acknowledged'
	elif stateValue == 2:
		state = 'Active, Unacknowledged'
	else:
		state = 'Active, Acknowledged'
	if priorityValue == 0:
		priority = 'Diagnostic'
	elif priorityValue == 1:
		priority = 'Low'
	elif priorityValue == 2:
		priority = 'Medium'
	elif priorityValue == 3:
		priority = 'High'
	else:
		priority = 'Critical'
	data.append([eventID, source, displayPath, eventTime, state, priority])
	alarmDataSet = system.dataset.toDataSet(headers, data)
	event.source.parent.getComponent('Power Table').data = alarmDataSet

The preceding script will create a dataset for a Power Table with 6 columns that has custom state and priority values

From there, you could use the various extension functions to customize the table.
Example:

def configureCell([...])
	if selected:
		return {'background': self.selectionBackground}
	elif self.data.getValueAt(rowIndex, "Priority") == "Diagnostic":
		return {'background': 'gray', 'foreground':'white'}
	elif self.data.getValueAt(rowIndex, "Priority") == "Low":
		return {'background': 'blue', 'foreground':'white'}
	elif self.data.getValueAt(rowIndex, "Priority") == "Medium":
		return {'background': 'green', 'foreground':'white'}
	elif self.data.getValueAt(rowIndex, "Priority") == "High":
		return {'background': 'orange', 'foreground':'white'}
	else:
		return {'background': 'red', 'foreground':'white'}

The preceding code examples produces the following result:

If you want to add acknowledgement and shelving capabilities or even create the ability for clients to add acknowledgement notes, you could probably embed the table into a container or a popup holder panel and add a couple of buttons for this purpose. Much of the source code that would be needed for this could be adapted from the example I posted here:

1 Like