In [1]:
from nilmtk import DataSet

redd = DataSet('/data/REDD/redd.h5')

In [2]:
redd.metadata


Out[2]:
{'contact': 'zkolter@cs.cmu.edu',
 'creators': ['Kolter, Zico', 'Johnson, Matthew'],
 'description': 'Several weeks of power data for 6 different homes.',
 'geo_location': {'country': 'US',
  'latitude': 42.360091,
  'locality': 'Massachusetts',
  'longitude': -71.09416},
 'institution': 'Massachusetts Institute of Technology (MIT)',
 'long_name': 'The Reference Energy Disaggregation Data set',
 'meter_devices': {'REDD_whole_house': {'description': u'REDD\'s DIY power meter used to measure whole-home AC waveforms at high frequency.  To quote from their paper: "CTs from TED (http://www.theenergydetective.com) to measure current in the power mains, a Pico TA041 oscilloscope probe (http://www.picotechnologies.com) to measure voltage for one of the two phases in the home, and a National Instruments NI-9239 analog to digital converter to transform both these analog signals to digital readings. This A/D converter has 24 bit resolution with noise of approximately 70 \xb5V, which determines the noise level of our current and voltage readings: the TED CTs are rated for 200 amp circuits and a maximum of 3 volts, so we are able to differentiate between currents of approximately ((200))(70 \xd7 10\u22126)/(3) = 4.66mA, corresponding to power changes of about 0.5 watts. Similarly, since we use a 1:100 voltage stepdown in the oscilloscope probe, we can detect voltage differences of about 7mV."\n',
   'max_sample_period': 30,
   'measurements': [{'lower_limit': 0,
     'physical_quantity': 'power',
     'type': 'apparent',
     'upper_limit': 50000}],
   'sample_period': 1,
   'wireless': False},
  'eMonitor': {'description': 'Measures circuit-level power demand.  Comes with 24 CTs. This FAQ page suggests the eMonitor measures real (active) power: http://www.energycircle.com/node/14103  although the REDD readme.txt says all channels record apparent power.\n',
   'manufacturer': 'Powerhouse Dynamics',
   'manufacturer_url': 'http://powerhousedynamics.com',
   'max_sample_period': 50,
   'measurements': [{'lower_limit': 0,
     'physical_quantity': 'power',
     'type': 'active',
     'upper_limit': 5000}],
   'model': 'eMonitor',
   'sample_period': 3,
   'wireless': False}},
 'name': 'REDD',
 'number_of_buildings': 6,
 'publication_date': 2011,
 'related_documents': ['http://redd.csail.mit.edu',
  'J. Zico Kolter and Matthew J. Johnson. REDD: A public data set for energy disaggregation research. In proceedings of the SustKDD workshop on Data Mining Applications in Sustainability, 2011. http://redd.csail.mit.edu/kolter-kddsust11.pdf\n'],
 'schema': 'https://github.com/nilmtk/nilm_metadata/tree/v0.2',
 'subject': 'Disaggregated power demand from domestic buildings.',
 'timezone': 'US/Eastern'}

In [3]:
redd.buildings


Out[3]:
OrderedDict([(1, Building(instance=1, dataset='REDD')), (3, Building(instance=3, dataset='REDD')), (2, Building(instance=2, dataset='REDD')), (5, Building(instance=5, dataset='REDD')), (4, Building(instance=4, dataset='REDD')), (6, Building(instance=6, dataset='REDD'))])

In [4]:
redd.buildings[1]


Out[4]:
Building(instance=1, dataset='REDD')

In [5]:
redd.buildings[1].elec


