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

a methodthat checks if the object is active added in CoreObject

parent 886d5d05
...@@ -54,6 +54,7 @@ class CoreObject(Process): ...@@ -54,6 +54,7 @@ class CoreObject(Process):
def initialize(self): def initialize(self):
Process.__init__(self) Process.__init__(self)
self.Up=True #Boolean that shows if the machine is in failure ("Down") or not ("up") self.Up=True #Boolean that shows if the machine is in failure ("Down") or not ("up")
self.onShift=True
self.currentEntity=None self.currentEntity=None
# ============================== total times =============================================== # ============================== total times ===============================================
self.totalBlockageTime=0 #holds the total blockage time self.totalBlockageTime=0 #holds the total blockage time
...@@ -389,3 +390,9 @@ class CoreObject(Process): ...@@ -389,3 +390,9 @@ class CoreObject(Process):
#ToDO make a generic method #ToDO make a generic method
pass pass
# =======================================================================
# checks if the object is in an active position
# =======================================================================
def checkIfActive(self):
return self.Up and self.onShift
...@@ -488,7 +488,7 @@ class Machine(CoreObject): ...@@ -488,7 +488,7 @@ class Machine(CoreObject):
activeObject.operatorPool.receivingObject=activeObject activeObject.operatorPool.receivingObject=activeObject
if activeObject.operatorPool.checkIfResourceIsAvailable()\ if activeObject.operatorPool.checkIfResourceIsAvailable()\
and activeObject.Up and len(activeObjectQueue)<activeObject.capacity\ and activeObject.checkIfActive() and len(activeObjectQueue)<activeObject.capacity\
and not giverObject.exitIsAssigned(): and not giverObject.exitIsAssigned():
activeObject.giver.assignExit() activeObject.giver.assignExit()
return True return True
...@@ -498,14 +498,14 @@ class Machine(CoreObject): ...@@ -498,14 +498,14 @@ class Machine(CoreObject):
# the operator performs no load and the entity is received by the machine while there is # the operator performs no load and the entity is received by the machine while there is
# no need for operators presence. The operator needs to be present only where the load Type # no need for operators presence. The operator needs to be present only where the load Type
# operation is assigned # operation is assigned
return activeObject.Up and len(activeObjectQueue)<activeObject.capacity\ return activeObject.checkIfActive() and len(activeObjectQueue)<activeObject.capacity\
and giverObject.haveToDispose(activeObject) and giverObject.haveToDispose(activeObject)
# TODO: if the set-up performance needs be first performed before the transfer of the entity to # TODO: if the set-up performance needs be first performed before the transfer of the entity to
# the machine then the presence of an operator to setup the machine before the getEntity() # the machine then the presence of an operator to setup the machine before the getEntity()
# is requested # is requested
# return (activeObject.operatorPool=='None'\ # return (activeObject.operatorPool=='None'\
# or activeObject.operatorPool.checkIfResourceIsAvailable())\ # or activeObject.operatorPool.checkIfResourceIsAvailable())\
# and activeObject.Up and len(activeObjectQueue)<activeObject.capacity\ # and activeObject.checkIfActive() and len(activeObjectQueue)<activeObject.capacity\
# and giverObject.haveToDispose() # and giverObject.haveToDispose()
# 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)
...@@ -541,7 +541,7 @@ class Machine(CoreObject): ...@@ -541,7 +541,7 @@ class Machine(CoreObject):
activeObject.operatorPool.receivingObject=activeObject activeObject.operatorPool.receivingObject=activeObject
if activeObject.operatorPool.checkIfResourceIsAvailable()\ if activeObject.operatorPool.checkIfResourceIsAvailable()\
and activeObject.Up and len(activeObjectQueue)<activeObject.capacity\ and activeObject.checkIfActive() 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()
return True return True
...@@ -550,11 +550,11 @@ class Machine(CoreObject): ...@@ -550,11 +550,11 @@ class Machine(CoreObject):
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.Up and len(activeObjectQueue)<activeObject.capacity and isRequested return activeObject.checkIfActive() and len(activeObjectQueue)<activeObject.capacity and isRequested
# while if the set up is performed before the (automatic) loading of the machine then the availability of the # while if the set up is performed before the (automatic) loading of the machine then the availability of the
# operator is requested # operator is requested
# return (activeObject.operatorPool=='None' or activeObject.operatorPool.checkIfResourceIsAvailable())\ # return (activeObject.operatorPool=='None' or activeObject.operatorPool.checkIfResourceIsAvailable())\
# and activeObject.Up and len(activeObjectQueue)<activeObject.capacity and isRequested # and activeObject.checkIfActive() and len(activeObjectQueue)<activeObject.capacity and isRequested
# ======================================================================= # =======================================================================
# checks if the machine down or it can dispose the object # checks if the machine down or it can dispose the object
...@@ -583,7 +583,7 @@ class Machine(CoreObject): ...@@ -583,7 +583,7 @@ class Machine(CoreObject):
#if we have only one successor just check if machine waits to dispose and also is up #if we have only one successor just check if machine waits to dispose and also is up
# this is done to achieve better (cpu) processing time # this is done to achieve better (cpu) processing time
if(len(activeObject.next)==1 or callerObject==None): if(len(activeObject.next)==1 or callerObject==None):
return len(activeObjectQueue)>0 and activeObject.waitToDispose and activeObject.Up return len(activeObjectQueue)>0 and activeObject.waitToDispose and activeObject.checkIfActive()
# # if the Machine is empty it returns false right away # # if the Machine is empty it returns false right away
# if(len(activeObjectQueue)==0): # if(len(activeObjectQueue)==0):
...@@ -601,7 +601,7 @@ class Machine(CoreObject): ...@@ -601,7 +601,7 @@ class Machine(CoreObject):
activeObject.receiver=object # set the receiver as the longest waiting possible receiver activeObject.receiver=object # set the receiver as the longest waiting possible receiver
# in the next loops, check the other successors in the previous list # in the next loops, check the other successors in the previous list
return len(activeObjectQueue)>0 and activeObject.waitToDispose\ return len(activeObjectQueue)>0 and activeObject.waitToDispose\
and activeObject.Up and (thecaller is self.receiver) and activeObject.checkIfActive() and (thecaller is self.receiver)
# ======================================================================= # =======================================================================
# calculates the setup time # calculates the setup time
......
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