Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
dba2853b
Commit
dba2853b
authored
May 07, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new event and flag added to queue to handle signalling from Router
parent
e066dd15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
dream/simulation/Queue.py
dream/simulation/Queue.py
+13
-6
No files found.
dream/simulation/Queue.py
View file @
dba2853b
...
@@ -26,7 +26,7 @@ Models a FIFO queue where entities can wait in order to get into a server
...
@@ -26,7 +26,7 @@ Models a FIFO queue where entities can wait in order to get into a server
'''
'''
from
SimPy.Simulation
import
Process
,
Resource
from
SimPy.Simulation
import
Process
,
Resource
,
SimEvent
from
SimPy.Simulation
import
waituntil
,
now
,
infinity
,
waitevent
from
SimPy.Simulation
import
waituntil
,
now
,
infinity
,
waitevent
from
CoreObject
import
CoreObject
from
CoreObject
import
CoreObject
# ===========================================================================
# ===========================================================================
...
@@ -66,8 +66,12 @@ class Queue(CoreObject):
...
@@ -66,8 +66,12 @@ class Queue(CoreObject):
(
scheduling_rule
,
id
))
(
scheduling_rule
,
id
))
self
.
gatherWipStat
=
gatherWipStat
self
.
gatherWipStat
=
gatherWipStat
# # Will be populated by an event generator
# Will be populated by an event generator
# self.wip_stat_list = []
self
.
wip_stat_list
=
[]
# event used by router
self
.
loadOperatorAvailable
=
SimEvent
(
'loadOperatorAvailable'
)
# flag used by router to check whether the
self
.
canProceedWithGetEntity
=
False
@
staticmethod
@
staticmethod
def
getSupportedSchedulingRules
():
def
getSupportedSchedulingRules
():
...
@@ -93,7 +97,7 @@ class Queue(CoreObject):
...
@@ -93,7 +97,7 @@ class Queue(CoreObject):
while
1
:
while
1
:
# print self.id, 'will wait for event', now()
# print self.id, 'will wait for event', now()
# wait until the Queue can accept an entity and one predecessor requests it
# wait until the Queue can accept an entity and one predecessor requests it
yield
waitevent
,
self
,
[
self
.
isRequested
,
self
.
canDispose
]
yield
waitevent
,
self
,
[
self
.
isRequested
,
self
.
canDispose
,
self
.
loadOperatorAvailable
]
# print now(), self.id, 'just received an event'
# print now(), self.id, 'just received an event'
# if the event that activated the thread is isRequested then getEntity
# if the event that activated the thread is isRequested then getEntity
if
self
.
isRequested
.
signalparam
:
if
self
.
isRequested
.
signalparam
:
...
@@ -104,6 +108,10 @@ class Queue(CoreObject):
...
@@ -104,6 +108,10 @@ class Queue(CoreObject):
#if entity just got to the dummyQ set its startTime as the current time
#if entity just got to the dummyQ set its startTime as the current time
if
self
.
isDummy
:
if
self
.
isDummy
:
activeObjectQueue
[
0
].
startTime
=
now
()
activeObjectQueue
[
0
].
startTime
=
now
()
# if the queue received an loadOperatorIsAvailable (from Router) with signalparam time
if
self
.
loadOperatorAvailable
.
signalparam
:
# print now(), self.id, 'received a loadOperatorAvailable event'
self
.
loadOperatorAvailable
.
signalparam
=
None
# if the queue received an canDispose with signalparam time, this means that the signals was sent from a MouldAssemblyBuffer
# if the queue received an canDispose with signalparam time, this means that the signals was sent from a MouldAssemblyBuffer
if
self
.
canDispose
.
signalparam
:
if
self
.
canDispose
.
signalparam
:
# print now(), self.id, 'received a canDispose event'
# print now(), self.id, 'received a canDispose event'
...
@@ -116,8 +124,7 @@ class Queue(CoreObject):
...
@@ -116,8 +124,7 @@ class Queue(CoreObject):
self
.
signalReceiver
()
self
.
signalReceiver
()
continue
continue
self
.
signalReceiver
()
self
.
signalReceiver
()
# =======================================================================
# =======================================================================
# checks if the Queue can accept an entity
# checks if the Queue can accept an entity
# it checks also who called it and returns TRUE
# it checks also who called it and returns TRUE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment