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
699be5b0
Commit
699be5b0
authored
Apr 19, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
entity appended to receiver internal queue from removeEntity of the giver
parent
6ed62573
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+12
-6
dream/simulation/Machine.py
dream/simulation/Machine.py
+2
-0
dream/simulation/Queue.py
dream/simulation/Queue.py
+8
-0
No files found.
dream/simulation/CoreObject.py
View file @
699be5b0
...
@@ -165,6 +165,10 @@ class CoreObject(Process):
...
@@ -165,6 +165,10 @@ class CoreObject(Process):
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
.
remove
(
entity
)
#remove the Entity from the queue
activeObjectQueue
.
remove
(
entity
)
#remove the Entity from the queue
if
self
.
receiver
:
receiverObject
=
self
.
getReceiverObject
()
receiverObjectQueue
=
receiverObject
.
getActiveObjectQueue
()
receiverObjectQueue
.
append
(
entity
)
self
.
failureTimeInCurrentEntity
=
0
self
.
failureTimeInCurrentEntity
=
0
self
.
downTimeInTryingToReleaseCurrentEntity
=
0
self
.
downTimeInTryingToReleaseCurrentEntity
=
0
...
@@ -214,17 +218,18 @@ class CoreObject(Process):
...
@@ -214,17 +218,18 @@ class CoreObject(Process):
# if the giverObject is blocked then unBlock it
# if the giverObject is blocked then unBlock it
if
giverObject
.
exitIsAssignedTo
():
if
giverObject
.
exitIsAssignedTo
():
giverObject
.
unAssignExit
()
giverObject
.
unAssignExit
()
# if the activeObject entry is blocked then unBlock it
if
activeObject
.
entryIsAssignedTo
():
activeObject
.
unAssignEntry
()
# remove entity from the giver
# remove entity from the giver
activeEntity
=
giverObject
.
removeEntity
(
entity
=
self
.
identifyEntityToGet
())
activeEntity
=
giverObject
.
removeEntity
(
entity
=
self
.
identifyEntityToGet
())
# variable that holds the last giver; used in case of preemption
# variable that holds the last giver; used in case of preemption
self
.
lastGiver
=
self
.
giver
self
.
lastGiver
=
self
.
giver
#get the entity from the previous object and put it in front of the activeQ
# #get the entity from the previous object and put it in front of the activeQ
activeObjectQueue
.
append
(
activeEntity
)
# activeObjectQueue.append(activeEntity)
# if the activeObject entry is blocked then unBlock it
if
activeObject
.
entryIsAssignedTo
():
activeObject
.
unAssignEntry
()
#append the time to schedule so that it can be read in the result
#append the time to schedule so that it can be read in the result
#remember that every entity has it's schedule which is supposed to be updated every time
#remember that every entity has it's schedule which is supposed to be updated every time
# he entity enters a new object
# he entity enters a new object
...
@@ -325,6 +330,7 @@ class CoreObject(Process):
...
@@ -325,6 +330,7 @@ class CoreObject(Process):
while
not
activeObject
.
receiver
.
canAcceptAndIsRequested
():
while
not
activeObject
.
receiver
.
canAcceptAndIsRequested
():
possibleReceivers
.
remove
(
activeObject
.
receiver
)
possibleReceivers
.
remove
(
activeObject
.
receiver
)
if
not
possibleReceivers
:
if
not
possibleReceivers
:
# print self.id, 'reseting receiver'
activeObject
.
receiver
.
giver
=
None
activeObject
.
receiver
.
giver
=
None
activeObject
.
receiver
=
None
activeObject
.
receiver
=
None
return
False
return
False
...
...
dream/simulation/Machine.py
View file @
699be5b0
...
@@ -225,8 +225,10 @@ class Machine(CoreObject):
...
@@ -225,8 +225,10 @@ class Machine(CoreObject):
# waitEvent isRequested /interruptionEnd/loadOperatorAvailable
# waitEvent isRequested /interruptionEnd/loadOperatorAvailable
while
1
:
while
1
:
yield
waitevent
,
self
,
[
self
.
isRequested
,
self
.
interruptionEnd
,
self
.
loadOperatorAvailable
]
yield
waitevent
,
self
,
[
self
.
isRequested
,
self
.
interruptionEnd
,
self
.
loadOperatorAvailable
]
# print now(), self.id, 'received an event'
# if the machine can accept an entity and one predecessor requests it continue with receiving the entity
# if the machine can accept an entity and one predecessor requests it continue with receiving the entity
if
self
.
isRequested
.
signalparam
:
if
self
.
isRequested
.
signalparam
:
# print now(), self.id, 'received an isRequested event from', self.isRequested.signalparam.id
assert
self
.
isRequested
.
signalparam
==
self
.
giver
,
'the giver is not the requestingObject'
assert
self
.
isRequested
.
signalparam
==
self
.
giver
,
'the giver is not the requestingObject'
assert
self
.
giver
.
receiver
==
self
,
'the receiver of the signalling object in not the station'
assert
self
.
giver
.
receiver
==
self
,
'the receiver of the signalling object in not the station'
# reset the signalparam of the isRequested event
# reset the signalparam of the isRequested event
...
...
dream/simulation/Queue.py
View file @
699be5b0
...
@@ -101,8 +101,15 @@ class Queue(CoreObject):
...
@@ -101,8 +101,15 @@ class Queue(CoreObject):
#if entity just got to the dummyQ set its startTime as the current time
#if entity just got to the dummyQ set its startTime as the current time
if
self
.
isDummy
:
if
self
.
isDummy
:
activeObjectQueue
[
0
].
startTime
=
now
()
activeObjectQueue
[
0
].
startTime
=
now
()
# if self.canDispose.signalparam:
# print now(), self.id, 'received a canDispose event from', self.canDispose.signalparam
# if the event that activated the thread is canDispose then signalReceiver
# if the event that activated the thread is canDispose then signalReceiver
if
self
.
haveToDispose
():
if
self
.
haveToDispose
():
# print now(), self.id, 'will try to signal a receiver from generator'
if
self
.
receiver
:
if
not
self
.
receiver
.
entryIsAssignedTo
():
self
.
signalReceiver
()
continue
self
.
signalReceiver
()
self
.
signalReceiver
()
...
@@ -152,6 +159,7 @@ class Queue(CoreObject):
...
@@ -152,6 +159,7 @@ class Queue(CoreObject):
# TODO: disable that for the mouldAssemblyBuffer
# TODO: disable that for the mouldAssemblyBuffer
if
not
self
.
__class__
.
__name__
==
'MouldAssemblyBuffer'
:
if
not
self
.
__class__
.
__name__
==
'MouldAssemblyBuffer'
:
if
self
.
haveToDispose
():
if
self
.
haveToDispose
():
# print now(), self.id, 'will try to signal a receiver from removeEntity'
self
.
signalReceiver
()
self
.
signalReceiver
()
return
activeEntity
return
activeEntity
...
...
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