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
f1b8b2bd
Commit
f1b8b2bd
authored
Sep 17, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes in frozen simulation
parent
6227d142
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
181 additions
and
128 deletions
+181
-128
dream/plugins/FrozenSimulation/PostProcessingOfferPhase.py
dream/plugins/FrozenSimulation/PostProcessingOfferPhase.py
+1
-1
dream/plugins/FrozenSimulation/projTabular.py
dream/plugins/FrozenSimulation/projTabular.py
+3
-3
dream/plugins/FrozenSimulation/schedTabular.py
dream/plugins/FrozenSimulation/schedTabular.py
+20
-2
dream/simulation/applications/FrozenSimulation/Globals.py
dream/simulation/applications/FrozenSimulation/Globals.py
+17
-6
dream/simulation/applications/FrozenSimulation/exeSim.py
dream/simulation/applications/FrozenSimulation/exeSim.py
+90
-73
dream/simulation/applications/FrozenSimulation/findSequence.py
.../simulation/applications/FrozenSimulation/findSequence.py
+5
-13
dream/simulation/applications/FrozenSimulation/jsonReader.py
dream/simulation/applications/FrozenSimulation/jsonReader.py
+34
-20
dream/simulation/applications/FrozenSimulation/timeCalculations.py
...ulation/applications/FrozenSimulation/timeCalculations.py
+11
-10
No files found.
dream/plugins/FrozenSimulation/PostProcessingOfferPhase.py
View file @
f1b8b2bd
...
...
@@ -18,6 +18,6 @@ class PostProcessingOfferPhase(plugin.OutputPreparationPlugin):
data
[
'result'
][
'result_list'
][
-
1
][
self
.
configuration_dict
[
'output_id'
]]
=
{
'name'
:
'Result.xlsx'
,
'mime_type'
:
'application/vnd.ms-excel'
,
'data'
:
G
.
tabSchedule
.
xlsx
.
encode
(
'base64'
)
'data'
:
G
.
reportResults
.
xlsx
.
encode
(
'base64'
)
}
return
data
\ No newline at end of file
dream/plugins/FrozenSimulation/projTabular.py
View file @
f1b8b2bd
...
...
@@ -10,10 +10,10 @@ class projTabular(plugin.OutputPreparationPlugin):
"""
def
postprocess
(
self
,
data
):
data
[
'result'
][
'result_list'
][
0
][
'exit_output'
]
=
[[
'Project'
,
'Earliest Completion Date'
]]
data
[
'result'
][
'result_list'
][
0
][
'exit_output'
]
=
[[
'Project'
,
'Earliest Completion Date'
,
'Conservative estimate Completion Date'
]]
from
dream.simulation.applications.FrozenSimulation.Globals
import
G
for
proj
in
G
.
completionDate
.
keys
():
data
[
'result'
][
'result_list'
][
0
][
'exit_output'
].
append
([
proj
,
G
.
completionDate
[
proj
]])
for
proj
in
G
.
completionDate
[
'Earliest'
]
.
keys
():
data
[
'result'
][
'result_list'
][
0
][
'exit_output'
].
append
([
proj
,
G
.
completionDate
[
'Earliest'
][
proj
],
G
.
completionDate
[
'Latest'
]
[
proj
]])
return
data
...
...
dream/plugins/FrozenSimulation/schedTabular.py
View file @
f1b8b2bd
...
...
@@ -2,7 +2,7 @@
from
dream.plugins
import
plugin
from
operator
import
itemgetter
class
schedTabular
(
plugin
.
OutputPreparationPlugin
):
class
schedTabular
Earliest
(
plugin
.
OutputPreparationPlugin
):
""" Output the schedule in a tab
"""
...
...
@@ -11,7 +11,7 @@ class schedTabular(plugin.OutputPreparationPlugin):
from
dream.simulation.applications.FrozenSimulation.Globals
import
G
# sort schedule items in start time ascending order
sList
=
[]
for
entry
in
G
.
tabSchedule
:
for
entry
in
G
.
tabSchedule
[
'Earliest'
]
:
if
'End Time'
not
in
entry
:
sList
.
append
([
x
for
x
in
entry
])
sList
=
sorted
(
sList
,
key
=
itemgetter
(
5
))
...
...
@@ -19,3 +19,21 @@ class schedTabular(plugin.OutputPreparationPlugin):
data
[
'result'
][
'result_list'
][
0
][
'schedule_output'
].
append
(
item
)
return
data
class
schedTabularLatest
(
plugin
.
OutputPreparationPlugin
):
""" Output the schedule in a tab
"""
def
postprocess
(
self
,
data
):
data
[
'result'
][
'result_list'
][
0
][
'schedule_output_latest'
]
=
[[
'Project'
,
'Part'
,
'Task ID'
,
'Station'
,
'Operator'
,
'Start Time'
,
'End Time'
]]
from
dream.simulation.applications.FrozenSimulation.Globals
import
G
# sort schedule items in start time ascending order
sList
=
[]
for
entry
in
G
.
tabSchedule
[
'Latest'
]:
if
'End Time'
not
in
entry
:
sList
.
append
([
x
for
x
in
entry
])
sList
=
sorted
(
sList
,
key
=
itemgetter
(
5
))
for
item
in
sList
:
data
[
'result'
][
'result_list'
][
0
][
'schedule_output_latest'
].
append
(
item
)
return
data
\ No newline at end of file
dream/simulation/applications/FrozenSimulation/Globals.py
View file @
f1b8b2bd
...
...
@@ -9,14 +9,25 @@ import tablib
class
G
:
Schedule
=
{}
seqPrjDone
=
None
resAvailability
=
None
MachPool
=
None
PMPool
=
None
Projects
=
None
xlreftime
=
None
reportResults
=
tablib
.
Databook
()
tabSchedule
=
tablib
.
Dataset
(
title
=
'Schedule'
)
tabSchedule
.
headers
=
([
'Project'
,
'Part'
,
'Task ID'
,
'Station'
,
'Operator'
,
'Start Time'
,
'End Time'
])
OrderDates
=
None
completionDate
=
None
jsonInput
=
None
excelInput
=
None
simMode
=
None
# reporting tabs
reportResults
=
tablib
.
Databook
()
tabSchedule
=
{}
pmSchedule
=
{}
tabScheduleOrig
=
[]
pmScheduleOrig
=
[]
# re-initialised variables
completionDate
=
{}
seqPrjDone
=
None
resAvailability
=
None
seqPrjDoneOrig
=
None
resAvailabilityOrig
=
None
dream/simulation/applications/FrozenSimulation/exeSim.py
View file @
f1b8b2bd
This diff is collapsed.
Click to expand it.
dream/simulation/applications/FrozenSimulation/findSequence.py
View file @
f1b8b2bd
...
...
@@ -11,9 +11,6 @@ def findSequence(Projects, seqPrjDone, idDone):
opReady
=
[]
print
'find sequence'
,
Projects
print
'find sequence'
,
seqPrjDone
for
proj
in
seqPrjDone
.
keys
():
for
part
in
seqPrjDone
[
proj
].
keys
():
...
...
@@ -22,12 +19,11 @@ def findSequence(Projects, seqPrjDone, idDone):
possibleOp
=
True
print
'part'
,
part
,
Projects
[
proj
][
part
][
seqPrjDone
[
proj
][
part
]][
'id'
]
if
seqPrjDone
[
proj
][
part
]
==
0
or
Projects
[
proj
][
part
][
seqPrjDone
[
proj
][
part
]
-
1
][
'id'
]
not
in
G
.
Schedule
.
keys
():
# set minimum start time for operation
if
seqPrjDone
[
proj
][
part
]
==
0
or
Projects
[
proj
][
part
][
seqPrjDone
[
proj
][
part
]
-
1
][
'id'
]
not
in
G
.
Schedule
[
G
.
simMode
].
keys
():
minStartTime
=
max
(
G
.
xlreftime
,
G
.
OrderDates
[
proj
])
else
:
minStartTime
=
G
.
Schedule
[
Projects
[
proj
][
part
][
seqPrjDone
[
proj
][
part
]
-
1
][
'id'
]][
'endDate'
]
minStartTime
=
G
.
Schedule
[
G
.
simMode
][
Projects
[
proj
][
part
][
seqPrjDone
[
proj
][
part
]
-
1
][
'id'
]][
'endDate'
]
# verify whether the operation can be performed in terms of prerequisite operations
for
preReq
in
Projects
[
proj
][
part
][
seqPrjDone
[
proj
][
part
]][
'preReq'
]:
...
...
@@ -37,12 +33,11 @@ def findSequence(Projects, seqPrjDone, idDone):
break
else
:
if
minStartTime
<
G
.
Schedule
[
preReq
][
'endDate'
]:
minStartTime
=
G
.
Schedule
[
preReq
][
'endDate'
]
if
minStartTime
<
G
.
Schedule
[
G
.
simMode
][
preReq
][
'endDate'
]:
minStartTime
=
G
.
Schedule
[
G
.
simMode
][
preReq
][
'endDate'
]
if
possibleOp
:
newOp
=
Projects
[
proj
][
part
][
seqPrjDone
[
proj
][
part
]]
print
newOp
[
'id'
],
'possible'
newOp
[
'minStartTime'
]
=
minStartTime
newOp
[
'project'
]
=
proj
newOp
[
'part'
]
=
part
...
...
@@ -59,7 +54,6 @@ def findSequence(Projects, seqPrjDone, idDone):
seqPrjDone
[
proj
][
part
]
+=
1
# verify that the operation is the same
print
followOp
[
'operation'
],
newOp
[
'operation'
]
assert
(
followOp
[
'operation'
].
split
(
'-'
)[
0
]
in
newOp
[
'operation'
])
# update operation (erase set)
...
...
@@ -91,10 +85,8 @@ def findSequence(Projects, seqPrjDone, idDone):
opReady
.
append
(
newOp
)
print
'pre'
,
opReady
opReady
=
sorted
(
opReady
,
key
=
itemgetter
(
'sequence'
,
'manualTime'
,
'autoTime'
))
print
'seq'
,
seqPrjDone
,
G
.
seqPrjDone
return
opReady
dream/simulation/applications/FrozenSimulation/jsonReader.py
View file @
f1b8b2bd
...
...
@@ -114,22 +114,18 @@ def importInput(jInput, excelInput, algorithmAttributes):
part
=
item
[
0
].
encode
(
'ascii'
,
'ignore'
)
#print 'startDate', startDate.date()
if
pt
.
seconds
>
0
or
pt
.
days
>
0
:
forzenOpsData
.
append
([
startDate
.
date
(),
part
,
order
,
item
[
3
],
item
[
7
],
station
,
startDate
.
time
(),
dateOut
.
time
(),
ordinalOutDate
,
'X'
])
frozen
[
item
[
3
]]
=
'X'
G
.
tabSchedule
.
append
([
order
,
part
,
item
[
3
],
station
,
item
[
7
],
startDate
,
dateOut
])
if
station
not
in
takenPeriods
:
takenPeriods
[
station
]
=
{}
G
.
tabScheduleOrig
.
append
([
order
,
part
,
item
[
3
],
station
,
item
[
7
],
startDate
,
dateOut
])
takenPeriods
[
station
]
[
startDate
]
=
{
'endDate'
:
dateOut
,
'taskID'
:
item
[
3
]}
takenPeriods
.
setdefault
(
station
,{})
[
startDate
]
=
{
'endDate'
:
dateOut
,
'taskID'
:
item
[
3
]}
# import PM schedule
PMschedule
=
dataJSON
[
'result'
][
'result_list'
][
selSol
][
'operator_gantt'
][
'task_list'
]
# extract resource availability
for
item
in
PMschedule
:
if
'parent'
in
item
.
keys
():
pm
=
item
[
'parent'
]
...
...
@@ -143,22 +139,17 @@ def importInput(jInput, excelInput, algorithmAttributes):
continue
if
pt
:
print
pm
,
taskID
if
pm
not
in
takenPeriods
:
takenPeriods
[
pm
]
=
{}
takenPeriods
[
pm
][
startDate
]
=
{
'endDate'
:
stopDate
,
'taskID'
:
taskID
}
print
'frozen operations'
,
forzenOpsData
print
'taken periods'
,
takenPeriods
G
.
pmScheduleOrig
.
append
([
pm
,
startDate
,
stopDate
,
taskID
])
#=================================
# Import Workplan from Excel file
#=================================
global
numParts
WorkPlan
=
wb
.
sheet_by_index
(
0
)
Projects
=
{}
...
...
@@ -304,6 +295,15 @@ def importInput(jInput, excelInput, algorithmAttributes):
if
'INJM-MAN'
in
skills
:
skills
.
remove
(
'INJM-MAN'
)
skills
.
append
(
'INJM'
)
if
'INJM-SET'
in
skills
:
skills
.
remove
(
'INJM-SET'
)
skills
.
append
(
'INJM'
)
if
'EDM-SET'
in
skills
:
skills
.
remove
(
'EDM-SET'
)
skills
.
append
(
'EDM'
)
if
'MILL-SET'
in
skills
:
skills
.
remove
(
'MILL-SET'
)
skills
.
append
(
'MILL'
)
PMInfo
.
append
({
'name'
:
PMskills
[
item
][
0
],
'skills'
:
skills
,
'sched'
:
'FIFO'
,
'status'
:
''
})
for
sk
in
skills
:
...
...
@@ -348,11 +348,25 @@ def importInput(jInput, excelInput, algorithmAttributes):
resAvailability
[
mach
]
=
availableTime_Shift
(
unavailDate
,
takenPeriods
[
mach
][
unavailDate
][
'endDate'
],
resAvailability
[
mach
])
# set global variables
G
.
resAvailability
=
deepcopy
(
resAvailability
)
G
.
seqPrjDone
=
deepcopy
(
seqPrjDone
)
G
.
resAvailability
=
deepcopy
(
resAvailability
)
G
.
seqPrjDoneOrig
=
deepcopy
(
seqPrjDone
)
G
.
resAvailabilityOrig
=
deepcopy
(
resAvailability
)
G
.
MachPool
=
deepcopy
(
MachPool
)
print
'mach pool'
,
G
.
MachPool
G
.
PMPool
=
deepcopy
(
PMPool
)
G
.
Projects
=
deepcopy
(
Projects
)
G
.
OrderDates
=
deepcopy
(
OrderDates
)
G
.
completionDate
=
deepcopy
(
OrderDates
)
def
initGlobals
():
G
.
resAvailability
=
deepcopy
(
G
.
resAvailabilityOrig
)
G
.
seqPrjDone
=
deepcopy
(
G
.
seqPrjDoneOrig
)
G
.
Schedule
[
G
.
simMode
]
=
{}
G
.
completionDate
[
G
.
simMode
]
=
deepcopy
(
G
.
OrderDates
)
G
.
tabSchedule
[
G
.
simMode
]
=
tablib
.
Dataset
(
title
=
'Schedule'
+
str
(
G
.
simMode
))
G
.
tabSchedule
[
G
.
simMode
].
headers
=
([
'Project'
,
'Part'
,
'Task ID'
,
'Station'
,
'Operator'
,
'Start Time'
,
'End Time'
])
for
item
in
G
.
tabScheduleOrig
:
G
.
tabSchedule
[
G
.
simMode
].
append
(
item
)
G
.
pmSchedule
[
G
.
simMode
]
=
tablib
.
Dataset
(
title
=
'PMschedule'
+
str
(
G
.
simMode
))
for
item
in
G
.
pmScheduleOrig
:
G
.
pmSchedule
[
G
.
simMode
].
append
(
item
)
dream/simulation/applications/FrozenSimulation/timeCalculations.py
View file @
f1b8b2bd
...
...
@@ -12,8 +12,10 @@ def availableTimeInterval_Manual(manualTime, tStart, availTime):
# suitable for manual operations...returns available time until the end
# sort time intervals according to ascending start date
sortedTime
=
sorted
(
availTime
.
keys
())
# find the interval for which the start date is just above tStart
i
=
0
while
i
<
len
(
sortedTime
)
and
sortedTime
[
i
]
<=
tStart
:
i
+=
1
...
...
@@ -25,6 +27,7 @@ def availableTimeInterval_Manual(manualTime, tStart, availTime):
# if i == 0 and tStart + manualTime < sortedTime[i]:
# return None
# go to next interval if available time is null
if
availTime
[
sortedTime
[
i
]][
'end'
]
-
max
(
tStart
,
sortedTime
[
i
])
<=
dt
.
timedelta
(
seconds
=
0
):
i
+=
1
...
...
@@ -59,6 +62,10 @@ def availableTimeInterval_MM(manualTime, autoTime, tStart, availTime):
if
availTime
[
sortedTime
[
i
]][
'endMode'
]
==
'EOS'
:
if
i
+
1
<
len
(
sortedTime
)
and
availTime
[
sortedTime
[
i
+
1
]][
'preDay'
]
==
sortedTime
[
i
].
date
()
and
availTime
[
sortedTime
[
i
+
1
]][
'startMode'
]
==
'SOS'
:
tCumulative
+=
availTime
[
sortedTime
[
i
]][
'end'
]
-
max
(
tStart
,
sortedTime
[
i
])
else
:
tCumulative
=
dt
.
timedelta
(
seconds
=
0
)
if
i
+
1
<
len
(
sortedTime
):
startSorted
=
sortedTime
[
i
+
1
]
else
:
tCumulative
=
dt
.
timedelta
(
seconds
=
0
)
...
...
@@ -79,8 +86,6 @@ def availableTimeInterval_MA(manualTime, autoTime, tStart, availTime):
sortedTime
=
sorted
(
availTime
.
keys
())
print
sortedTime
i
=
0
while
i
<
len
(
sortedTime
)
and
sortedTime
[
i
]
<=
tStart
:
i
+=
1
...
...
@@ -92,8 +97,6 @@ def availableTimeInterval_MA(manualTime, autoTime, tStart, availTime):
# if i == 0 and tStart + autoTime + manualTime < sortedTime[i]:
# return None
print
'start'
,
sortedTime
[
i
]
while
True
:
tCumulative
=
dt
.
timedelta
(
seconds
=
0
)
...
...
@@ -104,6 +107,10 @@ def availableTimeInterval_MA(manualTime, autoTime, tStart, availTime):
if
availTime
[
sortedTime
[
i
]][
'endMode'
]
==
'EOS'
:
if
i
+
1
<
len
(
sortedTime
)
and
availTime
[
sortedTime
[
i
+
1
]][
'preDay'
]
==
sortedTime
[
i
].
date
()
and
availTime
[
sortedTime
[
i
+
1
]][
'startMode'
]
==
'SOS'
:
tCumulative
+=
availTime
[
sortedTime
[
i
]][
'end'
]
-
max
(
tStart
,
sortedTime
[
i
])
else
:
tCumulative
=
dt
.
timedelta
(
seconds
=
0
)
if
i
+
1
<
len
(
sortedTime
):
startSorted
=
sortedTime
[
i
+
1
]
else
:
tCumulative
=
dt
.
timedelta
(
seconds
=
0
)
...
...
@@ -124,8 +131,6 @@ def availableTimeInterval_MA(manualTime, autoTime, tStart, availTime):
if
i
>=
len
(
sortedTime
):
return
None
# print 'end manual', sortedTime[i]
if
autoTime
:
if
availTime
[
sortedTime
[
i
]][
'end'
]
-
max
(
tManualEnd
,
sortedTime
[
i
])
<=
autoTime
:
if
availTime
[
sortedTime
[
i
]][
'endMode'
]
==
'EOS'
:
...
...
@@ -181,7 +186,6 @@ def updateAvailTime(keyStart, reqTime, tStart, availTime):
print
'WARNING: beyond planning horizon'
return
availTime
# print 'find next time', sortedTime[i], i
if
tStart
+
reqTime
>
sortedTime
[
i
]:
# repeat procedure
availTime
=
updateAvailTime
(
sortedTime
[
i
],
reqTime
-
(
sortedTime
[
i
]
-
tStart
),
sortedTime
[
i
],
availTime
)
...
...
@@ -198,8 +202,6 @@ def availableTime_Shift(tStart, tEnd, availTime):
i
+=
1
# print i, sortedTime[i], availTime[sortedTime[i]]['end'], tStart, tEnd
if
i
>=
len
(
sortedTime
):
print
'WARNING: time interval not found'
return
availTime
...
...
@@ -219,7 +221,6 @@ def availableTime_Shift(tStart, tEnd, availTime):
availTime
=
updateAvailTime
(
sortedTime
[
i
],
tEnd
-
max
(
tStart
,
sortedTime
[
i
]),
max
(
tStart
,
sortedTime
[
i
]),
availTime
)
elif
availTime
[
sortedTime
[
i
+
1
]][
'startMode'
]
==
'SOS'
and
availTime
[
sortedTime
[
i
+
1
]][
'preDay'
]
==
sortedTime
[
i
].
date
()
and
availTime
[
sortedTime
[
i
+
1
]][
'end'
]
>=
tEnd
:
print
'beyond eos'
,
max
(
tStart
,
sortedTime
[
i
]),
tEnd
-
max
(
tStart
,
sortedTime
[
i
])
availTime
=
updateAvailTime
(
sortedTime
[
i
],
tEnd
-
max
(
tStart
,
sortedTime
[
i
]),
max
(
tStart
,
sortedTime
[
i
]),
availTime
)
else
:
return
availTime
...
...
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