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
91b8bce2
Commit
91b8bce2
authored
May 29, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
signal preemptQueue added to handle preemption
parent
62074e93
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
dream/simulation/Machine.py
dream/simulation/Machine.py
+9
-4
dream/simulation/MachineJobShop.py
dream/simulation/MachineJobShop.py
+2
-1
No files found.
dream/simulation/Machine.py
View file @
91b8bce2
...
...
@@ -151,14 +151,14 @@ class Machine(CoreObject):
self
.
isPreemptive
=
isPreemptive
self
.
resetOnPreemption
=
resetOnPreemption
# events used by the broker
# self.brokerIsSet=SimEvent('brokerIsSet')
self
.
brokerIsSet
=
self
.
env
.
event
()
# this event is generated every time an operator is requested by machine for Load operation type.
# if the machine has not succeeded in getting an entity due to the resource absence
# and waits for the next event to get the entity,
# then it must be signalled that the operator is now available
# self.loadOperatorAvailable=SimEvent('loadOperatorAvailable')
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
# signal used for preemption
self
.
preemptQueue
=
self
.
env
.
event
()
# flag notifying that there is operator assigned to the actievObject
self
.
assignedOperator
=
True
...
...
@@ -222,6 +222,8 @@ class Machine(CoreObject):
# and waits for the next event to get the entity,
# then it must be signalled that the operator is now available
self
.
loadOperatorAvailable
=
self
.
env
.
event
()
# signal used for preemption
self
.
preemptQueue
=
self
.
env
.
event
()
# =======================================================================
# the main process of the machine
...
...
@@ -388,7 +390,7 @@ class Machine(CoreObject):
# else (if interrupted()) set interruption flag to true (only if tinM==0),
# and recalculate the processing time left tinM, passivate while waiting for repair.
# if a preemption has occurred then react accordingly (proceed with getting the critical entity)
receivedEvent
=
yield
self
.
env
.
timeout
(
self
.
tinM
)
|
self
.
interruptionStart
# getting processed for remaining processing time tinM
receivedEvent
=
yield
self
.
env
.
timeout
(
self
.
tinM
)
|
self
.
interruptionStart
|
self
.
preemptQueue
# getting processed for remaining processing time tinM
if
self
.
interruptionStart
in
receivedEvent
:
# if a failure occurs while processing the machine is interrupted.
assert
self
.
interruptionStart
.
value
==
self
.
env
.
now
,
'the interruption has not been processed on the time of activation'
self
.
interruptionStart
=
self
.
env
.
event
()
...
...
@@ -422,8 +424,11 @@ class Machine(CoreObject):
self
.
operatorWaitTimeCurrentEntity
+=
self
.
timeWaitForOperatorEnded
-
self
.
timeWaitForOperatorStarted
# if the station is reactivated by the preempt method
elif
(
self
.
shouldPreempt
):
if
(
self
.
preemptQueue
in
receivedEvent
):
assert
self
.
preemptQueue
.
value
==
self
.
env
.
now
,
'the preemption must be performed on the time of request'
self
.
preemptQueue
=
self
.
env
.
event
()
self
.
interruptionActions
()
# execute interruption actions
# =============== release the operator if there is interruption
if
(
self
.
operatorPool
!=
"None"
)
\
and
self
.
isOperated
()
\
...
...
dream/simulation/MachineJobShop.py
View file @
91b8bce2
...
...
@@ -247,7 +247,8 @@ class MachineJobShop(Machine):
self
.
waitToDispose
=
True
#set that I have to dispose
self
.
receiver
.
timeLastEntityEnded
=
self
.
env
.
now
#required to count blockage correctly in the preemptied station
# TODO: use a signal and wait for it, reactivation is not recognised as interruption
reactivate
(
self
)
# reactivate(self)
self
.
preemptQueue
.
succeed
(
self
.
env
.
now
)
# TODO: consider the case when a failure has the Station down. The event preempt will not be received now()
# but at a later simulation time.
...
...
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