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
16899abd
Commit
16899abd
authored
May 28, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new event entityRemoved added to handle inconsistency of timeout(0) while waiting to dispose a unit
parent
9bf41014
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+9
-1
dream/simulation/Dismantle.py
dream/simulation/Dismantle.py
+10
-6
No files found.
dream/simulation/CoreObject.py
View file @
16899abd
...
...
@@ -65,6 +65,8 @@ class CoreObject(object):
self
.
interruptionEnd
=
self
.
env
.
event
()
# self.interruptionStart=SimEvent('interruptionStart')
self
.
interruptionStart
=
self
.
env
.
event
()
self
.
entityRemoved
=
self
.
env
.
event
()
def
initialize
(
self
):
# XXX why call super.__init__ outside of __init__ ?
...
...
@@ -148,6 +150,8 @@ class CoreObject(object):
self
.
interruptionEnd
=
self
.
env
.
event
()
# self.interruptionStart=SimEvent('interruptionStart')
self
.
interruptionStart
=
self
.
env
.
event
()
self
.
entityRemoved
=
self
.
env
.
event
()
# =======================================================================
# the main process of the core object
...
...
@@ -192,6 +196,10 @@ class CoreObject(object):
# update wipStatList
if
self
.
gatherWipStat
:
self
.
wipStatList
.
append
([
self
.
env
.
now
,
len
(
activeObjectQueue
)])
if
not
self
.
entityRemoved
.
triggered
:
self
.
printTrace
(
self
.
id
,
signal
=
'(removedEntity)'
)
self
.
entityRemoved
.
succeed
(
self
.
env
.
now
)
return
entity
#===========================================================================
...
...
@@ -431,7 +439,7 @@ class CoreObject(object):
@
staticmethod
def
findGiversFor
(
activeObject
):
givers
=
[]
for
object
in
[
x
for
x
in
activeObject
.
previous
if
(
not
x
is
activeObject
)
]:
#
and not x.canDispose.triggered]:
for
object
in
[
x
for
x
in
activeObject
.
previous
if
(
not
x
is
activeObject
)
and
not
x
.
canDispose
.
triggered
]:
if
object
.
haveToDispose
(
activeObject
):
givers
.
append
(
object
)
return
givers
...
...
dream/simulation/Dismantle.py
View file @
16899abd
...
...
@@ -121,12 +121,12 @@ class Dismantle(CoreObject):
# check if there is WIP and signal receiver
self
.
initialSignalReceiver
()
while
1
:
self
.
printTrace
(
self
.
id
,
waitEvent
=
'(frame)'
)
#
self.printTrace(self.id, waitEvent='(frame)')
# wait until the Queue can accept an entity and one predecessor requests it
yield
self
.
isRequested
#[self.isRequested,self.canDispose, self.loadOperatorAvailable]
if
self
.
isRequested
.
value
:
self
.
printTrace
(
self
.
id
,
isRequested
=
self
.
isRequested
.
value
.
id
)
#
self.printTrace(self.id, isRequested=self.isRequested.value.id)
# reset the isRequested signal parameter
self
.
isRequested
=
self
.
env
.
event
()
...
...
@@ -144,6 +144,7 @@ class Dismantle(CoreObject):
self
.
waitToDispose
=
True
self
.
waitToDisposePart
=
True
#Dismantle is in state to dispose a part
# while the object still holds the frame
flag
=
False
while
not
self
.
isEmpty
():
# try and signal the receiver
if
not
self
.
signalReceiver
():
...
...
@@ -154,8 +155,10 @@ class Dismantle(CoreObject):
if
not
self
.
signalReceiver
():
continue
# if the receiver was not responsive, release the control to let him remove the entity
yield
self
.
env
.
timeout
(
0
)
# if all the parts are removed but not the frame, then set the flag waitToDisposeFrame
yield
self
.
entityRemoved
self
.
entityRemoved
=
self
.
env
.
event
()
# yield self.env.timeout(0)#(0.000000000000005)
if
self
.
frameIsEmpty
()
and
not
self
.
waitToDisposeFrame
:
self
.
waitToDisposePart
=
False
self
.
waitToDisposeFrame
=
True
...
...
@@ -220,8 +223,9 @@ class Dismantle(CoreObject):
#===========================================================================
# find possible receivers
#===========================================================================
def
findReceivers
(
self
):
activeObject
=
self
.
getActiveObject
()
@
staticmethod
def
findReceiversFor
(
activeObject
):
# activeObject=self.getActiveObject()
next
=
[]
receivers
=
[]
# if the parts are not yet disposed
...
...
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