Commit e088ab7e authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

new methods related to the allocation of skilled operators added to...

new methods related to the allocation of skilled operators added to coreObject. SignalReceiver and SignalRouter updated for the required allocation control
parent 072e8183
...@@ -366,11 +366,21 @@ class CoreObject(object): ...@@ -366,11 +366,21 @@ class CoreObject(object):
# receivers.append(object) # receivers.append(object)
# return receivers # return receivers
#===========================================================================
# check if the any of the operators are skilled (having a list of skills regarding the machines)
#===========================================================================
@staticmethod
def checkForSkilledOpertors():
from Globals import G
# XXX this can also be global
# flag used to inform if the operators assigned to the station are skilled (skillsList)
return any(operator.skillsList for operator in G.OperatorsList)
# ======================================================================= # =======================================================================
# signal the successor that the object can dispose an entity # signal the successor that the object can dispose an entity
# ======================================================================= # =======================================================================
def signalReceiver(self): def signalReceiver(self):
possibleReceivers=self.findReceiversFor(self) possibleReceivers=self.findReceiversFor(self)
if possibleReceivers: if possibleReceivers:
receiver=self.selectReceiver(possibleReceivers) receiver=self.selectReceiver(possibleReceivers)
receiversGiver=self receiversGiver=self
...@@ -400,6 +410,16 @@ class CoreObject(object): ...@@ -400,6 +410,16 @@ class CoreObject(object):
return True return True
# if no receiver can accept then try to preempt a receive if the stations holds a critical order # if no receiver can accept then try to preempt a receive if the stations holds a critical order
self.preemptReceiver() self.preemptReceiver()
# TODO if the station is operated, and the operators have skills defined then the SkilledOperatorRouter should be signalled
if self.checkForSkilledOpertors():
allocationNeeded=False
for nextObj in self.next:
if nextObj.operatorPool!='None':
if not nextObj.operatorPool.operators:
allocationNeeded=True
break
if allocationNeeded:
self.signalRouter()
return False return False
# ======================================================================= # =======================================================================
...@@ -419,6 +439,23 @@ class CoreObject(object): ...@@ -419,6 +439,23 @@ class CoreObject(object):
receiver=object # set the receiver as the longest waiting possible receiver receiver=object # set the receiver as the longest waiting possible receiver
return receiver return receiver
#===========================================================================
# method used to request allocation from the Router
#===========================================================================
@staticmethod
def requestAllocation():
try:
# TODO: signal the Router, skilled operators must be assigned to operatorPools
from Globals import G
G.Router.allocation=True
G.Router.waitEndProcess=False
if not G.Router.invoked:
G.Router.invoked=True
G.Router.isCalled.succeed(G.env.now)
return True
except:
return False
#=========================================================================== #===========================================================================
# signalRouter method # signalRouter method
#=========================================================================== #===========================================================================
...@@ -426,6 +463,16 @@ class CoreObject(object): ...@@ -426,6 +463,16 @@ class CoreObject(object):
def signalRouter(receiver=None): def signalRouter(receiver=None):
# if an operator is not assigned to the receiver then do not signal the receiver but the Router # if an operator is not assigned to the receiver then do not signal the receiver but the Router
try: try:
# TODO: if the receiver is not defined then directly signal the Router, skilled operators must be assigned to operatorPools
if not receiver:
from Globals import G
G.Router.allocation=True
G.Router.waitEndProcess=False
if not G.Router.invoked:
G.Router.invoked=True
G.Router.isCalled.succeed(G.env.now)
return True
# XXX in the case of skilledOperators assignedOperators must be always True in order to avoid invoking the Router
if not receiver.assignedOperator or\ if not receiver.assignedOperator or\
(receiver.isPreemptive and len(receiver.Res.users)>0): (receiver.isPreemptive and len(receiver.Res.users)>0):
if receiver.isLoadRequested(): if receiver.isLoadRequested():
......
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