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
e694962f
Commit
e694962f
authored
Jun 18, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
operators now hold schedule. PrintRoute pritns schedule of operators
parent
0e8eebb3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
18 deletions
+105
-18
dream/simulation/OperatedPoolBroker.py
dream/simulation/OperatedPoolBroker.py
+5
-1
dream/simulation/Operator.py
dream/simulation/Operator.py
+2
-0
dream/simulation/PrintRoute.py
dream/simulation/PrintRoute.py
+98
-17
No files found.
dream/simulation/OperatedPoolBroker.py
View file @
e694962f
...
...
@@ -119,11 +119,13 @@ class Broker(ObjectInterruption):
# clear the timeWaitForOperatorStarted variable
self
.
timeWaitForOperatorStarted
=
0
# update the time that the operation started
self
.
timeOperationStarted
=
self
.
env
.
now
#()
self
.
timeOperationStarted
=
self
.
env
.
now
self
.
victim
.
outputTrace
(
self
.
victim
.
currentOperator
.
objName
,
"started work in "
+
self
.
victim
.
objName
)
self
.
victim
.
currentOperator
.
timeLastOperationStarted
=
self
.
env
.
now
#()
# signal the machine that an operator is reserved
self
.
victim
.
brokerIsSet
.
succeed
(
self
.
env
.
now
)
# update the schedule of the operator
self
.
victim
.
currentOperator
.
schedule
.
append
([
self
.
victim
,
self
.
env
.
now
])
# wait till the processing is over
yield
self
.
isCalled
...
...
@@ -149,6 +151,8 @@ class Broker(ObjectInterruption):
# TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers.
self
.
victim
.
printTrace
(
self
.
victim
.
currentOperator
.
objName
,
finishWork
=
self
.
victim
.
id
)
# update the schedule of the operator
self
.
victim
.
currentOperator
.
schedule
[
-
1
].
append
(
self
.
env
.
now
)
# the victim current operator must be cleared after the operator is released
self
.
timeLastOperationEnded
=
self
.
env
.
now
self
.
victim
.
currentOperator
.
workingStation
=
None
...
...
dream/simulation/Operator.py
View file @
e694962f
...
...
@@ -72,6 +72,8 @@ class Operator(ObjectResource):
self
.
candidateEntity
=
None
# the entity that will be chosen for processing
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
@
staticmethod
def
getSupportedSchedulingRules
():
return
(
"FIFO"
,
"Priority"
,
"WT"
,
"EDD"
,
"EOD"
,
...
...
dream/simulation/PrintRoute.py
View file @
e694962f
...
...
@@ -11,9 +11,23 @@ JOB_SHOP_TECHNOLOGY_SEQ=['CAD','CAM','MILL','EDM','ASSM','MA','INJM','IM' ]
ORDER_COMPONENT_TYPE_SET
=
set
([
'OrderComponent'
,
'Design'
,
'Mould'
])
def
sortMachines
():
'''sort the machines according to the set provided by JOB_SHOP_TECHNOLOGY_SEQ'''
for
tech
in
JOB_SHOP_TECHNOLOGY_SEQ
:
G
.
MachineList
.
sort
(
key
=
lambda
x
:
x
.
id
.
startswith
(
tech
))
def
getEventsList
(
objectsList
=
[]):
'''create an event list from the schedules of the objects provided'''
events_list
=
[]
# list to hold the events of the system
for
object
in
objectsList
:
if
object
.
schedule
:
for
record
in
object
.
schedule
:
if
not
record
[
1
]
in
events_list
:
events_list
.
append
(
record
[
1
])
if
len
(
record
)
==
3
:
if
not
record
[
2
]
in
events_list
:
events_list
.
append
(
record
[
2
])
return
events_list
def
outputRoute
():
'''
prints the routes of the Jobs through the model as a table
...
...
@@ -37,6 +51,8 @@ def outputRoute():
job accessing it)
'''
# xx for each station allocate 2 rows and a 3rd one for operators
if
G
.
trace
==
'Yes'
:
if
G
.
JobList
:
G
.
routeSheetIndex
=
G
.
sheetIndex
+
1
...
...
@@ -44,16 +60,8 @@ def outputRoute():
G
.
routeTraceSheet
=
G
.
traceFile
.
add_sheet
(
'sheet '
+
str
(
G
.
routeSheetIndex
)
+
' route'
,
cell_overwrite_ok
=
True
)
number_of_machines
=
len
(
G
.
MachineList
)
sortMachines
()
# sort the machines according to the priority specified in JOB_SHOP_TECHNOLOGY_SEQ
events_list
=
[]
# list to hold the events of the system
# list all events
for
job
in
G
.
JobList
:
if
job
.
schedule
:
for
record
in
job
.
schedule
:
if
not
record
[
1
]
in
events_list
:
events_list
.
append
(
record
[
1
])
if
len
(
record
)
==
3
:
if
not
record
[
2
]
in
events_list
:
events_list
.
append
(
record
[
2
])
# get the events list
events_list
=
getEventsList
(
G
.
JobList
+
G
.
OperatorsList
)
events_list
.
sort
(
cmp
=
None
,
key
=
None
,
reverse
=
False
)
# sort the events
number_of_events
=
len
(
events_list
)
# keep the total number of events
# create a table number_of_events X number_of_machines
...
...
@@ -61,8 +69,12 @@ def outputRoute():
# write the events in the first column and the machineIDs in the first row
for
j
,
event
in
enumerate
(
events_list
):
G
.
routeTraceSheet
.
write
(
j
+
1
,
0
,
float
(
event
))
# XXX create 3 times as many columns as the number of machines
for
j
,
machine
in
enumerate
(
G
.
MachineList
):
G
.
routeTraceSheet
.
write
(
0
,
j
+
1
,
str
(
machine
.
id
))
machine
.
cell_ids
=
range
(
j
*
3
+
1
,
j
*
3
+
3
)
machine
.
op_cel
=
j
*
3
+
3
G
.
routeTraceSheet
.
write_merge
(
0
,
0
,
j
*
3
+
1
,
j
*
3
+
3
,
str
(
machine
.
id
))
# sort the jobs according to their name
G
.
JobList
.
sort
(
key
=
lambda
x
:
x
.
id
)
# list of cells to be written
...
...
@@ -90,6 +102,7 @@ def outputRoute():
# 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
...
...
@@ -105,26 +118,94 @@ def outputRoute():
exit_time_index
=
len
(
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
.
cell_ids
[
0
]
stepDone
=
False
# check if the cell is already written, if yes, then modify it adding the new jobs but not overwrite it
if
not
cells
:
cells
.
append
({
'row'
:
step
+
1
,
'col'
:
machine_index
+
1
,
'col'
:
col_to_write
,
'job'
:
job
.
alias
})
G
.
routeTraceSheet
.
write
(
step
+
1
,
machine_index
+
1
,
job
.
alias
)
G
.
routeTraceSheet
.
write
(
step
+
1
,
col_to_write
,
job
.
alias
)
continue
for
cell
in
cells
:
if
cell
[
'row'
]
==
step
+
1
and
cell
[
'col'
]
==
machine_index
+
1
:
if
cell
[
'row'
]
==
step
+
1
and
cell
[
'col'
]
==
col_to_write
:
next_col
=
station
.
cell_ids
[
1
]
if
not
next_col
in
[
x
[
'col'
]
for
x
in
cells
if
x
[
'row'
]
==
step
+
1
]:
cells
.
append
({
'row'
:
step
+
1
,
'col'
:
next_col
,
'job'
:
job
.
alias
})
G
.
routeTraceSheet
.
write
(
step
+
1
,
next_col
,
job
.
alias
)
stepDone
=
True
break
cell
[
'job'
]
=
cell
[
'job'
]
+
','
+
job
.
alias
G
.
routeTraceSheet
.
write
(
cell
[
'row'
],
cell
[
'col'
],
cell
[
'job'
])
stepDone
=
True
break
if
not
stepDone
:
cells
.
append
({
'row'
:
step
+
1
,
'col'
:
machine_index
+
1
,
'col'
:
col_to_write
,
'job'
:
job
.
alias
})
G
.
routeTraceSheet
.
write
(
step
+
1
,
machine_index
+
1
,
job
.
alias
)
G
.
routeTraceSheet
.
write
(
step
+
1
,
col_to_write
,
job
.
alias
)
# list of cells to be written
cells
=
[]
# for every job in the JobList
for
worker
in
G
.
OperatorsList
:
# choose alias for the worker
worker
.
alias
=
worker
.
id
if
worker
.
schedule
:
for
record
in
worker
.
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
=
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
=
events_list
.
index
(
exit_time
)
elif
len
(
record
)
!=
3
:
exit_time_index
=
len
(
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_cel
stepDone
=
False
# check if the cell is already written, if yes, then modify it adding the new jobs but not overwrite it
if
not
cells
:
cells
.
append
({
'row'
:
step
+
1
,
'col'
:
col_to_write
,
'worker'
:
worker
.
alias
})
G
.
routeTraceSheet
.
write
(
step
+
1
,
col_to_write
,
worker
.
alias
)
continue
for
cell
in
cells
:
if
cell
[
'row'
]
==
step
+
1
and
cell
[
'col'
]
==
col_to_write
:
cell
[
'worker'
]
=
cell
[
'worker'
]
+
','
+
worker
.
alias
G
.
routeTraceSheet
.
write
(
cell
[
'row'
],
cell
[
'col'
],
cell
[
'worker'
])
stepDone
=
True
break
if
not
stepDone
:
cells
.
append
({
'row'
:
step
+
1
,
'col'
:
col_to_write
,
'worker'
:
worker
.
alias
})
G
.
routeTraceSheet
.
write
(
step
+
1
,
col_to_write
,
worker
.
alias
)
# print aliases
try
:
sample_job
=
next
(
x
for
x
in
G
.
JobList
)
...
...
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