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):
# check if the operatorPool is a List or a OperatorPool type Object
# if it is a list then initiate a OperatorPool type object containing
# 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'
name=self.objName+'_operatorPool'
self.operatorPool=OperatorPool(id, name, operatorsList=operatorPool)
......@@ -69,7 +72,7 @@ class OperatedMachine(Machine):
self.operatorPool.coreObjectIds.append(self.id)
self.operatorPool.coreObjects.append(self)
# holds the Operator currently processing the Machine
self.currentOperator='None'
self.currentOperator=None
# define if load/setup/removal/processing are performed by the operator
self.operationType=operationType
# boolean to check weather the machine is being operated
......@@ -596,7 +599,9 @@ class OperatedMachine(Machine):
# =======================================================================
def requestSetup(self):
self.setUp=False
# =======================================================================
# actions to be taken after the simulation ends
# =======================================================================
......@@ -638,14 +643,14 @@ class OperatedMachine(Machine):
alreadyAdded=True
# print activeObject.objName,'total Block time:',activeObject.totalBlockageTime#/G.maxSimTime
#if Machine is currently processing an entity we should count this working time
if(len(activeObject.Res.activeQ)>0)\
#if Machine is currently processing an entity we should count this working time
if(len(activeObject.getActiveObjectQueue())>0)\
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
#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(len(activeObjectQueue)>0) and (self.Up==False):
# if(len(activeObjectQueue)>0) and (self.Up==False):
activeObject.downTimeProcessingCurrentEntity+=now()-activeObject.timeLastFailure
activeObject.totalWorkingTime+=now()-activeObject.timeLastEntityEntered\
-activeObject.downTimeProcessingCurrentEntity\
......@@ -655,9 +660,9 @@ class OperatedMachine(Machine):
# print "downTimeProcessingCurrentEntity", activeObject.downTimeProcessingCurrentEntity
# print "operatorWaitTimeCurrentEntity", activeObject.operatorWaitTimeCurrentEntity
# print "setupTimeCurrentEntity",activeObject.setupTimeCurrentEntity
elif(len(activeObject.Res.activeQ)>0)\
elif(len(activeObject.getActiveObjectQueue())>0)\
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
if self.Up==False:
activeObject.downTimeProcessingCurrentEntity+=now()-activeObject.timeLastFailure
......@@ -691,4 +696,4 @@ class OperatedMachine(Machine):
activeObject.WaitingForOperator.append(100*self.totalTimeWaitingForOperator/MaxSimtime)
activeObject.WaitingForLoadOperator.append(100*self.totalTimeWaitingForLoadOperator/MaxSimtime)
activeObject.Loading.append(100*self.totalLoadTime/MaxSimtime)
activeObject.SettingUp.append(100*self.totalSetupTime/MaxSimtime)
\ No newline at end of file
activeObject.SettingUp.append(100*self.totalSetupTime/MaxSimtime)
......@@ -80,7 +80,7 @@ class Broker(ObjectInterruption):
self.victim.currentOperator.totalWorkingTime+=now()-self.victim.currentOperator.timeLastOperationStarted
yield release,self,self.victim.operatorPool.getResource(self.victim.currentOperator)
# the victim current operator must be cleared after the operator is released
self.victim.currentOperator = 'None'
self.victim.currentOperator = None
self.timeLastOperationEnded = now()
else:
pass
......
......@@ -63,7 +63,7 @@ class OperatorPool(ObjectResource):
for index in range(self.capacity):
id='O_'+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
else:
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