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
33d8a5a6
Commit
33d8a5a6
authored
Dec 09, 2013
by
Ioannis Papagiannopoulos
Committed by
Sebastien Robin
Dec 11, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
__init__ method for CoreObject created
parent
4146eca1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
28 deletions
+46
-28
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+15
-1
dream/simulation/Exit.py
dream/simulation/Exit.py
+5
-4
dream/simulation/Machine.py
dream/simulation/Machine.py
+12
-11
dream/simulation/Queue.py
dream/simulation/Queue.py
+7
-6
dream/simulation/Source.py
dream/simulation/Source.py
+7
-6
No files found.
dream/simulation/CoreObject.py
View file @
33d8a5a6
...
...
@@ -30,8 +30,17 @@ from SimPy.Simulation import Process, Resource, now
# =================================== the core object ==============================================
class
CoreObject
(
Process
):
def
initialize
(
self
):
def
__init__
(
self
):
Process
.
__init__
(
self
)
# lists that hold the previous and next objects in the flow
self
.
next
=
[]
#list with the next objects in the flow
self
.
previous
=
[]
#list with the previous objects in the flow
self
.
nextIds
=
[]
#list with the ids of the next objects in the flow
self
.
previousIds
=
[]
#list with the ids of the previous objects in the flow
def
initialize
(
self
):
# Process.__init__(self)
self
.
predecessorIndex
=
0
#holds the index of the predecessor from which the Machine will take an entity next
self
.
successorIndex
=
0
#holds the index of the successor where the Machine will dispose an entity next
self
.
Up
=
True
#Boolean that shows if the machine is in failure ("Down") or not ("up")
...
...
@@ -70,6 +79,11 @@ class CoreObject(Process):
# when the entities have to be loaded to operatedMachines
# then the giverObjects have to be blocked for the time
# that the machine is being loaded
# ============================== lists to hold statistics of multiple runs =====================
self
.
Failure
=
[]
self
.
Working
=
[]
self
.
Blockage
=
[]
self
.
Waiting
=
[]
# ======================== the main process of the core object =================================
# ================ this is dummy, every object must have its own implementation ================
...
...
dream/simulation/Exit.py
View file @
33d8a5a6
...
...
@@ -35,16 +35,17 @@ from CoreObject import CoreObject
class
Exit
(
CoreObject
):
def
__init__
(
self
,
id
,
name
):
CoreObject
.
__init__
(
self
)
Process
.
__init__
(
self
)
self
.
predecessorIndex
=
0
# holds the index of the predecessor from which the Exit will take an entity next
# general properties of the Exit
self
.
id
=
id
self
.
objName
=
name
self
.
type
=
"Exit"
# list with routing information
self
.
previous
=
[]
# list with the previous objects in the flow
self
.
nextIds
=
[]
# list with the ids of the next objects in the flow. For the exit it is always empty!
self
.
previousIds
=
[]
# list with the ids of the previous objects in the flow
#
# list with routing information
#
self.previous=[] # list with the previous objects in the flow
#
self.nextIds=[] # list with the ids of the next objects in the flow. For the exit it is always empty!
#
self.previousIds=[] # list with the ids of the previous objects in the flow
#lists to hold statistics of multiple runs
self
.
Exits
=
[]
...
...
dream/simulation/Machine.py
View file @
33d8a5a6
...
...
@@ -42,7 +42,8 @@ class Machine(CoreObject):
#initialize the id the capacity, of the resource and the distribution
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
distribution
=
'Fixed'
,
mean
=
1
,
stdev
=
0
,
min
=
0
,
max
=
10
,
\
failureDistribution
=
'No'
,
MTTF
=
0
,
MTTR
=
0
,
availability
=
0
,
repairman
=
'None'
):
Process
.
__init__
(
self
)
# Process.__init__(self)
CoreObject
.
__init__
(
self
)
# used for the routing of the entities
self
.
predecessorIndex
=
0
#holds the index of the predecessor from which the Machine will take an entity next
self
.
successorIndex
=
0
#holds the index of the successor where the Machine will dispose an entity next
...
...
@@ -66,16 +67,16 @@ class Machine(CoreObject):
self
.
MTTF
=
MTTF
self
.
MTTR
=
MTTR
self
.
availability
=
availability
# lists that hold the previous and next objects in the flow
self
.
next
=
[]
#list with the next objects in the flow
self
.
previous
=
[]
#list with the previous objects in the flow
self
.
nextIds
=
[]
#list with the ids of the next objects in the flow
self
.
previousIds
=
[]
#list with the ids of the previous objects in the flow
# lists to hold statistics of multiple runs
self
.
Failure
=
[]
self
.
Working
=
[]
self
.
Blockage
=
[]
self
.
Waiting
=
[]
#
# lists that hold the previous and next objects in the flow
#
self.next=[] #list with the next objects in the flow
#
self.previous=[] #list with the previous objects in the flow
#
self.nextIds=[] #list with the ids of the next objects in the flow
#
self.previousIds=[] #list with the ids of the previous objects in the flow
#
# lists to hold statistics of multiple runs
#
self.Failure=[]
#
self.Working=[]
#
self.Blockage=[]
#
self.Waiting=[]
# =======================================================================
# initialize the Machine object
...
...
dream/simulation/Queue.py
View file @
33d8a5a6
...
...
@@ -35,7 +35,8 @@ from CoreObject import CoreObject
class
Queue
(
CoreObject
):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
dummy
=
False
,
schedulingRule
=
"FIFO"
):
Process
.
__init__
(
self
)
CoreObject
.
__init__
(
self
)
# Process.__init__(self)
# used for the routing of the entities
self
.
predecessorIndex
=
0
# holds the index of the predecessor from which the Queue will take an entity next
self
.
successorIndex
=
0
# holds the index of the successor where the Queue will dispose an entity next
...
...
@@ -54,11 +55,11 @@ class Queue(CoreObject):
# No failures are considered for the Queue
# lists that hold the previous and next objects in the flow
self
.
next
=
[]
#list with the next objects in the flow
self
.
previous
=
[]
#list with the previous objects in the flow
self
.
nextIds
=
[]
#list with the ids of the next objects in the flow
self
.
previousIds
=
[]
#list with the ids of the previous objects in the flow
#
# lists that hold the previous and next objects in the flow
#
self.next=[] #list with the next objects in the flow
#
self.previous=[] #list with the previous objects in the flow
#
self.nextIds=[] #list with the ids of the next objects in the flow
#
self.previousIds=[] #list with the ids of the previous objects in the flow
self
.
isDummy
=
dummy
#Boolean that shows if it is the dummy first Queue
self
.
schedulingRule
=
schedulingRule
#the scheduling rule that the Queue follows
...
...
dream/simulation/Source.py
View file @
33d8a5a6
...
...
@@ -36,7 +36,8 @@ from Globals import G
#============================================================================
class
Source
(
CoreObject
):
def
__init__
(
self
,
id
,
name
,
distribution
=
'Fixed'
,
mean
=
1
,
item
=
Part
):
Process
.
__init__
(
self
)
CoreObject
.
__init__
(
self
)
# Process.__init__(self)
# general properties
self
.
id
=
id
self
.
objName
=
name
...
...
@@ -44,11 +45,11 @@ class Source(CoreObject):
# properties used for statistics
self
.
totalInterArrivalTime
=
0
# the total interarrival time
self
.
numberOfArrivals
=
0
# the number of entities that were created
# list containing objects that follow in the routing
self
.
next
=
[]
# list with the next objects in the flow
self
.
nextIds
=
[]
# list with the ids of the next objects in the flow
self
.
previousIds
=
[]
# list with the ids of the previous objects in the flow.
# For the source it is always empty!
#
# list containing objects that follow in the routing
#
self.next=[] # list with the next objects in the flow
#
self.nextIds=[] # list with the ids of the next objects in the flow
#
self.previousIds=[] # list with the ids of the previous objects in the flow.
#
# For the source it is always empty!
self
.
type
=
"Source"
#String that shows the type of object
self
.
rng
=
RandomNumberGenerator
(
self
,
self
.
distType
)
self
.
rng
.
avg
=
mean
...
...
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