Out[5]:
MeterGroup(meters=
  ElecMeter(instance=1, building=1, dataset='REDD', site_meter, appliances=[])
  ElecMeter(instance=2, building=1, dataset='REDD', site_meter, appliances=[])
  ElecMeter(instance=5, building=1, dataset='REDD', appliances=[Appliance(type='fridge', instance=1)])
  ElecMeter(instance=6, building=1, dataset='REDD', appliances=[Appliance(type='dish washer', instance=1)])
  ElecMeter(instance=7, building=1, dataset='REDD', appliances=[Appliance(type='sockets', instance=1)])
  ElecMeter(instance=8, building=1, dataset='REDD', appliances=[Appliance(type='sockets', instance=2)])
  ElecMeter(instance=9, building=1, dataset='REDD', appliances=[Appliance(type='light', instance=1)])
  ElecMeter(instance=11, building=1, dataset='REDD', appliances=[Appliance(type='microwave', instance=1)])
  ElecMeter(instance=12, building=1, dataset='REDD', appliances=[Appliance(type='unknown', instance=1)])
  ElecMeter(instance=13, building=1, dataset='REDD', appliances=[Appliance(type='electric space heater', instance=1)])
  ElecMeter(instance=14, building=1, dataset='REDD', appliances=[Appliance(type='electric stove', instance=1)])
  ElecMeter(instance=15, building=1, dataset='REDD', appliances=[Appliance(type='sockets', instance=3)])
  ElecMeter(instance=16, building=1, dataset='REDD', appliances=[Appliance(type='sockets', instance=4)])
  ElecMeter(instance=17, building=1, dataset='REDD', appliances=[Appliance(type='light', instance=2)])
  ElecMeter(instance=18, building=1, dataset='REDD', appliances=[Appliance(type='light', instance=3)])
  ElecMeter(instance=19, building=1, dataset='REDD', appliances=[Appliance(type='unknown', instance=2)])
  MeterGroup(meters=
    ElecMeter(instance=3, building=1, dataset='REDD', appliances=[Appliance(type='electric oven', instance=1)])
    ElecMeter(instance=4, building=1, dataset='REDD', appliances=[Appliance(type='electric oven', instance=1)])
  )
  MeterGroup(meters=
    ElecMeter(instance=10, building=1, dataset='REDD', appliances=[Appliance(type='washer dryer', instance=1)])
    ElecMeter(instance=20, building=1, dataset='REDD', appliances=[Appliance(type='washer dryer', instance=1)])
  )
)

In [6]:
redd.buildings[1].elec.mains()


Out[6]:
MeterGroup(meters=
  ElecMeter(instance=1, building=1, dataset='REDD', site_meter, appliances=[])
  ElecMeter(instance=2, building=1, dataset='REDD', site_meter, appliances=[])
)

In [7]:
redd.buildings[1].elec.mains().total_energy()


Out[7]:
167.76623618641219

In [8]:
redd.buildings[1].elec[1].total_energy()


Out[8]:
99.271402796506891

In [14]:
redd.buildings[1].elec[2].total_energy()


Out[14]:
68.494833389905295

In [11]:
meter = redd.buildings[1].elec[2]

In [12]:
meter.total_energy?

In [15]:
meter.device


Out[15]:
{'description': u'REDD\'s DIY power meter used to measure whole-home AC waveforms at high frequency.  To quote from their paper: "CTs from TED (http://www.theenergydetective.com) to measure current in the power mains, a Pico TA041 oscilloscope probe (http://www.picotechnologies.com) to measure voltage for one of the two phases in the home, and a National Instruments NI-9239 analog to digital converter to transform both these analog signals to digital readings. This A/D converter has 24 bit resolution with noise of approximately 70 \xb5V, which determines the noise level of our current and voltage readings: the TED CTs are rated for 200 amp circuits and a maximum of 3 volts, so we are able to differentiate between currents of approximately ((200))(70 \xd7 10\u22126)/(3) = 4.66mA, corresponding to power changes of about 0.5 watts. Similarly, since we use a 1:100 voltage stepdown in the oscilloscope probe, we can detect voltage differences of about 7mV."\n',
 'max_sample_period': 30,
 'measurements': [{'lower_limit': 0,
   'physical_quantity': 'power',
   'type': 'apparent',
   'upper_limit': 50000}],
 'sample_period': 1,
 'wireless': False}

