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
9164973f
Commit
9164973f
authored
Sep 09, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
many objects set to update the flags at correct place
parent
df5712d6
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
23 deletions
+29
-23
dream/simulation/BatchDecomposition.py
dream/simulation/BatchDecomposition.py
+7
-9
dream/simulation/BatchReassembly.py
dream/simulation/BatchReassembly.py
+7
-10
dream/simulation/CapacityStationController.py
dream/simulation/CapacityStationController.py
+2
-0
dream/simulation/Conveyer.py
dream/simulation/Conveyer.py
+1
-1
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+3
-0
dream/simulation/Exit.py
dream/simulation/Exit.py
+1
-0
dream/simulation/Machine.py
dream/simulation/Machine.py
+2
-3
dream/simulation/Queue.py
dream/simulation/Queue.py
+3
-0
dream/simulation/Source.py
dream/simulation/Source.py
+3
-0
No files found.
dream/simulation/BatchDecomposition.py
View file @
9164973f
...
@@ -85,13 +85,11 @@ class BatchDecomposition(CoreObject):
...
@@ -85,13 +85,11 @@ class BatchDecomposition(CoreObject):
# check if there is WIP and signal receiver
# check if there is WIP and signal receiver
self
.
initialSignalReceiver
()
self
.
initialSignalReceiver
()
while
1
:
while
1
:
# wait for an event or an interruption
# wait for an event or an interruption
self
.
expectedSignals
[
'isRequested'
]
=
1
self
.
expectedSignals
[
'interruptionStart'
]
=
1
self
.
expectedSignals
[
'initialWIP'
]
=
1
while
1
:
while
1
:
self
.
expectedSignals
[
'isRequested'
]
=
1
self
.
expectedSignals
[
'interruptionStart'
]
=
1
self
.
expectedSignals
[
'initialWIP'
]
=
1
receivedEvent
=
yield
self
.
env
.
any_of
([
self
.
isRequested
,
self
.
interruptionStart
,
self
.
initialWIP
])
receivedEvent
=
yield
self
.
env
.
any_of
([
self
.
isRequested
,
self
.
interruptionStart
,
self
.
initialWIP
])
# if an interruption has occurred
# if an interruption has occurred
if
self
.
interruptionStart
in
receivedEvent
:
if
self
.
interruptionStart
in
receivedEvent
:
...
@@ -144,9 +142,7 @@ class BatchDecomposition(CoreObject):
...
@@ -144,9 +142,7 @@ class BatchDecomposition(CoreObject):
# reset the variable
# reset the variable
self
.
isProcessingInitialWIP
=
False
self
.
isProcessingInitialWIP
=
False
self
.
expectedSignals
[
'canDispose'
]
=
1
# TODO: add failure control
# TODO: add failure control
# as long as there are sub-Batches in the internal Resource
# as long as there are sub-Batches in the internal Resource
numberOfSubBatches
=
int
(
len
(
self
.
getActiveObjectQueue
()))
numberOfSubBatches
=
int
(
len
(
self
.
getActiveObjectQueue
()))
...
@@ -161,6 +157,7 @@ class BatchDecomposition(CoreObject):
...
@@ -161,6 +157,7 @@ class BatchDecomposition(CoreObject):
if
not
signaling
:
if
not
signaling
:
# if there was no success wait till the receiver is available
# if there was no success wait till the receiver is available
while
1
:
while
1
:
self
.
expectedSignals
[
'canDispose'
]
=
1
yield
self
.
canDispose
yield
self
.
canDispose
transmitter
,
eventTime
=
self
.
canDispose
.
value
transmitter
,
eventTime
=
self
.
canDispose
.
value
self
.
canDispose
=
self
.
env
.
event
()
self
.
canDispose
=
self
.
env
.
event
()
...
@@ -182,6 +179,7 @@ class BatchDecomposition(CoreObject):
...
@@ -182,6 +179,7 @@ class BatchDecomposition(CoreObject):
# we know that the receiver is occupied with the previous sub-batch
# we know that the receiver is occupied with the previous sub-batch
else
:
else
:
while
1
:
while
1
:
self
.
expectedSignals
[
'canDispose'
]
=
1
yield
self
.
canDispose
yield
self
.
canDispose
transmitter
,
eventTime
=
self
.
canDispose
.
value
transmitter
,
eventTime
=
self
.
canDispose
.
value
self
.
canDispose
=
self
.
env
.
event
()
self
.
canDispose
=
self
.
env
.
event
()
...
...
dream/simulation/BatchReassembly.py
View file @
9164973f
...
@@ -81,13 +81,11 @@ class BatchReassembly(CoreObject):
...
@@ -81,13 +81,11 @@ class BatchReassembly(CoreObject):
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
# check if there is WIP and signal receiver
# check if there is WIP and signal receiver
self
.
initialSignalReceiver
()
self
.
initialSignalReceiver
()
while
1
:
while
1
:
self
.
expectedSignals
[
'isRequested'
]
=
1
self
.
expectedSignals
[
'interruptionStart'
]
=
1
self
.
expectedSignals
[
'initialWIP'
]
=
1
while
1
:
while
1
:
self
.
expectedSignals
[
'isRequested'
]
=
1
self
.
expectedSignals
[
'interruptionStart'
]
=
1
self
.
expectedSignals
[
'initialWIP'
]
=
1
receivedEvent
=
yield
self
.
env
.
any_of
([
self
.
isRequested
,
self
.
interruptionStart
,
self
.
initialWIP
])
receivedEvent
=
yield
self
.
env
.
any_of
([
self
.
isRequested
,
self
.
interruptionStart
,
self
.
initialWIP
])
if
self
.
interruptionStart
in
receivedEvent
:
if
self
.
interruptionStart
in
receivedEvent
:
transmitter
,
eventTime
=
self
.
interruptionStart
.
value
transmitter
,
eventTime
=
self
.
interruptionStart
.
value
...
@@ -140,16 +138,15 @@ class BatchReassembly(CoreObject):
...
@@ -140,16 +138,15 @@ class BatchReassembly(CoreObject):
self
.
reassemble
()
self
.
reassemble
()
self
.
isProcessingInitialWIP
=
False
self
.
isProcessingInitialWIP
=
False
# signal the receiver that the activeObject has something to dispose of
# signal the receiver that the activeObject has something to dispose of
self
.
expectedSignals
[
'interruptionStart'
]
=
1
self
.
expectedSignals
[
'canDispose'
]
=
1
if
not
self
.
signalReceiver
():
if
not
self
.
signalReceiver
():
# if there was no available receiver, get into blocking control
# if there was no available receiver, get into blocking control
while
1
:
while
1
:
# self.timeLastBlockageStarted=self.env.now # blockage is starting
# self.timeLastBlockageStarted=self.env.now # blockage is starting
# wait the event canDispose, this means that the station can deliver the item to successor
# wait the event canDispose, this means that the station can deliver the item to successor
self
.
printTrace
(
self
.
id
,
waitEvent
=
'(canDispose or interruption start)'
)
self
.
printTrace
(
self
.
id
,
waitEvent
=
'(canDispose or interruption start)'
)
self
.
expectedSignals
[
'interruptionStart'
]
=
1
self
.
expectedSignals
[
'canDispose'
]
=
1
receivedEvent
=
yield
self
.
env
.
any_of
([
self
.
canDispose
,
self
.
interruptionStart
])
receivedEvent
=
yield
self
.
env
.
any_of
([
self
.
canDispose
,
self
.
interruptionStart
])
# if there was interruption
# if there was interruption
# TODO not good implementation
# TODO not good implementation
...
...
dream/simulation/CapacityStationController.py
View file @
9164973f
...
@@ -65,6 +65,7 @@ class CapacityStationController(EventGenerator):
...
@@ -65,6 +65,7 @@ class CapacityStationController(EventGenerator):
if
exit
.
expectedSignals
[
'isRequested'
]:
if
exit
.
expectedSignals
[
'isRequested'
]:
succeedTuple
=
(
station
,
self
.
env
.
now
)
succeedTuple
=
(
station
,
self
.
env
.
now
)
exit
.
isRequested
.
succeed
(
succeedTuple
)
# send is requested to station
exit
.
isRequested
.
succeed
(
succeedTuple
)
# send is requested to station
exit
.
expectedSignals
[
'isRequested'
]
=
0
# wait until the entity is removed
# wait until the entity is removed
station
.
waitEntityRemoval
=
True
station
.
waitEntityRemoval
=
True
...
@@ -125,6 +126,7 @@ class CapacityStationController(EventGenerator):
...
@@ -125,6 +126,7 @@ class CapacityStationController(EventGenerator):
if
station
.
expectedSignals
[
'isRequested'
]:
if
station
.
expectedSignals
[
'isRequested'
]:
succeedTuple
=
(
buffer
,
self
.
env
.
now
)
succeedTuple
=
(
buffer
,
self
.
env
.
now
)
station
.
isRequested
.
succeed
(
succeedTuple
)
# send is requested to station
station
.
isRequested
.
succeed
(
succeedTuple
)
# send is requested to station
station
.
expectedSignals
[
'isRequested'
]
=
0
# wait until the entity is removed
# wait until the entity is removed
buffer
.
waitEntityRemoval
=
True
buffer
.
waitEntityRemoval
=
True
...
...
dream/simulation/Conveyer.py
View file @
9164973f
...
@@ -543,6 +543,6 @@ class ConveyerMover(object):
...
@@ -543,6 +543,6 @@ class ConveyerMover(object):
if
self
.
conveyer
.
expectedSignals
[
'moveEnd'
]:
if
self
.
conveyer
.
expectedSignals
[
'moveEnd'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
conveyer
.
moveEnd
.
succeed
(
succeedTuple
)
# send a signal to the conveyer that the move has ended
self
.
conveyer
.
moveEnd
.
succeed
(
succeedTuple
)
# send a signal to the conveyer that the move has ended
self
.
conveyer
.
expectedSignals
[
'moveEnd'
]
=
0
dream/simulation/CoreObject.py
View file @
9164973f
...
@@ -298,11 +298,13 @@ class CoreObject(ManPyObject):
...
@@ -298,11 +298,13 @@ class CoreObject(ManPyObject):
self
.
printTrace
(
self
.
id
,
signal
=
'(removedEntity)'
)
self
.
printTrace
(
self
.
id
,
signal
=
'(removedEntity)'
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
entityRemoved
.
succeed
(
succeedTuple
)
self
.
entityRemoved
.
succeed
(
succeedTuple
)
self
.
expectedSignals
[
'entityRemoved'
]
=
0
elif
self
.
waitEntityRemoval
and
self
.
expectedSignals
[
'entityRemoved'
]:
elif
self
.
waitEntityRemoval
and
self
.
expectedSignals
[
'entityRemoved'
]:
# print self.id,'not triggered and waiting'
# print self.id,'not triggered and waiting'
self
.
printTrace
(
self
.
id
,
signal
=
'(removedEntity)'
)
self
.
printTrace
(
self
.
id
,
signal
=
'(removedEntity)'
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
entityRemoved
.
succeed
(
succeedTuple
)
self
.
entityRemoved
.
succeed
(
succeedTuple
)
self
.
expectedSignals
[
'entityRemoved'
]
=
0
elif
not
self
.
waitEntityRemoval
and
not
self
.
expectedSignals
[
'entityRemoved'
]:
elif
not
self
.
waitEntityRemoval
and
not
self
.
expectedSignals
[
'entityRemoved'
]:
# print self.id,'not triggered but not waiting'
# print self.id,'not triggered but not waiting'
pass
pass
...
@@ -566,6 +568,7 @@ class CoreObject(ManPyObject):
...
@@ -566,6 +568,7 @@ class CoreObject(ManPyObject):
self
.
printTrace
(
self
.
id
,
signalGiver
=
self
.
giver
.
id
)
self
.
printTrace
(
self
.
id
,
signalGiver
=
self
.
giver
.
id
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
giver
.
canDispose
.
succeed
(
succeedTuple
)
self
.
giver
.
canDispose
.
succeed
(
succeedTuple
)
self
.
giver
.
expectedSignals
[
'canDispose'
]
=
0
return
True
return
True
return
False
return
False
...
...
dream/simulation/Exit.py
View file @
9164973f
...
@@ -70,6 +70,7 @@ class Exit(CoreObject):
...
@@ -70,6 +70,7 @@ class Exit(CoreObject):
def
run
(
self
):
def
run
(
self
):
while
1
:
while
1
:
# wait until the Queue can accept an entity and one predecessor requests it
# wait until the Queue can accept an entity and one predecessor requests it
self
.
expectedSignals
[
'isRequested'
]
=
1
yield
self
.
isRequested
yield
self
.
isRequested
self
.
isRequested
=
self
.
env
.
event
()
self
.
isRequested
=
self
.
env
.
event
()
# TODO: insert extra controls to check whether the self.giver attribute is correctly updated
# TODO: insert extra controls to check whether the self.giver attribute is correctly updated
...
...
dream/simulation/Machine.py
View file @
9164973f
...
@@ -732,11 +732,10 @@ class Machine(CoreObject):
...
@@ -732,11 +732,10 @@ class Machine(CoreObject):
# signal the receiver that the activeObject has something to dispose of
# signal the receiver that the activeObject has something to dispose of
if
not
self
.
signalReceiver
():
if
not
self
.
signalReceiver
():
# if there was no available receiver, get into blocking control
# if there was no available receiver, get into blocking control
self
.
expectedSignals
[
'interruptionStart'
]
=
1
self
.
expectedSignals
[
'canDispose'
]
=
1
while
1
:
while
1
:
self
.
expectedSignals
[
'interruptionStart'
]
=
1
self
.
expectedSignals
[
'canDispose'
]
=
1
self
.
timeLastBlockageStarted
=
self
.
env
.
now
# blockage is starting
self
.
timeLastBlockageStarted
=
self
.
env
.
now
# blockage is starting
# wait the event canDispose, this means that the station can deliver the item to successor
# wait the event canDispose, this means that the station can deliver the item to successor
self
.
printTrace
(
self
.
id
,
waitEvent
=
'(canDispose or interruption start)'
)
self
.
printTrace
(
self
.
id
,
waitEvent
=
'(canDispose or interruption start)'
)
...
...
dream/simulation/Queue.py
View file @
9164973f
...
@@ -102,6 +102,9 @@ class Queue(CoreObject):
...
@@ -102,6 +102,9 @@ class Queue(CoreObject):
while
1
:
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
# wait until the Queue can accept an entity and one predecessor requests it
self
.
expectedSignals
[
'canDispose'
]
=
1
self
.
expectedSignals
[
'isRequested'
]
=
1
self
.
expectedSignals
[
'loadOperatorAvailable'
]
=
1
receivedEvent
=
yield
self
.
isRequested
|
self
.
canDispose
|
self
.
loadOperatorAvailable
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 the event that activated the thread is isRequested then getEntity
...
...
dream/simulation/Source.py
View file @
9164973f
...
@@ -140,6 +140,9 @@ class Source(CoreObject):
...
@@ -140,6 +140,9 @@ class Source(CoreObject):
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
while
1
:
while
1
:
# wait for any event (entity creation or request for disposal of entity)
# wait for any event (entity creation or request for disposal of entity)
self
.
expectedSignals
[
'canDispose'
]
=
1
self
.
expectedSignals
[
'entityCreated'
]
=
1
self
.
expectedSignals
[
'loadOperatorAvailable'
]
=
1
receivedEvent
=
yield
self
.
entityCreated
|
self
.
canDispose
|
self
.
loadOperatorAvailable
receivedEvent
=
yield
self
.
entityCreated
|
self
.
canDispose
|
self
.
loadOperatorAvailable
self
.
printTrace
(
self
.
id
,
received
=
''
)
self
.
printTrace
(
self
.
id
,
received
=
''
)
# if an entity is created try to signal the receiver and continue
# if an entity is created try to signal the receiver and continue
...
...
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