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): ...@@ -77,7 +77,7 @@ class BatchReassembly(CoreObject):
self.initialSignalReceiver() self.initialSignalReceiver()
while 1: while 1:
while 1: while 1:
receivedEvent=yield self.isRequested | self.interruptionStart receivedEvent=yield self.isRequested | self.interruptionStart | self.initialWIP
if self.interruptionStart in receivedEvent: if self.interruptionStart in receivedEvent:
assert self.interruptionStart.value==self.env.now, 'the interruptionStart received by BatchReassembly later than created' assert self.interruptionStart.value==self.env.now, 'the interruptionStart received by BatchReassembly later than created'
self.interruptionStart=self.env.event() self.interruptionStart=self.env.event()
...@@ -86,23 +86,33 @@ class BatchReassembly(CoreObject): ...@@ -86,23 +86,33 @@ class BatchReassembly(CoreObject):
self.interruptionEnd=self.env.event() self.interruptionEnd=self.env.event()
if self.signalGiver(): if self.signalGiver():
break 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 break
requestingObject=self.isRequested.value
assert requestingObject==self.giver, 'the giver is not the requestingObject'
self.isRequested=self.env.event()
self.currentEntity=self.getEntity()
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 # initialize the timer timeLastEntityEntered
self.nameLastEntityEntered=self.currentEntity.name # this holds the name of the last entity that got into Machine 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.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')\
or (self.isProcessingInitialWIP and self.currentEntity.type=='Batch'): # this needed for initial
if len(self.getActiveObjectQueue())==self.numberOfSubBatches and self.currentEntity.type!='Batch': # WIP that may be batch
yield self.env.timeout(self.calculateProcessingTime()) # Reassemble only if current entity is SubBatch
self.reassemble() if self.currentEntity.type=='SubBatch':
yield self.env.timeout(self.calculateProcessingTime())
self.reassemble()
if not self.signalReceiver(): if not self.signalReceiver():
while 1: while 1:
receivedEvent=yield self.canDispose | self.interruptionStart receivedEvent=yield self.canDispose | self.interruptionStart
......
...@@ -255,9 +255,12 @@ def setWIP(entityList): ...@@ -255,9 +255,12 @@ def setWIP(entityList):
if G.env.now==0 and entity.currentStation: if G.env.now==0 and entity.currentStation:
if entity.currentStation.class_name: if entity.currentStation.class_name:
stationClass=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 entity.currentStation.currentEntity=entity
entity.currentStation.initialWIP.succeed(G.env) # 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 from Exit import Exit
def countIntervalThroughput(argumentDict={}): def countIntervalThroughput(argumentDict={}):
......
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