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
7ef38f88
Commit
7ef38f88
authored
Dec 12, 2013
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
__init__ method added to ObjectResource. isInitialized() method is also added
parent
199bc41b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
4 deletions
+19
-4
dream/simulation/ObjectResource.py
dream/simulation/ObjectResource.py
+12
-1
dream/simulation/OperatorPool.py
dream/simulation/OperatorPool.py
+4
-1
dream/simulation/Repairman.py
dream/simulation/Repairman.py
+3
-2
No files found.
dream/simulation/ObjectResource.py
View file @
7ef38f88
...
...
@@ -31,11 +31,16 @@ from SimPy.Simulation import Resource
# ===========================================================================
class
ObjectResource
(
object
):
def
__init__
(
self
):
self
.
initialized
=
False
def
initialize
(
self
):
self
.
totalWorkingTime
=
0
#holds the total working time
self
.
totalWaitingTime
=
0
#holds the total waiting time
self
.
timeLastOperationStarted
=
0
#holds the time that the last repair was started
self
.
Res
=
Resource
(
self
.
capacity
)
self
.
Res
=
Resource
(
self
.
capacity
)
# variable that checks weather the resource is already initialized
self
.
initialized
=
True
# =======================================================================
# checks if the worker is available
...
...
@@ -91,3 +96,9 @@ class ObjectResource(object):
def
getResourceQueue
(
self
):
return
self
.
Res
.
activeQ
# =======================================================================
# check if the resource is already initialized
# =======================================================================
def
isInitialized
(
self
):
return
self
.
initialized
dream/simulation/OperatorPool.py
View file @
7ef38f88
...
...
@@ -80,8 +80,11 @@ class OperatorPool(ObjectResource):
# self.timeLastOperationStarted=0 #holds the time that the last operation was started
# initialize the operators
# an operator that may have been initialized by an other operator pool, is initiated again
# reconsider
for
operator
in
self
.
operators
:
operator
.
initialize
()
if
not
operator
.
isInitialized
():
operator
.
initialize
()
# =======================================================================
# checks if there are operators available
...
...
dream/simulation/Repairman.py
View file @
7ef38f88
...
...
@@ -36,7 +36,8 @@ from ObjectResource import ObjectResource
# ===========================================================================
class
Repairman
(
ObjectResource
):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
):
ObjectResource
.
__init__
(
self
)
self
.
id
=
id
self
.
objName
=
name
self
.
capacity
=
capacity
# repairman is an instance of resource
...
...
@@ -49,7 +50,7 @@ class Repairman(ObjectResource):
self
.
coreObjectIds
=
[]
# list with the coreObjects that the repairman repairs
self
.
coreObjects
=
[]
# =======================================================================
# actions to be taken after the simulation ends
# =======================================================================
...
...
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