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
081cdbed
Commit
081cdbed
authored
Jan 30, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugin to read rolling capacity of capacity stations added
parent
c1043314
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletion
+53
-1
dream/plugins/AvailableCapacitySpreadsheet.py
dream/plugins/AvailableCapacitySpreadsheet.py
+47
-0
dream/simulation/Examples/CapacityProjectAllInOneEmpty.json
dream/simulation/Examples/CapacityProjectAllInOneEmpty.json
+6
-1
No files found.
dream/plugins/AvailableCapacitySpreadsheet.py
0 → 100644
View file @
081cdbed
from
copy
import
copy
import
json
import
time
import
random
import
operator
import
datetime
from
dream.plugins
import
plugin
class
AvailableCapacitySpreadsheet
(
plugin
.
InputPreparationPlugin
):
""" Input prepration
read wip-srpeadsheet data and update the wip property of the stations.
"""
def
preprocess
(
self
,
data
):
strptime
=
datetime
.
datetime
.
strptime
capacityData
=
data
[
'input'
].
get
(
'available_capacity_spreadsheet'
,
None
)
node
=
data
[
'graph'
][
'node'
]
now
=
strptime
(
data
[
'general'
][
'currentDate'
],
'%Y/%m/%d'
)
if
capacityData
:
numberOfStations
=
len
(
capacityData
[
0
])
-
1
numberOfExceptions
=
len
(
capacityData
)
# loop through stations
for
col
in
range
(
numberOfStations
):
stationId
=
capacityData
[
0
][
col
+
1
]
assert
stationId
in
data
[
'graph'
][
'node'
].
keys
(),
'available capacity spreadsheet has station id that does not exist in production line'
# for every station read the interval capacity (Monday to Sunday)
intervalCapacity
=
[]
for
row
in
range
(
7
):
intervalCapacity
.
append
(
float
(
capacityData
[
row
+
1
][
col
+
1
]))
node
[
stationId
][
'intervalCapacity'
]
=
intervalCapacity
# for every station read the interval capacity exceptions
for
row
in
range
(
8
,
len
(
capacityData
)):
if
not
capacityData
[
row
][
0
]:
break
exeptionDate
=
strptime
(
capacityData
[
row
][
0
],
'%Y/%m/%d'
)
dayDifference
=
(
exeptionDate
-
now
).
days
assert
dayDifference
>=
0
,
'exception date for past day given'
intervalCapacityExceptions
=
node
[
stationId
].
get
(
'intervalCapacityExceptions'
,{})
if
not
intervalCapacityExceptions
:
node
[
stationId
][
'intervalCapacityExceptions'
]
=
{}
node
[
stationId
][
'intervalCapacityExceptions'
][
str
(
float
(
dayDifference
))]
=
float
(
capacityData
[
row
][
col
+
1
])
# set the interval capacity start
node
[
stationId
][
'intervalCapacityStart'
]
=
now
.
weekday
()
return
data
\ No newline at end of file
dream/simulation/Examples/CapacityProjectAllInOneEmpty.json
View file @
081cdbed
...
...
@@ -634,7 +634,12 @@
}
},
"pre_processing"
:
{
"plugin_list"
:
[]
"plugin_list"
:
[
{
"_class"
:
"dream.plugins.AvailableCapacitySpreadsheet.AvailableCapacitySpreadsheet"
,
"input_id"
:
"availableCapacity"
}
]
},
"processing_plugin"
:
{
"_class"
:
"dream.plugins.plugin.DefaultExecutionPlugin"
,
...
...
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