Exploring SynD with NILMTK!

3 minute read

Published:

In this tutorial, we will use NILMTK to load and explore SynD!

IN[1]:

from nilmtk import DataSet

SynD = DataSet('/Users/christoph/datasets/SynD-release/SynD.h5')

SynD.metadata

OUT[1]:

{'contact': 'klemenjak@ieee.org',
 'creators': ['Klemenjak, Christoph',
  'Kovatsch, Christoph',
  'Herold, Manuel',
  'Elmenreich, Wilfried'],
 'dataset_ID': 1,
 'date_created': '2019-09-29',
 'description': 'an energy consumption dataset created from synthetic power signals',
 'duration': 180,
 'geo_location': {'country': 'AT',
  'latitude': 46.6247222,
  'locality': 'Klagenfurt',
  'longitude': 14.3052778},
 'institution': 'University of Klagenfurt',
 'long_name': 'SynD - A Synthetic Energy Consumption Dataset for Non-Intrusive Load Monitoring in Residential Buildings',
 'name': 'SynD',
 'number_of_buildings': 1,
 'publication_date': 2019,
 'related_documents': ['http://github.com/klemenjak/synd/'],
 'sampling_interval': 0.2,
 'schema': 'https://github.com/nilmtk/nilm_metadata/tree/v0.2',
 'subject': 'SynD - A Synthetic Energy Dataset for Load Disaggregation Scholarship',
 'timezone': 'Europe/Vienna',
 'meter_devices': {'HMC8015': {'description': 'Power analyzer',
   'manufacturer': 'R&S',
   'manufacturer_url': 'https://www.rohde-schwarz.com/us/product/hmc8015-productstartpage_63493-150914.html',
   'max_sample_period': 0.2,
   'measurements': [{'lower_limit': 0,
     'physical_quantity': 'power',
     'type': 'active',
     'upper_limit': 96000}],
   'model': 'HMC8015 Power analyzer',
   'sample_period': 0.2}}}

The elec object is a key element in NILMTK.

IN[2]:

elec = SynD.buildings[1].elec
elec

OUT[2]:

MeterGroup(meters=
  ElecMeter(instance=1, building=1, dataset='SynD', site_meter, appliances=[])
  ElecMeter(instance=2, building=1, dataset='SynD', appliances=[Appliance(type='fridge', instance=1)])
  ElecMeter(instance=3, building=1, dataset='SynD', appliances=[Appliance(type='dish washer', instance=1)])
  ElecMeter(instance=4, building=1, dataset='SynD', appliances=[Appliance(type='electric space heater', instance=1)])
  ElecMeter(instance=5, building=1, dataset='SynD', appliances=[Appliance(type='washing machine', instance=1)])
  ElecMeter(instance=6, building=1, dataset='SynD', appliances=[Appliance(type='toaster', instance=1)])
  ElecMeter(instance=7, building=1, dataset='SynD', appliances=[Appliance(type='fan', instance=1)])
  ElecMeter(instance=8, building=1, dataset='SynD', appliances=[Appliance(type='microwave', instance=1)])
  ElecMeter(instance=9, building=1, dataset='SynD', appliances=[Appliance(type='clothes iron', instance=1)])
  ElecMeter(instance=10, building=1, dataset='SynD', appliances=[Appliance(type='fan', instance=2)])
  ElecMeter(instance=11, building=1, dataset='SynD', appliances=[Appliance(type='broadband router', instance=1)])
  ElecMeter(instance=12, building=1, dataset='SynD', appliances=[Appliance(type='coffee maker', instance=1)])
  ElecMeter(instance=13, building=1, dataset='SynD', appliances=[Appliance(type='television', instance=1)])
  ElecMeter(instance=14, building=1, dataset='SynD', appliances=[Appliance(type='printer', instance=1)])
  ElecMeter(instance=15, building=1, dataset='SynD', appliances=[Appliance(type='laptop computer', instance=1)])
  ElecMeter(instance=16, building=1, dataset='SynD', appliances=[Appliance(type='light', instance=1)])
  ElecMeter(instance=17, building=1, dataset='SynD', appliances=[Appliance(type='computer', instance=1)])
  ElecMeter(instance=18, building=1, dataset='SynD', appliances=[Appliance(type='unknown', instance=1)])
  ElecMeter(instance=19, building=1, dataset='SynD', appliances=[Appliance(type='computer monitor', instance=1)])
  ElecMeter(instance=20, building=1, dataset='SynD', appliances=[Appliance(type='electric oven', instance=1)])
  ElecMeter(instance=21, building=1, dataset='SynD', appliances=[Appliance(type='hair dryer', instance=1)])
  ElecMeter(instance=22, building=1, dataset='SynD', appliances=[Appliance(type='kettle', instance=1)])
)

We can use the elec object to obtain basic information on SynD’s household.

IN[3]:

print("SynD comes with a Sample Period of: " + str( elec.sample_period() ))
print("Available physical quantities: " + str( elec.available_physical_quantities() ))
print("Available AC types :" + str(elec.available_ac_types('power')))
print("Number of days: "+ str(elec.uptime()))

OUT[3]:

SynD comes with a Sample Period of: 0.2
Available physical quantities: ['power']
Available AC types :['active']
Number of days: 179 days 23:59:59.400000

The wiring graph reveals how the power grid inside the household looks like.

IN[4]:

elec.draw_wiring_graph()

OUT[4]:

(<networkx.classes.digraph.DiGraph at 0x123d72940>,
 <matplotlib.axes._axes.Axes at 0x123d7b748>)

png

Since SynD is synthetic, we have knowledge about all components of the aggregate signal!

IN[5]:

round(elec.proportion_of_energy_submetered(), 2)

OUT[5]:

Running MeterGroup.proportion_of_energy_submetered...
1.0

Finally, we explore how much consumption per appliance we have in SynD:

IN[6]:

elec.submeters().fraction_per_meter()

OUT[6]:

21/21 ElecMeter(instance=22, building=1, dataset='SynD', appliances=[Appliance(type='kettle', instance=1)])1)]))]))]))])

(2, 1, SynD)     0.073865
(3, 1, SynD)     0.115977
(4, 1, SynD)     0.348956
(5, 1, SynD)     0.104910
(6, 1, SynD)     0.003695
(7, 1, SynD)     0.008397
(8, 1, SynD)     0.004937
(9, 1, SynD)     0.183080
(10, 1, SynD)    0.008172
(11, 1, SynD)    0.015761
(12, 1, SynD)    0.001748
(13, 1, SynD)    0.055371
(14, 1, SynD)    0.000339
(15, 1, SynD)    0.002415
(16, 1, SynD)    0.000274
(17, 1, SynD)    0.013942
(18, 1, SynD)    0.000114
(19, 1, SynD)    0.002901
(20, 1, SynD)    0.013366
(21, 1, SynD)    0.022287
(22, 1, SynD)    0.019496
dtype: float64

This tutorial should give you basic code fragments to start working with NILMTK. May the elec object be with you!

best,

Christoph

Comments