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
3d99a809
Commit
3d99a809
authored
Mar 02, 2015
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
schedule of operators and entities now defined as dictionary
parent
1cf21501
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
80 additions
and
71 deletions
+80
-71
dream/simulation/Batch.py
dream/simulation/Batch.py
+1
-1
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+4
-3
dream/simulation/Examples/JobShop1.py
dream/simulation/Examples/JobShop1.py
+2
-2
dream/simulation/Examples/JobShop1Trace.py
dream/simulation/Examples/JobShop1Trace.py
+2
-2
dream/simulation/Examples/JobShop2EDD.py
dream/simulation/Examples/JobShop2EDD.py
+2
-2
dream/simulation/Examples/JobShop2MC.py
dream/simulation/Examples/JobShop2MC.py
+2
-2
dream/simulation/Examples/JobShop2Priority.py
dream/simulation/Examples/JobShop2Priority.py
+2
-2
dream/simulation/Examples/JobShop2RPC.py
dream/simulation/Examples/JobShop2RPC.py
+2
-2
dream/simulation/ExcelHandler.py
dream/simulation/ExcelHandler.py
+3
-3
dream/simulation/Globals.py
dream/simulation/Globals.py
+4
-2
dream/simulation/Job.py
dream/simulation/Job.py
+17
-17
dream/simulation/Machine.py
dream/simulation/Machine.py
+2
-1
dream/simulation/MouldAssembly.py
dream/simulation/MouldAssembly.py
+1
-1
dream/simulation/MouldAssemblyManaged.py
dream/simulation/MouldAssemblyManaged.py
+1
-1
dream/simulation/OperatedPoolBroker.py
dream/simulation/OperatedPoolBroker.py
+2
-3
dream/simulation/Operator.py
dream/simulation/Operator.py
+12
-12
dream/simulation/OperatorRouter.py
dream/simulation/OperatorRouter.py
+5
-2
dream/simulation/PrintRoute.py
dream/simulation/PrintRoute.py
+6
-5
dream/simulation/ShiftScheduler.py
dream/simulation/ShiftScheduler.py
+10
-8
No files found.
dream/simulation/Batch.py
View file @
3d99a809
...
...
@@ -51,6 +51,6 @@ class Batch(Entity):
route
=
[]
for
child
in
self
.
subBatchList
:
for
step
in
child
.
schedule
:
route
.
append
(
step
[
0
])
route
.
append
(
step
[
"station"
])
route
=
list
(
set
(
route
))
return
route
dream/simulation/CoreObject.py
View file @
3d99a809
...
...
@@ -299,7 +299,7 @@ class CoreObject(ManPyObject):
#remember that every entity has it's schedule which is supposed to be updated every time
# he entity enters a new object
if
entity
.
schedule
:
entity
.
schedule
[
-
1
]
.
append
(
self
.
env
.
now
)
entity
.
schedule
[
-
1
]
[
"exitTime"
]
=
self
.
env
.
now
# update wipStatList
if
self
.
gatherWipStat
:
...
...
@@ -369,8 +369,9 @@ class CoreObject(ManPyObject):
#append the time to schedule so that it can be read in the result
#remember that every entity has it's schedule which is supposed to be updated every time
# he entity enters a new object
activeEntity
.
schedule
.
append
([
self
,
self
.
env
.
now
])
# the entity enters a new object
activeEntity
.
schedule
.
append
({
"station"
:
self
,
"entranceTime"
:
self
.
env
.
now
})
#update variables
activeEntity
.
currentStation
=
self
self
.
timeLastEntityEntered
=
self
.
env
.
now
...
...
dream/simulation/Examples/JobShop1.py
View file @
3d99a809
...
...
@@ -33,12 +33,12 @@ def main(test=0):
if
test
:
returnSchedule
=
[]
for
record
in
J
.
schedule
:
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
returnSchedule
.
append
([
record
[
"station"
].
objName
,
record
[
"entranceTime"
]])
return
returnSchedule
# print the results
for
record
in
J
.
schedule
:
print
J
.
name
,
"got into"
,
record
[
0
].
objName
,
"at"
,
record
[
1
]
print
J
.
name
,
"got into"
,
record
[
"station"
].
objName
,
"at"
,
record
[
"entranceTime"
]
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
dream/simulation/Examples/JobShop1Trace.py
View file @
3d99a809
...
...
@@ -32,8 +32,8 @@ def main():
#loop in the schedule to print the results
schedule
=
[]
for
record
in
J
.
schedule
:
schedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
print
J
.
name
,
"got into"
,
record
[
0
].
objName
,
"at"
,
record
[
1
]
schedule
.
append
([
record
[
"station"
].
objName
,
record
[
"entranceTime"
]])
print
J
.
name
,
"got into"
,
record
[
"station"
].
objName
,
"at"
,
record
[
"entranceTime"
]
ExcelHandler
.
outputTrace
(
'TRACE'
)
return
schedule
...
...
dream/simulation/Examples/JobShop2EDD.py
View file @
3d99a809
...
...
@@ -57,13 +57,13 @@ def main(test=0):
returnSchedule
=
[]
for
job
in
[
J1
,
J2
,
J3
]:
for
record
in
job
.
schedule
:
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
returnSchedule
.
append
([
record
[
"station"
].
objName
,
record
[
"entranceTime"
]])
return
returnSchedule
# print the results
for
job
in
[
J1
,
J2
,
J3
]:
for
record
in
job
.
schedule
:
print
job
.
name
,
"got into"
,
record
[
0
].
objName
,
"at"
,
record
[
1
]
print
job
.
name
,
"got into"
,
record
[
"station"
].
objName
,
"at"
,
record
[
"entranceTime"
]
print
"-"
*
30
if
__name__
==
'__main__'
:
...
...
dream/simulation/Examples/JobShop2MC.py
View file @
3d99a809
...
...
@@ -57,13 +57,13 @@ def main(test=0):
returnSchedule
=
[]
for
job
in
[
J1
,
J2
,
J3
]:
for
record
in
job
.
schedule
:
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
returnSchedule
.
append
([
record
[
"station"
].
objName
,
record
[
"entranceTime"
]])
return
returnSchedule
# print the results
for
job
in
[
J1
,
J2
,
J3
]:
for
record
in
job
.
schedule
:
print
job
.
name
,
"got into"
,
record
[
0
].
objName
,
"at"
,
record
[
1
]
print
job
.
name
,
"got into"
,
record
[
"station"
].
objName
,
"at"
,
record
[
"entranceTime"
]
print
"-"
*
30
if
__name__
==
'__main__'
:
...
...
dream/simulation/Examples/JobShop2Priority.py
View file @
3d99a809
...
...
@@ -57,13 +57,13 @@ def main(test=0):
returnSchedule
=
[]
for
job
in
[
J1
,
J2
,
J3
]:
for
record
in
job
.
schedule
:
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
returnSchedule
.
append
([
record
[
"station"
].
objName
,
record
[
"entranceTime"
]])
return
returnSchedule
# print the results
for
job
in
[
J1
,
J2
,
J3
]:
for
record
in
job
.
schedule
:
print
job
.
name
,
"got into"
,
record
[
0
].
objName
,
"at"
,
record
[
1
]
print
job
.
name
,
"got into"
,
record
[
"station"
].
objName
,
"at"
,
record
[
"entranceTime"
]
print
"-"
*
30
if
__name__
==
'__main__'
:
...
...
dream/simulation/Examples/JobShop2RPC.py
View file @
3d99a809
...
...
@@ -57,13 +57,13 @@ def main(test=0):
returnSchedule
=
[]
for
job
in
[
J1
,
J2
,
J3
]:
for
record
in
job
.
schedule
:
returnSchedule
.
append
([
record
[
0
].
objName
,
record
[
1
]])
returnSchedule
.
append
([
record
[
"station"
].
objName
,
record
[
"entranceTime"
]])
return
returnSchedule
# print the results
for
job
in
[
J1
,
J2
,
J3
]:
for
record
in
job
.
schedule
:
print
job
.
name
,
"got into"
,
record
[
0
].
objName
,
"at"
,
record
[
1
]
print
job
.
name
,
"got into"
,
record
[
"station"
].
objName
,
"at"
,
record
[
"entranceTime"
]
print
"-"
*
30
if
__name__
==
'__main__'
:
...
...
dream/simulation/ExcelHandler.py
View file @
3d99a809
...
...
@@ -47,9 +47,9 @@ def outputLog(fileName='Log', entityList=G.EntityList):
for
entity
in
entityList
:
for
stop
in
entity
.
schedule
:
logSheet
.
write
(
logIndex
,
0
,
entity
.
name
)
logSheet
.
write
(
logIndex
,
1
,
stop
[
0
].
id
)
logSheet
.
write
(
logIndex
,
2
,
stop
[
0
].
objName
)
logSheet
.
write
(
logIndex
,
3
,
stop
[
1
])
logSheet
.
write
(
logIndex
,
1
,
stop
[
"station"
].
id
)
logSheet
.
write
(
logIndex
,
2
,
stop
[
"station"
].
objName
)
logSheet
.
write
(
logIndex
,
3
,
stop
[
"entranceTime"
])
logIndex
+=
1
#increment the row
#if we reach row 65536 we need to create a new sheet (excel limitation)
if
(
logIndex
==
65536
):
...
...
dream/simulation/Globals.py
View file @
3d99a809
...
...
@@ -217,7 +217,8 @@ def setWIP(entityList):
if
entity
.
currentStation
:
object
=
entity
.
currentStation
#identify the object
object
.
getActiveObjectQueue
().
append
(
entity
)
#append the entity to its Queue
entity
.
schedule
.
append
([
object
,
G
.
env
.
now
])
#append the time to schedule so that it can be read in the result
entity
.
schedule
.
append
({
"station"
:
object
,
"entranceTime"
:
G
.
env
.
now
})
#append the time to schedule so that it can be read in the result
# if the entity is of type Job/OrderComponent/Order/Mould
...
...
@@ -256,7 +257,8 @@ def setWIP(entityList):
object
.
next
.
append
(
nextObject
)
entity
.
remainingRoute
.
pop
(
0
)
# remove data from the remaining route.
entity
.
schedule
.
append
([
object
,
G
.
env
.
now
])
#append the time to schedule so that it can be read in the result
entity
.
schedule
.
append
({
"station"
:
object
,
"entranceTime"
:
G
.
env
.
now
})
#append the time to schedule so that it can be read in the result
# if the currentStation of the entity is of type Machine then the entity
# must be processed first and then added to the pendingEntities list
...
...
dream/simulation/Job.py
View file @
3d99a809
...
...
@@ -85,21 +85,21 @@ class Job(Entity): # inherits from the Entity c
# if there is schedule
if
self
.
schedule
:
#if the Job has reached an exit, input completion time in the results
if
self
.
schedule
[
-
1
][
0
].
type
==
'Exit'
:
json
[
'results'
][
'completionTime'
]
=
self
.
schedule
[
-
1
][
1
]
completionTime
=
self
.
schedule
[
-
1
][
1
]
if
self
.
schedule
[
-
1
][
"station"
].
type
==
'Exit'
:
json
[
'results'
][
'completionTime'
]
=
self
.
schedule
[
-
1
][
"entranceTime"
]
completionTime
=
self
.
schedule
[
-
1
][
"entranceTime"
]
# TODO
# if the entity is of type Mould and the last object holding it is orderDecomposition
# XXX now Orders do not run through the system but OrderDesigns do
elif
self
.
type
==
'OrderDesign'
and
self
.
schedule
[
-
1
][
0
].
type
==
'OrderDecomposition'
:
#
json
[
'results'
][
'completionTime'
]
=
self
.
schedule
[
-
1
][
1
]
completionTime
=
self
.
schedule
[
-
1
][
1
]
elif
self
.
type
==
'OrderDesign'
and
self
.
schedule
[
-
1
][
"station"
].
type
==
'OrderDecomposition'
:
#
json
[
'results'
][
'completionTime'
]
=
self
.
schedule
[
-
1
][
"entranceTime"
]
completionTime
=
self
.
schedule
[
-
1
][
"entranceTime"
]
# TODO : check if there is a need for setting a different 'type' for the MouldAssembly than 'Machine'
# ask Georgios if the method __class__.__name__ of finding the class type of the last step is correct
# if the entity is of type orderComponent and the last step in it's schedule is Assembly
elif
self
.
type
==
'OrderComponent'
and
self
.
schedule
[
-
1
][
0
].
__class__
.
__name__
in
set
([
'MouldAssemblyManaged'
,
'MouldAssembly'
]):
json
[
'results'
][
'completionTime'
]
=
self
.
schedule
[
-
1
][
1
]
completionTime
=
self
.
schedule
[
-
1
][
1
]
elif
self
.
type
==
'OrderComponent'
and
self
.
schedule
[
-
1
][
"station"
].
__class__
.
__name__
in
set
([
'MouldAssemblyManaged'
,
'MouldAssembly'
]):
json
[
'results'
][
'completionTime'
]
=
self
.
schedule
[
-
1
][
"entranceTime"
]
completionTime
=
self
.
schedule
[
-
1
][
"entranceTime"
]
#else input "still in progress"
else
:
json
[
'results'
][
'completionTime'
]
=
"still in progress"
...
...
@@ -112,9 +112,9 @@ class Job(Entity): # inherits from the Entity c
json
[
'results'
][
'schedule'
]
=
[]
i
=
0
for
record
in
self
.
schedule
:
json
[
'results'
][
'schedule'
].
append
({})
# dictionary holding time and
json
[
'results'
][
'schedule'
][
i
][
'stationId'
]
=
record
[
0
].
id
# id of the Object
json
[
'results'
][
'schedule'
][
i
][
'entranceTime'
]
=
record
[
1
]
# time entering the Object
json
[
'results'
][
'schedule'
].
append
({})
# dictionary holding time and
json
[
'results'
][
'schedule'
][
i
][
'stationId'
]
=
record
[
"station"
].
id
# id of the Object
json
[
'results'
][
'schedule'
][
i
][
'entranceTime'
]
=
record
[
"entranceTime"
]
# time entering the Object
i
+=
1
G
.
outputJSON
[
'elementList'
].
append
(
json
)
...
...
@@ -322,21 +322,21 @@ class Job(Entity): # inherits from the Entity c
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?
station
=
record
[
"station"
]
# 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
entrance_time
=
record
[
"entranceTime"
]
# 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
if
record
.
get
(
"exitTime"
,
None
)
!=
None
:
exit_time
=
record
[
"exitTime"
]
# 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
)
el
if
len
(
record
)
!=
3
:
el
se
:
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
):
...
...
dream/simulation/Machine.py
View file @
3d99a809
...
...
@@ -1163,7 +1163,8 @@ class Machine(CoreObject):
# this checks if the operator is working on the last element.
# If yes the time that he was set off-shift should be updated
operator
=
self
.
currentOperator
operator
.
schedule
[
-
1
].
append
(
self
.
env
.
now
)
operator
.
schedule
[
-
1
][
"exitTime"
]
=
self
.
env
.
now
operator
.
schedule
[
-
1
][
"entity"
]
=
self
.
getActiveObjectQueue
()[
0
]
if
not
self
.
currentOperator
.
onShift
:
operator
.
timeLastShiftEnded
=
self
.
env
.
now
operator
.
unAssign
()
# set the flag operatorAssignedTo to None
...
...
dream/simulation/MouldAssembly.py
View file @
3d99a809
...
...
@@ -183,7 +183,7 @@ class MouldAssembly(MachineJobShop):
temp_activeObjectQueue
=
list
(
activeObjectQueue
)
for
element
in
temp_activeObjectQueue
:
# update their schedule
element
.
schedule
[
-
1
]
.
append
(
self
.
env
.
now
)
element
.
schedule
[
-
1
]
[
"exitTime"
]
=
self
.
env
.
now
# remove the elements from the activeObjectQueue and reset the current station of the entity
activeObjectQueue
.
remove
(
element
)
element
.
currentStation
=
None
...
...
dream/simulation/MouldAssemblyManaged.py
View file @
3d99a809
...
...
@@ -178,7 +178,7 @@ class MouldAssemblyManaged(MachineManagedJob):
temp_activeObjectQueue
=
list
(
activeObjectQueue
)
for
element
in
temp_activeObjectQueue
:
# update their schedule
element
.
schedule
[
-
1
]
.
append
(
self
.
env
.
now
)
element
.
schedule
[
-
1
]
[
"exitTime"
]
=
self
.
env
.
now
# remove the elements
activeObjectQueue
.
remove
(
element
)
del
temp_activeObjectQueue
[:]
...
...
dream/simulation/OperatedPoolBroker.py
View file @
3d99a809
...
...
@@ -158,7 +158,8 @@ class Broker(ObjectInterruption):
if
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]:
self
.
sendSignal
(
receiver
=
self
.
victim
,
signal
=
self
.
victim
.
brokerIsSet
)
# update the schedule of the operator
self
.
victim
.
currentOperator
.
schedule
.
append
([
self
.
victim
,
self
.
env
.
now
])
self
.
victim
.
currentOperator
.
schedule
.
append
({
"station"
:
self
.
victim
,
"entranceTime"
:
self
.
env
.
now
})
# wait till the processing is over
self
.
expectedSignals
[
'isCalled'
]
=
1
...
...
@@ -186,8 +187,6 @@ 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 @
3d99a809
...
...
@@ -183,7 +183,7 @@ class Operator(ObjectResource):
for
part
in
activeObjectQ
:
part
.
factor
=
0
if
part
.
schedule
:
part
.
factor
=
self
.
env
.
now
-
part
.
schedule
[
-
1
][
1
]
part
.
factor
=
self
.
env
.
now
-
part
.
schedule
[
-
1
][
"entranceTime"
]
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
factor
,
reverse
=
True
)
#if the schedulingRule is earliest due date
...
...
@@ -294,18 +294,18 @@ class Operator(ObjectResource):
json
[
'results'
][
'schedule'
]
=
[]
for
record
in
self
.
schedule
:
try
:
stationId
=
record
[
0
].
id
stationId
=
record
[
"station"
].
id
except
AttributeError
:
stationId
=
record
[
0
][
'id'
]
if
len
(
record
)
==
3
:
stationId
=
record
[
"station"
][
'id'
]
if
record
.
get
(
"exitTime"
,
None
)
!=
None
:
json
[
'results'
][
'schedule'
].
append
({
'stationId'
:
stationId
,
'entranceTime'
:
record
[
1
],
'exitTime'
:
record
[
2
]})
'entranceTime'
:
record
[
"entranceTime"
],
'exitTime'
:
record
[
"exitTime"
]})
else
:
json
[
'results'
][
'schedule'
].
append
({
'stationId'
:
stationId
,
'entranceTime'
:
record
[
1
]})
'entranceTime'
:
record
[
"entranceTime"
]})
G
.
outputJSON
[
'elementList'
].
append
(
json
)
#===========================================================================
...
...
@@ -315,22 +315,22 @@ class Operator(ObjectResource):
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?
station
=
record
[
"station"
]
# 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
entrance_time
=
record
[
"entranceTime"
]
# 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
try
:
exit_time
=
record
[
"exitTime"
]
# 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
)
e
lif
len
(
record
)
!=
3
:
e
xcept
:
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
):
...
...
dream/simulation/OperatorRouter.py
View file @
3d99a809
...
...
@@ -363,13 +363,16 @@ class Router(ObjectInterruption):
# Sort candidateOperators
# sort the operators according to their idle time
#=======================================================================
def
sortOperators
(
self
):
def
sortOperators
(
self
):
if
self
.
candidateOperators
:
# calculate the time the operators have been waiting
for
op
in
self
.
candidateOperators
:
op
.
waitingTime
=
0
if
op
.
schedule
:
op
.
waitingTime
=
self
.
env
.
now
-
op
.
schedule
[
-
1
][
-
1
]
if
op
.
schedule
[
-
1
].
get
(
"exitTime"
,
None
)
!=
None
:
op
.
waitingTime
=
self
.
env
.
now
-
op
.
schedule
[
-
1
][
"exitTime"
]
elif
op
.
schedule
[
-
1
].
get
(
"entranceTime"
,
None
)
!=
None
:
op
.
waitingTime
=
0
elif
self
.
env
.
now
>
0
:
op
.
waitingTime
=
self
.
env
.
now
self
.
candidateOperators
.
sort
(
key
=
lambda
x
:
x
.
waitingTime
,
reverse
=
True
)
...
...
dream/simulation/PrintRoute.py
View file @
3d99a809
...
...
@@ -21,11 +21,12 @@ def getEventsList(objectsList=[]):
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
])
if
not
record
[
"entranceTime"
]
in
events_list
:
events_list
.
append
(
record
[
"entranceTime"
])
exit_time
=
record
.
get
(
"exitTime"
,
None
)
if
exit_time
!=
None
:
if
not
exit_time
in
events_list
:
events_list
.
append
(
exit_time
)
return
events_list
def
outputRoute
():
...
...
dream/simulation/ShiftScheduler.py
View file @
3d99a809
...
...
@@ -79,9 +79,10 @@ class ShiftScheduler(ObjectInterruption):
self
.
interruptVictim
()
# interrupt the victim
else
:
if
self
.
victim
.
schedule
:
if
len
(
self
.
victim
.
schedule
[
-
1
])
==
2
:
self
.
victim
.
schedule
[
-
1
].
append
(
self
.
env
.
now
)
self
.
victim
.
schedule
.
append
([{
'id'
:
'off-shift'
},
self
.
env
.
now
])
if
not
self
.
victim
.
schedule
[
-
1
].
get
(
"exitTime"
,
None
):
self
.
victim
.
schedule
[
-
1
][
"exitTime"
]
=
self
.
env
.
now
self
.
victim
.
schedule
.
append
({
"station"
:
{
'id'
:
'off-shift'
},
"entranceTime"
:
self
.
env
.
now
})
self
.
requestAllocation
()
self
.
victim
.
timeLastShiftEnded
=
self
.
env
.
now
...
...
@@ -103,8 +104,8 @@ class ShiftScheduler(ObjectInterruption):
self
.
reactivateVictim
()
# re-activate the victim in case it was interrupted
else
:
if
self
.
victim
.
schedule
:
if
len
(
self
.
victim
.
schedule
[
-
1
])
==
2
:
self
.
victim
.
schedule
[
-
1
]
.
append
(
self
.
env
.
now
)
if
not
self
.
victim
.
schedule
[
-
1
].
get
(
"exitTime"
,
None
)
:
self
.
victim
.
schedule
[
-
1
]
[
"exitTime"
]
=
self
.
env
.
now
self
.
requestAllocation
()
# if the victim has interruptions that measure only the on-shift time, they have to be notified
...
...
@@ -157,9 +158,10 @@ class ShiftScheduler(ObjectInterruption):
if
not
self
.
endUnfinished
and
station
.
expectedSignals
[
'processOperatorUnavailable'
]:
self
.
sendSignal
(
receiver
=
station
,
signal
=
station
.
processOperatorUnavailable
)
if
self
.
victim
.
schedule
:
if
len
(
self
.
victim
.
schedule
[
-
1
])
==
2
:
self
.
victim
.
schedule
[
-
1
].
append
(
self
.
env
.
now
)
self
.
victim
.
schedule
.
append
([{
'id'
:
'off-shift'
},
self
.
env
.
now
])
if
not
self
.
victim
.
schedule
[
-
1
].
get
(
"exitTime"
,
None
):
self
.
victim
.
schedule
[
-
1
][
"exitTime"
]
=
self
.
env
.
now
self
.
victim
.
schedule
.
append
({
"station"
:
{
'id'
:
'off-shift'
},
"entranceTime"
:
self
.
env
.
now
})
self
.
requestAllocation
()
# if the victim has interruptions that measure only the on-shift time, they have to be notified
...
...
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