Commit 3846fd2a authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Sebastien Robin

BatchReassembly class added

parent 5cea27e3
...@@ -28,17 +28,16 @@ BatchDecomposition is a Core Object that takes a batch and decomposes to sub-bat ...@@ -28,17 +28,16 @@ BatchDecomposition is a Core Object that takes a batch and decomposes to sub-bat
from SimPy.Simulation import Process, Resource from SimPy.Simulation import Process, Resource
from SimPy.Simulation import activate, waituntil, now, hold from SimPy.Simulation import activate, waituntil, now, hold
import scipy.stats as stat
from Globals import G
from CoreObject import CoreObject from CoreObject import CoreObject
from RandomNumberGenerator import RandomNumberGenerator from RandomNumberGenerator import RandomNumberGenerator
import scipy.stats as stat
from Entity import Entity from Entity import Entity
from SubBatch import SubBatch from SubBatch import SubBatch
from Batch import Batch from Batch import Batch
from Globals import G
# =========================================================================== # ===========================================================================
# the Batch-Decomposition Object # the Batch-Decomposition Object
...@@ -88,7 +87,7 @@ class BatchDecomposition(CoreObject): ...@@ -88,7 +87,7 @@ class BatchDecomposition(CoreObject):
while 1: while 1:
yield waituntil, self, self.canAcceptAndIsRequested #wait until the Queue can accept an entity yield waituntil, self, self.canAcceptAndIsRequested #wait until the Queue can accept an entity
#and one predecessor requests it #and one predecessor requests it
ent=self.getEntity() self.getEntity()
# self.outputTrace("got into "+self.objName) # self.outputTrace("got into "+self.objName)
...@@ -109,6 +108,7 @@ class BatchDecomposition(CoreObject): ...@@ -109,6 +108,7 @@ class BatchDecomposition(CoreObject):
activeObject = self.getActiveObject() activeObject = self.getActiveObject()
activeObjectQueue=activeObject.getActiveObjectQueue() #get the internal queue of the active core object activeObjectQueue=activeObject.getActiveObjectQueue() #get the internal queue of the active core object
activeEntity = activeObjectQueue.pop() activeEntity = activeObjectQueue.pop()
G.BatchWaitingList.append(activeEntity) # this batch has to be reassembled by the method reassemble G.BatchWaitingList.append(activeEntity) # this batch has to be reassembled by the method reassemble
numberOfSubBatchUnits = activeEntity.numberOfUnits/self.numberOfSubBatches numberOfSubBatchUnits = activeEntity.numberOfUnits/self.numberOfSubBatches
for i in range(self.numberOfSubBatches): for i in range(self.numberOfSubBatches):
...@@ -169,7 +169,7 @@ class BatchDecomposition(CoreObject): ...@@ -169,7 +169,7 @@ class BatchDecomposition(CoreObject):
#if we have only one predecessor just check if there is a place available and the predecessor has an entity to dispose #if we have only one predecessor just check if there is a place available and the predecessor has an entity to dispose
if(len(activeObject.previous)==1): if(len(activeObject.previous)==1):
return self.canAccept(self) and giverObject.haveToDispose(activeObject) return self.canAccept() and giverObject.haveToDispose(activeObject)
isRequested=False # dummy boolean variable to check if any predecessor has something to hand in isRequested=False # dummy boolean variable to check if any predecessor has something to hand in
maxTimeWaiting=0 # dummy timer to check which predecessor has been waiting the most maxTimeWaiting=0 # dummy timer to check which predecessor has been waiting the most
......
This diff is collapsed.
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