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
8389f3fe
Commit
8389f3fe
authored
Nov 14, 2013
by
Georgios Dagkakis
Committed by
Jérome Perrin
Dec 02, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ExcelHandler.outputLog method added. This gives the chance to output the log of Entities to excel
parent
059d4f94
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
4 deletions
+24
-4
dream/simulation/ExcelHandler.py
dream/simulation/ExcelHandler.py
+24
-4
No files found.
dream/simulation/ExcelHandler.py
View file @
8389f3fe
...
...
@@ -31,9 +31,29 @@ from Globals import G
import
xlwt
import
xlrd
#outputs the trace of the simulation run
def
outputTrace
(
fileName
=
'Trace'
):
G
.
traceFile
.
save
(
str
(
fileName
)
+
'.xls'
)
G
.
traceIndex
=
0
#index that shows in what row we are
G
.
sheetIndex
=
1
#index that shows in what sheet we are
G
.
traceFile
=
xlwt
.
Workbook
()
#create excel file
G
.
traceSheet
=
G
.
traceFile
.
add_sheet
(
'sheet '
+
str
(
G
.
sheetIndex
),
cell_overwrite_ok
=
True
)
#create excel sheet
\ No newline at end of file
#outputs the log of the Entities given
#the format is (Entity Name | Station ID | time)
def
outputLog
(
fileName
=
'Log'
,
entityList
=
G
.
EntityList
):
sheetIndex
=
1
#index that shows in which sheet we are
logIndex
=
0
#index that shows in what row we are
logFile
=
xlwt
.
Workbook
()
#create excel file
logSheet
=
logFile
.
add_sheet
(
'sheet '
+
str
(
sheetIndex
),
cell_overwrite_ok
=
True
)
#create excel sheet
#post processing for outputting the Log
for
entity
in
entityList
:
for
stop
in
entity
.
schedule
:
logSheet
.
write
(
logIndex
,
0
,
entity
.
name
)
logSheet
.
write
(
logIndex
,
1
,
stop
[
0
])
logSheet
.
write
(
logIndex
,
2
,
stop
[
1
])
logIndex
+=
1
#increment the row
#if we reach row 65536 we need to create a new sheet (excel limitation)
if
(
logIndex
==
65536
):
logIndex
=
0
sheetIndex
+=
1
logSheet
=
logFile
.
add_sheet
(
'sheet '
+
str
(
sheetIndex
),
cell_overwrite_ok
=
True
)
logFile
.
save
(
str
(
fileName
)
+
'.xls'
)
\ 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