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
007e5b7c
Commit
007e5b7c
authored
Nov 25, 2013
by
Ioannis Papagiannopoulos
Committed by
Jérome Perrin
Dec 02, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nomeclature change (repair->operation) to incorporate the use of operators
parent
1d85fc71
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
9 deletions
+16
-9
dream/simulation/Failure.py
dream/simulation/Failure.py
+3
-3
dream/simulation/Machine.py
dream/simulation/Machine.py
+0
-1
dream/simulation/ObjectResource.py
dream/simulation/ObjectResource.py
+9
-2
dream/simulation/Repairman.py
dream/simulation/Repairman.py
+4
-3
No files found.
dream/simulation/Failure.py
View file @
007e5b7c
...
...
@@ -98,8 +98,8 @@ class Failure(ObjectInterruption):
#resource is available
yield
request
,
self
,
self
.
repairman
.
getResource
()
# update the time that the repair started
time
Repair
Started
=
now
()
self
.
repairman
.
timeLast
Repair
Started
=
now
()
time
Operation
Started
=
now
()
self
.
repairman
.
timeLast
Operation
Started
=
now
()
yield
hold
,
self
,
self
.
rngTTR
.
generateNumber
()
# wait until the repairing process is over
self
.
victim
.
totalFailureTime
+=
now
()
-
failTime
...
...
@@ -111,7 +111,7 @@ class Failure(ObjectInterruption):
self
.
outputTrace
(
"is up"
)
if
(
self
.
repairman
!=
"None"
):
#if a resource was used, it is now released
yield
release
,
self
,
self
.
repairman
.
getResource
()
self
.
repairman
.
totalWorkingTime
+=
now
()
-
time
Repair
Started
self
.
repairman
.
totalWorkingTime
+=
now
()
-
time
Operation
Started
except
AttributeError
:
print
"AttributeError2"
...
...
dream/simulation/Machine.py
View file @
007e5b7c
...
...
@@ -279,7 +279,6 @@ class Machine(CoreObject):
# =======================================================================
# checks if the machine down or it can dispose the object
# =======================================================================
#checks if the machine down or it can dispose the object
def
ifCanDisposeOrHaveFailure
(
self
):
return
self
.
Up
==
False
or
self
.
getReceiverObject
().
canAccept
(
self
)
or
len
(
self
.
getActiveObjectQueue
())
==
0
...
...
dream/simulation/ObjectResource.py
View file @
007e5b7c
...
...
@@ -34,7 +34,7 @@ class ObjectResource(object):
def
initialize
(
self
):
self
.
totalWorkingTime
=
0
#holds the total working time
self
.
totalWaitingTime
=
0
#holds the total waiting time
self
.
timeLast
Repair
Started
=
0
#holds the time that the last repair was started
self
.
timeLast
Operation
Started
=
0
#holds the time that the last repair was started
self
.
Res
=
Resource
(
self
.
capacity
)
# =======================================================================
...
...
@@ -89,4 +89,11 @@ class ObjectResource(object):
# returns the active queue of the resource
# =======================================================================
def
getResourceQueue
(
self
):
return
self
.
Res
.
activeQ
\ No newline at end of file
return
self
.
Res
.
activeQ
# =======================================================================
# check availability of the resource
# =======================================================================
def
isResourceFree
(
self
):
if
len
(
self
.
getResourceQueue
())
==
0
:
return
True
\ No newline at end of file
dream/simulation/Repairman.py
View file @
007e5b7c
...
...
@@ -41,7 +41,7 @@ class Repairman(ObjectResource):
self
.
objName
=
name
self
.
capacity
=
capacity
# repairman is an instance of resource
self
.
type
=
"Repairman"
#
self.Res=Resource(self.capacity)
self
.
Res
=
Resource
(
self
.
capacity
)
# lists to hold statistics of multiple runs
self
.
Waiting
=
[]
# holds the percentage of waiting time
self
.
Working
=
[]
# holds the percentage of working time
...
...
@@ -56,8 +56,9 @@ class Repairman(ObjectResource):
from
Globals
import
G
MaxSimtime
=
G
.
maxSimTime
# if the repairman is currently working we have to count the time of this work
if
len
(
self
.
getResourceQueue
())
>
0
:
self
.
totalWorkingTime
+=
now
()
-
self
.
timeLastRepairStarted
# if len(self.getResourceQueue())>0:
if
not
self
.
isResourceFree
():
self
.
totalWorkingTime
+=
now
()
-
self
.
timeLastOperationStarted
# Repairman was idle when he was not in any other state
self
.
totalWaitingTime
=
MaxSimtime
-
self
.
totalWorkingTime
...
...
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