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
5858ff7f
Commit
5858ff7f
authored
Sep 05, 2014
by
Ioannis Papagiannopoulos
Committed by
Georgios Dagkakis
Nov 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BatchReassembly signalRouter loop fixed
parent
5df6e60a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
6 deletions
+49
-6
dream/simulation/BatchReassembly.py
dream/simulation/BatchReassembly.py
+49
-6
No files found.
dream/simulation/BatchReassembly.py
View file @
5858ff7f
...
...
@@ -117,17 +117,60 @@ class BatchReassembly(CoreObject):
yield
self
.
env
.
timeout
(
self
.
calculateProcessingTime
())
self
.
reassemble
()
self
.
isProcessingInitialWIP
=
False
# signal the receiver that the activeObject has something to dispose of
if
not
self
.
signalReceiver
():
# if there was no available receiver, get into blocking control
while
1
:
# self.timeLastBlockageStarted=self.env.now # blockage is starting
# wait the event canDispose, this means that the station can deliver the item to successor
self
.
printTrace
(
self
.
id
,
waitEvent
=
'(canDispose or interruption start)'
)
receivedEvent
=
yield
self
.
env
.
any_of
([
self
.
canDispose
,
self
.
interruptionStart
])
if
self
.
canDispose
in
receivedEvent
:
self
.
canDispose
=
self
.
env
.
event
()
# if there was interruption
# TODO not good implementation
if
self
.
interruptionStart
in
receivedEvent
:
self
.
interruptionStart
.
value
==
self
.
env
.
now
,
'the interruptionStart event received by BatchReassembly later than created
'
assert
self
.
interruptionStart
.
value
==
self
.
env
.
now
,
'the interruption has not been processed on the time of activation
'
self
.
interruptionStart
=
self
.
env
.
event
()
yield
self
.
interruptionEnd
assert
self
==
self
.
interruptionEnd
.
value
,
'interruptionEnd event received by BatchReassembly other than the one intended'
if
self
.
signalReceiver
():
# wait for the end of the interruption
self
.
interruptionActions
()
# execute interruption actions
# loop until we reach at a state that there is no interruption
while
1
:
yield
self
.
interruptionEnd
# interruptionEnd to be triggered by ObjectInterruption
assert
self
.
env
.
now
==
self
.
interruptionEnd
.
value
,
'the victim of the failure is not the object that received it'
self
.
interruptionEnd
=
self
.
env
.
event
()
if
self
.
Up
and
self
.
onShift
:
break
self
.
postInterruptionActions
()
if
self
.
signalReceiver
():
# self.timeLastBlockageStarted=self.env.now
break
else
:
continue
if
self
.
canDispose
in
receivedEvent
:
if
self
.
canDispose
.
value
!=
self
.
env
.
now
:
self
.
canDispose
=
self
.
env
.
event
()
continue
assert
self
.
canDispose
.
value
==
self
.
env
.
now
,
'canDispose signal is late'
self
.
canDispose
=
self
.
env
.
event
()
# try to signal a receiver, if successful then proceed to get an other entity
if
self
.
signalReceiver
():
break
# TODO: router most probably should signal givers and not receivers in order to avoid this hold,self,0
# As the receiver (e.g.) a machine that follows the machine receives an loadOperatorAvailable event,
# signals the preceding station (e.g. self.machine) and immediately after that gets the entity.
# the preceding machine gets the canDispose signal which is actually useless, is emptied by the following station
# and then cannot exit an infinite loop.
# notify that the station waits the entity to be removed
if
not
self
.
haveToDispose
():
break
self
.
waitEntityRemoval
=
True
self
.
printTrace
(
self
.
id
,
waitEvent
=
'(entityRemoved)'
)
yield
self
.
entityRemoved
self
.
printTrace
(
self
.
id
,
entityRemoved
=
self
.
entityRemoved
.
value
)
assert
self
.
entityRemoved
.
value
==
self
.
env
.
now
,
'entityRemoved event activated earlier than received'
self
.
waitEntityRemoval
=
False
self
.
entityRemoved
=
self
.
env
.
event
()
# if while waiting (for a canDispose event) became free as the machines that follows emptied it, then proceed
if
not
self
.
haveToDispose
():
break
# =======================================================================
...
...
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