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
da936b96
Commit
da936b96
authored
Aug 12, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comments added
parent
d0a0926c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
dream/simulation/Failure.py
dream/simulation/Failure.py
+6
-0
dream/simulation/Machine.py
dream/simulation/Machine.py
+5
-1
No files found.
dream/simulation/Failure.py
View file @
da936b96
...
...
@@ -106,8 +106,10 @@ class Failure(ObjectInterruption):
remainingTimeToFailure
=
timeToFailure
failureNotTriggered
=
True
# if time to failure counts not matter the state of the victim
if
self
.
deteriorationType
==
'constant'
:
yield
self
.
env
.
timeout
(
remainingTimeToFailure
)
# if time to failure counts only in onShift time
elif
self
.
deteriorationType
==
'onShift'
:
while
failureNotTriggered
:
timeRestartedCounting
=
self
.
env
.
now
...
...
@@ -125,16 +127,20 @@ 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
else
:
failureNotTriggered
=
False
# if time to failure counts only in working time
elif
self
.
deteriorationType
==
'working'
:
# wait for victim to start process
yield
self
.
victimStartsProcess
self
.
victimStartsProcess
=
self
.
env
.
event
()
while
failureNotTriggered
:
timeRestartedCounting
=
self
.
env
.
now
# wait either for the failure or end of process
receivedEvent
=
yield
self
.
env
.
timeout
(
remainingTimeToFailure
)
|
self
.
victimEndsProcess
if
self
.
victimEndsProcess
in
receivedEvent
:
self
.
victimEndsProcess
=
self
.
env
.
event
()
remainingTimeToFailure
=
remainingTimeToFailure
-
(
self
.
env
.
now
-
timeRestartedCounting
)
yield
self
.
victimStartsProcess
# wait for victim to start again processing
self
.
victimStartsProcess
=
self
.
env
.
event
()
else
:
failureNotTriggered
=
False
...
...
dream/simulation/Machine.py
View file @
da936b96
...
...
@@ -450,7 +450,9 @@ class Machine(CoreObject):
# timers to follow up the failure time of the machine while on current Entity
self
.
downTimeInCurrentEntity
=
0
#holds the total time that the
#object was down while holding current entity
# if there is a failure that depends on the working time of the Machine
# send it the victimStartsProcess signal
for
oi
in
self
.
objectInterruptions
:
if
oi
.
type
==
'Failure'
:
if
oi
.
deteriorationType
==
'working'
:
...
...
@@ -630,6 +632,8 @@ class Machine(CoreObject):
self
.
shouldPreempt
=
False
self
.
isProcessingInitialWIP
=
False
# if there is a failure that depends on the working time of the Machine
# send it the victimEndsProcess signal
for
oi
in
self
.
objectInterruptions
:
if
oi
.
type
==
'Failure'
:
if
oi
.
deteriorationType
==
'working'
:
...
...
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