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
df071c74
Commit
df071c74
authored
Jun 16, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transpose available capacity input spreadsheet
parent
d4861bec
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
23 deletions
+31
-23
dream/platform/static/src/dream_launcher.js
dream/platform/static/src/dream_launcher.js
+4
-1
dream/platform/static/src/jsonPlumb.js
dream/platform/static/src/jsonPlumb.js
+4
-5
dream/simulation/Examples/CapacityProject_example.json
dream/simulation/Examples/CapacityProject_example.json
+14
-14
dream/simulation/GUI/CapacityProject.py
dream/simulation/GUI/CapacityProject.py
+9
-3
No files found.
dream/platform/static/src/dream_launcher.js
View file @
df071c74
...
...
@@ -106,7 +106,10 @@
var
capacity_by_station_spreadsheet_data
=
data
.
capacity_by_station_spreadsheet
;
if
(
capacity_by_station_spreadsheet_data
!==
undefined
)
{
var
spreadsheet
=
$
(
'
#capacity_by_station_spreadsheet
'
);
spreadsheet
.
handsontable
(
'
populateFromArray
'
,
0
,
0
,
capacity_by_station_spreadsheet_data
);
var
hot
=
spreadsheet
.
handsontable
(
'
getInstance
'
);
hot
.
updateSettings
({
minCols
:
Math
.
min
(
capacity_by_station_spreadsheet_data
.
length
,
3
)
})
hot
.
populateFromArray
(
0
,
0
,
capacity_by_station_spreadsheet_data
);
}
var
preference
=
data
.
preference
!==
undefined
?
...
...
dream/platform/static/src/jsonPlumb.js
View file @
df071c74
...
...
@@ -189,16 +189,15 @@
var
capacity_by_station_spreadsheet
=
$
(
'
#capacity_by_station_spreadsheet
'
);
var
data
=
[
[
"
Machine
"
,
"
Day 0
"
,
"
Day 1
"
,
"
Day 2
"
,
"
Day 3
"
,
"
Day
"
,
"
CS1
"
,
"
CS2
"
]
];
capacity_by_station_spreadsheet
.
handsontable
({
data
:
data
,
minSpareRows
:
1
,
minSpareCols
:
1
,
// Allow adding columns
stretchH
:
'
all
'
,
width
:
function
()
{
return
$
(
window
).
width
()
-
...
...
dream/simulation/Examples/CapacityProject_example.json
View file @
df071c74
...
...
@@ -24,28 +24,28 @@
"capacity_by_station_spreadsheet"
:
[
[
"Machine"
,
"Day 0"
,
"Day 1"
,
"Day 2"
,
"Day 3"
"SMF"
,
"WELD"
],
[
"
SMF
"
,
"
Day 0
"
,
"100"
,
"200"
,
"300"
,
""
"150"
,
null
],
[
"
WELD
"
,
"
15
0"
,
"
Day 1
"
,
"
20
0"
,
"60"
,
null
],
[
"Day 2"
,
"300"
,
"350"
,
null
],
[
null
,
""
,
null
,
null
,
null
...
...
dream/simulation/GUI/CapacityProject.py
View file @
df071c74
...
...
@@ -4,6 +4,7 @@ import time
import
random
import
operator
from
datetime
import
datetime
from
collections
import
defaultdict
from
dream.simulation.GUI.Default
import
Simulation
as
DefaultSimulation
from
dream.simulation.GUI.Default
import
schema
...
...
@@ -58,9 +59,14 @@ class Simulation(DefaultSimulation):
# read the spreadsheets
# a mapping station id -> list of interval capacity
available_capacity_by_station
=
dict
()
for
line
in
data
.
pop
(
'capacity_by_station_spreadsheet'
)[
1
:]:
available_capacity_by_station
[
line
[
0
]]
=
[
float
(
x
)
for
x
in
line
[
1
:]
if
x
]
available_capacity_by_station
=
defaultdict
(
list
)
capacity_by_station_spreadsheet
=
data
.
pop
(
'capacity_by_station_spreadsheet'
)
station_id_list
=
copy
([
x
for
x
in
capacity_by_station_spreadsheet
[
0
][
1
:]
if
x
])
for
line
in
capacity_by_station_spreadsheet
[
1
:]:
for
station_id
,
capacity
in
zip
(
station_id_list
,
line
[
1
:]):
available_capacity_by_station
[
station_id
].
append
(
float
(
capacity
or
0
))
assert
set
(
station_id_list
)
==
set
(
data
[
'nodes'
].
keys
()),
"Check stations ids in capacity spreadsheet"
# a mapping project id -> mapping station_id -> required capacity
required_capacity_by_project
=
dict
()
...
...
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