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
c3943b8e
Commit
c3943b8e
authored
Sep 09, 2014
by
Ioannis Papagiannopoulos
Committed by
Georgios Dagkakis
Nov 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more CoreObjects use the expectedSignals dict
parent
6ddc0faa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
4 deletions
+54
-4
dream/simulation/Assembly.py
dream/simulation/Assembly.py
+26
-2
dream/simulation/Conveyer.py
dream/simulation/Conveyer.py
+12
-2
dream/simulation/Dismantle.py
dream/simulation/Dismantle.py
+16
-0
No files found.
dream/simulation/Assembly.py
View file @
c3943b8e
...
...
@@ -154,6 +154,9 @@ class Assembly(CoreObject):
while
1
:
self
.
printTrace
(
self
.
id
,
waitEvent
=
''
)
# wait until the Queue can accept an entity and one predecessor requests it
self
.
expectedSignals
[
'isRequested'
]
=
1
yield
self
.
isRequested
#[self.isRequested,self.canDispose, self.loadOperatorAvailable]
if
self
.
isRequested
.
value
:
transmitter
,
eventTime
=
self
.
isRequested
.
value
...
...
@@ -173,7 +176,9 @@ class Assembly(CoreObject):
self
.
isRequested
=
self
.
env
.
event
()
# TODO: fix the getEntity 'Part' case
self
.
getEntity
(
"Part"
)
self
.
expectedSignals
[
'isRequested'
]
=
0
self
.
outputTrace
(
self
.
getActiveObjectQueue
()[
0
].
name
,
"is now full in "
+
self
.
objName
)
self
.
isProcessing
=
True
...
...
@@ -199,6 +204,10 @@ class Assembly(CoreObject):
# 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
self
.
expectedSignals
[
'canDispose'
]
=
1
self
.
expectedSignals
[
'interruptionStart'
]
=
1
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
...
...
@@ -214,7 +223,13 @@ class Assembly(CoreObject):
self
.
interruptionActions
()
# execute interruption actions
# loop until we reach at a state that there is no interruption
while
1
:
self
.
expectedSignals
[
'interruptionEnd'
]
=
1
yield
self
.
interruptionEnd
# interruptionEnd to be triggered by ObjectInterruption
self
.
expectedSignals
[
'interruptionEnd'
]
=
0
transmitter
,
eventTime
=
self
.
interruptionEnd
.
value
assert
eventTime
==
self
.
env
.
now
,
'the victim of the failure is not the object that received it'
self
.
interruptionEnd
=
self
.
env
.
event
()
...
...
@@ -246,7 +261,13 @@ class Assembly(CoreObject):
# notify that the station waits the entity to be removed
self
.
waitEntityRemoval
=
True
self
.
printTrace
(
self
.
id
,
waitEvent
=
'(entityRemoved)'
)
self
.
expectedSignals
[
'entityRemoved'
]
=
1
yield
self
.
entityRemoved
self
.
expectedSignals
[
'entityRemoved'
]
=
0
transmitter
,
eventTime
=
self
.
entityRemoved
.
value
self
.
printTrace
(
self
.
id
,
entityRemoved
=
eventTime
)
assert
eventTime
==
self
.
env
.
now
,
'entityRemoved event activated earlier than received'
...
...
@@ -255,7 +276,10 @@ class Assembly(CoreObject):
# if while waiting (for a canDispose event) became free as the machines that follows emptied it, then proceed
if
not
self
.
haveToDispose
():
break
self
.
expectedSignals
[
'canDispose'
]
=
0
self
.
expectedSignals
[
'interruptionStart'
]
=
0
#===========================================================================
# checks if the Assembly can accept an entity
#===========================================================================
...
...
dream/simulation/Conveyer.py
View file @
c3943b8e
...
...
@@ -107,6 +107,11 @@ class Conveyer(CoreObject):
self
.
conveyerMover
.
canMove
.
succeed
(
succeedTuple
)
self
.
printTrace
(
self
.
id
,
waitEvent
=
''
)
self
.
expectedSignals
[
'isRequested'
]
=
1
self
.
expectedSignals
[
'canDispose'
]
=
1
self
.
expectedSignals
[
'moveEnd'
]
=
1
receivedEvent
=
yield
self
.
env
.
any_of
([
self
.
isRequested
,
self
.
canDispose
,
self
.
moveEnd
])
# , self.loadOperatorAvailable]
# if the event that activated the thread is isRequested then getEntity
if
self
.
isRequested
in
receivedEvent
:
...
...
@@ -137,6 +142,10 @@ class Conveyer(CoreObject):
self
.
printTrace
(
self
.
id
,
attemptSignalGiver
=
'(removeEntity)'
)
self
.
signalGiver
()
self
.
expectedSignals
[
'isRequested'
]
=
0
self
.
expectedSignals
[
'canDispose'
]
=
0
self
.
expectedSignals
[
'moveEnd'
]
=
0
# if the event that activated the thread is canDispose then signalReceiver
if
self
.
haveToDispose
():
self
.
printTrace
(
self
.
id
,
attemptSignalReceiver
=
'(generator)'
)
...
...
@@ -531,8 +540,9 @@ class ConveyerMover(object):
yield
self
.
env
.
timeout
(
self
.
timeToWait
)
#wait for the time that the conveyer calculated
# continue if interrupted
self
.
conveyer
.
moveEntities
()
# move the entities of the conveyer
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
conveyer
.
moveEnd
.
succeed
(
succeedTuple
)
# send a signal to the conveyer that the move has ended
if
self
.
conveyer
.
expectedSignals
[
'moveEnd'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
conveyer
.
moveEnd
.
succeed
(
succeedTuple
)
# send a signal to the conveyer that the move has ended
dream/simulation/Dismantle.py
View file @
c3943b8e
...
...
@@ -126,8 +126,13 @@ class Dismantle(CoreObject):
while
1
:
# self.printTrace(self.id, waitEvent='(frame)')
# wait until the Queue can accept an entity and one predecessor requests it
self
.
expectedSignals
[
'isRequested'
]
=
1
yield
self
.
isRequested
#[self.isRequested,self.canDispose, self.loadOperatorAvailable]
self
.
expectedSignals
[
'isRequested'
]
=
0
if
self
.
isRequested
.
value
:
# self.printTrace(self.id, isRequested=self.isRequested.value.id)
# reset the isRequested signal parameter
...
...
@@ -154,6 +159,9 @@ class Dismantle(CoreObject):
# while the object still holds the frame
flag
=
False
while
not
self
.
isEmpty
():
self
.
expectedSignals
[
'canDispose'
]
=
1
# try and signal the receiver
if
not
self
.
signalReceiver
():
# if not possible, then wait till a receiver is available
...
...
@@ -164,7 +172,13 @@ class Dismantle(CoreObject):
continue
# if the receiver was not responsive, release the control to let him remove the entity
self
.
waitEntityRemoval
=
True
self
.
expectedSignals
[
'entityRemoved'
]
=
1
yield
self
.
entityRemoved
self
.
expectedSignals
[
'entityRemoved'
]
=
0
self
.
waitEntityRemoval
=
False
self
.
entityRemoved
=
self
.
env
.
event
()
...
...
@@ -175,6 +189,8 @@ class Dismantle(CoreObject):
if
self
.
isEmpty
():
self
.
waitToDisposeFrame
=
False
#the Dismantle has no Frame to dispose now
break
self
.
expectedSignals
[
'canDispose'
]
=
0
#===========================================================================
# checks if the Dismantle can accept an entity and there is a Frame
...
...
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