Commit 34865eaf authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

requestAllocation is invoked instead of signalRouter from signalReceiver and...

requestAllocation is invoked instead of signalRouter from signalReceiver and getEntity/removeEntity in the case of level-Queue
parent 4f239696
...@@ -411,6 +411,7 @@ class CoreObject(object): ...@@ -411,6 +411,7 @@ class CoreObject(object):
# 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 # TODO if the station is operated, and the operators have skills defined then the SkilledOperatorRouter should be signalled
# XXX: there may be a case where one machine is not assigned an operator, in that case we do not want to invoke the allocation routine
if self.checkForSkilledOpertors(): if self.checkForSkilledOpertors():
allocationNeeded=False allocationNeeded=False
for nextObj in self.next: for nextObj in self.next:
...@@ -419,7 +420,7 @@ class CoreObject(object): ...@@ -419,7 +420,7 @@ class CoreObject(object):
allocationNeeded=True allocationNeeded=True
break break
if allocationNeeded: if allocationNeeded:
self.signalRouter() self.requestAllocation()
return False return False
# ======================================================================= # =======================================================================
...@@ -444,7 +445,6 @@ class CoreObject(object): ...@@ -444,7 +445,6 @@ class CoreObject(object):
#=========================================================================== #===========================================================================
@staticmethod @staticmethod
def requestAllocation(): def requestAllocation():
try:
# TODO: signal the Router, skilled operators must be assigned to operatorPools # TODO: signal the Router, skilled operators must be assigned to operatorPools
from Globals import G from Globals import G
G.Router.allocation=True G.Router.allocation=True
...@@ -452,9 +452,6 @@ class CoreObject(object): ...@@ -452,9 +452,6 @@ class CoreObject(object):
if not G.Router.invoked: if not G.Router.invoked:
G.Router.invoked=True G.Router.invoked=True
G.Router.isCalled.succeed(G.env.now) G.Router.isCalled.succeed(G.env.now)
return True
except:
return False
#=========================================================================== #===========================================================================
# signalRouter method # signalRouter method
...@@ -463,15 +460,6 @@ class CoreObject(object): ...@@ -463,15 +460,6 @@ 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 # 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):
......
...@@ -174,12 +174,7 @@ class Queue(CoreObject): ...@@ -174,12 +174,7 @@ class Queue(CoreObject):
try: try:
if self.level: if self.level:
if not len(self.getActiveObjectQueue()): if not len(self.getActiveObjectQueue()):
from Globals import G self.requestAllocation()
G.Router.allocation=True
G.Router.waitEndProcess=True
if not G.Router.invoked:
G.Router.invoked=True
G.Router.isCalled.succeed(G.env.now)
except: except:
pass pass
return activeEntity return activeEntity
...@@ -205,12 +200,7 @@ class Queue(CoreObject): ...@@ -205,12 +200,7 @@ class Queue(CoreObject):
try: try:
if self.level: if self.level:
if len(self.getActiveObjectQueue())==self.level: if len(self.getActiveObjectQueue())==self.level:
from Globals import G self.requestAllocation()
G.Router.allocation=True
G.Router.waitEndProcess=True
if not G.Router.invoked:
G.Router.invoked=True
G.Router.isCalled.succeed(G.env.now)
except: except:
pass pass
return activeEntity return activeEntity
......
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