Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NASA Battery Dataset
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GC TICc
16TICc19 HES-SO - Predict
NASA Battery Dataset
Commits
1eb02b4a
Unverified
Commit
1eb02b4a
authored
6 years ago
by
Etienne Frank
Browse files
Options
Downloads
Patches
Plain Diff
Iterate over charges
parent
bac7f581
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
explore_data.py
+83
-0
83 additions, 0 deletions
explore_data.py
with
83 additions
and
0 deletions
explore_data.py
0 → 100644
+
83
−
0
View file @
1eb02b4a
import
scipy.io
import
os
from
glob
import
glob
def
convert_matlab_datetime_vector_to_utc
(
date_vector
):
string_time
=
\
str
(
int
(
date_vector
[
0
]))
+
"
-
"
+
\
str
(
int
(
date_vector
[
1
]))
+
"
-
"
+
\
str
(
int
(
date_vector
[
2
]))
+
"
T
"
+
\
str
(
int
(
date_vector
[
3
]))
+
"
:
"
+
\
str
(
int
(
date_vector
[
4
]))
+
"
:
"
+
\
str
(
float
(
date_vector
[
5
]))
return
string_time
def
filter_mat
(
mat
,
test_type
):
return
[
x
for
x
in
mat
if
x
[
0
][
0
]
==
test_type
]
def
charge_iteration
(
charge_items
):
for
item
in
charge_items
:
test_type
=
item
[
0
][
0
]
# charge impedence discharge
ambiant_temp
=
item
[
1
][
0
][
0
]
# temperature: 4 ~24 ~43
datetime
=
convert_matlab_datetime_vector_to_utc
(
item
[
2
][
0
])
voltage_measured
=
item
[
3
][
0
][
0
][
0
][
0
]
# Battery terminal voltage (Volts)
current_measured
=
item
[
3
][
0
][
0
][
1
][
0
]
# Battery output current (Amps)
temperature_measured
=
item
[
3
][
0
][
0
][
2
][
0
]
# Battery temperature (degree C)
current_charge
=
item
[
3
][
0
][
0
][
3
]
# Current measured at charger (Amps)
voltage_charge
=
item
[
3
][
0
][
0
][
4
]
# Voltage measured at charger (Volts)
# MEH
time
=
item
[
3
][
0
][
0
][
5
]
# Time vector for the cycle (secs)
#check size for plotting
if
(
len
(
voltage_measured
)
!=
len
(
current_measured
)
and
len
(
voltage_measured
)
!=
len
(
temperature_measured
)
and
len
(
voltage_measured
)
!=
len
(
voltage_measured
)
and
len
(
voltage_measured
)
!=
len
(
current_charge
)
):
import
sys
sys
.
exit
(
"
ERROR
"
)
def
main
():
filepaths
=
[
y
for
x
in
os
.
walk
(
"
./data/
"
)
for
y
in
glob
(
os
.
path
.
join
(
x
[
0
],
'
*.mat
'
))]
for
filepath
in
filepaths
:
filename
=
filepath
.
split
(
"
/
"
)[
-
1
].
split
(
"
.
"
)[
0
]
print
(
filename
)
raw_mat
=
scipy
.
io
.
loadmat
(
filepath
)
mat
=
raw_mat
[
filename
][
0
][
0
][
0
][
0
]
impedance_items
=
filter_mat
(
mat
,
"
impedance
"
)
charge_items
=
filter_mat
(
mat
,
"
charge
"
)
discharge_items
=
filter_mat
(
mat
,
"
discharge
"
)
charge_iteration
(
charge_items
)
# print(([1][0]))
# print(mat["B0025"][0][0])
# TODO
# for discharge the fields are:
# Voltage_measured: Battery terminal voltage (Volts)
# Current_measured: Battery output current (Amps)
# Temperature_measured: Battery temperature (degree C)
# Current_charge: Current measured at load (Amps)
# Voltage_charge: Voltage measured at load (Volts)
# Time: Time vector for the cycle (secs)
# Capacity: Battery capacity (Ahr) for discharge till 2.7V
# for impedance the fields are:
# Sense_current: Current in sense branch (Amps)
# Battery_current: Current in battery branch (Amps)
# Current_ratio: Ratio of the above currents
# Battery_impedance: Battery impedance (Ohms) computed from raw data
# Rectified_impedance: Calibrated and smoothed battery impedance (Ohms)
# Re: Estimated electrolyte resistance (Ohms)
# Rct: Estimated charge transfer resistance (Ohms)
if
__name__
==
"
__main__
"
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment