Commit f12db0b0 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Jérome Perrin

minor changes

parent 25ab8b6d
...@@ -47,6 +47,7 @@ class MachineManagedJob(MachineJobShop): ...@@ -47,6 +47,7 @@ class MachineManagedJob(MachineJobShop):
name=self.objName+'_operatorPool' name=self.objName+'_operatorPool'
self.operatorPool=OperatorPool(id, name, operatorsList=[]) self.operatorPool=OperatorPool(id, name, operatorsList=[])
self.operatorPool.initialize() self.operatorPool.initialize()
self.operatorPool.operators=[]
#create a Broker #create a Broker
self.broker = Broker(self) self.broker = Broker(self)
activate(self.broker,self.broker.run()) activate(self.broker,self.broker.run())
...@@ -61,22 +62,6 @@ class MachineManagedJob(MachineJobShop): ...@@ -61,22 +62,6 @@ class MachineManagedJob(MachineJobShop):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=self.getActiveObjectQueue() activeObjectQueue=self.getActiveObjectQueue()
giverObject=self.getGiverObject() giverObject=self.getGiverObject()
# if we have only one predecessor just check if there is a place,
# the machine is up and the predecessor has an entity to dispose
# if the machine has to compete for an Operator that loads the entities onto it
# check if the predecessor if blocked by an other Machine
# if not then the machine has to block the predecessor giverObject to avoid conflicts
# with other competing machines
if(len(activeObject.previous)==1):
if (any(type=='Load' for type in activeObject.multOperationTypeList)):
if activeObject.Up and len(activeObjectQueue)<activeObject.capacity\
and giverObject.haveToDispose(activeObject) and not giverObject.exitIsAssigned():
activeObject.giver.assignExit()
#make the operatorsList so that it holds only the manager of the current order
activeObject.operatorPool.operatorsList=[activeObject.giver.getActiveObjectQueue()[0].manager]
return True
else:
return False
# dummy variables that help prioritise the objects requesting to give objects to the Machine (activeObject) # dummy variables that help prioritise the objects requesting to give objects to the Machine (activeObject)
isRequested=False # is requested is dummyVariable checking if it is requested to accept an item isRequested=False # is requested is dummyVariable checking if it is requested to accept an item
...@@ -110,12 +95,12 @@ class MachineManagedJob(MachineJobShop): ...@@ -110,12 +95,12 @@ class MachineManagedJob(MachineJobShop):
# update the last object calling the operatorPool # update the last object calling the operatorPool
activeObject.operatorPool.receivingObject=activeObject activeObject.operatorPool.receivingObject=activeObject
if activeObject.operatorPool.checkIfResourceIsAvailable()\ if activeObject.Up and len(activeObjectQueue)<activeObject.capacity\
and activeObject.Up and len(activeObjectQueue)<activeObject.capacity\
and isRequested and not activeObject.giver.exitIsAssigned(): and isRequested and not activeObject.giver.exitIsAssigned():
activeObject.giver.assignExit() activeObject.giver.assignExit()
#make the operatorsList so that it holds only the manager of the current order #make the operatorsList so that it holds only the manager of the current order
activeObject.operatorPool.operatorsList=[activeObject.giver.getActiveObjectQueue()[0].manager] activeObject.operatorPool.operatorsList=[activeObject.giver.getActiveObjectQueue()[0].manager]
activeObject.operatorPool.operators=[activeObject.giver.getActiveObjectQueue()[0].manager]
return True return True
else: else:
return False return False
......
...@@ -74,10 +74,12 @@ class Broker(ObjectInterruption): ...@@ -74,10 +74,12 @@ class Broker(ObjectInterruption):
self.timeWaitForOperatorStarted = 0 self.timeWaitForOperatorStarted = 0
# update the time that the operation started # update the time that the operation started
self.timeOperationStarted = now() self.timeOperationStarted = now()
#self.victim.outputTrace(self.victim.currentOperator.objName, "started work "+self.victim.objName)
self.victim.currentOperator.timeLastOperationStarted=now() self.victim.currentOperator.timeLastOperationStarted=now()
# ======= release a resource # ======= release a resource
elif not self.victim.isOperated(): elif not self.victim.isOperated():
self.victim.currentOperator.totalWorkingTime+=now()-self.victim.currentOperator.timeLastOperationStarted self.victim.currentOperator.totalWorkingTime+=now()-self.victim.currentOperator.timeLastOperationStarted
#self.victim.outputTrace(self.victim.currentOperator.objName, "finished work "+self.victim.objName)
yield release,self,self.victim.operatorPool.getResource(self.victim.currentOperator) yield release,self,self.victim.operatorPool.getResource(self.victim.currentOperator)
# the victim current operator must be cleared after the operator is released # the victim current operator must be cleared after the operator is released
self.timeLastOperationEnded = now() self.timeLastOperationEnded = now()
......
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