clean in operators and machines

parent 50838599
...@@ -638,15 +638,6 @@ class Machine(CoreObject): ...@@ -638,15 +638,6 @@ class Machine(CoreObject):
# has to block the predecessor giverObject to avoid conflicts with other competing machines # has to block the predecessor giverObject to avoid conflicts with other competing machines
if (activeObject.operatorPool!='None' and (any(type=='Load' for type in activeObject.multOperationTypeList))): if (activeObject.operatorPool!='None' and (any(type=='Load' for type in activeObject.multOperationTypeList))):
if giverObject.haveToDispose(activeObject): if giverObject.haveToDispose(activeObject):
#===============================================================
# # TODO: check whether this entity is the one to be hand in
# # to be used in operatorPreemptive
# activeObject.requestingEntity=giverObject.getActiveObjectQueue()[0]
# # TODO: update the objects requesting the operator
# activeObject.operatorPool.requestingObject=activeObject.giver
# # TODOD: update the last object calling the operatorPool
# activeObject.operatorPool.receivingObject=activeObject
#===============================================================
if activeObject.checkOperator()\ if activeObject.checkOperator()\
and activeObject.checkIfActive() and len(activeObjectQueue)<activeObject.capacity: and activeObject.checkIfActive() and len(activeObjectQueue)<activeObject.capacity:
if not giverObject.exitIsAssignedTo(): if not giverObject.exitIsAssignedTo():
...@@ -699,12 +690,6 @@ class Machine(CoreObject): ...@@ -699,12 +690,6 @@ class Machine(CoreObject):
else: else:
return True return True
# # =======================================================================
# # checks if the machine down or it can dispose the object
# # =======================================================================
# def ifCanDisposeOrHaveFailure(self):
# return self.Up==False or self.getReceiverObject().canAccept(self) or len(self.getActiveObjectQueue())==0
# ======================================================================= # =======================================================================
# get an entity from the giver # get an entity from the giver
# ======================================================================= # =======================================================================
......
...@@ -117,15 +117,6 @@ class MachineManagedJob(MachineJobShop): ...@@ -117,15 +117,6 @@ class MachineManagedJob(MachineJobShop):
if (activeObject.operatorPool!='None' and (any(type=='Load' for type in activeObject.multOperationTypeList)\ if (activeObject.operatorPool!='None' and (any(type=='Load' for type in activeObject.multOperationTypeList)\
or any(type=='Setup' for type in activeObject.multOperationTypeList))): or any(type=='Setup' for type in activeObject.multOperationTypeList))):
if giverObject.haveToDispose(activeObject): if giverObject.haveToDispose(activeObject):
#===============================================================
# # TODO: check whether this entity is the one to be hand in
# # to be used in operatorPreemptive
# activeObject.requestingEntity=activeObject.giver.getActiveObjectQueue()[0]
# # TODO: update the object requesting the operator
# activeObject.operatorPool.requestingObject=activeObject.giver
# # TODO: update the last object calling the operatorPool
# activeObject.operatorPool.receivingObject=activeObject
#===============================================================
if activeObject.checkIfActive() and len(activeObjectQueue)<activeObject.capacity\ if activeObject.checkIfActive() and len(activeObjectQueue)<activeObject.capacity\
and activeObject.checkOperator(giverObject): and activeObject.checkOperator(giverObject):
if not giverObject.exitIsAssignedTo(): if not giverObject.exitIsAssignedTo():
...@@ -144,33 +135,12 @@ class MachineManagedJob(MachineJobShop): ...@@ -144,33 +135,12 @@ class MachineManagedJob(MachineJobShop):
# if the multOperationTypeList contains only Processing # if the multOperationTypeList contains only Processing
elif (activeObject.operatorPool!='None' and any(type=='Processing' for type in activeObject.multOperationTypeList)): elif (activeObject.operatorPool!='None' and any(type=='Processing' for type in activeObject.multOperationTypeList)):
if giverObject.haveToDispose(activeObject): if giverObject.haveToDispose(activeObject):
#=============================================================== # the operator must not be available for the object to receive the entity
# # TODO: check whether this entity is the one to be hand in
# # to be used in operatorPreemptive
# activeObject.requestingEntity=activeObject.giver.getActiveObjectQueue()[0]
# # TODO: update the object requesting the operator
# activeObject.operatorPool.requestingObject=activeObject.giver
# # TODO: update the last object calling the operatorPool
# activeObject.operatorPool.receivingObject=activeObject
#===============================================================
# TODO: the operator must not be available for the object to receive the entity
# the exit of the giver should not be assigned # the exit of the giver should not be assigned
# the manager must not be available for the entity to be delivered # the manager must not be available for the entity to be delivered
# the machine can be appended to the activeCallersList of the manager
# there may be a problem with the activeCallersList as the Router may assign
# the operator to the machine while he is not needed for receiving the entity # the operator to the machine while he is not needed for receiving the entity
# the entityToGet should be updated if activeObject.checkIfActive() and len(activeObjectQueue)<activeObject.capacity:
if activeObject.checkIfActive() and len(activeObjectQueue)<activeObject.capacity:#\ # the entityToGet should be updated
# and self.checkOperator()\
# and not activeObject.giver.exitIsAssignedTo():
# activeObject.giver.assignExitTo()
# # if the activeObject is not in manager's activeCallersList of the entityToGet
# if self not in activeObject.giver.getActiveObjectQueue()[0].manager.activeCallersList:
# # append it to the activeCallerList of the manager of the entity to be received
# activeObject.giver.getActiveObjectQueue()[0].manager.activeCallersList.append(self)
# # update entityToGet
# self.entityToGet=activeObject.giver.getActiveObjectQueue()[0]
activeObject.entityToGet=giverObjectQueue[0] activeObject.entityToGet=giverObjectQueue[0]
#make the operators List so that it holds only the manager of the current order #make the operators List so that it holds only the manager of the current order
activeObject.operatorPool.operators=[giverObjectQueue[0].manager] activeObject.operatorPool.operators=[giverObjectQueue[0].manager]
......
...@@ -114,7 +114,6 @@ class Broker(ObjectInterruption): ...@@ -114,7 +114,6 @@ class Broker(ObjectInterruption):
# ======= 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, "left "+ self.victim.objName)
yield release,self,self.victim.operatorPool.getResource(self.victim.currentOperator) yield release,self,self.victim.operatorPool.getResource(self.victim.currentOperator)
# signal the other brokers waiting for the same operators that they are now free # signal the other brokers waiting for the same operators that they are now free
# also signal the stations that were not requested to receive because the operator was occupied # also signal the stations that were not requested to receive because the operator was occupied
...@@ -128,7 +127,6 @@ class Broker(ObjectInterruption): ...@@ -128,7 +127,6 @@ class Broker(ObjectInterruption):
# TODO: signalling the router will give the chance to it to take the control, but when will it eventually receive it. # TODO: signalling the router will give the chance to it to take the control, but when will it eventually receive it.
# after signalling the broker will signal it's victim that it has finished it's processes # after signalling the broker will signal it's victim that it has finished it's processes
# TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers. # TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers.
# self.signalLoadStations()
self.printTrace(self.victim.currentOperator.objName, 'released '+self.victim.id) self.printTrace(self.victim.currentOperator.objName, 'released '+self.victim.id)
# the victim current operator must be cleared after the operator is released # the victim current operator must be cleared after the operator is released
......
...@@ -67,25 +67,6 @@ class OperatorManagedJob(Operator): ...@@ -67,25 +67,6 @@ class OperatorManagedJob(Operator):
# return False # return False
return len(self.Res.activeQ)<self.capacity return len(self.Res.activeQ)<self.capacity
# #===========================================================================
# # assign an operator
# #===========================================================================
# def assignTo(self, callerObject=None):
# assert callerObject!=None, 'the operator cannot be assigned to None'
# self.operatorAssignedTo=callerObject
#
# #===========================================================================
# # un-assign an operator
# #===========================================================================
# def unAssign(self):
# self.operatorAssignedTo=None
#
# #===========================================================================
# # check whether the operator is assigned
# #===========================================================================
# def isAssignedTo(self):
# return self.operatorAssignedTo
#=========================================================================== #===========================================================================
# check if the operator has only one station as candidate option # check if the operator has only one station as candidate option
#=========================================================================== #===========================================================================
......
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