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
a226846a
Commit
a226846a
authored
Jun 23, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
printRoute methods added to Job and Operator, printRoute static method updated
parent
5bd8dbae
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
121 additions
and
132 deletions
+121
-132
dream/simulation/Job.py
dream/simulation/Job.py
+56
-0
dream/simulation/Operator.py
dream/simulation/Operator.py
+50
-2
dream/simulation/PrintRoute.py
dream/simulation/PrintRoute.py
+15
-130
No files found.
dream/simulation/Job.py
View file @
a226846a
...
...
@@ -50,6 +50,8 @@ class Job(Entity): # inherits from the Entity c
self
.
extraPropertyDict
=
extraPropertyDict
# variable used to differentiate entities with and entities without routes
self
.
family
=
'Job'
# used by printRoute
self
.
alias
=
'J'
+
str
(
len
(
G
.
JobList
))
# =======================================================================
# outputs results to JSON File
...
...
@@ -149,4 +151,58 @@ class Job(Entity): # inherits from the Entity c
if
not
self
in
router
.
conflictingEntities
:
router
.
conflictingEntities
.
append
(
self
)
return
availableReceiver
#===========================================================================
# print the route (the different stations the entity moved through)
#===========================================================================
def
printRoute
(
self
):
if
self
.
schedule
:
for
record
in
self
.
schedule
:
# find the station of this step
station
=
record
[
0
]
# XXX should also hold a list with all the machines G.MachineList?
# find the column corresponding to the machine
# XXX each machine should have at least 3 columns, 2 for the jobs and one for operators
if
station
in
G
.
MachineList
:
machine_index
=
G
.
MachineList
.
index
(
station
)
# find the entrance time of this step
entrance_time
=
record
[
1
]
# the time entity entered station
# find the row corresponding to the event and start placing the name of the Job in the cells
entrance_time_index
=
G
.
events_list
.
index
(
entrance_time
)
# find the exit time of this step
if
len
(
record
)
==
3
:
exit_time
=
record
[
2
]
# the time the entity exited the station
# find the row corresponding to the event and place the name of the Job in the cell, this is the last cell of this processing
exit_time_index
=
G
.
events_list
.
index
(
exit_time
)
elif
len
(
record
)
!=
3
:
exit_time_index
=
len
(
G
.
events_list
)
# for the rows with indices entrance_time_index to exit_time_index print the id of the Job in the column of the machine_index
for
step
in
range
(
entrance_time_index
,
exit_time_index
+
1
,
1
):
col_to_write
=
station
.
station_col_inds
[
0
]
# XXX
stepDone
=
False
# check if the cell is already written, if yes, then modify it adding the new jobs but not overwrite it
if
not
G
.
cells_to_write
:
G
.
cells_to_write
.
append
({
'row'
:
step
+
1
,
'col'
:
col_to_write
,
'job'
:
self
.
alias
})
G
.
routeTraceSheet
.
write
(
step
+
1
,
col_to_write
,
self
.
alias
)
continue
for
cell
in
G
.
cells_to_write
:
if
cell
[
'row'
]
==
step
+
1
and
cell
[
'col'
]
==
col_to_write
:
next_col
=
station
.
station_col_inds
[
1
]
# XXX
if
not
next_col
in
[
x
[
'col'
]
for
x
in
G
.
cells_to_write
if
x
[
'row'
]
==
step
+
1
]:
# XXX
G
.
cells_to_write
.
append
({
'row'
:
step
+
1
,
# XXX
'col'
:
next_col
,
# XXX
'job'
:
self
.
alias
})
# XXX
G
.
routeTraceSheet
.
write
(
step
+
1
,
next_col
,
self
.
alias
)
# XXX
stepDone
=
True
# XXX
break
# XXX
cell
[
'job'
]
=
cell
[
'job'
]
+
','
+
self
.
alias
G
.
routeTraceSheet
.
write
(
cell
[
'row'
],
cell
[
'col'
],
cell
[
'job'
])
stepDone
=
True
break
if
not
stepDone
:
G
.
cells_to_write
.
append
({
'row'
:
step
+
1
,
'col'
:
col_to_write
,
'job'
:
self
.
alias
})
G
.
routeTraceSheet
.
write
(
step
+
1
,
col_to_write
,
self
.
alias
)
dream/simulation/Operator.py
View file @
a226846a
...
...
@@ -73,6 +73,8 @@ class Operator(ObjectResource):
self
.
candidateStations
=
[]
# list of candidateStations of the stations (those stations that can receive an entity)
self
.
schedule
=
[]
# the working schedule of the resource, the objects the resource was occupied by and the corresponding times
# alias used by printRoute
self
.
alias
=
self
.
id
@
staticmethod
def
getSupportedSchedulingRules
():
...
...
@@ -351,7 +353,7 @@ class Operator(ObjectResource):
G
.
outputIndex
+=
1
G
.
outputIndex
+=
1
# =======================================================================
# =======================================================================
# outputs results to JSON File
# =======================================================================
def
outputResultsJSON
(
self
):
...
...
@@ -367,4 +369,50 @@ class Operator(ObjectResource):
json
[
'results'
][
'working_ratio'
]
=
getConfidenceIntervals
(
self
.
Working
)
json
[
'results'
][
'waiting_ratio'
]
=
getConfidenceIntervals
(
self
.
Waiting
)
G
.
outputJSON
[
'elementList'
].
append
(
json
)
\ No newline at end of file
#===========================================================================
# print the route (the different stations the resource was occupied by)
#===========================================================================
def
printRoute
(
self
):
if
self
.
schedule
:
for
record
in
self
.
schedule
:
# find the station of this step
station
=
record
[
0
]
# XXX should also hold a list with all the machines G.MachineList?
# find the column corresponding to the machine
from
Globals
import
G
# XXX each machine should have at least 3 columns, 2 for the jobs and one for operators
if
station
in
G
.
MachineList
:
machine_index
=
G
.
MachineList
.
index
(
station
)
# find the entrance time of this step
entrance_time
=
record
[
1
]
# the time entity entered station
# find the row corresponding to the event and start placing the name of the Job in the G.cells_to_write
entrance_time_index
=
G
.
events_list
.
index
(
entrance_time
)
# find the exit time of this step
if
len
(
record
)
==
3
:
exit_time
=
record
[
2
]
# the time the entity exited the station
# find the row corresponding to the event and place the name of the Job in the cell, this is the last cell of this processing
exit_time_index
=
G
.
events_list
.
index
(
exit_time
)
elif
len
(
record
)
!=
3
:
exit_time_index
=
len
(
G
.
events_list
)
# for the rows with indices entrance_time_index to exit_time_index print the id of the Job in the column of the machine_index
for
step
in
range
(
entrance_time_index
,
exit_time_index
+
1
,
1
):
col_to_write
=
station
.
op_col_indx
stepDone
=
False
# check if the cell is already written, if yes, then modify it adding the new jobs but not overwrite it
if
not
G
.
cells_to_write
:
G
.
cells_to_write
.
append
({
'row'
:
step
+
1
,
'col'
:
col_to_write
,
'worker'
:
self
.
alias
})
G
.
routeTraceSheet
.
write
(
step
+
1
,
col_to_write
,
self
.
alias
)
continue
for
cell
in
G
.
cells_to_write
:
if
cell
[
'row'
]
==
step
+
1
and
cell
[
'col'
]
==
col_to_write
:
cell
[
'worker'
]
=
cell
[
'worker'
]
+
','
+
self
.
alias
G
.
routeTraceSheet
.
write
(
cell
[
'row'
],
cell
[
'col'
],
cell
[
'worker'
])
stepDone
=
True
break
if
not
stepDone
:
G
.
cells_to_write
.
append
({
'row'
:
step
+
1
,
'col'
:
col_to_write
,
'worker'
:
self
.
alias
})
G
.
routeTraceSheet
.
write
(
step
+
1
,
col_to_write
,
self
.
alias
)
\ No newline at end of file
dream/simulation/PrintRoute.py
View file @
a226846a
This diff is collapsed.
Click to expand it.
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