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
9aaeb36f
Commit
9aaeb36f
authored
Jul 03, 2014
by
Ioannis Papagiannopoulos
Committed by
Georgios Dagkakis
Sep 01, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ScheduledMaintenance updated, now checks if the machine has to be emptied before the maintenance
parent
e5e68f85
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
4 deletions
+55
-4
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+2
-0
dream/simulation/Machine.py
dream/simulation/Machine.py
+11
-0
dream/simulation/ScheduledMaintenance.py
dream/simulation/ScheduledMaintenance.py
+42
-4
No files found.
dream/simulation/CoreObject.py
View file @
9aaeb36f
...
...
@@ -96,6 +96,8 @@ class CoreObject(object):
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
# ============================== 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 @
9aaeb36f
...
...
@@ -556,6 +556,17 @@ class Machine(CoreObject):
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
# =======================================================================
# actions to be carried out when the processing of an Entity ends
...
...
dream/simulation/ScheduledMaintenance.py
View file @
9aaeb36f
...
...
@@ -38,10 +38,26 @@ class ScheduledMaintenance(ObjectInterruption):
# =======================================================================
# the __init__() method of the class
# =======================================================================
def
__init__
(
self
,
victim
=
None
,
start
=
0
,
duration
=
1
):
def
__init__
(
self
,
victim
=
None
,
start
=
0
,
duration
=
1
,
endStatus
=
'interrupt'
):
'''
interrupted : the maintenance starts immediately
loaded : the maintenance starts as soon as the victim has ended processing
emptied : the maintenance starts as soon as the victim is empty
'''
ObjectInterruption
.
__init__
(
self
,
victim
)
self
.
start
=
start
self
.
duration
=
duration
# the victim can be 'interrupted', 'loaded' or 'emptied' when the maintenance interruption happens
self
.
endStatus
=
endStatus
# =======================================================================
# initialize for every replications
# =======================================================================
def
initialize
(
self
):
ObjectInterruption
.
initialize
(
self
)
self
.
victimEndedLastProcessing
=
self
.
env
.
event
()
# not used yet
self
.
victimIsEmpty
=
self
.
env
.
now
# =======================================================================
# the run method
...
...
@@ -51,8 +67,30 @@ class ScheduledMaintenance(ObjectInterruption):
def
run
(
self
):
yield
self
.
env
.
timeout
(
self
.
start
)
#wait until the start time
try
:
# if the station is occupied then it should not be interrupted but the maintenance must wait until the station is clear,
# the maintenance should be performed then (the victim is not interrupted)
waitTime
=
0
# TODO: should be implemented by signals or else there is no way to control when to stop the maintenance
if
(
len
(
self
.
getVictimQueue
())
>
0
):
# when a Machine gets failure
self
.
interruptVictim
()
# while in process it is interrupted
# TODO: boolean flags canInterruptProc, canInterruptBlock to be used when the desired behaviour is required
if
self
.
endStatus
==
'interrupted'
:
self
.
interruptVictim
()
# while in process it is interrupted
elif
self
.
endstatus
==
'loaded'
:
waitStartTime
=
self
.
env
.
now
self
.
victim
.
isWorkingOnTheLastBeforeMaintenance
=
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'
self
.
victimEndedLastProcessing
=
self
.
env
.
event
()
waitTime
=
self
.
env
.
now
-
waitStartTime
self
.
interruptVictim
()
elif
self
.
endStatus
==
'emptied'
:
waitStartTime
=
self
.
env
.
now
# 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
()
waitTime
=
self
.
env
.
now
-
waitStartTime
self
.
victim
.
Up
=
False
self
.
victim
.
timeLastFailure
=
self
.
env
.
now
self
.
outputTrace
(
"is down"
)
...
...
@@ -60,10 +98,10 @@ class ScheduledMaintenance(ObjectInterruption):
print
"AttributeError1"
yield
self
.
env
.
timeout
(
self
.
duration
)
# wait for the defined duration of the interruption
self
.
victim
.
totalFailureTime
+=
self
.
duration
self
.
victim
.
totalFailureTime
+=
self
.
duration
-
waitTime
try
:
if
(
len
(
self
.
getVictimQueue
())
>
0
):
if
(
len
(
self
.
getVictimQueue
())
>
0
):
self
.
reactivateVictim
()
# since the maintenance is over, the victim is reactivated
self
.
victim
.
Up
=
True
self
.
outputTrace
(
"is up"
)
...
...
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