Commit 60a5159e authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

Machine has new signal endLastProcessing for use by objectInterruption....

Machine has new signal endLastProcessing for use by objectInterruption. skilledOperators flag reset in initialize method. SkilledOperatorRouter to be created by createOperatorPool method
parent 4c4cdc35
...@@ -33,6 +33,7 @@ from Failure import Failure ...@@ -33,6 +33,7 @@ from Failure import Failure
from CoreObject import CoreObject from CoreObject import CoreObject
from OperatorRouter import Router from OperatorRouter import Router
from SkilledOperatorRouter import SkilledRouter
from OperatedPoolBroker import Broker from OperatedPoolBroker import Broker
from OperatorPool import OperatorPool from OperatorPool import OperatorPool
...@@ -181,6 +182,12 @@ class Machine(CoreObject): ...@@ -181,6 +182,12 @@ class Machine(CoreObject):
self.loadOperatorAvailable=self.env.event() self.loadOperatorAvailable=self.env.event()
# signal used for preemption # signal used for preemption
self.preemptQueue=self.env.event() self.preemptQueue=self.env.event()
# signal used for informing objectInterruption objects that the current entity processed has finished processnig
self.endedLastProcessing=self.env.event()
# flag used to inform if the operators assigned to the station are skilled (skillsList)
self.skilledOperators=False
#=========================================================================== #===========================================================================
# create an operatorPool if needed # create an operatorPool if needed
...@@ -192,8 +199,9 @@ class Machine(CoreObject): ...@@ -192,8 +199,9 @@ class Machine(CoreObject):
the list of operators provided the list of operators provided
if the list is empty create operator pool with empty list if the list is empty create operator pool with empty list
''' '''
from Globals import G # flag used to inform if the operators assigned to the station are skilled (skillsList)
self.skilledOperators=False self.skilledOperators=False
from Globals import G
# XXX operatorPool is not None ? # XXX operatorPool is not None ?
# if a list of operators is provided as argument # if a list of operators is provided as argument
if (type(operatorPool) is list) and len(operatorPool)>0: if (type(operatorPool) is list) and len(operatorPool)>0:
...@@ -241,7 +249,11 @@ class Machine(CoreObject): ...@@ -241,7 +249,11 @@ class Machine(CoreObject):
from Globals import G from Globals import G
# if there is no router # if there is no router
if not G.Router: if not G.Router:
self.router=Router() # TODO if the skilledOperators flag is raised then create a SkilledRouter (temp)
if self.skilledOperators:
self.router=SkilledRouter()
else:
self.router=Router()
G.Router=self.router G.Router=self.router
# otherwise set the already existing router as the machines Router # otherwise set the already existing router as the machines Router
else: else:
...@@ -599,7 +611,7 @@ class Machine(CoreObject): ...@@ -599,7 +611,7 @@ class Machine(CoreObject):
# the total processing time for this entity is what the distribution initially gave # the total processing time for this entity is what the distribution initially gave
if not self.shouldPreempt: if not self.shouldPreempt:
self.totalWorkingTime+=self.totalProcessingTimeInCurrentEntity self.totalWorkingTime+=self.totalProcessingTimeInCurrentEntity
# if the station was preemptied for a critical order then calculate the total working time accorindingly # if the station was preemptied for a critical order then calculate the total working time accordingly
else: else:
self.totalWorkingTime+=self.env.now-(self.timeLastEntityEntered) self.totalWorkingTime+=self.env.now-(self.timeLastEntityEntered)
# update the variables keeping track of Entity related attributes of the machine # update the variables keeping track of Entity related attributes of the machine
...@@ -616,7 +628,8 @@ class Machine(CoreObject): ...@@ -616,7 +628,8 @@ class Machine(CoreObject):
# if the objectInterruption is waiting for a a signal # if the objectInterruption is waiting for a a signal
if interruption.victim==self and interruption.waitingSignal: if interruption.victim==self and interruption.waitingSignal:
# signal it and reset the flags # signal it and reset the flags
interruption.victimEndedLastProcessing.succeed(self.env.now) # interruption.victimEndedLastProcessing.succeed(self.env.now)
self.endedLastProcessing.succeed(self.env.now)
interruption.waitinSignal=False interruption.waitinSignal=False
self.isWorkingOnTheLast=False self.isWorkingOnTheLast=False
......
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