Commit 45ef0893 authored by Georgios Dagkakis's avatar Georgios Dagkakis

BatchReassembly to be able to accept WIP

parent 39976f90
......@@ -77,7 +77,7 @@ class BatchReassembly(CoreObject):
self.initialSignalReceiver()
while 1:
while 1:
receivedEvent=yield self.isRequested | self.interruptionStart
receivedEvent=yield self.isRequested | self.interruptionStart | self.initialWIP
if self.interruptionStart in receivedEvent:
assert self.interruptionStart.value==self.env.now, 'the interruptionStart received by BatchReassembly later than created'
self.interruptionStart=self.env.event()
......@@ -86,21 +86,31 @@ class BatchReassembly(CoreObject):
self.interruptionEnd=self.env.event()
if self.signalGiver():
break
else:
# if we have initial wip
elif self.initialWIP in receivedEvent:
assert self.initialWIP.value==self.env, 'initial wip was not sent by the Environment'
self.initialWIP=self.env.event()
self.isProcessingInitialWIP=True
break
# otherwise proceed with getEntity
else:
requestingObject=self.isRequested.value
assert requestingObject==self.giver, 'the giver is not the requestingObject'
self.isRequested=self.env.event()
break
if not self.isProcessingInitialWIP: # if we are in the state of having initial wip no need to take an Entity
self.currentEntity=self.getEntity()
# initialize the timer timeLastEntityEntered
self.nameLastEntityEntered=self.currentEntity.name # this holds the name of the last entity that got into Machine
self.timeLastEntityEntered=self.env.now #this holds the last time that an entity got into Machine
# self.tinM=self.totalProcessingTimeInCurrentEntity # timer to hold the processing time left
if len(self.getActiveObjectQueue())==self.numberOfSubBatches and self.currentEntity.type!='Batch':
if (len(self.getActiveObjectQueue())==self.numberOfSubBatches and self.currentEntity.type!='Batch')\
or (self.isProcessingInitialWIP and self.currentEntity.type=='Batch'): # this needed for initial
# WIP that may be batch
# Reassemble only if current entity is SubBatch
if self.currentEntity.type=='SubBatch':
yield self.env.timeout(self.calculateProcessingTime())
self.reassemble()
if not self.signalReceiver():
......
......@@ -255,8 +255,11 @@ def setWIP(entityList):
if G.env.now==0 and entity.currentStation:
if entity.currentStation.class_name:
stationClass=entity.currentStation.__class__.__name__
if stationClass in ['Machine', 'BatchScrapMachine', 'MachineJobShop','BatchDecomposition']:
if stationClass in ['Machine', 'BatchScrapMachine', 'MachineJobShop','BatchDecomposition', 'BatchReassembly']:
entity.currentStation.currentEntity=entity
# trigger initialWIP event only if it has not been triggered. Otherwise
# if we set more than one entities (e.g. in reassembly) it will crash
if not (entity.currentStation.initialWIP.triggered):
entity.currentStation.initialWIP.succeed(G.env)
from Exit import Exit
......
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