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
33e35bb9
Commit
33e35bb9
authored
Aug 15, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Operator to be able to release current work in the end of shift
parent
4445678b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
4 deletions
+41
-4
dream/simulation/Machine.py
dream/simulation/Machine.py
+27
-1
dream/simulation/ShiftScheduler.py
dream/simulation/ShiftScheduler.py
+14
-3
No files found.
dream/simulation/Machine.py
View file @
33e35bb9
...
...
@@ -213,6 +213,11 @@ class Machine(CoreObject):
loadTime
[
'max'
]
=
float
(
loadTime
[
'mean'
])
+
5
*
float
(
loadTime
[
'stdev'
])
return
loadTime
# events about the availability of process operator
# TODO group those operator relate events
self
.
processOperatorAvailable
=
self
.
env
.
event
()
self
.
processOperatorUnavailable
=
self
.
env
.
event
()
#===========================================================================
# create an operatorPool if needed
...
...
@@ -611,7 +616,8 @@ class Machine(CoreObject):
# 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 | self.preemptQueue
receivedEvent
=
yield
self
.
env
.
any_of
([
self
.
interruptionStart
,
self
.
env
.
timeout
(
self
.
tinM
)
,
self
.
preemptQueue
])
receivedEvent
=
yield
self
.
env
.
any_of
([
self
.
interruptionStart
,
self
.
env
.
timeout
(
self
.
tinM
)
,
self
.
preemptQueue
,
self
.
processOperatorUnavailable
])
if
self
.
interruptionStart
in
receivedEvent
:
# if a failure occurs while processing the machine is interrupted.
transmitter
,
eventTime
=
self
.
interruptionStart
.
value
assert
eventTime
==
self
.
env
.
now
,
'the interruption has not been processed on the time of activation'
...
...
@@ -671,6 +677,26 @@ class Machine(CoreObject):
self
.
brokerIsSet
=
self
.
env
.
event
()
self
.
timeWaitForOperatorEnded
=
self
.
env
.
now
self
.
operatorWaitTimeCurrentEntity
+=
self
.
timeWaitForOperatorEnded
-
self
.
timeWaitForOperatorStarted
# if the processing operator left
elif
self
.
processOperatorUnavailable
in
receivedEvent
:
assert
self
.
env
.
now
==
self
.
processOperatorUnavailable
.
value
,
'the operator leaving has not been processed at
\
the time it should'
self
.
processOperatorUnavailable
=
self
.
env
.
event
()
# machine has to release the operator
self
.
releaseOperator
()
# request for allocation
self
.
requestAllocation
()
# wait until the Broker has finished processing
yield
self
.
brokerIsSet
self
.
brokerIsSet
=
self
.
env
.
event
()
# carry interruption actions
self
.
interruptionActions
()
# wait until there is available processing operator (to be sent by Router)
yield
self
.
processOperatorAvailable
# interruptionEnd to be triggered by ObjectInterruption
assert
self
.
env
.
now
==
self
.
processOperatorAvailable
.
value
,
'the operator available has not been received in time'
self
.
processOperatorAvailable
=
self
.
env
.
event
()
# carry post interruption actions
self
.
postInterruptionActions
()
# if the station is reactivated by the preempt method
elif
(
self
.
shouldPreempt
):
if
(
self
.
preemptQueue
in
receivedEvent
):
...
...
dream/simulation/ShiftScheduler.py
View file @
33e35bb9
...
...
@@ -61,7 +61,7 @@ class ShiftScheduler(ObjectInterruption):
# =======================================================================
def
run
(
self
):
from
CoreObject
import
CoreObject
from
Object
Interruption
import
ObjectInterruption
from
Object
Resource
import
ObjectResource
# the victim should not be interrupted but the scheduler should wait for the processing to finish before the stations turns to off-shift mode
self
.
victim
.
totalOffShiftTime
=
0
...
...
@@ -109,9 +109,11 @@ class ShiftScheduler(ObjectInterruption):
self
.
victim
.
isLocked
=
True
# lock the entry of the victim
yield
self
.
env
.
timeout
(
self
.
receiveBeforeEndThreshold
)
# wait until the shift is over
self
.
victim
.
isLocked
=
False
# unlock the entry of the victim
# if the mode is to end current work before going off-shift and there is current work, wait for victimEndedLastProcessing
# signal before going off-shift
# if the victim is station
if
issubclass
(
self
.
victim
.
__class__
,
CoreObject
):
# if the mode is to end current work before going off-shift and there is current work,
# wait for victimEndedLastProcessing
# signal before going off-shift
if
self
.
endUnfinished
and
self
.
victim
.
isProcessing
:
self
.
victim
.
isWorkingOnTheLast
=
True
self
.
waitingSignal
=
True
...
...
@@ -124,6 +126,15 @@ class ShiftScheduler(ObjectInterruption):
transmitter
,
eventTime
=
self
.
victim
.
endedLastProcessing
.
value
self
.
victim
.
endedLastProcessing
=
self
.
env
.
event
()
# if the victim is operator
elif
issubclass
(
self
.
victim
.
__class__
,
ObjectResource
):
# if the operator is working in a station and the mode is
# to stop current work in the end of shift
# signal to the station that the operator has to leave
station
=
self
.
victim
.
workingStation
if
station
:
if
not
self
.
endUnfinished
and
station
.
isProcessing
:
station
.
processOperatorUnavailable
.
succeed
(
self
.
env
.
now
)
# if the victim has interruptions that measure only the on-shift time, they have to be notified
for
oi
in
self
.
victim
.
objectInterruptions
:
...
...
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