Commit 27e90ab1 authored by Georgios Dagkakis's avatar Georgios Dagkakis

two auxiliary methods added

parent daf942e3
...@@ -55,17 +55,18 @@ class BatchesWIPShort(plugin.InputPreparationPlugin): ...@@ -55,17 +55,18 @@ class BatchesWIPShort(plugin.InputPreparationPlugin):
# set the WIP for every group # set the WIP for every group
for group in groups: for group in groups:
# if we have stations that may share sub-batches # if the station does not work in full batch
groupWorkingBatchSize=nodes[group[0]]['workingBatchSize'] groupWorkingBatchSize=nodes[group[0]]['workingBatchSize']
if groupWorkingBatchSize<standardBatchUnits:
currentBatchId='Batch_'+str(batchCounter)+'_WIP' currentBatchId='Batch_'+str(batchCounter)+'_WIP'
subBatchCounter=0 subBatchCounter=0
unitsToCompleteBatch=standardBatchUnits unitsToCompleteBatch=standardBatchUnits
group.sort(key=lambda x: self.getDistanceFromSource(data, x)) group.sort(key=lambda x: self.getDistanceFromSource(data, x))
if groupWorkingBatchSize<standardBatchUnits:
for stationId in group: for stationId in group:
workingBatchSize=nodes[stationId]['workingBatchSize'] workingBatchSize=nodes[stationId]['workingBatchSize']
stationWIPData=[element for element in WIPData if element[0] == stationId][0] stationWIPData=[element for element in WIPData if element[0] == stationId][0]
print stationWIPData print stationWIPData
print stationId, self.checkIfStationIsAfterDecomposition(data, stationId),self.getBuffer(data, stationId)
awaiting=stationWIPData[1] awaiting=stationWIPData[1]
complete=stationWIPData[2] complete=stationWIPData[2]
if not awaiting: if not awaiting:
...@@ -205,5 +206,33 @@ class BatchesWIPShort(plugin.InputPreparationPlugin): ...@@ -205,5 +206,33 @@ class BatchesWIPShort(plugin.InputPreparationPlugin):
current=previous current=previous
return distance return distance
# returns the buffer for a station id.
def getBuffer(self,data,stationId):
nodes=data['graph']['node']
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 'Queue' in nodes[previous]['_class'] or 'Clearance' in nodes[previous]['_class']:
return previous
if 'Source' in nodes[previous]['_class'] or 'Clearance' in nodes[previous]['_class']:
return None
current=previous
# returns true if the buffer is closer to a decompositions than a buffer
def checkIfStationIsAfterDecomposition(self,data,stationId):
nodes=data['graph']['node']
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 'Queue' in nodes[previous]['_class'] or 'Clearance' in nodes[previous]['_class']:
return False
if 'Decomposition' in nodes[previous]['_class']:
return True
current=previous
\ No newline at end of file
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