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
adfbf696
Commit
adfbf696
authored
Feb 21, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make common initialization parts in CoreObject.__init__
parent
d18c8602
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
17 additions
and
40 deletions
+17
-40
dream/simulation/Assembly.py
dream/simulation/Assembly.py
+1
-3
dream/simulation/BatchDecomposition.py
dream/simulation/BatchDecomposition.py
+1
-4
dream/simulation/CompoundObject.py
dream/simulation/CompoundObject.py
+3
-4
dream/simulation/Conveyer.py
dream/simulation/Conveyer.py
+1
-3
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+3
-1
dream/simulation/Dismantle.py
dream/simulation/Dismantle.py
+1
-3
dream/simulation/Exit.py
dream/simulation/Exit.py
+1
-3
dream/simulation/Machine.py
dream/simulation/Machine.py
+1
-4
dream/simulation/OrderDecomposition.py
dream/simulation/OrderDecomposition.py
+2
-6
dream/simulation/Queue.py
dream/simulation/Queue.py
+1
-4
dream/simulation/Source.py
dream/simulation/Source.py
+2
-5
No files found.
dream/simulation/Assembly.py
View file @
adfbf696
...
@@ -38,9 +38,7 @@ class Assembly(CoreObject):
...
@@ -38,9 +38,7 @@ class Assembly(CoreObject):
#initialize the object
#initialize the object
def
__init__
(
self
,
id
,
name
,
distribution
=
'Fixed'
,
mean
=
1
,
stdev
=
0.1
,
min
=
0
,
max
=
5
,
**
kw
):
def
__init__
(
self
,
id
,
name
,
distribution
=
'Fixed'
,
mean
=
1
,
stdev
=
0.1
,
min
=
0
,
max
=
5
,
**
kw
):
CoreObject
.
__init__
(
self
)
CoreObject
.
__init__
(
self
,
id
,
name
)
self
.
id
=
id
self
.
objName
=
name
self
.
type
=
"Assembly"
#String that shows the type of object
self
.
type
=
"Assembly"
#String that shows the type of object
self
.
distType
=
distribution
#the distribution that the procTime follows
self
.
distType
=
distribution
#the distribution that the procTime follows
self
.
rng
=
RandomNumberGenerator
(
self
,
self
.
distType
)
self
.
rng
=
RandomNumberGenerator
(
self
,
self
.
distType
)
...
...
dream/simulation/BatchDecomposition.py
View file @
adfbf696
...
@@ -46,10 +46,7 @@ class BatchDecomposition(CoreObject):
...
@@ -46,10 +46,7 @@ class BatchDecomposition(CoreObject):
# =======================================================================
# =======================================================================
def
__init__
(
self
,
id
,
name
,
numberOfSubBatches
=
1
,
distribution
=
'Fixed'
,
\
def
__init__
(
self
,
id
,
name
,
numberOfSubBatches
=
1
,
distribution
=
'Fixed'
,
\
mean
=
1
,
stdev
=
0
,
min
=
0
,
max
=
10
,
operator
=
'None'
,
**
kw
):
mean
=
1
,
stdev
=
0
,
min
=
0
,
max
=
10
,
operator
=
'None'
,
**
kw
):
CoreObject
.
__init__
(
self
)
CoreObject
.
__init__
(
self
,
id
,
name
)
# hold the id, name, and type of the Machine instance
self
.
id
=
id
self
.
objName
=
name
self
.
type
=
"BatchDecomposition"
#String that shows the type of object
self
.
type
=
"BatchDecomposition"
#String that shows the type of object
# holds the capacity of the object
# holds the capacity of the object
self
.
numberOfSubBatches
=
numberOfSubBatches
self
.
numberOfSubBatches
=
numberOfSubBatches
...
...
dream/simulation/CompoundObject.py
View file @
adfbf696
...
@@ -71,11 +71,10 @@ class NoneCallerObjectError(Exception):
...
@@ -71,11 +71,10 @@ class NoneCallerObjectError(Exception):
class
CompoundObject
(
CoreObject
,
Queue
):
class
CompoundObject
(
CoreObject
,
Queue
):
# object arguments may provide information on the type of the object, and the arguments needed to initiate it
# object arguments may provide information on the type of the object, and the arguments needed to initiate it
def
__init__
(
self
,
id
,
name
,
capacity
,
routing
=
'Series'
,
*
objects
):
def
__init__
(
self
,
id
,
name
,
capacity
,
routing
=
'Series'
,
*
objects
):
CoreObject
.
__init__
(
self
)
CoreObject
.
__init__
(
self
,
id
,
name
)
# it would be a good idea to have the arguments provided as dictionary
# it would be a good idea to have the arguments provided as dictionary
self
.
id
=
id
# may avoid to use that here
self
.
objName
=
name
# -||-
self
.
type
=
'CompoundObject'
self
.
type
=
'CompoundObject'
# variable that can hold according to this implementation two different values
# variable that can hold according to this implementation two different values
# 'Parallel'
# 'Parallel'
# 'Series'
# 'Series'
...
...
dream/simulation/Conveyer.py
View file @
adfbf696
...
@@ -36,9 +36,7 @@ from CoreObject import CoreObject
...
@@ -36,9 +36,7 @@ from CoreObject import CoreObject
class
Conveyer
(
CoreObject
):
class
Conveyer
(
CoreObject
):
def
__init__
(
self
,
id
,
name
,
length
,
speed
,
**
kw
):
def
__init__
(
self
,
id
,
name
,
length
,
speed
,
**
kw
):
CoreObject
.
__init__
(
self
)
CoreObject
.
__init__
(
self
,
id
,
name
)
self
.
id
=
id
self
.
objName
=
name
self
.
type
=
"Conveyer"
self
.
type
=
"Conveyer"
self
.
speed
=
speed
#the speed of the conveyer in m/sec
self
.
speed
=
speed
#the speed of the conveyer in m/sec
self
.
length
=
length
#the length of the conveyer in meters
self
.
length
=
length
#the length of the conveyer in meters
...
...
dream/simulation/CoreObject.py
View file @
adfbf696
...
@@ -32,8 +32,10 @@ from SimPy.Simulation import Process, Resource, now
...
@@ -32,8 +32,10 @@ from SimPy.Simulation import Process, Resource, now
# ===========================================================================
# ===========================================================================
class
CoreObject
(
Process
):
class
CoreObject
(
Process
):
def
__init__
(
self
):
def
__init__
(
self
,
id
,
name
,
**
kw
):
Process
.
__init__
(
self
)
Process
.
__init__
(
self
)
self
.
id
=
id
self
.
objName
=
name
# lists that hold the previous and next 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
.
next
=
[]
#list with the next objects in the flow
self
.
previous
=
[]
#list with the previous objects in the flow
self
.
previous
=
[]
#list with the previous objects in the flow
...
...
dream/simulation/Dismantle.py
View file @
adfbf696
...
@@ -43,9 +43,7 @@ class Dismantle(CoreObject):
...
@@ -43,9 +43,7 @@ class Dismantle(CoreObject):
# =======================================================================
# =======================================================================
def
__init__
(
self
,
id
,
name
,
distribution
=
'Fixed'
,
mean
=
1
,
stdev
=
0.1
,
def
__init__
(
self
,
id
,
name
,
distribution
=
'Fixed'
,
mean
=
1
,
stdev
=
0.1
,
min
=
0
,
max
=
5
,
**
kw
):
min
=
0
,
max
=
5
,
**
kw
):
CoreObject
.
__init__
(
self
)
CoreObject
.
__init__
(
self
,
id
,
name
)
self
.
id
=
id
self
.
objName
=
name
self
.
type
=
"Dismantle"
#String that shows the type of object
self
.
type
=
"Dismantle"
#String that shows the type of object
self
.
distType
=
distribution
#the distribution that the procTime follows
self
.
distType
=
distribution
#the distribution that the procTime follows
self
.
rng
=
RandomNumberGenerator
(
self
,
self
.
distType
)
self
.
rng
=
RandomNumberGenerator
(
self
,
self
.
distType
)
...
...
dream/simulation/Exit.py
View file @
adfbf696
...
@@ -35,13 +35,11 @@ from CoreObject import CoreObject
...
@@ -35,13 +35,11 @@ from CoreObject import CoreObject
class
Exit
(
CoreObject
):
class
Exit
(
CoreObject
):
def
__init__
(
self
,
id
,
name
=
None
,
**
kw
):
def
__init__
(
self
,
id
,
name
=
None
,
**
kw
):
CoreObject
.
__init__
(
self
)
if
not
name
:
if
not
name
:
name
=
id
name
=
id
CoreObject
.
__init__
(
self
,
id
,
name
)
self
.
predecessorIndex
=
0
# holds the index of the predecessor from which the Exit will take an entity next
self
.
predecessorIndex
=
0
# holds the index of the predecessor from which the Exit will take an entity next
# general properties of the Exit
# general properties of the Exit
self
.
id
=
id
self
.
objName
=
name
self
.
type
=
"Exit"
# XXX needed ?
self
.
type
=
"Exit"
# XXX needed ?
# # list with routing information
# # list with routing information
# self.previous=[] # list with the previous objects in the flow
# self.previous=[] # list with the previous objects in the flow
...
...
dream/simulation/Machine.py
View file @
adfbf696
...
@@ -52,10 +52,7 @@ class Machine(CoreObject):
...
@@ -52,10 +52,7 @@ class Machine(CoreObject):
loadDistribution
=
"No"
,
loadMean
=
0
,
loadStdev
=
0
,
loadMin
=
0
,
loadMax
=
10
,
loadDistribution
=
"No"
,
loadMean
=
0
,
loadStdev
=
0
,
loadMin
=
0
,
loadMax
=
10
,
setupDistribution
=
"No"
,
setupMean
=
0
,
setupStdev
=
0
,
setupMin
=
0
,
setupMax
=
10
,
setupDistribution
=
"No"
,
setupMean
=
0
,
setupStdev
=
0
,
setupMin
=
0
,
setupMax
=
10
,
isPreemptive
=
False
,
resetOnPreemption
=
False
,
**
kw
):
isPreemptive
=
False
,
resetOnPreemption
=
False
,
**
kw
):
CoreObject
.
__init__
(
self
)
CoreObject
.
__init__
(
self
,
id
,
name
)
# hold the id, name, and type of the Machine instance
self
.
id
=
id
self
.
objName
=
name
self
.
type
=
"Machine"
#String that shows the type of object
self
.
type
=
"Machine"
#String that shows the type of object
# holds the capacity of the machine
# holds the capacity of the machine
self
.
capacity
=
capacity
self
.
capacity
=
capacity
...
...
dream/simulation/OrderDecomposition.py
View file @
adfbf696
...
@@ -48,11 +48,7 @@ class MouldComponentException(Exception):
...
@@ -48,11 +48,7 @@ class MouldComponentException(Exception):
# the Order-Decomposition Object
# the Order-Decomposition Object
# ===========================================================================
# ===========================================================================
class
OrderDecomposition
(
CoreObject
):
class
OrderDecomposition
(
CoreObject
):
def
__init__
(
self
,
id
,
name
,
**
kw
):
type
=
'OrderDecomposition'
CoreObject
.
__init__
(
self
)
self
.
id
=
id
self
.
objName
=
name
self
.
type
=
'OrderDecomposition'
# =======================================================================
# =======================================================================
# the initialize method
# the initialize method
...
...
dream/simulation/Queue.py
View file @
adfbf696
...
@@ -35,14 +35,11 @@ from CoreObject import CoreObject
...
@@ -35,14 +35,11 @@ from CoreObject import CoreObject
class
Queue
(
CoreObject
):
class
Queue
(
CoreObject
):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
isDummy
=
False
,
schedulingRule
=
"FIFO"
,
**
kw
):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
isDummy
=
False
,
schedulingRule
=
"FIFO"
,
**
kw
):
CoreObject
.
__init__
(
self
)
CoreObject
.
__init__
(
self
,
id
,
name
)
# Process.__init__(self)
# Process.__init__(self)
# used for the routing of the entities
# 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
.
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
self
.
successorIndex
=
0
# holds the index of the successor where the Queue will dispose an entity next
# hold the id, name, and type of the Queue instance
self
.
id
=
id
self
.
objName
=
name
self
.
type
=
"Queue"
# String that shows the type of object
self
.
type
=
"Queue"
# String that shows the type of object
# holds the capacity of the Queue
# holds the capacity of the Queue
if
capacity
>
0
:
if
capacity
>
0
:
...
...
dream/simulation/Source.py
View file @
adfbf696
...
@@ -36,11 +36,8 @@ import Globals
...
@@ -36,11 +36,8 @@ import Globals
#============================================================================
#============================================================================
class
Source
(
CoreObject
):
class
Source
(
CoreObject
):
def
__init__
(
self
,
id
,
name
,
distribution
=
'Fixed'
,
mean
=
1
,
item
=
'Dream.Part'
,
**
kw
):
def
__init__
(
self
,
id
,
name
,
distribution
=
'Fixed'
,
mean
=
1
,
item
=
'Dream.Part'
,
**
kw
):
CoreObject
.
__init__
(
self
)
CoreObject
.
__init__
(
self
,
id
,
name
)
# Process.__init__(self)
# general properties
self
.
id
=
id
self
.
objName
=
name
self
.
distType
=
distribution
# label that sets the distribution type
self
.
distType
=
distribution
# label that sets the distribution type
# properties used for statistics
# properties used for statistics
self
.
totalInterArrivalTime
=
0
# the total interarrival time
self
.
totalInterArrivalTime
=
0
# the total interarrival time
...
...
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