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
a01083db
Commit
a01083db
authored
Aug 13, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Failure time to be counted only if Machine is onShift
parent
ac5526b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
13 deletions
+17
-13
dream/simulation/Failure.py
dream/simulation/Failure.py
+14
-3
dream/simulation/Machine.py
dream/simulation/Machine.py
+3
-9
dream/simulation/ShiftScheduler.py
dream/simulation/ShiftScheduler.py
+0
-1
No files found.
dream/simulation/Failure.py
View file @
a01083db
...
...
@@ -178,9 +178,20 @@ class Failure(ObjectInterruption):
yield
self
.
env
.
timeout
(
self
.
rngTTR
.
generateNumber
())
# wait until the repairing process is over
# add the failure time only if the victim was interrupted by this failure
if
self
.
victim
.
interruptedBy
==
'Failure'
:
self
.
victim
.
totalFailureTime
+=
self
.
env
.
now
-
failTime
# add the failure
# if victim is off shift add only the fail time before the shift ended
if
not
self
.
victim
.
onShift
and
failTime
<
self
.
victim
.
timeLastShiftEnded
:
self
.
victim
.
totalFailureTime
+=
self
.
victim
.
timeLastShiftEnded
-
failTime
# if the victim was off shift since the start of the failure add nothing
elif
not
self
.
victim
.
onShift
and
failTime
>=
self
.
victim
.
timeLastShiftEnded
:
pass
# if victim was off shift in the start of the fail time, add on
elif
self
.
victim
.
onShift
and
failTime
<
self
.
victim
.
timeLastShiftStarted
:
self
.
victim
.
totalFailureTime
+=
self
.
env
.
now
-
self
.
victim
.
timeLastShiftStarted
# this can happen only if deteriorationType is constant
assert
self
.
deteriorationType
==
'constant'
,
'object got failure while off-shift and deterioration type not constant'
else
:
self
.
victim
.
totalFailureTime
+=
self
.
env
.
now
-
failTime
self
.
reactivateVictim
()
# since repairing is over, the Machine is reactivated
self
.
victim
.
Up
=
True
self
.
outputTrace
(
"is up"
)
dream/simulation/Machine.py
View file @
a01083db
...
...
@@ -615,7 +615,7 @@ class Machine(CoreObject):
# set the variable that flags an Entity is ready to be disposed
self
.
waitToDispose
=
True
#do this so that if it is overtime working it is not counted as off-shift time
if
not
self
.
onShift
:
if
not
self
.
onShift
and
self
.
interruptedBy
==
'ShiftScheduler'
:
self
.
timeLastShiftEnded
=
self
.
env
.
now
# update the total working time
# the total processing time for this entity is what the distribution initially gave
...
...
@@ -937,7 +937,7 @@ class Machine(CoreObject):
#calculate the offShift time for current entity
offShiftTimeInCurrentEntity
=
0
if
self
.
interruptedBy
:
if
self
.
onShift
==
False
and
self
.
interruptedBy
==
'ShiftScheduler'
:
if
self
.
onShift
==
False
:
#
and self.interruptedBy=='ShiftScheduler':
offShiftTimeInCurrentEntity
=
self
.
env
.
now
-
activeObject
.
timeLastShiftEnded
# if there is an entity that finished processing in a Machine but did not get to reach
...
...
@@ -988,13 +988,7 @@ class Machine(CoreObject):
#if the machine is off shift,add this to the off-shift time
# we also need to add the last blocking time to total blockage time
if
activeObject
.
onShift
==
False
:
#add the time only if the object is interrupted because of off-shift
if
self
.
interruptedBy
:
if
self
.
interruptedBy
==
'ShiftScheduler'
:
self
.
totalOffShiftTime
+=
self
.
env
.
now
-
self
.
timeLastShiftEnded
elif
len
(
self
.
getActiveObjectQueue
())
==
0
or
self
.
waitToDispose
:
self
.
totalOffShiftTime
+=
self
.
env
.
now
-
self
.
timeLastShiftEnded
# we add the value only if it hasn't already been added
self
.
totalOffShiftTime
+=
self
.
env
.
now
-
self
.
timeLastShiftEnded
if
((
mightBeBlocked
)
and
(
activeObject
.
nameLastEntityEnded
==
activeObject
.
nameLastEntityEntered
)
and
(
not
alreadyAdded
)):
activeObject
.
totalBlockageTime
+=
(
self
.
env
.
now
-
activeObject
.
timeLastEntityEnded
)
-
offShiftTimeInCurrentEntity
...
...
dream/simulation/ShiftScheduler.py
View file @
a01083db
...
...
@@ -74,7 +74,6 @@ class ShiftScheduler(ObjectInterruption):
if
not
self
.
victim
.
onShift
:
yield
self
.
env
.
timeout
(
float
(
self
.
remainingShiftPattern
[
0
][
0
]
-
self
.
env
.
now
))
# wait for the onShift
self
.
reactivateVictim
()
# re-activate the victim in case it was interrupted
self
.
victim
.
totalOffShiftTime
+=
self
.
env
.
now
-
self
.
victim
.
timeLastShiftEnded
self
.
victim
.
onShift
=
True
self
.
victim
.
timeLastShiftStarted
=
self
.
env
.
now
...
...
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