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

operated machine changed so that currentOperator will be None and not 'None'...

operated machine changed so that currentOperator will be None and not 'None' if there is no operator in the machine
parent 3683fd0d
...@@ -59,7 +59,10 @@ class OperatedMachine(Machine): ...@@ -59,7 +59,10 @@ class OperatedMachine(Machine):
# check if the operatorPool is a List or a OperatorPool type Object # check if the operatorPool is a List or a OperatorPool type Object
# if it is a list then initiate a OperatorPool type object containing # if it is a list then initiate a OperatorPool type object containing
# the list of operators provided # the list of operators provided
if (type(operatorPool) is list) and len(operatorPool)>0: '''
change! if the list is empty create operator pool with empty list
'''
if (type(operatorPool) is list): #and len(operatorPool)>0:
id = id+'_OP' id = id+'_OP'
name=self.objName+'_operatorPool' name=self.objName+'_operatorPool'
self.operatorPool=OperatorPool(id, name, operatorsList=operatorPool) self.operatorPool=OperatorPool(id, name, operatorsList=operatorPool)
...@@ -69,7 +72,7 @@ class OperatedMachine(Machine): ...@@ -69,7 +72,7 @@ class OperatedMachine(Machine):
self.operatorPool.coreObjectIds.append(self.id) self.operatorPool.coreObjectIds.append(self.id)
self.operatorPool.coreObjects.append(self) self.operatorPool.coreObjects.append(self)
# holds the Operator currently processing the Machine # holds the Operator currently processing the Machine
self.currentOperator='None' self.currentOperator=None
# define if load/setup/removal/processing are performed by the operator # define if load/setup/removal/processing are performed by the operator
self.operationType=operationType self.operationType=operationType
# boolean to check weather the machine is being operated # boolean to check weather the machine is being operated
...@@ -596,7 +599,9 @@ class OperatedMachine(Machine): ...@@ -596,7 +599,9 @@ class OperatedMachine(Machine):
# ======================================================================= # =======================================================================
def requestSetup(self): def requestSetup(self):
self.setUp=False self.setUp=False
# ======================================================================= # =======================================================================
# actions to be taken after the simulation ends # actions to be taken after the simulation ends
# ======================================================================= # =======================================================================
...@@ -638,14 +643,14 @@ class OperatedMachine(Machine): ...@@ -638,14 +643,14 @@ class OperatedMachine(Machine):
alreadyAdded=True alreadyAdded=True
# print activeObject.objName,'total Block time:',activeObject.totalBlockageTime#/G.maxSimTime # print activeObject.objName,'total Block time:',activeObject.totalBlockageTime#/G.maxSimTime
#if Machine is currently processing an entity we should count this working time #if Machine is currently processing an entity we should count this working time
if(len(activeObject.Res.activeQ)>0)\ if(len(activeObject.getActiveObjectQueue())>0)\
and (not (activeObject.nameLastEntityEnded==activeObject.nameLastEntityEntered))\ and (not (activeObject.nameLastEntityEnded==activeObject.nameLastEntityEntered))\
and (activeObject.currentOperator!='None'): and (not (activeObject.operationType=='Processing' and (activeObject.currentOperator==None))):
# print 'pre-total working time:',activeObject.totalWorkingTime#/G.maxSimTime # print 'pre-total working time:',activeObject.totalWorkingTime#/G.maxSimTime
#if Machine is down we should add this last failure time to the time that it has been down in current entity #if Machine is down we should add this last failure time to the time that it has been down in current entity
if self.Up==False: if self.Up==False:
# if(len(activeObjectQueue)>0) and (self.Up==False): # if(len(activeObjectQueue)>0) and (self.Up==False):
activeObject.downTimeProcessingCurrentEntity+=now()-activeObject.timeLastFailure activeObject.downTimeProcessingCurrentEntity+=now()-activeObject.timeLastFailure
activeObject.totalWorkingTime+=now()-activeObject.timeLastEntityEntered\ activeObject.totalWorkingTime+=now()-activeObject.timeLastEntityEntered\
-activeObject.downTimeProcessingCurrentEntity\ -activeObject.downTimeProcessingCurrentEntity\
...@@ -655,9 +660,9 @@ class OperatedMachine(Machine): ...@@ -655,9 +660,9 @@ class OperatedMachine(Machine):
# print "downTimeProcessingCurrentEntity", activeObject.downTimeProcessingCurrentEntity # print "downTimeProcessingCurrentEntity", activeObject.downTimeProcessingCurrentEntity
# print "operatorWaitTimeCurrentEntity", activeObject.operatorWaitTimeCurrentEntity # print "operatorWaitTimeCurrentEntity", activeObject.operatorWaitTimeCurrentEntity
# print "setupTimeCurrentEntity",activeObject.setupTimeCurrentEntity # print "setupTimeCurrentEntity",activeObject.setupTimeCurrentEntity
elif(len(activeObject.Res.activeQ)>0)\ elif(len(activeObject.getActiveObjectQueue())>0)\
and (not (activeObject.nameLastEntityEnded==activeObject.nameLastEntityEntered))\ and (not (activeObject.nameLastEntityEnded==activeObject.nameLastEntityEntered))\
and (activeObject.currentOperator=='None'): and (activeObject.currentOperator==None):
# needs further research as the time of failure while waiting for operator is not counted yet # needs further research as the time of failure while waiting for operator is not counted yet
if self.Up==False: if self.Up==False:
activeObject.downTimeProcessingCurrentEntity+=now()-activeObject.timeLastFailure activeObject.downTimeProcessingCurrentEntity+=now()-activeObject.timeLastFailure
...@@ -691,4 +696,4 @@ class OperatedMachine(Machine): ...@@ -691,4 +696,4 @@ class OperatedMachine(Machine):
activeObject.WaitingForOperator.append(100*self.totalTimeWaitingForOperator/MaxSimtime) activeObject.WaitingForOperator.append(100*self.totalTimeWaitingForOperator/MaxSimtime)
activeObject.WaitingForLoadOperator.append(100*self.totalTimeWaitingForLoadOperator/MaxSimtime) activeObject.WaitingForLoadOperator.append(100*self.totalTimeWaitingForLoadOperator/MaxSimtime)
activeObject.Loading.append(100*self.totalLoadTime/MaxSimtime) activeObject.Loading.append(100*self.totalLoadTime/MaxSimtime)
activeObject.SettingUp.append(100*self.totalSetupTime/MaxSimtime) activeObject.SettingUp.append(100*self.totalSetupTime/MaxSimtime)
\ No newline at end of file
...@@ -80,7 +80,7 @@ class Broker(ObjectInterruption): ...@@ -80,7 +80,7 @@ class Broker(ObjectInterruption):
self.victim.currentOperator.totalWorkingTime+=now()-self.victim.currentOperator.timeLastOperationStarted self.victim.currentOperator.totalWorkingTime+=now()-self.victim.currentOperator.timeLastOperationStarted
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.victim.currentOperator = 'None' self.victim.currentOperator = None
self.timeLastOperationEnded = now() self.timeLastOperationEnded = now()
else: else:
pass pass
......
...@@ -63,7 +63,7 @@ class OperatorPool(ObjectResource): ...@@ -63,7 +63,7 @@ class OperatorPool(ObjectResource):
for index in range(self.capacity): for index in range(self.capacity):
id='O_'+str(index) id='O_'+str(index)
name=self.objName+str(index) name=self.objName+str(index)
operators.append(Operator(id,name)) self.operators.append(Operator(id,name))
# if a list of operators is given then update accordingly the self.operators variable # if a list of operators is given then update accordingly the self.operators variable
else: else:
assert type(operatorsList) is list, "operatorsList is not a List" assert type(operatorsList) is list, "operatorsList is not a List"
......
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