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
fd40d840
Commit
fd40d840
authored
Aug 21, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Object Resources except OperatorPool to read in new style
parent
f598113e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
41 deletions
+23
-41
dream/simulation/64New.xls
dream/simulation/64New.xls
+0
-0
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+12
-37
dream/simulation/ObjectResource.py
dream/simulation/ObjectResource.py
+2
-0
dream/simulation/Operator.py
dream/simulation/Operator.py
+3
-1
dream/simulation/OperatorManagedJob.py
dream/simulation/OperatorManagedJob.py
+4
-3
dream/simulation/Repairman.py
dream/simulation/Repairman.py
+2
-0
No files found.
dream/simulation/64New.xls
0 → 100644
View file @
fd40d840
File added
dream/simulation/LineGenerationJSON.py
View file @
fd40d840
...
@@ -199,41 +199,16 @@ def createObjects():
...
@@ -199,41 +199,16 @@ def createObjects():
element
.
pop
(
k
,
None
)
element
.
pop
(
k
,
None
)
# with key 'id' and value the the element_id
# with key 'id' and value the the element_id
resourceClass
=
element
.
pop
(
'_class'
)
# get the class type of the element
resourceClass
=
element
.
pop
(
'_class'
)
# get the class type of the element
if
resourceClass
==
'Dream.Repairman'
:
# check the object type
id
=
element
.
get
(
'id'
,
'not found'
)
# get the id of the element
objectType
=
Globals
.
getClassFromName
(
resourceClass
)
name
=
element
.
get
(
'name'
,
id
)
# get the name of the element / default 'not_found'
from
ObjectResource
import
ObjectResource
# operator pools to be created later since they use operators
capacity
=
int
(
element
.
get
(
'capacity'
)
or
1
)
# ToDo maybe it is semantically diferent object
R
=
Repairman
(
element_id
,
name
,
capacity
)
# create a repairman object
if
issubclass
(
objectType
,
ObjectResource
)
and
not
resourceClass
==
'Dream.OperatorPool'
:
R
.
coreObjectIds
=
getSuccessorList
(
id
)
# update the list of objects that the repairman repairs
inputDict
=
dict
(
element
)
# calling the getSuccessorList() method on the repairman
# create the CoreObject
G
.
RepairmanList
.
append
(
R
)
# add the repairman to the RepairmanList
objectResource
=
objectType
(
**
inputDict
)
G
.
ObjectResourceList
.
append
(
R
)
objectResource
.
coreObjectIds
=
getSuccessorList
(
element
[
'id'
])
elif
resourceClass
==
'Dream.Operator'
:
id
=
element
.
get
(
'id'
,
'not found'
)
# get the id of the element / default 'not_found'
name
=
element
.
get
(
'name'
,
'not found'
)
# get the name of the element / default 'not_found'
capacity
=
int
(
element
.
get
(
'capacity'
)
or
1
)
schedulingRule
=
element
.
get
(
'schedulingRule'
,
'FIFO'
)
# get the scheduling rule of the el. (how to choose which
# station to serve first) / default 'FIFO' i.e. the one that
# called first
skills
=
element
.
get
(
'skills'
,[])
# list of stations that the operator can attend to
O
=
Operator
(
element_id
,
name
,
capacity
,
schedulingRule
,
skills
)
# create an operator object
O
.
coreObjectIds
=
getSuccessorList
(
id
)
# update the list of objects that the operator operates
# calling the getSuccesorList() method on the operator
G
.
OperatorsList
.
append
(
O
)
# add the operator to the RepairmanList
G
.
ObjectResourceList
.
append
(
O
)
elif
resourceClass
==
'Dream.OperatorManagedJob'
:
id
=
element
.
get
(
'id'
,
'not found'
)
# get the id of the element / default 'not_found'
name
=
element
.
get
(
'name'
,
'not found'
)
# get the name of the element / default 'not_found'
capacity
=
int
(
element
.
get
(
'capacity'
)
or
1
)
# get the capacity of the el. / defautl '1'
schedulingRule
=
element
.
get
(
'schedulingRule'
,
'FIFO'
)
# get the scheduling rule of the el. (how to choose which
# station to serve first) / default 'FIFO' i.e. the one that
# called first
O
=
OperatorManagedJob
(
element_id
,
name
,
capacity
,
schedulingRule
)
# create an operator object
O
.
coreObjectIds
=
getSuccessorList
(
id
)
# update the list of objects that the operator operates
# calling the getSuccesorList() method on the operator
G
.
OperatorsList
.
append
(
O
)
# add the operator to the RepairmanList
G
.
OperatorManagedJobsList
.
append
(
O
)
G
.
ObjectResourceList
.
append
(
O
)
'''
'''
loop through all the model resources
loop through all the model resources
search for operatorPools in order to create them
search for operatorPools in order to create them
...
@@ -244,8 +219,8 @@ def createObjects():
...
@@ -244,8 +219,8 @@ def createObjects():
# element itself
# element itself
element
=
element
.
copy
()
element
=
element
.
copy
()
element
[
'id'
]
=
element_id
# create a new entry for the element (dictionary)
element
[
'id'
]
=
element_id
# create a new entry for the element (dictionary)
#
for k in ('element_id', 'top', 'left'):
for
k
in
(
'element_id'
,
'top'
,
'left'
):
#
element.pop(k, None)
element
.
pop
(
k
,
None
)
# with key 'id' and value the the element_id
# with key 'id' and value the the element_id
resourceClass
=
element
.
pop
(
'_class'
)
# get the class type of the element
resourceClass
=
element
.
pop
(
'_class'
)
# get the class type of the element
if
resourceClass
==
'Dream.OperatorPool'
:
if
resourceClass
==
'Dream.OperatorPool'
:
...
...
dream/simulation/ObjectResource.py
View file @
fd40d840
...
@@ -38,6 +38,8 @@ class ObjectResource(object):
...
@@ -38,6 +38,8 @@ class ObjectResource(object):
self
.
objectInterruptions
=
[]
self
.
objectInterruptions
=
[]
# alias used for printing the trace
# alias used for printing the trace
self
.
alias
=
None
self
.
alias
=
None
from
Globals
import
G
G
.
ObjectResourceList
.
append
(
self
)
def
initialize
(
self
):
def
initialize
(
self
):
from
Globals
import
G
from
Globals
import
G
...
...
dream/simulation/Operator.py
View file @
fd40d840
...
@@ -41,7 +41,7 @@ class Operator(ObjectResource):
...
@@ -41,7 +41,7 @@ class Operator(ObjectResource):
ObjectResource
.
__init__
(
self
)
ObjectResource
.
__init__
(
self
)
self
.
id
=
id
self
.
id
=
id
self
.
objName
=
name
self
.
objName
=
name
self
.
capacity
=
capacity
# repairman is an instance of resource
self
.
capacity
=
int
(
capacity
)
# repairman is an instance of resource
self
.
type
=
"Operator"
self
.
type
=
"Operator"
# lists to hold statistics of multiple runs
# lists to hold statistics of multiple runs
self
.
Waiting
=
[]
# holds the percentage of waiting time
self
.
Waiting
=
[]
# holds the percentage of waiting time
...
@@ -78,6 +78,8 @@ class Operator(ObjectResource):
...
@@ -78,6 +78,8 @@ class Operator(ObjectResource):
self
.
skillsList
=
skills
self
.
skillsList
=
skills
# flag to show if the resource is available at the start of simulation
# flag to show if the resource is available at the start of simulation
self
.
available
=
available
self
.
available
=
available
from
Globals
import
G
G
.
OperatorsList
.
append
(
self
)
@
staticmethod
@
staticmethod
def
getSupportedSchedulingRules
():
def
getSupportedSchedulingRules
():
...
...
dream/simulation/OperatorManagedJob.py
View file @
fd40d840
...
@@ -35,9 +35,10 @@ from Operator import Operator
...
@@ -35,9 +35,10 @@ from Operator import Operator
# ===========================================================================
# ===========================================================================
class
OperatorManagedJob
(
Operator
):
class
OperatorManagedJob
(
Operator
):
# def __init__(self, id, name, capacity=1,schedulingRule="FIFO"):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
schedulingRule
=
"FIFO"
):
# Operator.__init__(self,id=id,name=name,capacity=capacity,schedulingRule=schedulingRule)
Operator
.
__init__
(
self
,
id
=
id
,
name
=
name
,
capacity
=
capacity
,
schedulingRule
=
schedulingRule
)
# self.operatorAssignedTo=None
from
Globals
import
G
G
.
OperatorManagedJobsList
.
append
(
self
)
# =======================================================================
# =======================================================================
# checks if the worker is available
# checks if the worker is available
...
...
dream/simulation/Repairman.py
View file @
fd40d840
...
@@ -37,4 +37,6 @@ class Repairman(Operator):
...
@@ -37,4 +37,6 @@ class Repairman(Operator):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
):
Operator
.
__init__
(
self
,
id
=
id
,
name
=
name
,
capacity
=
capacity
)
Operator
.
__init__
(
self
,
id
=
id
,
name
=
name
,
capacity
=
capacity
)
self
.
type
=
"Repairman"
self
.
type
=
"Repairman"
from
Globals
import
G
G
.
RepairmanList
.
append
(
self
)
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