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
63d66d46
Commit
63d66d46
authored
Aug 21, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some code moved in CoreObject
parent
849ea3b4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+11
-1
dream/simulation/Machine.py
dream/simulation/Machine.py
+6
-6
No files found.
dream/simulation/CoreObject.py
View file @
63d66d46
...
...
@@ -34,7 +34,7 @@ import simpy
class
CoreObject
(
object
):
class_name
=
'Dream.CoreObject'
def
__init__
(
self
,
id
,
name
,
**
kw
):
def
__init__
(
self
,
id
=
''
,
name
=
''
,
inputsDict
=
{}
,
**
kw
):
self
.
id
=
id
self
.
objName
=
name
# lists that hold the previous and next objects in the flow
...
...
@@ -67,6 +67,16 @@ class CoreObject(object):
# attributes/indices used for printing the route, hold the cols corresponding to the object (entities route and operators route)
self
.
station_col_inds
=
[]
self
.
op_col_indx
=
None
# if there is input in a dictionary parse from it
if
inputsDict
:
self
.
parseInputs
(
inputsDict
)
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def
parseInputs
(
self
,
inputsDict
):
self
.
id
=
inputsDict
.
get
(
'id'
)
self
.
objName
=
inputsDict
.
get
(
'name'
)
def
initialize
(
self
):
from
Globals
import
G
...
...
dream/simulation/Machine.py
View file @
63d66d46
...
...
@@ -56,8 +56,10 @@ class Machine(CoreObject):
isPreemptive
=
False
,
resetOnPreemption
=
False
,
canDeliverOnInterruption
=
False
,
inputsDict
=
{}):
self
.
type
=
"Machine"
#String that shows the type of object
# if input is given in a dictionary
if
inputsDict
:
self
.
parseInputs
(
inputsDict
)
CoreObject
.
__init__
(
self
,
inputsDict
=
inputsDict
)
# else read the separate ones
else
:
CoreObject
.
__init__
(
self
,
id
,
name
)
if
not
processingTime
:
...
...
@@ -131,11 +133,9 @@ class Machine(CoreObject):
# parses inputs if they are given in a dictionary
# =======================================================================
def
parseInputs
(
self
,
inputsDict
):
CoreObject
.
parseInputs
(
self
,
inputsDict
)
from
Globals
import
G
id
=
inputsDict
.
get
(
'id'
)
name
=
inputsDict
.
get
(
'name'
)
processingTime
=
inputsDict
.
get
(
'processingTime'
,{})
CoreObject
.
__init__
(
self
,
id
,
name
)
if
not
processingTime
:
processingTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
1
,
}
...
...
@@ -167,7 +167,7 @@ class Machine(CoreObject):
self
.
dedicatedOperator
=
self
.
checkForDedicatedOperators
()
if
len
(
G
.
OperatorPoolsList
)
>
0
:
for
operatorPool
in
G
.
OperatorPoolsList
:
# find the operatorPool assigned to the machine
if
(
id
in
operatorPool
.
coreObjectIds
):
# and add it to the machine's operatorPool
if
(
self
.
id
in
operatorPool
.
coreObjectIds
):
# and add it to the machine's operatorPool
machineOperatorPoolList
=
operatorPool
# there must only one operator pool assigned to the machine,
# otherwise only one of them will be taken into account
else
:
...
...
@@ -178,7 +178,7 @@ class Machine(CoreObject):
if
(
type
(
machineOperatorPoolList
)
is
list
):
# if the machineOperatorPoolList is a list
# find the operators assigned to it and add them to the list
for
operator
in
G
.
OperatorsList
:
# check which operator in the G.OperatorsList
if
(
id
in
operator
.
coreObjectIds
):
# (if any) is assigned to operate
if
(
self
.
id
in
operator
.
coreObjectIds
):
# (if any) is assigned to operate
machineOperatorPoolList
.
append
(
operator
)
# the machine with ID equal to id
self
.
operatorPool
=
machineOperatorPoolList
...
...
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