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
a43be552
Commit
a43be552
authored
Jul 03, 2014
by
Ioannis Papagiannopoulos
Committed by
Georgios Dagkakis
Sep 01, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
schedulled interruptions approach made more generic
parent
f6cc8c75
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
33 deletions
+26
-33
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+1
-3
dream/simulation/Machine.py
dream/simulation/Machine.py
+12
-23
dream/simulation/ScheduledMaintenance.py
dream/simulation/ScheduledMaintenance.py
+8
-5
dream/simulation/ShiftScheduler.py
dream/simulation/ShiftScheduler.py
+5
-2
No files found.
dream/simulation/CoreObject.py
View file @
a43be552
...
...
@@ -95,9 +95,7 @@ class CoreObject(object):
# ============================== waiting flag ==============================================
self
.
waitToDispose
=
False
#shows if the object waits to dispose an entity
self
.
isWorkingOnTheLastBeforeOffShift
=
False
#shows if the object is performing the last processing before it goes offShift
self
.
isWorkingOnTheLastBeforeMaintenance
=
False
#shows if the object is performing the last processing before maintenance
self
.
isWorkingOnTheLast
=
False
#shows if the object is performing the last processing before scheduled interruption
# ============================== the below are currently used in Jobshop =======================
self
.
giver
=
None
#the CoreObject that the activeObject will take an Entity from
...
...
dream/simulation/Machine.py
View file @
a43be552
...
...
@@ -544,29 +544,18 @@ class Machine(CoreObject):
self
.
completedJobs
+=
1
# Machine completed one more Job
# reseting the shouldPreempt flag
self
.
shouldPreempt
=
False
# in case Machine just performed the last work before end of shift it should signal the ShiftScheduler
if
self
.
isWorkingOnTheLastBeforeOffShift
:
# find the ShiftSchedulerList
mySS
=
None
for
SS
in
G
.
ShiftSchedulerList
:
if
SS
.
victim
==
self
:
mySS
=
SS
break
# set the signal
mySS
.
victimEndedLastProcessing
.
succeed
()
# reset the flag
self
.
isWorkingOnTheLastBeforeOffShift
=
False
# in case Machine just performed the last work before the maintenance it should signal the ShiftScheduler
if
self
.
isWorkingOnTheLastBeforeMaintenance
:
# find the scheduledMaintenanceList
mySM
=
None
for
SM
in
G
.
ScheduledMaintenanceList
:
if
SM
.
victim
==
self
:
mySM
=
SM
# set the signal
mySM
.
victimEndedLastProcessing
.
succeed
(
self
.
env
.
now
)
# reset the flag
self
.
isWorkingOnTheLastBeforeMaintenance
=
False
# in case Machine just performed the last work before the scheduled maintenance signal the corresponding object
if
self
.
isWorkingOnTheLast
:
# for the scheduled Object interruptions
for
interruption
in
(
G
.
ShiftSchedulerList
+
G
.
ScheduledMaintenanceList
):
# if the objectInterruption is waiting for a a signal
if
interruption
.
victim
==
self
and
interruption
.
waitingSignal
:
# signal it and reset the flags
interruption
.
victimEndedLastProcessing
.
succeed
(
self
.
env
.
now
)
interruption
.
waitinSignal
=
False
self
.
isWorkingOnTheLast
=
False
# =======================================================================
# actions to be carried out when the processing of an Entity ends
...
...
dream/simulation/ScheduledMaintenance.py
View file @
a43be552
...
...
@@ -56,8 +56,9 @@ class ScheduledMaintenance(ObjectInterruption):
def
initialize
(
self
):
ObjectInterruption
.
initialize
(
self
)
self
.
victimEndedLastProcessing
=
self
.
env
.
event
()
self
.
waitingSignal
=
False
# not used yet
self
.
victimIsEmpty
=
self
.
env
.
now
self
.
victimIsEmpty
BeforeMaintenance
=
self
.
env
.
event
()
# =======================================================================
# the run method
...
...
@@ -77,7 +78,8 @@ class ScheduledMaintenance(ObjectInterruption):
self
.
interruptVictim
()
# while in process it is interrupted
elif
self
.
endstatus
==
'loaded'
:
waitStartTime
=
self
.
env
.
now
self
.
victim
.
isWorkingOnTheLastBeforeMaintenance
=
True
self
.
victim
.
isWorkingOnTheLast
=
True
self
.
waitingSignal
=
True
# TODO: signal to be triggered by postProcessingActions of Machines
yield
self
.
victimEndedLastProcessing
# there is no signal yet that signals the change of such state (an object getting empty)
assert
self
.
victimEndedLastProcessing
.
value
==
self
.
env
.
now
,
'the processing end signal is not received by maintenance on time'
...
...
@@ -86,10 +88,11 @@ class ScheduledMaintenance(ObjectInterruption):
self
.
interruptVictim
()
elif
self
.
endStatus
==
'emptied'
:
waitStartTime
=
self
.
env
.
now
self
.
waitingSignal
=
True
# TODO: signal to be triggered by removeEntity of Machines
yield
self
.
victimIsEmpty
# there is no signal yet that signals the change of such state (an object getting empty)
assert
self
.
victimIsEmpty
.
value
==
self
.
env
.
now
,
'the processing end signal is not received by maintenance on time'
self
.
victimIsEmpty
=
self
.
env
.
event
()
yield
self
.
victimIsEmpty
BeforeMaintenance
# there is no signal yet that signals the change of such state (an object getting empty)
assert
self
.
victimIsEmpty
BeforeMaintenance
.
value
==
self
.
env
.
now
,
'the processing end signal is not received by maintenance on time'
self
.
victimIsEmpty
BeforeMaintenance
=
self
.
env
.
event
()
waitTime
=
self
.
env
.
now
-
waitStartTime
self
.
victim
.
Up
=
False
self
.
victim
.
timeLastFailure
=
self
.
env
.
now
...
...
dream/simulation/ShiftScheduler.py
View file @
a43be552
...
...
@@ -54,11 +54,13 @@ class ShiftScheduler(ObjectInterruption):
ObjectInterruption
.
initialize
(
self
)
self
.
remainingShiftPattern
=
list
(
self
.
shiftPattern
)
self
.
victimEndedLastProcessing
=
self
.
env
.
event
()
self
.
waitingSignal
=
False
# =======================================================================
# The run method for the failure which has to served by a repairman
# =======================================================================
def
run
(
self
):
def
run
(
self
):
# 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
self
.
victim
.
timeLastShiftEnded
=
self
.
env
.
now
# if in the beginning the victim is offShift set it as such
...
...
@@ -83,7 +85,8 @@ class ShiftScheduler(ObjectInterruption):
# 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
len
(
self
.
victim
.
getActiveObjectQueue
())
==
1
and
(
not
self
.
victim
.
waitToDispose
):
self
.
victim
.
isWorkingOnTheLastBeforeOffShift
=
True
self
.
victim
.
isWorkingOnTheLast
=
True
self
.
waitingSignal
=
True
yield
self
.
victimEndedLastProcessing
self
.
victimEndedLastProcessing
=
self
.
env
.
event
()
...
...
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