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
847d1adf
Commit
847d1adf
authored
Aug 12, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first version of failure that depends only on working time
parent
e0cebfb4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
8 deletions
+38
-8
dream/simulation/Failure.py
dream/simulation/Failure.py
+25
-3
dream/simulation/Machine.py
dream/simulation/Machine.py
+13
-5
No files found.
dream/simulation/Failure.py
View file @
847d1adf
...
@@ -59,7 +59,7 @@ class Failure(ObjectInterruption):
...
@@ -59,7 +59,7 @@ class Failure(ObjectInterruption):
# 'onShift' counts only if the victim is onShift
# 'onShift' counts only if the victim is onShift
# 'working' counts only working time
# 'working' counts only working time
self
.
deteriorationType
=
deteriorationType
self
.
deteriorationType
=
deteriorationType
if
(
self
.
distType
==
"Availability"
):
if
(
self
.
distType
==
"Availability"
):
# --------------------------------------------------------------
# --------------------------------------------------------------
...
@@ -91,6 +91,11 @@ class Failure(ObjectInterruption):
...
@@ -91,6 +91,11 @@ class Failure(ObjectInterruption):
# flag used to identify if the time between failures should be counted while the victim is off-shift
# flag used to identify if the time between failures should be counted while the victim is off-shift
self
.
offshift
=
offshift
self
.
offshift
=
offshift
def
initialize
(
self
):
ObjectInterruption
.
initialize
(
self
)
self
.
victimStartsProcess
=
self
.
env
.
event
()
self
.
victimEndsProcess
=
self
.
env
.
event
()
# =======================================================================
# =======================================================================
# The run method for the failure which has to served by a repairman
# The run method for the failure which has to served by a repairman
# =======================================================================
# =======================================================================
...
@@ -104,7 +109,7 @@ class Failure(ObjectInterruption):
...
@@ -104,7 +109,7 @@ class Failure(ObjectInterruption):
if
self
.
deteriorationType
==
'constant'
:
if
self
.
deteriorationType
==
'constant'
:
yield
self
.
env
.
timeout
(
remainingTimeToFailure
)
yield
self
.
env
.
timeout
(
remainingTimeToFailure
)
el
se
:
el
if
self
.
deteriorationType
==
'onShift'
:
while
failureNotTriggered
:
while
failureNotTriggered
:
timeRestartedCounting
=
self
.
env
.
now
timeRestartedCounting
=
self
.
env
.
now
# TODO: can also wait for interruptionStart signal of the victim and check whether the interruption is caused by a shiftScheduler
# TODO: can also wait for interruptionStart signal of the victim and check whether the interruption is caused by a shiftScheduler
...
@@ -122,7 +127,24 @@ class Failure(ObjectInterruption):
...
@@ -122,7 +127,24 @@ class Failure(ObjectInterruption):
# TODO: the signal interruptionStart is reset by the time it is received by the victim. not sure if will be still triggered when it is checked here
# TODO: the signal interruptionStart is reset by the time it is received by the victim. not sure if will be still triggered when it is checked here
else
:
else
:
failureNotTriggered
=
False
failureNotTriggered
=
False
elif
self
.
deteriorationType
==
'working'
:
yield
self
.
victimStartsProcess
self
.
victimStartsProcess
=
self
.
env
.
event
()
while
failureNotTriggered
:
timeRestartedCounting
=
self
.
env
.
now
receivedEvent
=
yield
self
.
env
.
timeout
(
remainingTimeToFailure
)
|
self
.
victimEndsProcess
if
self
.
victimEndsProcess
in
receivedEvent
:
#print self.env.now, 'victimEndsProcess'
self
.
victimEndsProcess
=
self
.
env
.
event
()
remainingTimeToFailure
=
remainingTimeToFailure
-
(
self
.
env
.
now
-
timeRestartedCounting
)
self
.
victim
.
expectedDownTime
=
self
.
env
.
now
+
remainingTimeToFailure
yield
self
.
victimStartsProcess
self
.
victimStartsProcess
=
self
.
env
.
event
()
#print self.env.now, 'startsProcess'
else
:
failureNotTriggered
=
False
# interrupt the victim only if it was not previously interrupted
# interrupt the victim only if it was not previously interrupted
if
not
self
.
victim
.
interruptionStart
.
triggered
:
if
not
self
.
victim
.
interruptionStart
.
triggered
:
self
.
interruptVictim
()
# interrupt the victim
self
.
interruptVictim
()
# interrupt the victim
...
...
dream/simulation/Machine.py
View file @
847d1adf
...
@@ -451,6 +451,12 @@ class Machine(CoreObject):
...
@@ -451,6 +451,12 @@ class Machine(CoreObject):
# timers to follow up the failure time of the machine while on current Entity
# timers to follow up the failure time of the machine while on current Entity
self
.
downTimeInCurrentEntity
=
0
#holds the total time that the
self
.
downTimeInCurrentEntity
=
0
#holds the total time that the
#object was down while holding current entity
#object was down while holding current entity
for
oi
in
self
.
objectInterruptions
:
if
oi
.
type
==
'Failure'
:
if
oi
.
deteriorationType
==
'working'
:
oi
.
victimStartsProcess
.
succeed
(
self
.
env
.
now
)
# this loop is repeated until the processing time is expired with no failure
# this loop is repeated until the processing time is expired with no failure
# check when the processingEndedFlag switched to false
# check when the processingEndedFlag switched to false
while
processingNotFinished
:
while
processingNotFinished
:
...
@@ -624,7 +630,12 @@ class Machine(CoreObject):
...
@@ -624,7 +630,12 @@ class Machine(CoreObject):
# reseting flags
# reseting flags
self
.
shouldPreempt
=
False
self
.
shouldPreempt
=
False
self
.
isProcessingInitialWIP
=
False
self
.
isProcessingInitialWIP
=
False
for
oi
in
self
.
objectInterruptions
:
if
oi
.
type
==
'Failure'
:
if
oi
.
deteriorationType
==
'working'
:
oi
.
victimEndsProcess
.
succeed
(
self
.
env
.
now
)
# in case Machine just performed the last work before the scheduled maintenance signal the corresponding object
# in case Machine just performed the last work before the scheduled maintenance signal the corresponding object
if
self
.
isWorkingOnTheLast
:
if
self
.
isWorkingOnTheLast
:
# for the scheduled Object interruptions
# for the scheduled Object interruptions
...
@@ -693,10 +704,7 @@ class Machine(CoreObject):
...
@@ -693,10 +704,7 @@ class Machine(CoreObject):
# checks if the machine is Up
# checks if the machine is Up
# =======================================================================
# =======================================================================
def
checkIfMachineIsUp
(
self
):
def
checkIfMachineIsUp
(
self
):
# the second part is added for synchronisation.
return
self
.
Up
# if Machine is to get failure at the current time but did not get it yet
# return also false
return
self
.
Up
and
not
self
.
expectedDownTime
==
self
.
env
.
now
# =======================================================================
# =======================================================================
# checks if the Machine can accept an entity
# checks if the Machine can accept an entity
...
...
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