In [18]:
redd.buildings[1].elec.draw_wiring_graph()

In [17]:
%pylab


Using matplotlib backend: Qt4Agg
Populating the interactive namespace from numpy and matplotlib

In [19]:
elec = redd.buildings[1].elec

In [20]:


In [21]:
meter.available_power_ac_types()


Out[21]:
['apparent']

In [22]:
elec.mains().available_power_ac_types()


Out[22]:
{'apparent'}

In [24]:
elec.submeters().available_power_ac_types()


Out[24]:
{'active'}

In [25]:
elec.proportion_of_energy_submetered()


/home/jack/workspace/python/nilmtk/nilmtk/metergroup.py:651: UserWarning: As a quick implementation we only get Good Sections from the first meter in the meter group.  We should really return the intersection of the good sections for all meters.  This will be fixed...
  warn("As a quick implementation we only get Good Sections from"
/home/jack/workspace/python/nilmtk/nilmtk/measurement.py:56: RuntimeWarning: None of the AC types recorded by Mains are present in `available_ac_types`. Will use try using one of ['active', 'apparent', 'reactive'].
  " Will use try using one of {}.".format(AC_TYPES), RuntimeWarning)
/home/jack/workspace/python/nilmtk/nilmtk/metergroup.py:601: UserWarning: at least one section requested from 'ElecMeter(instance=1, building=1, dataset='REDD', site_meter, appliances=[])' required multiple chunks to be loaded into memory. This may cause a failure when we try to unify results from multiple meters.
  " meters.".format(meter))
/home/jack/workspace/python/nilmtk/nilmtk/metergroup.py:601: UserWarning: at least one section requested from 'ElecMeter(instance=2, building=1, dataset='REDD', site_meter, appliances=[])' required multiple chunks to be loaded into memory. This may cause a failure when we try to unify results from multiple meters.
  " meters.".format(meter))
Out[25]:
0.75962890625021773

In [26]:
meter


Out[26]:
ElecMeter(instance=2, building=1, dataset='REDD', site_meter, appliances=[])

In [27]:
meter.total_energy()


Out[27]:
68.494833389905295

In [29]:
meter.get_timeframe()


Out[29]:
TimeFrame(start='2011-04-18 09:22:09-04:00', end='2011-05-24 15:57:02-04:00', empty=False)

In [30]:
from nilmtk import TimeFrame

In [31]:
meter = elec[2]

In [32]:
tf = TimeFrame("2011-04-25", "2011-05-01")

In [33]:
tf


Out[33]:
TimeFrame(start='2011-04-25 00:00:00', end='2011-05-01 00:00:00', empty=False)

In [42]:
meter.total_energy(sections=[tf])


Out[42]:
17.985797864165836

In [47]:
import matplotlib.pyplot as plt

In [52]:
meter.plot(sections=[tf])

In [51]:
%pylab


Using matplotlib backend: Qt4Agg
Populating the interactive namespace from numpy and matplotlib

In [56]:
elec.plot()


Out[56]:
<matplotlib.axes.AxesSubplot at 0x7fc224311b10>

In [55]:
%pylab


Using matplotlib backend: Qt4Agg
Populating the interactive namespace from numpy and matplotlib

In [57]:
elec.plot?

In [58]:
meter.good_sections()


