Commit f17455f5 authored by Georgios Dagkakis's avatar Georgios Dagkakis

wait for elements to move before deciding if buffer has space

parent 0aee6d25
...@@ -17,7 +17,7 @@ f=0.2 ...@@ -17,7 +17,7 @@ f=0.2
maxSimTime=1000 maxSimTime=1000
# the capacity of B123 # the capacity of B123
capacity=45 # float('inf') capacity=3 # float('inf')
class OpQueue(Queue): class OpQueue(Queue):
# allow to be locked between the time periods # allow to be locked between the time periods
...@@ -115,14 +115,16 @@ def controllerMethod(): ...@@ -115,14 +115,16 @@ def controllerMethod():
E.locked=False E.locked=False
if len(M3.getActiveObjectQueue()) and (not M3.state==0): if len(M3.getActiveObjectQueue()) and (not M3.state==0):
Controller.sendSignal(sender=M3, receiver=E,signal=E.isRequested) Controller.sendSignal(sender=M3, receiver=E,signal=E.isRequested)
yield G.env.timeout(0) while len(M3.getActiveObjectQueue()):
yield G.env.timeout(0)
E.locked=True E.locked=True
# unlock M3 and let part get from B123 to M3 # unlock M3 and let part get from B123 to M3
M3.locked=False M3.locked=False
if len(B123.getActiveObjectQueue()) and (not M3.state==0): if len(B123.getActiveObjectQueue()) and (not M3.state==0):
Controller.sendSignal(sender=B123, receiver=M3,signal=M3.isRequested) Controller.sendSignal(sender=B123, receiver=M3,signal=M3.isRequested)
yield G.env.timeout(0) while not len(M3.getActiveObjectQueue()):
yield G.env.timeout(0)
M3.locked=True M3.locked=True
# unlock B123 and let parts get from M1 and M2 to B123 # unlock B123 and let parts get from M1 and M2 to B123
......
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