Commit 5649093c authored by Georgios Dagkakis's avatar Georgios Dagkakis

plugin to be able to identify stations that may share batches

parent a96d270b
......@@ -13,5 +13,77 @@ class BatchesWIPShort(plugin.InputPreparationPlugin):
"""
def preprocess(self, data):
print 1
return data
\ No newline at end of file
nodes=data['graph']['node']
WIPData=data['input'].get(self.configuration_dict['input_id'], {})
from pprint import pprint
# pprint(WIPData)
# get the number of units for a standard batch
standardBatchUnits=0
for node_id, node in nodes.iteritems():
if node['_class']=='Dream.BatchSource':
standardBatchUnits=int(node['batchNumberOfUnits'])
node['wip']=[]
# remove the titles
WIPData.pop(0)
for row in WIPData:
# on the first empty row break
if not row[0]:
break
# if there is not record for the station continue
if (not row[1]) and not (row[2]):
pass
# continue
stationId=row[0]
workingBatchSize=nodes[stationId]['workingBatchSize']
# get a list with the stations that the station might share batches with (if any)
sharingStations=[]
if workingBatchSize!=standardBatchUnits:
sharingStations=self.findSharingStations(data,stationId)
print stationId,workingBatchSize,sharingStations
return data
# gets the data and a station id and returns a list with all the stations that the station may share batches
def findSharingStations(self,data,stationId):
nodes=data['graph']['node']
sharingStations=[]
current=stationId
# find all the predecessors that may share batches
while 1:
previous=self.getPredecessors(data, current)[0]
# when a decomposition is reached break
if 'Decomposition' in nodes[previous]['_class']:
break
# when a station is reach add it
if 'Machine' in nodes[previous]['_class'] or 'M3' in nodes[previous]['_class']:
sharingStations.append(previous)
# append also the parallel stations (this implies a symmetry)
parallelStations=self.getParallelStations(data, previous)
sharingStations.extend(parallelStations)
current=previous
current=stationId
# find all the successors that may share batches
while 1:
next=self.getSuccessors(data, current)[0]
# when a reassembly is reached break
if 'Reassembly' in nodes[next]['_class']:
break
# when a station is reach add it
if 'Machine' in nodes[next]['_class'] or 'M3' in nodes[next]['_class']:
sharingStations.append(next)
# append also the parallel stations (this implies a symmetry)
parallelStations=self.getParallelStations(data, next)
sharingStations.extend(parallelStations)
current=next
return sharingStations
\ No newline at end of file
......@@ -33,6 +33,18 @@ class Plugin(object):
successors.append(edge['destination'])
return successors
# returns the parallel stations for a station if any
def getParallelStations(self, data, node_id):
predecessors=self.getPredecessors(data, node_id)
if not predecessors:
return []
previous=predecessors[0]
parallelStations=self.getSuccessors(data, previous)
parallelStations.remove(node_id)
return parallelStations
# calculate the confidence interval for a list and a confidence level
def getConfidenceInterval(self, value_list, confidenceLevel):
from dream.KnowledgeExtraction.ConfidenceIntervals import ConfidenceIntervals
......
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