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
9bf41014
Commit
9bf41014
authored
May 28, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix to prevent singalling the same object twice
parent
c0abf540
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
13 deletions
+14
-13
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+4
-4
dream/simulation/Exit.py
dream/simulation/Exit.py
+1
-0
dream/simulation/Machine.py
dream/simulation/Machine.py
+5
-5
dream/simulation/Queue.py
dream/simulation/Queue.py
+4
-4
No files found.
dream/simulation/CoreObject.py
View file @
9bf41014
...
...
@@ -331,7 +331,7 @@ class CoreObject(object):
@
staticmethod
def
findReceiversFor
(
activeObject
):
receivers
=
[]
for
object
in
[
x
for
x
in
activeObject
.
next
if
x
.
canAccept
(
activeObject
)]:
for
object
in
[
x
for
x
in
activeObject
.
next
if
x
.
canAccept
(
activeObject
)
and
not
x
.
isRequested
.
triggered
]:
receivers
.
append
(
object
)
return
receivers
...
...
@@ -372,7 +372,7 @@ class CoreObject(object):
self
.
receiver
=
receiver
self
.
receiver
.
giver
=
self
#
self.printTrace(self.id, signalReceiver=self.receiver.id)
self
.
printTrace
(
self
.
id
,
signalReceiver
=
self
.
receiver
.
id
)
# assign the entry of the receiver
self
.
receiver
.
assignEntryTo
()
self
.
receiver
.
isRequested
.
succeed
(
self
)
...
...
@@ -431,7 +431,7 @@ class CoreObject(object):
@
staticmethod
def
findGiversFor
(
activeObject
):
givers
=
[]
for
object
in
[
x
for
x
in
activeObject
.
previous
if
(
not
x
is
activeObject
)]:
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
...
...
@@ -465,7 +465,7 @@ class CoreObject(object):
giversReceiver
=
self
self
.
giver
=
giver
self
.
giver
.
receiver
=
self
#
self.printTrace(self.id, signalGiver=self.giver.id)
self
.
printTrace
(
self
.
id
,
signalGiver
=
self
.
giver
.
id
)
self
.
giver
.
canDispose
.
succeed
(
self
)
return
True
return
False
...
...
dream/simulation/Exit.py
View file @
9bf41014
...
...
@@ -73,6 +73,7 @@ class Exit(CoreObject):
self
.
isRequested
=
self
.
env
.
event
()
# TODO: insert extra controls to check whether the self.giver attribute is correctly updated
self
.
getEntity
()
self
.
signalGiver
()
# =======================================================================
# sets the routing in element for the Exit
...
...
dream/simulation/Machine.py
View file @
9bf41014
...
...
@@ -234,13 +234,13 @@ class Machine(CoreObject):
while
1
:
# waitEvent isRequested /interruptionEnd/loadOperatorAvailable
while
1
:
#
self.printTrace(self.id, waitEvent='')
self
.
printTrace
(
self
.
id
,
waitEvent
=
''
)
# yield waitevent, self, [self.isRequested, self.interruptionEnd, self.loadOperatorAvailable]
receivedEvent
=
yield
self
.
isRequested
|
self
.
interruptionEnd
|
self
.
loadOperatorAvailable
#
self.printTrace(self.id, received='')
self
.
printTrace
(
self
.
id
,
received
=
''
)
# if the machine can accept an entity and one predecessor requests it continue with receiving the entity
if
self
.
isRequested
in
receivedEvent
:
#
self.printTrace(self.id, isRequested=self.isRequested.value.id)
self
.
printTrace
(
self
.
id
,
isRequested
=
self
.
isRequested
.
value
.
id
)
assert
self
.
isRequested
.
value
==
self
.
giver
,
'the giver is not the requestingObject'
assert
self
.
giver
.
receiver
==
self
,
'the receiver of the signalling object in not the station'
# reset the signalparam of the isRequested event
...
...
@@ -490,7 +490,7 @@ class Machine(CoreObject):
def
endProcessingActions
(
self
):
activeObjectQueue
=
self
.
Res
.
users
activeEntity
=
activeObjectQueue
[
0
]
# self.printTrace(activeObject.getActiveObjectQueue()[0].name, processEnd=activeObject
.objName)
self
.
printTrace
(
self
.
getActiveObjectQueue
()[
0
].
name
,
processEnd
=
self
.
objName
)
# reset the variables used to handle the interruptions timing
self
.
timeRestartingProcessing
=
0
self
.
breakTime
=
0
...
...
@@ -714,7 +714,7 @@ class Machine(CoreObject):
self
.
waitToDispose
=
False
# update the waitToDispose flag
# if the Machine canAccept then signal a giver
if
self
.
canAccept
():
#
self.printTrace(self.id, attemptSignalGiver='(removeEntity)')
self
.
printTrace
(
self
.
id
,
attemptSignalGiver
=
'(removeEntity)'
)
self
.
signalGiver
()
return
activeEntity
...
...
dream/simulation/Queue.py
View file @
9bf41014
...
...
@@ -97,13 +97,13 @@ class Queue(CoreObject):
# check if there is WIP and signal receiver
self
.
initialSignalReceiver
()
while
1
:
#
self.printTrace(self.id, waitEvent='')
self
.
printTrace
(
self
.
id
,
waitEvent
=
''
)
# wait until the Queue can accept an entity and one predecessor requests it
receivedEvent
=
yield
self
.
isRequested
|
self
.
canDispose
|
self
.
loadOperatorAvailable
#
self.printTrace(self.id, received='')
self
.
printTrace
(
self
.
id
,
received
=
''
)
# if the event that activated the thread is isRequested then getEntity
if
self
.
isRequested
in
receivedEvent
:
# self.printTrace(self.id, isRequested=self.isRequested.signalparam
.id)
self
.
printTrace
(
self
.
id
,
isRequested
=
self
.
isRequested
.
value
.
id
)
# reset the isRequested signal parameter
self
.
isRequested
=
self
.
env
.
event
()
self
.
getEntity
()
...
...
@@ -116,7 +116,7 @@ class Queue(CoreObject):
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
# if the queue received an canDispose with signalparam time, this means that the signals was sent from a MouldAssemblyBuffer
if
self
.
canDispose
in
receivedEvent
:
#
self.printTrace(self.id, canDispose='')
self
.
printTrace
(
self
.
id
,
canDispose
=
''
)
self
.
canDispose
=
self
.
env
.
event
()
# if the event that activated the thread is canDispose then signalReceiver
if
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