Commit 1ba43460 authored by Georgios Dagkakis's avatar Georgios Dagkakis

CapacityInstance to ouput mean utilizations in barplot

parent b778b1dc
from dream.plugins import plugin
from copy import copy
class CapacityProjectStationUtilization(plugin.OutputPreparationPlugin):
""" Output the station utilization metrics in a format compatible with
"""
def postprocess(self, data):
result = data['result']['result_list'][-1]
ticks = []
utilized_data = []
idle_data = []
options = {
"xaxis": {
"minTickSize": 1,
"ticks": ticks
},
"yaxis": {
"max": 100
},
"series": {
"bars": {
"show": True,
"barWidth": 0.8,
"align": "center"
},
"stack": True
}
}
series = [{
"label": "Utilized",
"data": utilized_data
}, {
"label": "Idle",
"data": idle_data
}
];
out = result[self.configuration_dict['output_id']] = {
"series": series,
"options": options
}
i = 0
for obj in result['elementList']:
if obj.get('family') == self.configuration_dict.get('family'):
print obj['id'], obj['results'].keys()
if obj['results']['meanUtilization']:
utilized_data.append((i, obj['results']['meanUtilization']*100))
idle_data.append((i, (1- obj['results']['meanUtilization'])*100))
ticks.append((i, obj.get('name', self.getNameFromId(data, obj['id']))))
i += 1
return data
......@@ -540,22 +540,15 @@
}
},
"output": {
"view_mean_capacity_utilization": {
"title": "Average Capacity Utilization",
"type": "object_view",
"gadget": "Output_viewStationUtilisationGraph",
"configuration": {
"family": "capacityStation",
"plot": "bar",
"group": [],
"data": {
"utilization": [
"meanUtilization"
]
}
}
}
},
"view_station_utilization": {
"configuration": {
"output_id": "station_utilization"
},
"gadget": "Output_viewChart",
"title": "Station Utilization",
"type": "object_view"
}
},
"pre_processing": {
"plugin_list": [
{
......@@ -585,7 +578,13 @@
"input_id": "Simulation"
},
"post_processing": {
"plugin_list": []
"plugin_list": [
{
"_class": "dream.plugins.CapacityProjectStationUtilization.CapacityProjectStationUtilization",
"family": "CapacityStation",
"output_id": "station_utilization"
}
]
},
"general": {
"properties": {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment