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
631c88c4
Commit
631c88c4
authored
Jul 23, 2014
by
Ioannis Papagiannopoulos
Committed by
Jérome Perrin
Jul 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix in the removeEntity event signalling
parent
83db4f6d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
8 deletions
+42
-8
dream/simulation/CapacityStationController.py
dream/simulation/CapacityStationController.py
+4
-0
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+17
-4
dream/simulation/Dismantle.py
dream/simulation/Dismantle.py
+2
-0
dream/simulation/Machine.py
dream/simulation/Machine.py
+19
-4
No files found.
dream/simulation/CapacityStationController.py
View file @
631c88c4
...
...
@@ -68,7 +68,9 @@ class CapacityStationController(EventGenerator):
if
not
exit
.
isRequested
.
triggered
:
# this is needed because the signal can be triggered also by the buffer
exit
.
isRequested
.
succeed
(
station
)
# send is requested to station
# wait until the entity is removed
station
.
waitEntityRemoval
=
True
yield
station
.
entityRemoved
station
.
waitEntityRemoval
=
False
exit
.
currentlyObtainedEntities
.
append
(
entity
)
station
.
entityRemoved
=
self
.
env
.
event
()
project
=
entity
.
capacityProject
...
...
@@ -113,7 +115,9 @@ class CapacityStationController(EventGenerator):
break
station
.
isRequested
.
succeed
(
buffer
)
# send is requested to station
# wait until the entity is removed
buffer
.
waitEntityRemoval
=
True
yield
buffer
.
entityRemoved
buffer
.
waitEntityRemoval
=
False
buffer
.
entityRemoved
=
self
.
env
.
event
()
project
=
entity
.
capacityProject
periodDict
[
project
.
id
]
=
entity
.
requiredCapacity
# dict to be appended in the utilization list
...
...
dream/simulation/CoreObject.py
View file @
631c88c4
...
...
@@ -53,6 +53,8 @@ class CoreObject(object):
self
.
resetOnPreemption
=
False
self
.
interruptCause
=
None
self
.
gatherWipStat
=
False
# flag used to signal that the station waits for removeEntity event
self
.
waitEntityRemoval
=
False
def
initialize
(
self
):
from
Globals
import
G
...
...
@@ -136,7 +138,8 @@ class CoreObject(object):
self
.
interruptionStart
=
self
.
env
.
event
()
self
.
interruptedBy
=
None
self
.
entityRemoved
=
self
.
env
.
event
()
# flag used to signal that the station waits for removeEntity event
self
.
waitEntityRemoval
=
False
# =======================================================================
# the main process of the core object
...
...
@@ -182,9 +185,19 @@ class CoreObject(object):
if
self
.
gatherWipStat
:
self
.
wipStatList
.
append
([
self
.
env
.
now
,
len
(
activeObjectQueue
)])
if
not
self
.
entityRemoved
.
triggered
:
if
self
.
entityRemoved
.
triggered
:
if
self
.
entityRemoved
.
value
!=
self
.
env
.
now
and
self
.
waitEntityRemoval
:
# print self.id,'triggered and waiting'
self
.
entityRemoved
=
self
.
env
.
event
()
self
.
printTrace
(
self
.
id
,
signal
=
'(removedEntity)'
)
self
.
entityRemoved
.
succeed
(
self
.
env
.
now
)
elif
self
.
waitEntityRemoval
:
# print self.id,'not triggered and waiting'
self
.
printTrace
(
self
.
id
,
signal
=
'(removedEntity)'
)
self
.
entityRemoved
.
succeed
(
self
.
env
.
now
)
elif
not
self
.
waitEntityRemoval
:
# print self.id,'not triggered but not waiting'
pass
return
entity
#===========================================================================
...
...
@@ -463,7 +476,7 @@ class CoreObject(object):
self
.
giver
=
giver
self
.
giver
.
receiver
=
self
self
.
printTrace
(
self
.
id
,
signalGiver
=
self
.
giver
.
id
)
self
.
giver
.
canDispose
.
succeed
(
self
)
self
.
giver
.
canDispose
.
succeed
(
self
.
env
.
now
)
return
True
return
False
...
...
dream/simulation/Dismantle.py
View file @
631c88c4
...
...
@@ -155,7 +155,9 @@ class Dismantle(CoreObject):
if
not
self
.
signalReceiver
():
continue
# if the receiver was not responsive, release the control to let him remove the entity
self
.
waitEntityRemoval
=
True
yield
self
.
entityRemoved
self
.
waitEntityRemoval
=
False
self
.
entityRemoved
=
self
.
env
.
event
()
# yield self.env.timeout(0)#(0.000000000000005)
...
...
dream/simulation/Machine.py
View file @
631c88c4
...
...
@@ -450,6 +450,7 @@ class Machine(CoreObject):
# if there was no available receiver, get into blocking control
while
1
:
# 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
.
canDispose
|
self
.
interruptionStart
# if there was interruption
#if self.interrupted():
...
...
@@ -463,7 +464,15 @@ class Machine(CoreObject):
assert
self
.
env
.
now
==
self
.
interruptionEnd
.
value
,
'the victim of the failure is not the object that received it'
self
.
interruptionEnd
=
self
.
env
.
event
()
self
.
postInterruptionActions
()
if
self
.
signalReceiver
():
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
():
...
...
@@ -473,7 +482,13 @@ class Machine(CoreObject):
# 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.
yield
self
.
entityRemoved
#env.timeout(0)
# notify that the station waits the entity to be removed
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
():
...
...
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