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
edb0a270
Commit
edb0a270
authored
Aug 12, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correction in failure and synchronization
parent
3a882e9d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
25 deletions
+30
-25
dream/simulation/Failure.py
dream/simulation/Failure.py
+25
-24
dream/simulation/Machine.py
dream/simulation/Machine.py
+5
-1
No files found.
dream/simulation/Failure.py
View file @
edb0a270
...
...
@@ -90,9 +90,9 @@ class Failure(ObjectInterruption):
def
run
(
self
):
while
1
:
# if the time that the victim is off-shift should not be counted
if
self
.
offshift
:
timeToFailure
=
self
.
rngTTF
.
generateNumber
()
remainingTimeToFailure
=
timeToFailure
self
.
victim
.
expectedDownTime
=
self
.
env
.
now
+
remainingTimeToFailure
failureNotTriggered
=
True
while
failureNotTriggered
:
...
...
@@ -104,14 +104,15 @@ 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
assert
self
.
victim
.
onShift
==
False
,
'shiftFailure cannot recalculate TTF if the victim is onShift'
remainingTimeToFailure
=
remainingTimeToFailure
-
(
self
.
env
.
now
-
timeRestartedCounting
)
self
.
victim
.
expectedDownTime
=
self
.
env
.
now
+
remainingTimeToFailure
# wait for the shift to start again
yield
self
.
victim
.
interruptionEnd
assert
self
.
victim
.
onShift
==
True
,
'the victim of shiftFailure must be onShift to continue counting the TTF'
# 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
else
:
yield
self
.
env
.
timeout
(
self
.
rngTTF
.
generateNumber
())
# wait until a failure happens
self
.
interruptVictim
()
# interrupt the victim
self
.
victim
.
Up
=
False
self
.
victim
.
timeLastFailure
=
self
.
env
.
now
...
...
dream/simulation/Machine.py
View file @
edb0a270
...
...
@@ -189,6 +189,7 @@ class Machine(CoreObject):
self
.
preemptQueue
=
self
.
env
.
event
()
# signal used for informing objectInterruption objects that the current entity processed has finished processnig
self
.
endedLastProcessing
=
self
.
env
.
event
()
self
.
expectedDownTime
=-
1
# the time the next failure is expected
#===========================================================================
# create an operatorPool if needed
...
...
@@ -692,7 +693,10 @@ class Machine(CoreObject):
# checks if the machine is Up
# =======================================================================
def
checkIfMachineIsUp
(
self
):
return
self
.
Up
# the second part is added for synchronisation.
# 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
...
...
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