Out[58]:
[TimeFrame(start='2011-04-18 09:22:09-04:00', end='2011-04-18 13:58:47-04:00', empty=False),
 TimeFrame(start='2011-04-18 14:03:07-04:00', end='2011-04-19 12:13:38-04:00', empty=False),
 TimeFrame(start='2011-04-19 12:14:17-04:00', end='2011-04-19 18:45:19-04:00', empty=False),
 TimeFrame(start='2011-04-19 20:20:08-04:00', end='2011-04-20 01:54:32-04:00', empty=False),
 TimeFrame(start='2011-04-20 01:55:36-04:00', end='2011-04-20 02:28:14-04:00', empty=False),
 TimeFrame(start='2011-04-20 02:28:52-04:00', end='2011-04-21 03:17:09-04:00', empty=False),
 TimeFrame(start='2011-04-21 06:17:17-04:00', end='2011-04-21 17:45:06-04:00', empty=False),
 TimeFrame(start='2011-04-21 19:41:29-04:00', end='2011-04-22 22:46:57-04:00', empty=False),
 TimeFrame(start='2011-04-22 22:48:33-04:00', end='2011-04-24 03:48:50-04:00', empty=False),
 TimeFrame(start='2011-04-24 03:52:24-04:00', end='2011-04-24 20:46:36-04:00', empty=False),
 TimeFrame(start='2011-04-24 20:47:17-04:00', end='2011-04-27 02:50:19-04:00', empty=False),
 TimeFrame(start='2011-04-27 02:51:21-04:00', end='2011-04-27 03:17:34-04:00', empty=False),
 TimeFrame(start='2011-04-27 03:21:15-04:00', end='2011-04-28 05:57:47-04:00', empty=False),
 TimeFrame(start='2011-04-29 23:10:34-04:00', end='2011-05-01 09:44:42-04:00', empty=False),
 TimeFrame(start='2011-05-01 09:47:18-04:00', end='2011-05-01 23:14:16-04:00', empty=False),
 TimeFrame(start='2011-05-01 23:14:17-04:00', end='2011-05-02 17:04:59-04:00', empty=False),
 TimeFrame(start='2011-05-02 17:07:27-04:00', end='2011-05-03 17:30:17-04:00', empty=False),
 TimeFrame(start='2011-05-03 17:32:49-04:00', end='2011-05-03 17:33:44-04:00', empty=False),
 TimeFrame(start='2011-05-06 10:51:46-04:00', end='2011-05-07 01:53:10-04:00', empty=False),
 TimeFrame(start='2011-05-07 01:53:55-04:00', end='2011-05-07 02:38:15-04:00', empty=False),
 TimeFrame(start='2011-05-07 02:40:43-04:00', end='2011-05-07 11:59:16-04:00', empty=False),
 TimeFrame(start='2011-05-11 03:19:43-04:00', end='2011-05-12 17:48:38-04:00', empty=False),
 TimeFrame(start='2011-05-12 20:14:30-04:00', end='2011-05-13 05:16:24-04:00', empty=False),
 TimeFrame(start='2011-05-22 16:04:46-04:00', end='2011-05-22 23:39:01-04:00', empty=False),
 TimeFrame(start='2011-05-22 23:41:35-04:00', end='2011-05-23 09:22:08-04:00', empty=False),
 TimeFrame(start='2011-05-23 10:31:34-04:00', end='2011-05-24 14:32:05-04:00', empty=False),
 TimeFrame(start='2011-05-24 15:55:33-04:00', end='2011-05-24 15:57:02-04:00', empty=False)]

In [59]:
meter.device


Out[59]:
{'description': u'REDD\'s DIY power meter used to measure whole-home AC waveforms at high frequency.  To quote from their paper: "CTs from TED (http://www.theenergydetective.com) to measure current in the power mains, a Pico TA041 oscilloscope probe (http://www.picotechnologies.com) to measure voltage for one of the two phases in the home, and a National Instruments NI-9239 analog to digital converter to transform both these analog signals to digital readings. This A/D converter has 24 bit resolution with noise of approximately 70 \xb5V, which determines the noise level of our current and voltage readings: the TED CTs are rated for 200 amp circuits and a maximum of 3 volts, so we are able to differentiate between currents of approximately ((200))(70 \xd7 10\u22126)/(3) = 4.66mA, corresponding to power changes of about 0.5 watts. Similarly, since we use a 1:100 voltage stepdown in the oscilloscope probe, we can detect voltage differences of about 7mV."\n',
 'max_sample_period': 30,
 'measurements': [{'lower_limit': 0,
   'physical_quantity': 'power',
   'type': 'apparent',
   'upper_limit': 50000}],
 'sample_period': 1,
 'wireless': False}

In [ ]: