Machine now controls if its entry is assigned before returning True from canAccept

parent 8a609356
...@@ -454,7 +454,6 @@ class Machine(CoreObject): ...@@ -454,7 +454,6 @@ class Machine(CoreObject):
if not self.signalReceiver(): if not self.signalReceiver():
# if there was no available receiver, get into blocking control # if there was no available receiver, get into blocking control
while 1: while 1:
# wait the event canDispose, this means that the station can deliver the item to successor # wait the event canDispose, this means that the station can deliver the item to successor
event=yield waitevent, self, [self.canDispose, self.interruptionStart] event=yield waitevent, self, [self.canDispose, self.interruptionStart]
# if there was interruption # if there was interruption
...@@ -487,6 +486,10 @@ class Machine(CoreObject): ...@@ -487,6 +486,10 @@ class Machine(CoreObject):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=activeObject.getActiveObjectQueue() activeObjectQueue=activeObject.getActiveObjectQueue()
activeEntity=activeObjectQueue[0] activeEntity=activeObjectQueue[0]
#=======================================================================
# # TESTING
# print activeObject.getActiveObjectQueue()[0].name,"ended processing in "+activeObject.objName
#=======================================================================
# reset the variables used to handle the interruptions timing # reset the variables used to handle the interruptions timing
self.timeRestartingProcessing=0 self.timeRestartingProcessing=0
self.breakTime=0 self.breakTime=0
...@@ -606,14 +609,17 @@ class Machine(CoreObject): ...@@ -606,14 +609,17 @@ class Machine(CoreObject):
# if we have only one predecessor just check if there is a place and the machine is up # if we have only one predecessor just check if there is a place and the machine is up
# this is done to achieve better (cpu) processing time # this is done to achieve better (cpu) processing time
# then we can also use it as a filter for a yield method # then we can also use it as a filter for a yield method
if(len(activeObject.previous)==1 or callerObject==None): if(callerObject==None):
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))):
return activeObject.operatorPool.checkIfResourceIsAvailable()\ return activeObject.operatorPool.checkIfResourceIsAvailable()\
and activeObject.checkIfMachineIsUp()\ and activeObject.checkIfMachineIsUp()\
and len(activeObjectQueue)<activeObject.capacity and len(activeObjectQueue)<activeObject.capacity\
and not activeObject.entryIsAssignedTo()
else: else:
return activeObject.checkIfMachineIsUp() and len(activeObjectQueue)<activeObject.capacity\ return activeObject.checkIfMachineIsUp()\
and len(activeObjectQueue)<activeObject.capacity\
and not activeObject.entryIsAssignedTo()
thecaller=callerObject thecaller=callerObject
# return True ONLY if the length of the activeOjbectQue is smaller than # return True ONLY if the length of the activeOjbectQue is smaller than
...@@ -622,11 +628,15 @@ class Machine(CoreObject): ...@@ -622,11 +628,15 @@ class Machine(CoreObject):
or any(type=='Setup' for type in activeObject.multOperationTypeList))): or any(type=='Setup' for type in activeObject.multOperationTypeList))):
return activeObject.operatorPool.checkIfResourceIsAvailable()\ return activeObject.operatorPool.checkIfResourceIsAvailable()\
and activeObject.checkIfMachineIsUp()\ and activeObject.checkIfMachineIsUp()\
and len(activeObjectQueue)<activeObject.capacity and len(activeObjectQueue)<activeObject.capacity\
and not activeObject.entryIsAssignedTo()
else: else:
# the operator doesn't have to be present for the loading of the machine as the load operation # the operator doesn't have to be present for the loading of the machine as the load operation
# is not assigned to operators # is not assigned to operators
return activeObject.checkIfMachineIsUp() and len(activeObjectQueue)<activeObject.capacity and (thecaller in activeObject.previous) return activeObject.checkIfMachineIsUp()\
and len(activeObjectQueue)<activeObject.capacity\
and (thecaller in activeObject.previous)\
and not activeObject.entryIsAssignedTo()
# ======================================================================= # =======================================================================
# checks if the Machine can accept an entity and there is an entity in # checks if the Machine can accept an entity and there is an entity in
......
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