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
bb2092c7
Commit
bb2092c7
authored
Sep 07, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updates in frozen simulation approach
parent
5d81ba21
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
171 deletions
+120
-171
dream/plugins/FrozenSimulation/AddOfferPhaseGenerator.py
dream/plugins/FrozenSimulation/AddOfferPhaseGenerator.py
+1
-1
dream/plugins/FrozenSimulation/projTabular.py
dream/plugins/FrozenSimulation/projTabular.py
+3
-2
dream/plugins/FrozenSimulation/schedTabular.py
dream/plugins/FrozenSimulation/schedTabular.py
+21
-0
dream/simulation/applications/FrozenSimulation/exeSim.py
dream/simulation/applications/FrozenSimulation/exeSim.py
+2
-2
dream/simulation/applications/FrozenSimulation/findSequence.py
.../simulation/applications/FrozenSimulation/findSequence.py
+5
-17
dream/simulation/applications/FrozenSimulation/jsonReader.py
dream/simulation/applications/FrozenSimulation/jsonReader.py
+73
-105
dream/simulation/applications/FrozenSimulation/shiftGeneration.py
...mulation/applications/FrozenSimulation/shiftGeneration.py
+12
-11
dream/simulation/applications/FrozenSimulation/timeCalculations.py
...ulation/applications/FrozenSimulation/timeCalculations.py
+3
-33
No files found.
dream/plugins/FrozenSimulation/AddOfferPhaseGenerator.py
View file @
bb2092c7
...
@@ -32,6 +32,6 @@ class AddOfferPhaseGenerator(plugin.InputPreparationPlugin):
...
@@ -32,6 +32,6 @@ class AddOfferPhaseGenerator(plugin.InputPreparationPlugin):
"stop"
:
0.5
,
"stop"
:
0.5
,
"_class"
:
"dream.simulation.EventGenerator.EventGenerator"
,
"_class"
:
"dream.simulation.EventGenerator.EventGenerator"
,
"method"
:
"dream.simulation.applications.FrozenSimulation.exeSim.exeSim"
,
"method"
:
"dream.simulation.applications.FrozenSimulation.exeSim.exeSim"
,
"argumentDict"
:
{
'jsonInput'
:
data_uri_encoded_input_data
,
'workplanInput'
:
data_uri_encoded_workplan_data
}
"argumentDict"
:
{
'jsonInput'
:
data_uri_encoded_input_data
,
'workplanInput'
:
data_uri_encoded_workplan_data
,
'algorithmAttributes'
:
algorithmAttributes
}
}
}
return
data
return
data
\ No newline at end of file
dream/plugins/FrozenSimulation/projTabular.py
View file @
bb2092c7
...
@@ -3,7 +3,6 @@ Created on 4 Sep 2015
...
@@ -3,7 +3,6 @@ Created on 4 Sep 2015
@author: Anna
@author: Anna
'''
'''
from
dream.plugins
import
plugin
from
dream.plugins
import
plugin
class
projTabular
(
plugin
.
OutputPreparationPlugin
):
class
projTabular
(
plugin
.
OutputPreparationPlugin
):
...
@@ -16,4 +15,6 @@ class projTabular(plugin.OutputPreparationPlugin):
...
@@ -16,4 +15,6 @@ class projTabular(plugin.OutputPreparationPlugin):
for
proj
in
G
.
completionDate
.
keys
():
for
proj
in
G
.
completionDate
.
keys
():
data
[
'result'
][
'result_list'
][
0
][
'exit_output'
].
append
([
proj
,
G
.
completionDate
[
proj
]])
data
[
'result'
][
'result_list'
][
0
][
'exit_output'
].
append
([
proj
,
G
.
completionDate
[
proj
]])
return
data
return
data
\ No newline at end of file
dream/plugins/FrozenSimulation/schedTabular.py
0 → 100644
View file @
bb2092c7
from
dream.plugins
import
plugin
from
operator
import
itemgetter
class
schedTabular
(
plugin
.
OutputPreparationPlugin
):
""" Output the schedule in a tab
"""
def
postprocess
(
self
,
data
):
data
[
'result'
][
'result_list'
][
0
][
'schedule_output'
]
=
[[
'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
:
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'
].
append
(
item
)
return
data
\ No newline at end of file
dream/simulation/applications/FrozenSimulation/exeSim.py
View file @
bb2092c7
...
@@ -179,7 +179,7 @@ def MAM_allocation(currentOp):
...
@@ -179,7 +179,7 @@ def MAM_allocation(currentOp):
print
G
.
resAvailability
[
sorted_startTimeOp
[
0
][
'pm'
]]
print
G
.
resAvailability
[
sorted_startTimeOp
[
0
][
'pm'
]]
def
exeSim
(
jsonInput
,
workplanInput
):
def
exeSim
(
jsonInput
,
workplanInput
,
algorithmAttributes
):
mime_type
,
attachement_data
=
jsonInput
[
len
(
'data:'
):].
split
(
';base64,'
,
1
)
mime_type
,
attachement_data
=
jsonInput
[
len
(
'data:'
):].
split
(
';base64,'
,
1
)
attachement_data
=
attachement_data
.
decode
(
'base64'
)
attachement_data
=
attachement_data
.
decode
(
'base64'
)
...
@@ -190,7 +190,7 @@ def exeSim(jsonInput, workplanInput):
...
@@ -190,7 +190,7 @@ def exeSim(jsonInput, workplanInput):
excelInput
=
attachement_data
excelInput
=
attachement_data
# read input data
# read input data
importInput
(
jInput
,
excelInput
)
importInput
(
jInput
,
excelInput
,
algorithmAttributes
)
# find initial operation
# find initial operation
opDone
=
[]
opDone
=
[]
...
...
dream/simulation/applications/FrozenSimulation/findSequence.py
View file @
bb2092c7
...
@@ -46,11 +46,10 @@ def findSequence(Projects, seqPrjDone, idDone):
...
@@ -46,11 +46,10 @@ def findSequence(Projects, seqPrjDone, idDone):
newOp
[
'minStartTime'
]
=
minStartTime
newOp
[
'minStartTime'
]
=
minStartTime
newOp
[
'project'
]
=
proj
newOp
[
'project'
]
=
proj
newOp
[
'part'
]
=
part
newOp
[
'part'
]
=
part
if
newOp
[
'personnel'
].
lower
()
!=
'automatic'
:
if
newOp
[
'
operation'
]
not
in
[
'INJM'
,
'MILL'
,
'EDM'
,
'INJM-MAN'
]:
#newOp['
personnel'].lower() != 'automatic':
newOp
[
'manualTime'
]
=
newOp
[
'pt'
]
*
newOp
[
'qty'
]
newOp
[
'manualTime'
]
=
newOp
[
'pt'
]
*
newOp
[
'qty'
]
seqPrjDone
[
proj
][
part
]
+=
1
seqPrjDone
[
proj
][
part
]
+=
1
# newOp['manualTime']
# if it is a setup operation add the following operation
# if it is a setup operation add the following operation
if
'SET'
in
newOp
[
'operation'
]:
if
'SET'
in
newOp
[
'operation'
]:
...
@@ -78,7 +77,7 @@ def findSequence(Projects, seqPrjDone, idDone):
...
@@ -78,7 +77,7 @@ def findSequence(Projects, seqPrjDone, idDone):
newOp
[
'autoTime'
]
=
0
newOp
[
'autoTime'
]
=
0
newOp
[
'preID'
]
=
None
newOp
[
'preID'
]
=
None
if
newOp
[
'operation'
]
in
[
'INJM'
,
'MILL'
,
'EDM'
,
'TURN'
,
'DRILL'
]:
if
newOp
[
'operation'
]
in
[
'INJM'
,
'MILL'
,
'EDM'
]:
#
, 'TURN', 'DRILL']:
newOp
[
'mode'
]
=
'MA'
newOp
[
'mode'
]
=
'MA'
elif
newOp
[
'operation'
]
==
'INJM-MAN'
:
elif
newOp
[
'operation'
]
==
'INJM-MAN'
:
...
@@ -88,6 +87,8 @@ def findSequence(Projects, seqPrjDone, idDone):
...
@@ -88,6 +87,8 @@ def findSequence(Projects, seqPrjDone, idDone):
else
:
else
:
newOp
[
'mode'
]
=
'M'
newOp
[
'mode'
]
=
'M'
newOp
[
'sequence'
]
=
seqPrjDone
[
proj
][
part
]
opReady
.
append
(
newOp
)
opReady
.
append
(
newOp
)
print
'pre'
,
opReady
print
'pre'
,
opReady
...
@@ -97,16 +98,3 @@ def findSequence(Projects, seqPrjDone, idDone):
...
@@ -97,16 +98,3 @@ def findSequence(Projects, seqPrjDone, idDone):
return
opReady
return
opReady
if
__name__
==
'__main__'
:
import
jsonReader
as
jR
seq
=
jR
.
seqPrjDone
seq
[
'Order 1'
][
'Order 1 - Mould'
]
=
2
seq
[
'Order 1'
][
'Order 1 - Part 01'
]
=
3
seq
[
'Order 1'
][
'Order 1 - Part 02'
]
=
3
seq
[
'Order 1'
][
'Order 1 - Part 03'
]
=
1
op
=
findSequence
(
jR
.
Projects
,
jR
.
seqPrjDone
,
[
'ID-00001'
,
'ID-00002'
,
'ID-00003'
,
'ID-00004'
,
'ID-00005'
,
'ID-00006'
,
'ID-00007'
,
'ID-00008'
,
'ID-00009'
])
print
'op'
,
op
\ No newline at end of file
dream/simulation/applications/FrozenSimulation/jsonReader.py
View file @
bb2092c7
This diff is collapsed.
Click to expand it.
dream/simulation/applications/FrozenSimulation/shiftGeneration.py
View file @
bb2092c7
...
@@ -7,28 +7,29 @@ Created on 6 Aug 2015
...
@@ -7,28 +7,29 @@ Created on 6 Aug 2015
import
datetime
as
dt
import
datetime
as
dt
from
copy
import
deepcopy
from
copy
import
deepcopy
def
shiftGenerator
(
startDate
,
noDays
):
def
shiftGenerator
(
startDate
,
noDays
,
exceptions
):
shift
=
{}
shift
=
{}
day
=
0
day
=
0
actualDays
=
0
actualDays
=
0
preDay
=
deepcopy
(
startDate
.
date
())
preDay
=
deepcopy
(
startDate
.
date
())
while
actualDays
<
noDays
:
while
actualDays
<
noDays
:
st
=
deepcopy
(
startDate
)
if
day
:
st
=
deepcopy
(
startDate
)
dateStart
=
st
.
date
()
dateStart
=
st
.
date
()
dateStart
+=
dt
.
timedelta
(
days
=
day
)
dateStart
+=
dt
.
timedelta
(
days
=
day
)
if
dateStart
in
exceptions
:
st
=
dt
.
datetime
(
dateStart
.
year
,
dateStart
.
month
,
dateStart
.
day
,
exceptions
[
dateStart
][
0
].
hour
,
exceptions
[
dateStart
][
0
].
minute
)
fin
=
dt
.
datetime
(
st
.
year
,
st
.
month
,
st
.
day
,
exceptions
[
st
.
date
()][
1
].
hour
,
exceptions
[
st
.
date
()][
1
].
minute
)
else
:
st
=
dt
.
datetime
(
dateStart
.
year
,
dateStart
.
month
,
dateStart
.
day
,
8
,
0
)
st
=
dt
.
datetime
(
dateStart
.
year
,
dateStart
.
month
,
dateStart
.
day
,
8
,
0
)
if
st
.
weekday
()
<
5
:
fin
=
dt
.
datetime
(
st
.
year
,
st
.
month
,
st
.
day
,
18
,
0
)
fin
=
dt
.
datetime
(
st
.
year
,
st
.
month
,
st
.
day
,
18
,
0
)
if
st
.
weekday
()
<
5
or
st
.
date
()
in
exceptions
:
shift
[
st
]
=
{
'end'
:
fin
,
'startMode'
:
'SOS'
,
'endMode'
:
'EOS'
,
'preDay'
:
preDay
}
shift
[
st
]
=
{
'end'
:
fin
,
'startMode'
:
'SOS'
,
'endMode'
:
'EOS'
,
'preDay'
:
preDay
}
preDay
=
st
.
date
()
preDay
=
st
.
date
()
actualDays
+=
1
actualDays
+=
1
day
+=
1
day
+=
1
return
shift
return
shift
if
__name__
==
'__main__'
:
shift
=
shiftGenerator
(
dt
.
datetime
(
2015
,
8
,
4
,
12
,
00
),
10
)
dream/simulation/applications/FrozenSimulation/timeCalculations.py
View file @
bb2092c7
...
@@ -127,13 +127,11 @@ def availableTimeInterval_MA(manualTime, autoTime, tStart, availTime):
...
@@ -127,13 +127,11 @@ def availableTimeInterval_MA(manualTime, autoTime, tStart, availTime):
# print 'end manual', sortedTime[i]
# print 'end manual', sortedTime[i]
if
autoTime
:
if
autoTime
:
# if availTime[sortedTime[i]]['end']- max(tStart,sortedTime[i]) <= (manualTime+autoTime):
if
availTime
[
sortedTime
[
i
]][
'end'
]
-
max
(
tManualEnd
,
sortedTime
[
i
])
<=
autoTime
:
if
availTime
[
sortedTime
[
i
]][
'end'
]
-
max
(
tManualEnd
,
sortedTime
[
i
])
<=
autoTime
:
if
availTime
[
sortedTime
[
i
]][
'endMode'
]
==
'EOS'
:
if
availTime
[
sortedTime
[
i
]][
'endMode'
]
==
'EOS'
:
if
i
==
len
(
sortedTime
)
-
1
:
if
i
==
len
(
sortedTime
)
-
1
:
break
break
# if availTime[sortedTime[i+1]]['startMode']=='SOS' and availTime[sortedTime[i+1]]['preDay'] == sortedTime[i].date() and availTime[sortedTime[i+1]]['end'] - max(tStart,sortedTime[i]) >= (manualTime+autoTime):
if
availTime
[
sortedTime
[
i
+
1
]][
'startMode'
]
==
'SOS'
and
availTime
[
sortedTime
[
i
+
1
]][
'preDay'
]
==
sortedTime
[
i
].
date
()
and
availTime
[
sortedTime
[
i
+
1
]][
'end'
]
-
max
(
tManualEnd
,
sortedTime
[
i
])
>=
autoTime
:
if
availTime
[
sortedTime
[
i
+
1
]][
'startMode'
]
==
'SOS'
and
availTime
[
sortedTime
[
i
+
1
]][
'preDay'
]
==
sortedTime
[
i
].
date
()
and
availTime
[
sortedTime
[
i
+
1
]][
'end'
]
-
max
(
tManualEnd
,
sortedTime
[
i
])
>=
autoTime
:
break
break
else
:
else
:
...
@@ -146,14 +144,12 @@ def availableTimeInterval_MA(manualTime, autoTime, tStart, availTime):
...
@@ -146,14 +144,12 @@ def availableTimeInterval_MA(manualTime, autoTime, tStart, availTime):
else
:
else
:
break
break
# return sortedTime[i]
return
startSorted
,
tManualEnd
-
max
(
tStart
,
startSorted
)
return
startSorted
,
tManualEnd
-
max
(
tStart
,
startSorted
)
def
updateAvailTime
(
keyStart
,
reqTime
,
tStart
,
availTime
):
def
updateAvailTime
(
keyStart
,
reqTime
,
tStart
,
availTime
):
# tStart e` tempo effettivo di inizio calcolato in precedenza come max(tStart,keyStart)
# tStart e` tempo effettivo di inizio calcolato in precedenza come max(tStart,keyStart)
# print 'update', keyStart, reqTime, tStart
if
reqTime
<=
dt
.
timedelta
(
seconds
=
0
):
if
reqTime
<=
dt
.
timedelta
(
seconds
=
0
):
return
availTime
return
availTime
...
@@ -166,8 +162,7 @@ def updateAvailTime(keyStart, reqTime, tStart, availTime):
...
@@ -166,8 +162,7 @@ def updateAvailTime(keyStart, reqTime, tStart, availTime):
availTime
[
keyStart
][
'end'
]
=
tStart
availTime
[
keyStart
][
'end'
]
=
tStart
availTime
[
keyStart
][
'endMode'
]
=
'IS'
availTime
[
keyStart
][
'endMode'
]
=
'IS'
# print 'inizio', keyStart, availTime[keyStart]
# case of interval ending before previous end
# case of interval ending before previous end
if
tStart
+
reqTime
<
tempSave
[
'end'
]:
if
tStart
+
reqTime
<
tempSave
[
'end'
]:
availTime
[
tStart
+
reqTime
]
=
{
'end'
:
tempSave
[
'end'
],
'startMode'
:
'IS'
,
'endMode'
:
tempSave
[
'endMode'
],
'preDay'
:
tempSave
[
'preDay'
]}
availTime
[
tStart
+
reqTime
]
=
{
'end'
:
tempSave
[
'end'
],
'startMode'
:
'IS'
,
'endMode'
:
tempSave
[
'endMode'
],
'preDay'
:
tempSave
[
'preDay'
]}
...
@@ -220,7 +215,7 @@ def availableTime_Shift(tStart, tEnd, availTime):
...
@@ -220,7 +215,7 @@ def availableTime_Shift(tStart, tEnd, availTime):
print
'WARNING: beyond last interval'
print
'WARNING: beyond last interval'
availTime
=
updateAvailTime
(
sortedTime
[
i
],
tEnd
-
max
(
tStart
,
sortedTime
[
i
]),
max
(
tStart
,
sortedTime
[
i
]),
availTime
)
availTime
=
updateAvailTime
(
sortedTime
[
i
],
tEnd
-
max
(
tStart
,
sortedTime
[
i
]),
max
(
tStart
,
sortedTime
[
i
]),
availTime
)
if
availTime
[
sortedTime
[
i
+
1
]][
'preDay'
]
==
sortedTime
[
i
].
date
()
and
sortedTime
[
i
+
1
]
>=
tEnd
:
el
if
availTime
[
sortedTime
[
i
+
1
]][
'preDay'
]
==
sortedTime
[
i
].
date
()
and
sortedTime
[
i
+
1
]
>=
tEnd
:
availTime
=
updateAvailTime
(
sortedTime
[
i
],
tEnd
-
max
(
tStart
,
sortedTime
[
i
]),
max
(
tStart
,
sortedTime
[
i
]),
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
:
elif
availTime
[
sortedTime
[
i
+
1
]][
'startMode'
]
==
'SOS'
and
availTime
[
sortedTime
[
i
+
1
]][
'preDay'
]
==
sortedTime
[
i
].
date
()
and
availTime
[
sortedTime
[
i
+
1
]][
'end'
]
>=
tEnd
:
...
@@ -234,28 +229,3 @@ def availableTime_Shift(tStart, tEnd, availTime):
...
@@ -234,28 +229,3 @@ def availableTime_Shift(tStart, tEnd, availTime):
return
availTime
return
availTime
if
__name__
==
'__main__'
:
availTime
=
{
dt
.
datetime
(
2015
,
7
,
23
,
8
,
0
):
{
'end'
:
dt
.
datetime
(
2015
,
7
,
23
,
18
,
0
),
'startMode'
:
'SOS'
,
'endMode'
:
'EOS'
},
dt
.
datetime
(
2015
,
7
,
24
,
8
,
0
):
{
'end'
:
dt
.
datetime
(
2015
,
7
,
24
,
18
,
0
),
'startMode'
:
'SOS'
,
'endMode'
:
'EOS'
},
dt
.
datetime
(
2015
,
7
,
25
,
8
,
0
):
{
'end'
:
dt
.
datetime
(
2015
,
7
,
27
,
18
,
0
),
'startMode'
:
'SOS'
,
'endMode'
:
'EOS'
}}
tStart
=
dt
.
datetime
(
2015
,
7
,
23
,
12
,
00
)
tEnd
=
dt
.
datetime
(
2015
,
7
,
25
,
14
,
0
)
autoTime
=
dt
.
timedelta
(
hours
=
20
)
manualTime
=
dt
.
timedelta
(
hours
=
4
)
print
tStart
keyStart
,
pt
=
availableTimeInterval_MM
(
manualTime
,
autoTime
,
tStart
,
availTime
)
print
keyStart
# pt = manualTime + autoTime
print
'pt'
,
pt
if
keyStart
:
availTime
=
updateAvailTime
(
keyStart
,
pt
,
max
(
tStart
,
keyStart
),
availTime
)
else
:
print
'WARNING: operation cannot be performed'
#availTime = availableTime_Shift(tStart, tEnd, availTime)
print
'updated time'
,
availTime
\ No newline at end of file
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