Commit d2c9ebce authored by Georgios Dagkakis's avatar Georgios Dagkakis

cleanup with comments

parent 824569d7
...@@ -15,6 +15,7 @@ class BatchesWIPKEtool(plugin.InputPreparationPlugin): ...@@ -15,6 +15,7 @@ class BatchesWIPKEtool(plugin.InputPreparationPlugin):
""" """
def preprocess(self, data): def preprocess(self, data):
# if the WIP data is to be defined manually just return
if data['general'].get('wipSource',None)=='Manually': if data['general'].get('wipSource',None)=='Manually':
return data return data
......
...@@ -13,6 +13,7 @@ class BatchesWIPShort(plugin.InputPreparationPlugin): ...@@ -13,6 +13,7 @@ class BatchesWIPShort(plugin.InputPreparationPlugin):
""" """
def preprocess(self, data): def preprocess(self, data):
# if the WIP data is to be read by KE tool just return
if data['general'].get('wipSource',None)=='KE tool': if data['general'].get('wipSource',None)=='KE tool':
return data return data
......
...@@ -15,6 +15,7 @@ class BatchesWIPSpreadsheet(plugin.InputPreparationPlugin): ...@@ -15,6 +15,7 @@ class BatchesWIPSpreadsheet(plugin.InputPreparationPlugin):
def preprocess(self, data): def preprocess(self, data):
""" Set the WIP in queue from spreadsheet data. """ Set the WIP in queue from spreadsheet data.
""" """
# if the WIP data is to be read by KE tool just return
if data['general'].get('wipSource',None)=='By KE': if data['general'].get('wipSource',None)=='By KE':
return data return data
......
from dream.plugins import plugin from dream.plugins import plugin
class OutputKEWIP(plugin.OutputPreparationPlugin): class OutputKEWIP(plugin.OutputPreparationPlugin):
""" Output the station utilization metrics in a format compatible with """ Output the WIP the KE tool return in a DREAM formatted spreadsheet
""" """
def postprocess(self, data): def postprocess(self, data):
# if the wip was defined manually, no report should be given, just a message to explain.
if data['general'].get('wipSource',None)=='Manually': if data['general'].get('wipSource',None)=='Manually':
data['result']['result_list'][0][self.configuration_dict['output_id']]=[[ data['result']['result_list'][0][self.configuration_dict['output_id']]=[[
'WIP Was defined Manually. No KE tool Input!' 'WIP Was defined Manually. No KE tool Input!'
]] ]]
return data return data
# if the mode was to read by KE but no spreadsheet was uploaded, give a warning.
if not data['input'].get('wip_report',{}): if not data['input'].get('wip_report',{}):
data['result']['result_list'][0][self.configuration_dict['output_id']]=[[ data['result']['result_list'][0][self.configuration_dict['output_id']]=[[
'Warning! No WIP Report was provided. KE could not be run and no WIP was defined in the model!' 'Warning! No WIP Report was provided. KE could not be run and no WIP was defined in the model!'
]] ]]
return data return data
# set the titles
outPutSpreadsheet=[['Station','# units awaiting processing','# units complete but not passed on']] outPutSpreadsheet=[['Station','# units awaiting processing','# units complete but not passed on']]
nodes=data['graph']['node'] nodes=data['graph']['node']
# create rows for all the stations
for node_id, node in nodes.iteritems(): for node_id, node in nodes.iteritems():
if 'Machine' in node['_class'] or 'M3' in node['_class']: if 'Machine' in node['_class'] or 'M3' in node['_class']:
outPutSpreadsheet.append([node_id,0]) outPutSpreadsheet.append([node_id,0])
# read the input and for the queues that have WIP set the total number of units to the next station
# WIP from KE tool now is only in Queues but the manual input is done as '# units awaiting processing' in station
for node_id, node in nodes.iteritems(): for node_id, node in nodes.iteritems():
if 'Queue' in node['_class'] or 'Clearance' in node['_class']: if 'Queue' in node['_class'] or 'Clearance' in node['_class']:
wip=node.get('wip',[]) wip=node.get('wip',[])
...@@ -43,7 +47,6 @@ class OutputKEWIP(plugin.OutputPreparationPlugin): ...@@ -43,7 +47,6 @@ class OutputKEWIP(plugin.OutputPreparationPlugin):
def getNextStation(self,data,bufferId): def getNextStation(self,data,bufferId):
nodes=data['graph']['node'] nodes=data['graph']['node']
current=bufferId current=bufferId
# find all the successors that may share batches
while 1: while 1:
next=self.getSuccessors(data, current)[0] next=self.getSuccessors(data, current)[0]
if 'Machine' in nodes[next]['_class'] or 'M3' in nodes[next]['_class']: if 'Machine' in nodes[next]['_class'] or 'M3' in nodes[next]['_class']:
......
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