from emobpy import DataBase, Export
from emobpy.plot import NBplot
DBm = DataBase('db')
DBm.loadfiles_batch(kind="driving") # load files in parallel that only contains Mobility time-series
Workers: 4 of 16 7
mname = list(DBm.db.keys())[0]
mname
'BEV1_W2_fd3ea'
vizm = NBplot(DBm)
figm = vizm.sgplot_dp(mname)
figm.show()
DBc = DataBase('db')
DBc.loadfiles_batch(kind="consumption", add_variables=['Trips'])
Workers: 4 of 16 7
cname = list(DBc.db.keys())[0]
cname
'BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2'
vizc = NBplot(DBc)
figc = vizc.sankey(cname, include=None, to_html=False, path='sankey.html')
Consumption [kWh]: 14.774 Distance [km]: 66.0 Specific consumption [kWh/100 km]: 22.385
figc.show()
DBa = DataBase('db')
DBa.loadfiles_batch(kind="availability")
Workers: 4 of 16 7
aname = list(DBa.db.keys())[0]
aname
'BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2'
viza = NBplot(DBa)
figg = viza.sgplot_ga(aname, rng=None, to_html=False, path=None)
figg.show()
DBd = DataBase('db')
DBd.loadfiles_batch(kind="charging")
Workers: 4 of 16 7
dname = list(DBd.db.keys())[0]
dname
'BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2_balanced_6dc8c'
vizd = NBplot(DBd)
figd = vizd.sgplot_ged(dname, rng=None, to_html=False, path=None)
figd.show()
DB = DataBase('db')
DB.update()
Exp = Export()
Exp.loaddata(DB)
Exp.to_csv()
Exp.save_files()
# See the two CSV files at "db" folder
Summary file: db/bev_data_input.csv Time series file: db/bev_time_series.csv
list(DB.db.keys())
['BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2', 'BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2_from_0_to_24_at_home_4bfa9', 'BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2_from_23_to_8_at_any_285e1', 'BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2', 'BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2_balanced_6dc8c', 'BEV1_W2_fd3ea', 'BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2_immediate_52d4b']
TS_id = list(DB.db.keys())[0] # you can choose any
TS_id
'BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2'
df = DB.db[TS_id]['timeseries']
df
hh | state | distance | consumption | charging_point | charging_cap | soc | |
---|---|---|---|---|---|---|---|
date | |||||||
2020-01-01 00:00:00 | 0.0 | home | 0.0 | 0.0 | public | 22 | 0.61 |
2020-01-01 00:15:00 | 0.25 | home | 0.0 | 0.0 | public | 22 | 0.72 |
2020-01-01 00:30:00 | 0.5 | home | 0.0 | 0.0 | public | 22 | 0.83 |
2020-01-01 00:45:00 | 0.75 | home | 0.0 | 0.0 | public | 22 | 0.94 |
2020-01-01 01:00:00 | 1.0 | home | 0.0 | 0.0 | public | 22 | 1.0 |
... | ... | ... | ... | ... | ... | ... | ... |
2020-01-07 22:45:00 | 166.75 | home | 0.0 | 0.0 | none | 0 | 0.981123 |
2020-01-07 23:00:00 | 167.0 | home | 0.0 | 0.0 | none | 0 | 0.981123 |
2020-01-07 23:15:00 | 167.25 | home | 0.0 | 0.0 | none | 0 | 0.981123 |
2020-01-07 23:30:00 | 167.5 | home | 0.0 | 0.0 | none | 0 | 0.981123 |
2020-01-07 23:45:00 | 167.75 | home | 0.0 | 0.0 | none | 0 | 0.981123 |
672 rows × 7 columns
df[['distance']].iplot()
pf = DB.db[TS_id]['profile']
pf # distance km and duration min
hh | state | distance | consumption | charging_point | charging_cap | soc | consumption kWh | count | |
---|---|---|---|---|---|---|---|---|---|
0 | 0.00 | home | 0.0 | 0.0 | public | 22 | 0.610000 | 0.0 | 143 |
1 | 0.25 | home | 0.0 | 0.0 | public | 22 | 0.720000 | 0.0 | 143 |
2 | 0.50 | home | 0.0 | 0.0 | public | 22 | 0.830000 | 0.0 | 143 |
3 | 0.75 | home | 0.0 | 0.0 | public | 22 | 0.940000 | 0.0 | 143 |
4 | 1.00 | home | 0.0 | 0.0 | public | 22 | 1.000000 | 0.0 | 143 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
667 | 166.75 | home | 0.0 | 0.0 | none | 0 | 0.981123 | 0.0 | 283 |
668 | 167.00 | home | 0.0 | 0.0 | none | 0 | 0.981123 | 0.0 | 283 |
669 | 167.25 | home | 0.0 | 0.0 | none | 0 | 0.981123 | 0.0 | 283 |
670 | 167.50 | home | 0.0 | 0.0 | none | 0 | 0.981123 | 0.0 | 283 |
671 | 167.75 | home | 0.0 | 0.0 | none | 0 | 0.981123 | 0.0 | 283 |
672 rows × 9 columns
for name in DB.db:
kind = DB.db[name]['kind']
if kind != 'driving':
input_ = DB.db[name]['input'] # upstream profile, e.g. charging <- availability <- consumption <- driving
print(kind, name, '<-', input_)
else:
print(kind, name)
availability BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2 <- BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2 charging BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2_from_0_to_24_at_home_4bfa9 <- BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2 charging BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2_from_23_to_8_at_any_285e1 <- BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2 consumption BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2 <- BEV1_W2_fd3ea charging BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2_balanced_6dc8c <- BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2 driving BEV1_W2_fd3ea charging BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2_immediate_52d4b <- BEV1_W2_fd3ea_Volkswagen_ID.3_2020_509a2_avai_041c2