├── nilmtk ├── tests │ ├── __init__.py │ ├── test_datastore_converter.py │ ├── testingtools.py │ ├── test_combinatorial_optimisation.py │ ├── test_fhmm.py │ ├── test_metrics.py │ ├── test_measurement.py │ └── test_node.py ├── stats │ ├── tests │ │ ├── __init__.py │ │ ├── test_totalenergyresults.py │ │ ├── test_dropoutrate.py │ │ └── test_totalenergy.py │ ├── __init__.py │ ├── histogram.py │ ├── totalenergyresults.py │ ├── dropoutrate.py │ ├── dropoutrateresults.py │ └── totalenergy.py ├── preprocessing │ ├── tests │ │ └── __init__.py │ ├── __init__.py │ ├── apply.py │ └── clip.py ├── dataset_converters │ ├── ampds │ │ ├── __init__.py │ │ └── metadata │ │ │ ├── __init__.py │ │ │ ├── dataset.yaml │ │ │ ├── meter_devices.yaml │ │ │ └── building1.yaml │ ├── eco │ │ ├── __init__.py │ │ ├── .gitignore │ │ └── metadata │ │ │ ├── __init__.py │ │ │ ├── dataset.yaml │ │ │ ├── meter_devices.yaml │ │ │ ├── building3.yaml │ │ │ ├── building6.yaml │ │ │ ├── building1.yaml │ │ │ ├── building5.yaml │ │ │ ├── building4.yaml │ │ │ └── building2.yaml │ ├── hes │ │ ├── __init__.py │ │ ├── metadata │ │ │ ├── __init__.py │ │ │ ├── dataset.yaml │ │ │ └── meter_devices.yaml │ │ └── Readme.md │ ├── iawe │ │ ├── __init__.py │ │ └── metadata │ │ │ ├── __init__.py │ │ │ ├── dataset.yaml │ │ │ ├── building1.yaml │ │ │ └── meter_devices.yaml │ ├── redd │ │ ├── __init__.py │ │ └── metadata │ │ │ ├── __init__.py │ │ │ ├── dataset.yaml │ │ │ ├── building2.yaml │ │ │ ├── meter_devices.yaml │ │ │ ├── building6.yaml │ │ │ ├── building4.yaml │ │ │ ├── building3.yaml │ │ │ ├── building1.yaml │ │ │ └── building5.yaml │ ├── refit │ │ ├── __init__.py │ │ └── metadata │ │ │ ├── __init__.py │ │ │ ├── meter_devices.yaml │ │ │ ├── building12.yaml │ │ │ ├── building8.yaml │ │ │ ├── building6.yaml │ │ │ ├── building7.yaml │ │ │ ├── building13.yaml │ │ │ ├── building2.yaml │ │ │ ├── building11.yaml │ │ │ ├── building19.yaml │ │ │ ├── building3.yaml │ │ │ ├── building18.yaml │ │ │ ├── building20.yaml │ │ │ ├── building4.yaml │ │ │ ├── building5.yaml │ │ │ ├── building16.yaml │ │ │ ├── building10.yaml │ │ │ ├── building9.yaml │ │ │ ├── dataset.yaml │ │ │ ├── building17.yaml │ │ │ ├── building14.yaml │ │ │ ├── building15.yaml │ │ │ └── building1.yaml │ ├── combed │ │ ├── __init__.py │ │ ├── metadata │ │ │ ├── __init__.py │ │ │ ├── meter_devices.yaml │ │ │ ├── building2.yaml │ │ │ ├── dataset.yaml │ │ │ └── building1.yaml │ │ └── download.py │ ├── dataport │ │ ├── __init__.py │ │ └── metadata │ │ │ ├── __init__.py │ │ │ ├── meter_devices.yaml │ │ │ └── dataset.yaml │ ├── greend │ │ ├── __init__.py │ │ ├── metadata │ │ │ ├── __init__.py │ │ │ ├── meter_devices.yaml │ │ │ ├── dataset.yaml │ │ │ ├── building7.yaml │ │ │ ├── building6.yaml │ │ │ ├── building0.yaml │ │ │ ├── building1.yaml │ │ │ ├── building4.yaml │ │ │ └── building5.yaml │ │ └── documentation_greend.pdf │ ├── ukdale │ │ ├── __init__.py │ │ ├── README.md │ │ └── convert_ukdale.py │ ├── __init__.py │ └── dred │ │ └── Readme.md ├── consts.py ├── feature_detectors │ └── __init__.py ├── version.py ├── datastore │ ├── __init__.py │ └── key.py ├── disaggregate │ └── __init__.py ├── exceptions.py ├── hashable.py ├── __init__.py ├── docinherit.py ├── building.py ├── timeframegroup.py └── measurement.py ├── data ├── random_csv │ └── metadata │ │ ├── dataset.yaml │ │ ├── meter_devices.yaml │ │ └── building1.yaml ├── energy.h5 ├── random.h5 ├── co_test.h5 ├── energy_complex.h5 └── README.md ├── docs ├── source │ ├── modules.rst │ ├── nilmtk.dataset_converters.eco.rst │ ├── nilmtk.dataset_converters.hes.rst │ ├── nilmtk.dataset_converters.redd.rst │ ├── nilmtk.dataset_converters.ampds.rst │ ├── nilmtk.dataset_converters.greend.rst │ ├── nilmtk.dataset_converters.ukdale.rst │ ├── nilmtk.dataset_converters.dataport.rst │ ├── nilmtk.dataset_converters.rst │ ├── nilmtk.dataset_converters.iawe.rst │ ├── nilmtk.feature_detectors.rst │ ├── index.rst │ ├── nilmtk.preprocessing.rst │ ├── nilmtk.dataset_converters.combed.rst │ ├── nilmtk.datastore.rst │ ├── nilmtk.disaggregate.rst │ ├── nilmtk.stats.tests.rst │ ├── nilmtk.stats.rst │ ├── nilmtk.tests.rst │ └── nilmtk.rst ├── outdated │ ├── static │ │ ├── img │ │ │ ├── IAM.jpg │ │ │ ├── fscore.png │ │ │ ├── metrics.png │ │ │ └── submetered.png │ │ ├── fonts │ │ │ ├── 17c55b27-e9ab-43cd-b948-d49f97480d68.eot │ │ │ ├── 46cf1067-688d-4aab-b0f7-bd942af6efd8.ttf │ │ │ ├── 6de0ce4d-9278-467b-b96f-c1f5f0a4c375.ttf │ │ │ ├── e9167238-3b3f-4813-a04a-a384394eed42.eot │ │ │ ├── 1e9892c0-6927-4412-9874-1b82801ba47a.woff │ │ │ └── fa19948e-5e38-4909-b31e-41acd170d6f2.woff │ │ └── styles.css │ ├── README.md │ └── experimental │ │ └── wiring_graph.ipynb └── manual │ ├── user_guide │ ├── cookbook.md │ └── install_user.md │ ├── README.md │ └── development_guide │ └── writing_a_disaggregation_algorithm.md ├── .coveragerc ├── tests_on_large_datasets ├── github_issues │ └── 405.py └── redd_house3_f1_score.py ├── .gitignore ├── environment.yml ├── .travis.yml └── README.md /nilmtk/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/stats/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/preprocessing/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/ampds/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/eco/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/hes/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/iawe/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/redd/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/random_csv/metadata/dataset.yaml: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/combed/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/dataport/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/eco/.gitignore: -------------------------------------------------------------------------------- 1 | Dataset/ -------------------------------------------------------------------------------- /nilmtk/dataset_converters/greend/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/ukdale/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/ampds/metadata/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/combed/metadata/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/eco/metadata/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/greend/metadata/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/hes/metadata/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/iawe/metadata/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/redd/metadata/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/dataport/metadata/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nilmtk/consts.py: -------------------------------------------------------------------------------- 1 | JOULES_PER_KWH = 3600000 2 | SECS_PER_DAY = 86400 3 | -------------------------------------------------------------------------------- /nilmtk/feature_detectors/__init__.py: -------------------------------------------------------------------------------- 1 | from .cluster import cluster 2 | -------------------------------------------------------------------------------- /nilmtk/version.py: -------------------------------------------------------------------------------- 1 | version = '0.2.0.dev-b9bd653' 2 | short_version = '0.2.0' 3 | -------------------------------------------------------------------------------- /data/energy.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/data/energy.h5 -------------------------------------------------------------------------------- /data/random.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/data/random.h5 -------------------------------------------------------------------------------- /nilmtk/preprocessing/__init__.py: -------------------------------------------------------------------------------- 1 | from .clip import Clip 2 | from .apply import Apply 3 | -------------------------------------------------------------------------------- /data/co_test.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/data/co_test.h5 -------------------------------------------------------------------------------- /data/energy_complex.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/data/energy_complex.h5 -------------------------------------------------------------------------------- /docs/source/modules.rst: -------------------------------------------------------------------------------- 1 | nilmtk 2 | ====== 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | nilmtk 8 | -------------------------------------------------------------------------------- /docs/outdated/static/img/IAM.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/docs/outdated/static/img/IAM.jpg -------------------------------------------------------------------------------- /docs/outdated/static/img/fscore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/docs/outdated/static/img/fscore.png -------------------------------------------------------------------------------- /docs/outdated/static/img/metrics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/docs/outdated/static/img/metrics.png -------------------------------------------------------------------------------- /docs/outdated/static/img/submetered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/docs/outdated/static/img/submetered.png -------------------------------------------------------------------------------- /nilmtk/stats/__init__.py: -------------------------------------------------------------------------------- 1 | from .totalenergy import TotalEnergy 2 | from .goodsections import GoodSections 3 | from .dropoutrate import DropoutRate 4 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | source = nilmtk 3 | [report] 4 | omit = 5 | */python?.?/* 6 | */site-packages/nose/* 7 | *nilmtk/notebooks/* 8 | 9 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/greend/documentation_greend.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/nilmtk/dataset_converters/greend/documentation_greend.pdf -------------------------------------------------------------------------------- /docs/outdated/README.md: -------------------------------------------------------------------------------- 1 | Please note that the notebooks here are only kept for historical purposes. See the [documentation](https://github.com/nilmtk/nilmtk/tree/master/docs/manual) instead. 2 | -------------------------------------------------------------------------------- /docs/outdated/static/fonts/17c55b27-e9ab-43cd-b948-d49f97480d68.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/docs/outdated/static/fonts/17c55b27-e9ab-43cd-b948-d49f97480d68.eot -------------------------------------------------------------------------------- /docs/outdated/static/fonts/46cf1067-688d-4aab-b0f7-bd942af6efd8.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/docs/outdated/static/fonts/46cf1067-688d-4aab-b0f7-bd942af6efd8.ttf -------------------------------------------------------------------------------- /docs/outdated/static/fonts/6de0ce4d-9278-467b-b96f-c1f5f0a4c375.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/docs/outdated/static/fonts/6de0ce4d-9278-467b-b96f-c1f5f0a4c375.ttf -------------------------------------------------------------------------------- /docs/outdated/static/fonts/e9167238-3b3f-4813-a04a-a384394eed42.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/docs/outdated/static/fonts/e9167238-3b3f-4813-a04a-a384394eed42.eot -------------------------------------------------------------------------------- /docs/outdated/static/fonts/1e9892c0-6927-4412-9874-1b82801ba47a.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/docs/outdated/static/fonts/1e9892c0-6927-4412-9874-1b82801ba47a.woff -------------------------------------------------------------------------------- /docs/outdated/static/fonts/fa19948e-5e38-4909-b31e-41acd170d6f2.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loathingKernel/nilmtk/master/docs/outdated/static/fonts/fa19948e-5e38-4909-b31e-41acd170d6f2.woff -------------------------------------------------------------------------------- /tests_on_large_datasets/github_issues/405.py: -------------------------------------------------------------------------------- 1 | from nilmtk import * 2 | 3 | ds = DataSet("/Users/nipunbatra/Downloads/nilm_gjw_data.hdf5") 4 | 5 | elec = ds.buildings[1].elec 6 | 7 | elec.plot() -------------------------------------------------------------------------------- /nilmtk/datastore/__init__.py: -------------------------------------------------------------------------------- 1 | from .datastore import DataStore, MAX_MEM_ALLOWANCE_IN_BYTES 2 | from .hdfdatastore import HDFDataStore 3 | from .csvdatastore import CSVDataStore 4 | from .key import Key 5 | -------------------------------------------------------------------------------- /nilmtk/disaggregate/__init__.py: -------------------------------------------------------------------------------- 1 | from .disaggregator import Disaggregator 2 | from .combinatorial_optimisation import CombinatorialOptimisation 3 | from .fhmm_exact import FHMM 4 | from .hart_85 import Hart85 5 | from .maximum_likelihood_estimation import MLE 6 | 7 | -------------------------------------------------------------------------------- /nilmtk/exceptions.py: -------------------------------------------------------------------------------- 1 | """File defining custom nilmtk exception classes. 2 | """ 3 | 4 | 5 | class TooFewSamplesError(Exception): 6 | pass 7 | 8 | 9 | class PerformanceWarning(RuntimeWarning): 10 | pass 11 | 12 | 13 | class MeasurementError(Exception): 14 | pass 15 | 16 | 17 | class VampirePowerAlreadyInModelError(Exception): 18 | pass 19 | -------------------------------------------------------------------------------- /docs/manual/user_guide/cookbook.md: -------------------------------------------------------------------------------- 1 | #### Visualisation 2 | 3 | 1. [How do I combine and display apparent and reactive power data on the same graph?](https://github.com/gjwo/nilm_gjw_data/blob/master/notebooks/graphing_two_metrics.ipynb) 4 | 5 | #### Data set 6 | 7 | 1. [How do I find original building id in nilmtk](http://nipunbatra.github.io/2015/06/nilmtk-building-id/) -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .pydevproject 3 | *.pyc 4 | *.*~ 5 | *.log 6 | profile.txt 7 | *.so 8 | build/ 9 | _build/ 10 | *.egg-info/ 11 | dist/ 12 | .ropeproject/ 13 | .ipynb_checkpoints/ 14 | *.swp 15 | notebooks/*.h5 16 | .idea/* 17 | .idea 18 | .DS_Store 19 | 20 | # Ignoring Local datasets: 21 | data/REDD 22 | data/ukdale 23 | *.h5 24 | *.tar 25 | *.dat 26 | 27 | -------------------------------------------------------------------------------- /data/random_csv/metadata/meter_devices.yaml: -------------------------------------------------------------------------------- 1 | Random Meter: 2 | manufacturer: Test Manufacturer 3 | max_sample_period: 15 4 | measurements: 5 | - {lower_limit: 0, physical_quantity: power, type: active, upper_limit: 6000} 6 | - {lower_limit: 0, physical_quantity: energy, type: reactive, upper_limit: 6000} 7 | - {lower_limit: 0, physical_quantity: voltage, type: '', upper_limit: 6000} 8 | model: Random Meter 9 | sample_period: 10 10 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/__init__.py: -------------------------------------------------------------------------------- 1 | from .redd.convert_redd import convert_redd 2 | from .ukdale.convert_ukdale import convert_ukdale 3 | from .ampds.convert_ampds import convert_ampds 4 | from .combed.convert_combed import convert_combed 5 | from .eco.convert_eco import convert_eco 6 | #from .dataport.download_dataport import download_dataport 7 | from .greend.convert_greend import convert_greend 8 | from .hes.convert_hes import convert_hes 9 | from .refit.convert_refit import convert_refit 10 | -------------------------------------------------------------------------------- /data/README.md: -------------------------------------------------------------------------------- 1 | These data files are used during unit testing. 2 | 3 | The h5 files are generated by 4 | `nilmtk.tests.generate_data.create_all()`. We do not generate these 5 | files very often (just when the design of the file structure changes). 6 | 7 | When nosetests runs, it uses these files. Some files will be modified 8 | by the tests of the cache. These modified files would confuse git so, 9 | when nosetests finishes, it runs `teardown_package()` in 10 | `nilmtk/__init__.py` which uses git to reset the `nilmtk/data` 11 | directory. 12 | -------------------------------------------------------------------------------- /data/random_csv/metadata/building1.yaml: -------------------------------------------------------------------------------- 1 | appliances: [] 2 | elec_meters: 3 | 1: {data_location: building1/elec/meter1, device_model: Random Meter, submeter_of: 1} 4 | 2: {data_location: building1/elec/meter2, device_model: Random Meter, submeter_of: 1} 5 | 3: {data_location: building1/elec/meter3, device_model: Random Meter, submeter_of: 1} 6 | 4: {data_location: building1/elec/meter4, device_model: Random Meter, submeter_of: 1} 7 | 5: {data_location: building1/elec/meter5, device_model: Random Meter, submeter_of: 1} 8 | instance: 1 9 | -------------------------------------------------------------------------------- /nilmtk/tests/test_datastore_converter.py: -------------------------------------------------------------------------------- 1 | from nilmtk.datastore import HDFDataStore, CSVDataStore 2 | from nilmtk.datastore.datastore import convert_datastore 3 | import os 4 | import shutil 5 | 6 | input_filepath = 'data/random.h5' 7 | output_filepath = 'data/random_csv' 8 | 9 | if os.path.isdir(output_filepath): 10 | shutil.rmtree(output_filepath) 11 | 12 | input_store=HDFDataStore(input_filepath) 13 | output_store=CSVDataStore(output_filepath) 14 | 15 | convert_datastore(input_store, output_store) 16 | 17 | input_store.close() 18 | output_store.close() -------------------------------------------------------------------------------- /docs/source/nilmtk.dataset_converters.eco.rst: -------------------------------------------------------------------------------- 1 | nilmtk.dataset_converters.eco package 2 | ===================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | nilmtk.dataset_converters.eco.convert_eco module 8 | ------------------------------------------------ 9 | 10 | .. automodule:: nilmtk.dataset_converters.eco.convert_eco 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: nilmtk.dataset_converters.eco 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/source/nilmtk.dataset_converters.hes.rst: -------------------------------------------------------------------------------- 1 | nilmtk.dataset_converters.hes package 2 | ===================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | nilmtk.dataset_converters.hes.convert_hes module 8 | ------------------------------------------------ 9 | 10 | .. automodule:: nilmtk.dataset_converters.hes.convert_hes 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: nilmtk.dataset_converters.hes 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/source/nilmtk.dataset_converters.redd.rst: -------------------------------------------------------------------------------- 1 | nilmtk.dataset_converters.redd package 2 | ====================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | nilmtk.dataset_converters.redd.convert_redd module 8 | -------------------------------------------------- 9 | 10 | .. automodule:: nilmtk.dataset_converters.redd.convert_redd 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: nilmtk.dataset_converters.redd 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/greend/metadata/meter_devices.yaml: -------------------------------------------------------------------------------- 1 | circle: 2 | model: circle 3 | model_url: http://www.plugwise.com/product/circle 4 | manufacturer: Plugwise 5 | manufacturer_url: http://www.plugwise.com 6 | sample_period: 1 7 | max_sample_period: 30 8 | measurements: 9 | - physical_quantity: power 10 | type: active 11 | upper_limit: 3000 12 | lower_limit: 0 13 | description: des 14 | pre_pay: false 15 | wireless: true 16 | wireless_configuration: 17 | base: Raspberry Pi 18 | protocol: zigbee 19 | carrier_frequency: 2400 20 | data_logger: log 21 | -------------------------------------------------------------------------------- /docs/source/nilmtk.dataset_converters.ampds.rst: -------------------------------------------------------------------------------- 1 | nilmtk.dataset_converters.ampds package 2 | ======================================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | nilmtk.dataset_converters.ampds.convert_ampds module 8 | ---------------------------------------------------- 9 | 10 | .. automodule:: nilmtk.dataset_converters.ampds.convert_ampds 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: nilmtk.dataset_converters.ampds 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/ukdale/README.md: -------------------------------------------------------------------------------- 1 | Dataset converter for the UK-DALE dataset. 2 | 3 | Details of the data set and a link to download the data can be found 4 | at http://www.doc.ic.ac.uk/~dk3810/data/ 5 | 6 | Unlike most other NILMTK dataset converters, the YAML metadata for 7 | UK-DALE is not included in NILMTK because the YAML metadata comes with 8 | the UK-DALE dataset. Hence the NILMTK UK-DALE converter uses the 9 | metadata downloaded with the dataset. If you want to see the UK-DALE 10 | metadata on its own then it is available here: 11 | https://github.com/JackKelly/UK-DALE_metadata 12 | 13 | -------------------------------------------------------------------------------- /docs/source/nilmtk.dataset_converters.greend.rst: -------------------------------------------------------------------------------- 1 | nilmtk.dataset_converters.greend package 2 | ======================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | nilmtk.dataset_converters.greend.convert_greend module 8 | ------------------------------------------------------ 9 | 10 | .. automodule:: nilmtk.dataset_converters.greend.convert_greend 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: nilmtk.dataset_converters.greend 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/source/nilmtk.dataset_converters.ukdale.rst: -------------------------------------------------------------------------------- 1 | nilmtk.dataset_converters.ukdale package 2 | ======================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | nilmtk.dataset_converters.ukdale.convert_ukdale module 8 | ------------------------------------------------------ 9 | 10 | .. automodule:: nilmtk.dataset_converters.ukdale.convert_ukdale 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: nilmtk.dataset_converters.ukdale 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/source/nilmtk.dataset_converters.dataport.rst: -------------------------------------------------------------------------------- 1 | nilmtk.dataset_converters.dataport package 2 | ========================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | nilmtk.dataset_converters.dataport.download_dataport module 8 | ----------------------------------------------------------- 9 | 10 | .. automodule:: nilmtk.dataset_converters.dataport.download_dataport 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: nilmtk.dataset_converters.dataport 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/dataport/metadata/meter_devices.yaml: -------------------------------------------------------------------------------- 1 | eGauge: 2 | model: eGauge SCT-400/750 3 | manufacturer: eGauge Systems LLC 4 | manufacturer_url: https://www.egauge.net 5 | description: > 6 | Measures circuit-level power demand. Comes with 12 CTs. 7 | http://egauge.net/docs/sct_0400.pdf 8 | sample_period: 60 # the interval between samples. In seconds. 9 | max_sample_period: 120 # Max allowable interval between samples. Seconds. 10 | measurements: 11 | - physical_quantity: power # power, voltage, energy, current? 12 | type: active # active (real power), reactive or apparent? 13 | upper_limit: 5000 14 | lower_limit: 0 15 | wireless: false 16 | -------------------------------------------------------------------------------- /docs/source/nilmtk.dataset_converters.rst: -------------------------------------------------------------------------------- 1 | nilmtk.dataset_converters package 2 | ================================= 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | nilmtk.dataset_converters.ampds 10 | nilmtk.dataset_converters.combed 11 | nilmtk.dataset_converters.dataport 12 | nilmtk.dataset_converters.eco 13 | nilmtk.dataset_converters.greend 14 | nilmtk.dataset_converters.hes 15 | nilmtk.dataset_converters.iawe 16 | nilmtk.dataset_converters.redd 17 | nilmtk.dataset_converters.ukdale 18 | 19 | Module contents 20 | --------------- 21 | 22 | .. automodule:: nilmtk.dataset_converters 23 | :members: 24 | :undoc-members: 25 | :show-inheritance: 26 | -------------------------------------------------------------------------------- /docs/source/nilmtk.dataset_converters.iawe.rst: -------------------------------------------------------------------------------- 1 | nilmtk.dataset_converters.iawe package 2 | ====================================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | nilmtk.dataset_converters.iawe.metadata 10 | 11 | Submodules 12 | ---------- 13 | 14 | nilmtk.dataset_converters.iawe.convert_iawe module 15 | -------------------------------------------------- 16 | 17 | .. automodule:: nilmtk.dataset_converters.iawe.convert_iawe 18 | :members: 19 | :undoc-members: 20 | :show-inheritance: 21 | 22 | 23 | Module contents 24 | --------------- 25 | 26 | .. automodule:: nilmtk.dataset_converters.iawe 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | -------------------------------------------------------------------------------- /nilmtk/hashable.py: -------------------------------------------------------------------------------- 1 | class Hashable(object): 2 | """Simple mix-in class to add functions necessary to make 3 | an object hashable. Just requires the child class to have 4 | an `identifier` namedtuple.""" 5 | 6 | def __eq__(self, other): 7 | if isinstance(other, self.__class__): 8 | return self.identifier == other.identifier 9 | else: 10 | return False 11 | 12 | def __ne__(self, other): 13 | return not self.__eq__(other) 14 | 15 | def __hash__(self): 16 | return hash(self.identifier) 17 | 18 | def __repr__(self): 19 | s = "{:s}(".format(self.__class__.__name__) 20 | s += str(self.identifier).partition("(")[2] 21 | return s 22 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/greend/metadata/dataset.yaml: -------------------------------------------------------------------------------- 1 | name: GREEND 2 | long_name: GREEND Electrical ENergy Dataset 3 | creators: 4 | - Egarter, Dominik 5 | - Elmenreich, Wilfried 6 | - Monacchi, Andrea 7 | - Pöchacker, Manfred 8 | timezone: CET 9 | #date: 10 | #contact: 11 | institution: Alpen-Adria-Universität 12 | #description: 13 | number_of_buildings: 8 14 | #identifier: 15 | #subject: 16 | #geospatial_coverage: 17 | #timeframe: 18 | #funding: 19 | #publisher: 20 | geo_location: 21 | locality: Klagenfurt 22 | country: AT 23 | latitude: 46.614150 24 | longitude: 14.263321 25 | #rights_list: 26 | #description_of_subjects: 27 | related_documents: 28 | - http://arxiv.org/abs/1405.3100 29 | schema: https://github.com/nilmtk/nilm_metadata/tree/v0.2 30 | 31 | -------------------------------------------------------------------------------- /nilmtk/preprocessing/apply.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function, division 2 | from ..node import Node 3 | 4 | class Apply(Node): 5 | 6 | """Apply an arbitrary function to each pd.Series chunk.""" 7 | 8 | def __init__(self, upstream=None, generator=None, func=None): 9 | self.func = func 10 | super(Apply, self).__init__(upstream, generator) 11 | 12 | def process(self): 13 | self.check_requirements() 14 | for chunk in self.upstream.process(): 15 | new_chunk = self.func(chunk) 16 | new_chunk.timeframe = chunk.timeframe 17 | if hasattr(chunk, 'look_ahead'): 18 | new_chunk.look_ahead = chunk.look_ahead 19 | del chunk 20 | yield new_chunk 21 | -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | name: nilmtk-env 2 | dependencies: 3 | - python=3.6 4 | - Cython>=0.27.3 5 | - bottleneck>=1.2.1 6 | - numpy>=1.13.3 7 | - numexpr>=2.6.4 8 | - pytables 9 | - pandas==0.22.0 10 | - matplotlib>=2.2.0 11 | - networkx==2.1 12 | - scipy>=1.0.0 13 | - scikit-learn>=0.19.1 14 | - jupyter 15 | - ipython 16 | - ipykernel 17 | - six 18 | - future 19 | - nose 20 | - coverage 21 | - pip 22 | - psycopg2 23 | - pip: # Install packages which are not in conda. Install these using pip: 24 | - coveralls 25 | - https://github.com/hmmlearn/hmmlearn/archive/ae1a41e4d03ea61b7a25cba68698e8e2e52880ad.zip#egg=hmmlearn 26 | - https://github.com/nilmtk/nilm_metadata/archive/master.zip#egg=nilm_metadata 27 | - https://github.com/nilmtk/nilmtk/archive/master.zip#egg=nilmtk 28 | -------------------------------------------------------------------------------- /docs/source/nilmtk.feature_detectors.rst: -------------------------------------------------------------------------------- 1 | nilmtk.feature_detectors package 2 | ================================ 3 | 4 | Submodules 5 | ---------- 6 | 7 | nilmtk.feature_detectors.cluster module 8 | --------------------------------------- 9 | 10 | .. automodule:: nilmtk.feature_detectors.cluster 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | nilmtk.feature_detectors.steady_states module 16 | --------------------------------------------- 17 | 18 | .. automodule:: nilmtk.feature_detectors.steady_states 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | 24 | Module contents 25 | --------------- 26 | 27 | .. automodule:: nilmtk.feature_detectors 28 | :members: 29 | :undoc-members: 30 | :show-inheritance: 31 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/hes/Readme.md: -------------------------------------------------------------------------------- 1 | There are a couple of small fixes/issues with the current converter. Till we get a chance to fix them in the main converter, please use the following fix. 2 | 3 | ````python 4 | st = pd.HDFStore("/data/hes/hes_3.h5") 5 | keys = st.keys() 6 | for key in keys: 7 | df = st[key] 8 | if not df.index.is_monotonic: 9 | df = df.sort() 10 | st.put(key, df, format='table') 11 | st.close() 12 | ``` 13 | 14 | This will sort the meters in ascending order. 15 | 16 | There is also an issue with data from one of the home (nilmtk id #234). For now, the quick fix would be to ignore this home in the analysis. 17 | 18 | Some exploratory analysis of the dataset can be found on [Nipun's blog](http://nipunbatra.github.io/2016/01/nilmtk-hes/) 19 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. NILMTK documentation master file 2 | 3 | 4 | NILMTK's API documentation! 5 | =========================== 6 | 7 | Please note that this website only contains the automatically 8 | generated documentation, taken from the NILMTK Python docstrings. The 9 | manual has been moved to a set of `IPython notebooks 10 | `_. 11 | 12 | You might also be interested in NILMTK's `UML Class diagram `_. 13 | 14 | API Documentation 15 | ================= 16 | 17 | .. toctree:: 18 | :maxdepth: 4 19 | 20 | nilmtk 21 | 22 | 23 | Indices and tables 24 | ================== 25 | 26 | * :ref:`genindex` 27 | * :ref:`modindex` 28 | * :ref:`search` 29 | 30 | -------------------------------------------------------------------------------- /docs/source/nilmtk.preprocessing.rst: -------------------------------------------------------------------------------- 1 | nilmtk.preprocessing package 2 | ============================ 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | nilmtk.preprocessing.tests 10 | 11 | Submodules 12 | ---------- 13 | 14 | nilmtk.preprocessing.apply module 15 | --------------------------------- 16 | 17 | .. automodule:: nilmtk.preprocessing.apply 18 | :members: 19 | :undoc-members: 20 | :show-inheritance: 21 | 22 | nilmtk.preprocessing.clip module 23 | -------------------------------- 24 | 25 | .. automodule:: nilmtk.preprocessing.clip 26 | :members: 27 | :undoc-members: 28 | :show-inheritance: 29 | 30 | 31 | Module contents 32 | --------------- 33 | 34 | .. automodule:: nilmtk.preprocessing 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/combed/metadata/meter_devices.yaml: -------------------------------------------------------------------------------- 1 | EM6400: 2 | model: EM6400 3 | manufacturer: Schneider Electric 4 | manufacturer_url: http://www.schneider-electric.com/ 5 | description: Multifunction meter for feeders 6 | sample_period: 30 # the interval between samples. In seconds. 7 | max_sample_period: 300 8 | measurements: 9 | - physical_quantity: power # power, voltage, energy, current? 10 | type: active # active (real power), reactive or apparent? 11 | upper_limit: 1000000 12 | lower_limit: 0 13 | - physical_quantity: energy # power, voltage, energy, current? 14 | type: active # active (real power), reactive or apparent? 15 | upper_limit: 500000000000 16 | lower_limit: 0 17 | - physical_quantity: current 18 | type: 19 | upper_limit: 1000 20 | lower_limit: 0 21 | 22 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/combed/metadata/building2.yaml: -------------------------------------------------------------------------------- 1 | instance: 2 2 | original_name: lecture 3 | elec_meters: 4 | 1: &total_building 5 | site_meter: true 6 | device_model: EM6400 7 | 2: &floor_total 8 | submeter_of: 0 9 | device_model: EM6400 10 | 3: *floor_total 11 | 4: *floor_total 12 | 5: &AHU_lh1 13 | submeter_of: 0 14 | device_model: EM6400 15 | 6: &AHU_lh2 16 | submeter_of: 0 17 | device_model: EM6400 18 | 7: &AHU_lh3 19 | submeter_of: 0 20 | device_model: EM6400 21 | 22 | appliances: 23 | - original_name: AHU 24 | type: AHU 25 | instance: 1 26 | #floor: 1 27 | meters: [5] 28 | 29 | - original_name: AHU 30 | type: AHU 31 | instance: 2 32 | #floor: 1 33 | meters: [6] 34 | 35 | - original_name: AHU 36 | type: AHU 37 | instance: 3 38 | #floor: 1 39 | meters: [7] 40 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/eco/metadata/dataset.yaml: -------------------------------------------------------------------------------- 1 | name: ECO 2 | long_name: Electricity Consumption and Occupancy Dataset 3 | creators: 4 | - Beckel, Christian 5 | - Kleiminger, Wilhelm 6 | publication_date: 2014 7 | institution: Swiss Federal Institute of Technology Zurich 8 | contact: beckel@inf.ethz.ch 9 | description: > 10 | Dataset of 6 Swiss residential buildings with avg. 8 meters for around 8 months. 11 | subject: > 12 | The ECO data set is a comprehensive data set for non-intrusive load monitoring 13 | and occupancy detection research. It was collected in 6 Swiss households over 14 | a period of 8 months. 15 | number_of_buildings: 6 16 | timezone: CET 17 | geo_location: 18 | country: CH # standard two-letter country code defined by ISO 3166-1 alpha-2 19 | latitude: 46.757 20 | longitude: 7.61333 21 | related_documents: 22 | - http://www.vs.inf.ethz.ch/publ/papers/beckel-2014-nilm.pdf -------------------------------------------------------------------------------- /nilmtk/dataset_converters/dred/Readme.md: -------------------------------------------------------------------------------- 1 | DRED (Dutch Residential Energy Dataset) is the first open-access, publicly available dataset from The Netherlands. The data set live deployment consists of several sensors measuring electricity, occupants occupancy and ambient parameters in a household. The DRED dataset includes: 2 | 3 | * Electricity monitoring - aggregated energy consumption and appliance level energy consumption. 4 | * Ambient information - room-level indoor temperature, outdoor temperature, environmental parameters (wind speed, humidity, precipitation). 5 | * Occupancy information- room-level location information of occupants, WiFi and BT RSSI information for localisation 6 | * Household information - house layout, number of appliance monitored, appliance-location mapping, etc. 7 | 8 | The [data set homepage](http://www.st.ewi.tudelft.nl/~akshay/dred/) contains nilmtk H5 file, in addition to the raw data. 9 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/combed/metadata/dataset.yaml: -------------------------------------------------------------------------------- 1 | name: combed 2 | long_name: Commercial Building Energy Dataset 3 | creators: 4 | - Batra, Nipun 5 | - Parson, Oliver 6 | - Berges, Mario 7 | - Singh, Amarjeet 8 | - Rogers, Alex 9 | publication_date: 2014 10 | institution: Indraprastha Institute of Information Technology Delhi (IIITD) 11 | contact: nipunb@iiitd.ac.in 12 | description: 30 days of electricity data from IIITD campus 13 | subject: First public data set from an educational campus 14 | number_of_buildings: 2 15 | timezone: Asia/Kolkata 16 | geo_location: 17 | locality: Delhi # village, town, city or state 18 | country: IN # standard two-letter country code defined by ISO 3166-1 alpha-2 19 | latitude: 28.54 # 20 | longitude: 77.27 21 | related_documents: 22 | - http://combed.github.io 23 | - > 24 | A comparison of non-intrusive load monitoring methods for commercial and residential buildings 25 | schema: https://github.com/nilmtk/nilm_metadata/tree/v0.2 26 | -------------------------------------------------------------------------------- /docs/source/nilmtk.dataset_converters.combed.rst: -------------------------------------------------------------------------------- 1 | nilmtk.dataset_converters.combed package 2 | ======================================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | nilmtk.dataset_converters.combed.metadata 10 | 11 | Submodules 12 | ---------- 13 | 14 | nilmtk.dataset_converters.combed.convert_combed module 15 | ------------------------------------------------------ 16 | 17 | .. automodule:: nilmtk.dataset_converters.combed.convert_combed 18 | :members: 19 | :undoc-members: 20 | :show-inheritance: 21 | 22 | nilmtk.dataset_converters.combed.download module 23 | ------------------------------------------------ 24 | 25 | .. automodule:: nilmtk.dataset_converters.combed.download 26 | :members: 27 | :undoc-members: 28 | :show-inheritance: 29 | 30 | 31 | Module contents 32 | --------------- 33 | 34 | .. automodule:: nilmtk.dataset_converters.combed 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/greend/metadata/building7.yaml: -------------------------------------------------------------------------------- 1 | instance: 7 2 | original_name: House#6 3 | 4 | elec_meters: 5 | 1: 6 | device_model: circle 7 | submeter_of: 0 8 | room: hall 9 | 2: 10 | device_model: circle 11 | submeter_of: 0 12 | room: hall 13 | 3: 14 | device_model: circle 15 | submeter_of: 0 16 | room: hall 17 | 18 | appliances: [] 19 | 20 | description: Three floor terraced house 21 | rooms: 22 | - name: hall 23 | instance: 1 24 | floor: 0 25 | - name: utility 26 | instance: 1 27 | floor: 0 28 | - name: utility 29 | instance: 2 30 | floor: 0 31 | - name: bathroom 32 | instance: 1 33 | floor: 0 34 | - name: lounge 35 | instance: 1 36 | floor: 1 37 | - name: kitchen 38 | instance: 1 39 | floor: 1 40 | - name: bedroom 41 | instance: 1 42 | floor: 2 43 | - name: bedroom 44 | instance: 2 45 | floor: 2 46 | - name: bathroom 47 | instance: 2 48 | floor: 2 49 | 50 | n_occupants: 4 51 | construction_year: 2008 52 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/ampds/metadata/dataset.yaml: -------------------------------------------------------------------------------- 1 | name: AMPds 2 | long_name: The Almanac of Minutely Power Dataset 3 | creators: 4 | - Makonin, Stephen 5 | - Popowich, Fred 6 | - Bartram, Lyn 7 | - Gill, Bob 8 | - Bajic, Ivan V. 9 | publication_date: 2013, 2014 10 | institution: Simon Fraser University (SFU) 11 | contact: stephen@makonin.com 12 | description: a dataset consisting of electricity, water, and natural gas consumption for 2 years 13 | subject: First dataset from Canada 14 | number_of_buildings: 1 15 | timezone: America/Vancouver 16 | geo_location: 17 | locality: Burnaby 18 | country: CA 19 | latitude: 49.269 20 | longitude: -122.992 21 | related_documents: 22 | - http://ampds.org 23 | - > 24 | Stephen Makonin and Fred Popowich and Lyn Bartram and Bob Gill and Ivan V. Bajic 25 | AMPds: A Public Dataset for Load Disaggregation and Eco-Feedback Research 26 | In proceedings of the 2013 IEEE Electrical Power and Energy Conference 27 | (EPEC 2013) 28 | http://ampds.org/EPEC_2013.pdf 29 | schema: https://github.com/nilmtk/nilm_metadata/tree/v0.2 30 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/meter_devices.yaml: -------------------------------------------------------------------------------- 1 | IAM: 2 | model: unknown 3 | manufacturer: unknown 4 | manufacturer_url: unknown 5 | description: individual appliance monitor 6 | sample_period: 7 # the interval between samples. In seconds. 7 | max_sample_period: 120 # Max allowable interval between samples. Seconds. 8 | measurements: 9 | - physical_quantity: power # power, voltage, energy, current? 10 | type: active # active (real power), reactive or apparent? 11 | upper_limit: 5000 12 | lower_limit: 0 13 | wireless: true 14 | 15 | Clamp: 16 | model: unknown 17 | manufacturer: unknown 18 | manufacturer_url: unknown 19 | description: current clamp 20 | sample_period: 7 # the interval between samples. In seconds. 21 | max_sample_period: 120 # Max allowable interval between samples. Seconds. 22 | measurements: 23 | - physical_quantity: power # power, voltage, energy, current? 24 | type: active # active (real power), reactive or apparent? 25 | upper_limit: 5000 26 | lower_limit: 0 27 | wireless: true 28 | -------------------------------------------------------------------------------- /docs/source/nilmtk.datastore.rst: -------------------------------------------------------------------------------- 1 | nilmtk.datastore package 2 | ======================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | nilmtk.datastore.csvdatastore module 8 | ------------------------------------ 9 | 10 | .. automodule:: nilmtk.datastore.csvdatastore 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | nilmtk.datastore.datastore module 16 | --------------------------------- 17 | 18 | .. automodule:: nilmtk.datastore.datastore 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | nilmtk.datastore.hdfdatastore module 24 | ------------------------------------ 25 | 26 | .. automodule:: nilmtk.datastore.hdfdatastore 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | nilmtk.datastore.key module 32 | --------------------------- 33 | 34 | .. automodule:: nilmtk.datastore.key 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | 40 | Module contents 41 | --------------- 42 | 43 | .. automodule:: nilmtk.datastore 44 | :members: 45 | :undoc-members: 46 | :show-inheritance: 47 | -------------------------------------------------------------------------------- /nilmtk/tests/testingtools.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tools to help with testing. 3 | """ 4 | 5 | from __future__ import print_function, division 6 | import os, inspect, warnings 7 | 8 | def data_dir(): 9 | # Taken from http://stackoverflow.com/a/6098238/732596 10 | current_file_path = os.path.dirname(inspect.getfile(inspect.currentframe())) 11 | data_dir = os.path.join(current_file_path, '..', '..', 'data') 12 | data_dir = os.path.abspath(data_dir) 13 | assert os.path.isdir(data_dir), data_dir + " does not exist." 14 | return data_dir 15 | 16 | 17 | class WarningTestMixin(object): 18 | """A test which checks if the specified warning was raised. 19 | 20 | Taken from http://stackoverflow.com/a/12935176/732596 21 | """ 22 | def assertWarns(self, warning, callable, *args, **kwds): 23 | with warnings.catch_warnings(record=True) as warning_list: 24 | warnings.simplefilter('always') 25 | result = callable(*args, **kwds) 26 | self.assertTrue(any(item.category == warning for item in warning_list), 27 | msg="Warning '{}' not raised.".format(warning)) 28 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/dataport/metadata/dataset.yaml: -------------------------------------------------------------------------------- 1 | name: Dataport 2 | long_name: Dataport Database 3 | creators: 4 | - Grant Fisher 5 | publication_date: 2015 6 | institution: Pecan Street Inc 7 | contact: gfisher@pecanstreet.org 8 | description: Over 100,000,000,000 (100 Billion) records of energy, water, gas, and additional data 9 | subject: Disaggregated power, water, and other data from residential, commercial, and light industrial buildings. 10 | number_of_buildings: 1500 #as of 2015-05 in energy. Additional with water 11 | timezone: US/Central 12 | geo_location: #of Pecan Street. Data is from over 50 states 13 | locality: Austin # village, town, city or state 14 | country: US # standard two-letter country code defined by ISO 3166-1 alpha-2 15 | latitude: 30.292308 # Pecan Street lab's coorindates 16 | longitude: -97.699671 17 | related_documents: 18 | - https://dataport.pecanstreet.org/ 19 | - https://dataport.pecanstreet.org/data/interactive?metadata #must be logged in to view 20 | - https://dataport.pecanstreet.org/data/database?tabledata #must be logged in to view 21 | schema: https://github.com/nilmtk/nilm_metadata/tree/v0.2 22 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/hes/metadata/dataset.yaml: -------------------------------------------------------------------------------- 1 | name: HES 2 | long_name: Household Electricity Survey 3 | creators: 4 | - DECC 5 | - DEFRA 6 | - EST 7 | publication_date: 2012 8 | institution: UK Department of Energy and Climate Change 9 | contact: Efficient.Products@icfi.com 10 | description: Electricity and temperature data collected from 250 homes in England. 11 | subject: Disaggregated power from residential buildings. 12 | number_of_buildings: 250 13 | timezone: Europe/London 14 | geo_location: #of London. Data is from across England 15 | locality: Austin # village, town, city or state 16 | country: GB # standard two-letter country code defined by ISO 3166-1 alpha-2 17 | latitude: 51.505986 # Pecan Street lab's coorindates 18 | longitude: -0.126082 19 | related_documents: 20 | - https://www.gov.uk/government/uploads/system/uploads/attachment_data/file/208097/10043_R66141HouseholdElectricitySurveyFinalReportissue4.pdf 21 | - http://www.energysavingtrust.org.uk/sites/default/files/reports/PoweringthenationreportCO332.pdf 22 | - https://www.gov.uk/government/uploads/system/uploads/attachment_data/file/325741/Powering_the_Nation_2_260614.pdf 23 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/redd/metadata/dataset.yaml: -------------------------------------------------------------------------------- 1 | name: REDD 2 | long_name: The Reference Energy Disaggregation Data set 3 | creators: 4 | - Kolter, Zico 5 | - Johnson, Matthew 6 | publication_date: 2011 7 | institution: Massachusetts Institute of Technology (MIT) 8 | contact: zkolter@cs.cmu.edu # Zico moved from MIT to CMU 9 | description: Several weeks of power data for 6 different homes. 10 | subject: Disaggregated power demand from domestic buildings. 11 | number_of_buildings: 6 12 | timezone: US/Eastern # MIT is on the east coast 13 | geo_location: 14 | locality: Massachusetts # village, town, city or state 15 | country: US # standard two-letter country code defined by ISO 3166-1 alpha-2 16 | latitude: 42.360091 # MIT's coorindates 17 | longitude: -71.09416 18 | related_documents: 19 | - http://redd.csail.mit.edu 20 | - > 21 | J. Zico Kolter and Matthew J. Johnson. 22 | REDD: A public data set for energy disaggregation research. 23 | In proceedings of the SustKDD workshop on 24 | Data Mining Applications in Sustainability, 2011. 25 | http://redd.csail.mit.edu/kolter-kddsust11.pdf 26 | schema: https://github.com/nilmtk/nilm_metadata/tree/v0.2 27 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/hes/metadata/meter_devices.yaml: -------------------------------------------------------------------------------- 1 | wattmeter: 2 | model: serial wattmeter 3 | manufacturer: Enertech 4 | manufacturer_url: http://www.enertech.net/ 5 | description: > 6 | Measures appliance-level power demand. 7 | sample_period: 120 # the interval between samples. In seconds. 8 | max_sample_period: 240 # Max allowable interval between samples. Seconds. 9 | measurements: 10 | - physical_quantity: power # power, voltage, energy, current? 11 | type: active # active (real power), reactive or apparent? 12 | upper_limit: 3000 13 | lower_limit: 0 14 | wireless: false 15 | 16 | multivoies: 17 | model: Multivoies system 18 | manufacturer: OmegaWatt 19 | manufacturer_url: http://mv.omegawatt.fr/ 20 | description: > 21 | Measures circuit-level power demand. 22 | sample_period: 120 # the interval between samples. In seconds. 23 | max_sample_period: 240 # Max allowable interval between samples. Seconds. 24 | measurements: 25 | - physical_quantity: power # power, voltage, energy, current? 26 | type: active # active (real power), reactive or apparent? 27 | upper_limit: 3000 28 | lower_limit: 0 29 | wireless: true -------------------------------------------------------------------------------- /docs/source/nilmtk.disaggregate.rst: -------------------------------------------------------------------------------- 1 | nilmtk.disaggregate package 2 | =========================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | nilmtk.disaggregate.combinatorial_optimisation module 8 | ----------------------------------------------------- 9 | 10 | .. automodule:: nilmtk.disaggregate.combinatorial_optimisation 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | nilmtk.disaggregate.disaggregator module 16 | ---------------------------------------- 17 | 18 | .. automodule:: nilmtk.disaggregate.disaggregator 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | nilmtk.disaggregate.fhmm_exact module 24 | ------------------------------------- 25 | 26 | .. automodule:: nilmtk.disaggregate.fhmm_exact 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | nilmtk.disaggregate.hart_85 module 32 | ---------------------------------- 33 | 34 | .. automodule:: nilmtk.disaggregate.hart_85 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | 40 | Module contents 41 | --------------- 42 | 43 | .. automodule:: nilmtk.disaggregate 44 | :members: 45 | :undoc-members: 46 | :show-inheritance: 47 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/iawe/metadata/dataset.yaml: -------------------------------------------------------------------------------- 1 | name: iAWE 2 | long_name: Indian dataset for ambient, water and electricity sensing 3 | creators: 4 | - Batra, Nipun 5 | - Gulati, Manoj 6 | - Singh, Amarjeet 7 | - Srivastava, Mani 8 | publication_date: 2013 9 | institution: Indraprastha Institute of Information Technology Delhi (IIITD) 10 | contact: nipunb@iiitd.ac.in 11 | description: 73 days of ambient, water and electricity data for a home in Delhi 12 | subject: First dataset from a developing country 13 | number_of_buildings: 1 14 | timezone: Asia/Kolkata 15 | geo_location: 16 | locality: Delhi # village, town, city or state 17 | country: IN # standard two-letter country code defined by ISO 3166-1 alpha-2 18 | latitude: 28.64 # 19 | longitude: 77.11 20 | related_documents: 21 | - http://iawe.github.io 22 | - > 23 | Nipun Batra and Manoj Gulati and Amarjeet Singh and Mani Srivastava 24 | It's Different: Insights into home energy consumption in India. 25 | In proceedings of the 5th ACM Workshop On Embedded Systems 26 | For Energy-Efficient Buildings (Buildsys 2013) 27 | http://nipunbatra.github.io/downloads/files/buildsys_2013.pdf 28 | schema: https://github.com/nilmtk/nilm_metadata/tree/v0.2 29 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false # use new container infrastructure on Travis CI 2 | 3 | language: python 4 | 5 | python: 2.7 6 | 7 | before_install: 8 | # Install miniconda. 9 | - wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh 10 | - bash miniconda.sh -b -p $HOME/miniconda 11 | - rm miniconda.sh 12 | - export PATH="$HOME/miniconda/bin:$PATH" 13 | - hash -r 14 | - conda config --set always_yes yes --set changeps1 no 15 | - conda install -c conda conda-env 16 | - conda info -a # Useful for debugging any issues with conda 17 | 18 | install: 19 | # create and activate env using NILMTK's environment.yml 20 | - conda env create 21 | - source activate nilmtk-env 22 | 23 | # Install nilm_metadata (can't yet install using pip / conda) 24 | #- pip install 'git+https://github.com/nilmtk/nilm_metadata.git#egg=nilm_metadata' 25 | 26 | # Finally, install nilmtk... 27 | #- pip install 'git+https://github.com/nilmtk/nilmtk.git#egg=nilmtk' 28 | 29 | script: 30 | - python -c 'from nilmtk.utils import show_versions; show_versions()' 31 | - nosetests 32 | 33 | after_script: 34 | - source deactivate 35 | 36 | cache: 37 | directories: 38 | - $HOME/.cache/pip 39 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building12.yaml: -------------------------------------------------------------------------------- 1 | instance: 12 2 | original_name: House12 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge-Freezer 21 | type: fridge freezer 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: ??? 26 | type: unknown 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: ??? 31 | type: unknown 32 | instance: 2 33 | meters: [4] 34 | 35 | - original_name: Computer Site 36 | type: computer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Microwave 41 | type: microwave 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Kettle 46 | type: kettle 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Toaster 51 | type: toaster 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Television 56 | type: television 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: ??? 61 | type: unknown 62 | instance: 3 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /docs/source/nilmtk.stats.tests.rst: -------------------------------------------------------------------------------- 1 | nilmtk.stats.tests package 2 | ========================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | nilmtk.stats.tests.test_dropoutrate module 8 | ------------------------------------------ 9 | 10 | .. automodule:: nilmtk.stats.tests.test_dropoutrate 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | nilmtk.stats.tests.test_locategoodsections module 16 | ------------------------------------------------- 17 | 18 | .. automodule:: nilmtk.stats.tests.test_locategoodsections 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | nilmtk.stats.tests.test_totalenergy module 24 | ------------------------------------------ 25 | 26 | .. automodule:: nilmtk.stats.tests.test_totalenergy 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | nilmtk.stats.tests.test_totalenergyresults module 32 | ------------------------------------------------- 33 | 34 | .. automodule:: nilmtk.stats.tests.test_totalenergyresults 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | 40 | Module contents 41 | --------------- 42 | 43 | .. automodule:: nilmtk.stats.tests 44 | :members: 45 | :undoc-members: 46 | :show-inheritance: 47 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building8.yaml: -------------------------------------------------------------------------------- 1 | instance: 8 2 | original_name: House8 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge 21 | type: fridge 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Freezer 26 | type: freezer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Washer Dryer 31 | type: washer dryer 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Washing Machine 36 | type: washing machine 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Toaster 41 | type: toaster 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Computer 46 | type: computer 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Television Site 51 | type: television 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Microwave 56 | type: microwave 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Kettle 61 | type: kettle 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building6.yaml: -------------------------------------------------------------------------------- 1 | instance: 6 2 | original_name: House6 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Freezer 21 | type: freezer 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Washing Machine 26 | type: washing machine 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Dishwasher 31 | type: dish washer 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: MJY Computer 36 | type: computer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: TV/Satellite 41 | type: television 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Microwave 46 | type: microwave 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Kettle 51 | type: kettle 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Toaster 56 | type: toaster 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: PGM Computer 61 | type: computer 62 | instance: 2 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building7.yaml: -------------------------------------------------------------------------------- 1 | instance: 7 2 | original_name: House7 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge 21 | type: fridge 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Freezer(1) 26 | type: freezer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Freezer(2) 31 | type: freezer 32 | instance: 2 33 | meters: [4] 34 | 35 | - original_name: Tumble Dryer 36 | type: tumble dryer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Washing Machine 41 | type: washing machine 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Dishwasher 46 | type: dish washer 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Television Site 51 | type: television 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Toaster 56 | type: toaster 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Kettle 61 | type: kettle 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building13.yaml: -------------------------------------------------------------------------------- 1 | instance: 13 2 | original_name: House13 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Television Site 21 | type: television 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Freezer 26 | type: freezer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Washing Machine 31 | type: washing machine 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Dishwasher 36 | type: dish washer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: ??? 41 | type: unknown 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Network Site 46 | type: broadband router 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Microwave 51 | type: microwave 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Microwave 56 | type: microwave 57 | instance: 2 58 | meters: [9] 59 | 60 | - original_name: Kettle 61 | type: kettle 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building2.yaml: -------------------------------------------------------------------------------- 1 | instance: 2 2 | original_name: House2 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge-Freezer 21 | type: fridge freezer 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Washing Machine 26 | type: washing machine 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Dishwaser 31 | type: dish washer 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Television Site 36 | type: television 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Microwave 41 | type: microwave 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Toaster 46 | type: toaster 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Hi-Fi 51 | type: audio system 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Kettle 56 | type: kettle 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Overhead Fan 61 | type: fan 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building11.yaml: -------------------------------------------------------------------------------- 1 | instance: 11 2 | original_name: House11 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Firdge 21 | type: fridge 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Fridge-Freezer 26 | type: fridge freezer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Washing Machine 31 | type: washing machine 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Dishwasher 36 | type: dish washer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Computer Site 41 | type: computer 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Microwave 46 | type: microwave 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Kettle 51 | type: kettle 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Router 56 | type: broadband router 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Hi-Fi 61 | type: audio system 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building19.yaml: -------------------------------------------------------------------------------- 1 | instance: 19 2 | original_name: House20 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge 21 | type: fridge 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Freezer 26 | type: freezer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Tumble Dryer 31 | type: tumble dryer 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Washing Machine 36 | type: washing machine 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Dishwasher 41 | type: dish washer 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Computer Site 46 | type: computer 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Television Site 51 | type: television 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Microwave 56 | type: microwave 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Kettle 61 | type: kettle 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building3.yaml: -------------------------------------------------------------------------------- 1 | instance: 3 2 | original_name: House3 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Toaster 21 | type: toaster 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Fridge-Freezer 26 | type: fridge freezer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Freezer 31 | type: freezer 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Tumble Dryer 36 | type: tumble dryer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Dishwasher 41 | type: dish washer 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Washing Machine 46 | type: washing machine 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Television Site 51 | type: television 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Microwave 56 | type: microwave 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Kettle 61 | type: kettle 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building18.yaml: -------------------------------------------------------------------------------- 1 | instance: 18 2 | original_name: House19 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge Freezer 21 | type: fridge freezer 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Washing Machine 26 | type: washing machine 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Television Site 31 | type: television 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Microwave 36 | type: microwave 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Kettle 41 | type: kettle 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Toaster 46 | type: toaster 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Bread-maker 51 | type: breadmaker 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Games Console 56 | type: games console 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Hi-Fi 61 | type: audio system 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building20.yaml: -------------------------------------------------------------------------------- 1 | instance: 20 2 | original_name: House21 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge-Freezer 21 | type: fridge freezer 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Tumble Dryer 26 | type: tumble dryer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Washing Machine 31 | type: washing machine 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Dishwasher 36 | type: dish washer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Food Mixer 41 | type: food processor 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Television 46 | type: television 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: ??? 51 | type: unknown 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Vivarium 56 | type: appliance 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Pond Pump 61 | type: pond pump 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building4.yaml: -------------------------------------------------------------------------------- 1 | instance: 4 2 | original_name: House4 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge 21 | type: fridge 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Freezer 26 | type: freezer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Fridge-Freezer 31 | type: fridge freezer 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Tumble Dryer 36 | type: tumble dryer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Washing Machine(1) 41 | type: washing machine 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Washing Machine(2) 46 | type: washing machine 47 | instance: 2 48 | meters: [7] 49 | 50 | - original_name: Television Site 51 | type: television 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Microwave 56 | type: microwave 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Kettle 61 | type: kettle 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building5.yaml: -------------------------------------------------------------------------------- 1 | instance: 5 2 | original_name: House5 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge-Freezer 21 | type: fridge freezer 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Tumble Dryer 26 | type: tumble dryer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Washing Machine 31 | type: washing machine 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Dishwasher 36 | type: dish washer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Desktop Computer 41 | type: computer 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Television Site 46 | type: television 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Microwave 51 | type: microwave 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Kettle 56 | type: kettle 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Toaster 61 | type: toaster 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building16.yaml: -------------------------------------------------------------------------------- 1 | instance: 16 2 | original_name: House17 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Freezer 21 | type: freezer 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Fridge-Freezer 26 | type: fridge freezer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Tumble Dryer 31 | type: tumble dryer 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Washing Machine 36 | type: washing machine 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Computer Site 41 | type: computer 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Television Site 46 | type: television 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Microwave 51 | type: microwave 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Kettle 56 | type: kettle 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: TV Site(Bedroom) 61 | type: television 62 | instance: 2 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/tests/test_combinatorial_optimisation.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | from __future__ import print_function, division 3 | import unittest 4 | from os.path import join 5 | from os import remove 6 | import pandas as pd 7 | from .testingtools import data_dir 8 | from nilmtk.datastore import HDFDataStore 9 | from nilmtk import DataSet 10 | from nilmtk.disaggregate import CombinatorialOptimisation 11 | 12 | 13 | class TestCO(unittest.TestCase): 14 | 15 | @classmethod 16 | def setUpClass(cls): 17 | filename = join(data_dir(), 'co_test.h5') 18 | cls.dataset = DataSet(filename) 19 | 20 | @classmethod 21 | def tearDownClass(cls): 22 | cls.dataset.store.close() 23 | 24 | def test_co_correctness(self): 25 | elec = self.dataset.buildings[1].elec 26 | co = CombinatorialOptimisation() 27 | co.train(elec) 28 | mains = elec.mains() 29 | 30 | pred = co.disaggregate_chunk(next(mains.load(sample_period=1))) 31 | gt = {} 32 | for meter in elec.submeters().meters: 33 | gt[meter] = next(meter.load(sample_period=1)).squeeze() 34 | gt = pd.DataFrame(gt) 35 | pred = pred[gt.columns] 36 | self.assertTrue(gt.equals(pred)) 37 | 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building10.yaml: -------------------------------------------------------------------------------- 1 | instance: 10 2 | original_name: House10 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Magimix(Blender) 21 | type: food processor 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Toaster 26 | type: toaster 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Chest Freezer 31 | type: freezer 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Fridge-Freezer 36 | type: fridge freezer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Washing Machine 41 | type: washing machine 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Dishwasher 46 | type: dish washer 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Television Site 51 | type: television 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Microwave 56 | type: microwave 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: K Mix 61 | type: food processor 62 | instance: 2 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building9.yaml: -------------------------------------------------------------------------------- 1 | instance: 9 2 | original_name: House9 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge-Freezer 21 | type: fridge freezer 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Washer Dryer 26 | type: washer dryer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Washing Machine 31 | type: washing machine 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Dishwasher 36 | type: dish washer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Television Site 41 | type: television 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Microwave 46 | type: microwave 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Kettle 51 | type: kettle 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Hi-Fi 56 | type: audio system 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Electric Heater 61 | type: electric space heater 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/dataset.yaml: -------------------------------------------------------------------------------- 1 | name: REFIT 2 | long_name: REFIT Electrical Load Measurements dataset 3 | creators: 4 | - Murray, David 5 | - Stankovic, Lina 6 | publication_date: 2015 7 | institution: University of Strathclyde 8 | contact: david.murray.2013@uni.strath.ac.uk 9 | description: Up to 2 years of power data for 20 UK homes. 10 | subject: Disaggregated power demand from domestic buildings. 11 | number_of_buildings: 20 12 | timezone: Europe/London 13 | geo_location: 14 | locality: Loughborough # village, town, city or state 15 | country: UK # standard two-letter country code defined by ISO 3166-1 alpha-2 16 | latitude: 52.769655 # Loughborough University's coorindates 17 | longitude: -1.225061 18 | related_documents: 19 | - http://iet.jrc.ec.europa.eu/energyefficiency/sites/energyefficiency/files/events/EEDAL15/S25_Smart_Meters/eedal15_submission_124.pdf 20 | - > 21 | David Murray, Jing Liao, Lina Stankovic, Vladimir Stankovic, Richard Hauxwell-Baldwin, Charlie Wilson, Michael Coleman, Tom Kane, Steven Firth. 22 | A data management platform for personalised real-time energy feedback. 23 | In Procededings of the 8th International Conference on Energy Efficiency in Domestic Appliances and Lighting, 2015. 24 | schema: https://github.com/nilmtk/nilm_metadata/tree/v0.2 25 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building17.yaml: -------------------------------------------------------------------------------- 1 | instance: 17 2 | original_name: House18 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge(garage) 21 | type: fridge 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Freezer(garage) 26 | type: freezer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Fridge-Freezer 31 | type: fridge freezer 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Washer Dryer(garage) 36 | type: washer dryer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Washing Machine 41 | type: washing machine 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Dishwasher 46 | type: dish washer 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Desktop Computer 51 | type: computer 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Television Site 56 | type: television 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Microwave 61 | type: microwave 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building14.yaml: -------------------------------------------------------------------------------- 1 | instance: 14 2 | original_name: House15 # house 14 is missing from the dataset 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge-Freezer 21 | type: fridge freezer 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Tumble Dryer 26 | type: tumble dryer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Washing Machine 31 | type: washing machine 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Dishwasher 36 | type: dish washer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Computer Site 41 | type: computer 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Television Site 46 | type: television 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Microwave 51 | type: microwave 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Hi-Fi 56 | type: audio system 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Toaster 61 | type: toaster 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/eco/metadata/meter_devices.yaml: -------------------------------------------------------------------------------- 1 | smart_meter: 2 | model: Smart Meter 3 | model_url: http://www.landisgyr.com/webfoo/wp-content/uploads/2012/12/Landis+Gyr-E750-Brochure-English.pdf 4 | description: > 5 | 1 Hz aggregate consumption data. Each measurement contains data 6 | on current, voltage, and phase shift for each of the three phases 7 | in the household. 8 | sample_period: 1 9 | max_sample_period: 1 10 | measurements: 11 | - physical_quantity: power 12 | type: active 13 | upper_limit: 100000 14 | lower_limit: 0 15 | - physical_quantity: current 16 | upper_limit: 20 17 | lower_limit: 0 18 | - physical_quantity: voltage 19 | upper_limit: 400 20 | lower_limit: 0 21 | - physical_quantity: phase_angle 22 | upper_limit: 360 23 | lower_limit: 0 24 | - physical_quantity: power 25 | type: reactive 26 | upper_limit: 100000 27 | lower_limit: -100000 28 | wireless: false 29 | 30 | plug: 31 | model: Plug 32 | description: > 33 | 1 Hz plug-level data measured from selected appliances. 34 | sample_period: 1 35 | max_sample_period: 1 36 | measurements: 37 | - physical_quantity: power 38 | type: active 39 | upper_limit: 10000 40 | lower_limit: 0 41 | wireless: true 42 | wireless_configuration: 43 | protocol: ZigBee 44 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building15.yaml: -------------------------------------------------------------------------------- 1 | instance: 15 2 | original_name: House16 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge-Freezer(1) 21 | type: fridge freezer 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Fridge-Freezer(2) 26 | type: fridge freezer 27 | instance: 2 28 | meters: [3] 29 | 30 | - original_name: Electric Heater(1) 31 | type: electric space heater 32 | instance: 1 33 | meters: [4] 34 | 35 | - original_name: Electric Heater(2) 36 | type: electric space heater 37 | instance: 2 38 | meters: [5] 39 | 40 | - original_name: Washing Machine 41 | type: washing machine 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Dishwasher 46 | type: dish washer 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Computer Site 51 | type: computer 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Television Site 56 | type: television 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Dehumidifier 61 | type: dehumidifier 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/refit/metadata/building1.yaml: -------------------------------------------------------------------------------- 1 | instance: 1 # this is the first building in the dataset 2 | original_name: House1 # original name from REFIT dataset 3 | elec_meters: 4 | 1: &clamp 5 | site_meter: true 6 | device_model: Clamp 7 | 2: &iam 8 | submeter_of: 0 9 | device_model: IAM 10 | 3: *iam 11 | 4: *iam 12 | 5: *iam 13 | 6: *iam 14 | 7: *iam 15 | 8: *iam 16 | 9: *iam 17 | 10: *iam 18 | 19 | appliances: 20 | - original_name: Fridge 21 | type: fridge 22 | instance: 1 23 | meters: [2] 24 | 25 | - original_name: Freezer(1) 26 | type: freezer 27 | instance: 1 28 | meters: [3] 29 | 30 | - original_name: Freezer(2) 31 | type: freezer 32 | instance: 2 33 | meters: [4] 34 | 35 | - original_name: Washer Dryer 36 | type: washer dryer 37 | instance: 1 38 | meters: [5] 39 | 40 | - original_name: Washing Machine 41 | type: washing machine 42 | instance: 1 43 | meters: [6] 44 | 45 | - original_name: Dishwaser 46 | type: dish washer 47 | instance: 1 48 | meters: [7] 49 | 50 | - original_name: Computer 51 | type: computer 52 | instance: 1 53 | meters: [8] 54 | 55 | - original_name: Television Site 56 | type: television 57 | instance: 1 58 | meters: [9] 59 | 60 | - original_name: Electric Heater 61 | type: electric space heater 62 | instance: 1 63 | meters: [10] 64 | -------------------------------------------------------------------------------- /tests_on_large_datasets/redd_house3_f1_score.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function, division 2 | from nilmtk import DataSet, HDFDataStore 3 | from nilmtk.disaggregate import fhmm_exact 4 | from nilmtk.metrics import f1_score 5 | from os.path import join 6 | import matplotlib.pyplot as plt 7 | 8 | """ 9 | This file replicates issue #376 (which should now be fixed) 10 | https://github.com/nilmtk/nilmtk/issues/376 11 | """ 12 | 13 | data_dir = '/data/REDD' 14 | building_number = 3 15 | disag_filename = join(data_dir, 'disag-fhmm' + str(building_number) + '.h5') 16 | 17 | data = DataSet(join(data_dir, 'redd.h5')) 18 | print("Loading building " + str(building_number)) 19 | elec = data.buildings[building_number].elec 20 | 21 | top_train_elec = elec.submeters().select_top_k(k=5) 22 | fhmm = fhmm_exact.FHMM() 23 | fhmm.train(top_train_elec) 24 | 25 | output = HDFDataStore(disag_filename, 'w') 26 | fhmm.disaggregate(elec.mains(), output) 27 | output.close() 28 | 29 | ### f1score fhmm 30 | disag = DataSet(disag_filename) 31 | disag_elec = disag.buildings[building_number].elec 32 | 33 | f1 = f1_score(disag_elec, elec) 34 | f1.index = disag_elec.get_labels(f1.index) 35 | f1.plot(kind='barh') 36 | plt.ylabel('appliance'); 37 | plt.xlabel('f-score'); 38 | plt.title("FHMM"); 39 | plt.savefig(join(data_dir, 'f1-fhmm' + str(building_number) + '.png')) 40 | disag.store.close() 41 | #### 42 | print("Finishing building " + str(building_number)) 43 | -------------------------------------------------------------------------------- /nilmtk/tests/test_fhmm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | from __future__ import print_function, division 3 | import unittest 4 | from os.path import join 5 | from os import remove 6 | from .testingtools import data_dir 7 | from nilmtk.datastore import HDFDataStore 8 | from nilmtk import DataSet 9 | from nilmtk.disaggregate import FHMM 10 | 11 | 12 | class TestFHMM(unittest.TestCase): 13 | 14 | @classmethod 15 | def setUpClass(cls): 16 | filename = join(data_dir(), 'co_test.h5') 17 | cls.dataset = DataSet(filename) 18 | 19 | @classmethod 20 | def tearDownClass(cls): 21 | cls.dataset.store.close() 22 | 23 | def test_fhmm_correctness(self): 24 | elec = self.dataset.buildings[1].elec 25 | fhmm = FHMM() 26 | fhmm.train(elec) 27 | mains = elec.mains() 28 | output = HDFDataStore('output.h5', 'w') 29 | fhmm.disaggregate(mains, output, sample_period=1) 30 | 31 | for meter in range(2, 4): 32 | df1 = output.store.get('/building1/elec/meter{}'.format(meter)) 33 | df2 = self.dataset.store.store.get( 34 | '/building1/elec/meter{}'.format(meter)) 35 | 36 | self.assertEqual((df1 == df2).sum().values[0], len(df1.index)) 37 | self.assertEqual(len(df1.index), len(df2.index)) 38 | output.close() 39 | remove("output.h5") 40 | 41 | 42 | if __name__ == '__main__': 43 | unittest.main() 44 | -------------------------------------------------------------------------------- /docs/manual/user_guide/install_user.md: -------------------------------------------------------------------------------- 1 | 2 | # Install NILMTK 3 | 4 | We recommend using 5 | [Anaconda](https://store.continuum.io/cshop/anaconda/), which bundles 6 | togther most of the required packages. Since many packages are deprecating 7 | Python 2, we are now recommending installing Python 3.6. For the time being, 8 | Python 2.7 is still supported but that may change in the near future. 9 | 10 | ```bash 11 | # 0. For Windows only. Download the appropriate version of VS C++ compiler for Python version. 12 | # For Python 3.6 https://www.microsoft.com/en-us/download/details.aspx?id=48159 13 | # For Python 2.7 https://www.microsoft.com/en-us/download/details.aspx?id=44266 14 | # This is needed for building hmmlearn. 15 | 16 | # 1. Download environment.yml from NILMTK. For Unix like environment, use wget 17 | # for Windows, download manually 18 | wget https://raw.githubusercontent.com/nilmtk/nilmtk/master/environment.yml 19 | 20 | # 2. Creating nilmtk environment. Will download the necessary packages 21 | conda env create 22 | # For Linux/OSX 23 | source activate nilmtk-env 24 | # For Windows 25 | activate nilmtk-env 26 | 27 | # 3. Create a Jupyter kernel environment 28 | python -m ipykernel install --user --name nilmtk-env --display-name "Python (nilmtk)" 29 | 30 | #4. Configuring the interpreter in your IDE to use nilmtk-env 31 | # See https://github.com/nilmtk/nilmtk/issues/557#issuecomment-290094260 on how to do this in PyCharm. 32 | ``` 33 | 34 | -------------------------------------------------------------------------------- /nilmtk/__init__.py: -------------------------------------------------------------------------------- 1 | # re-enable deprecation warnings 2 | import warnings 3 | warnings.simplefilter('default') 4 | 5 | # Silence ImportWarnings for the time being 6 | warnings.filterwarnings('ignore', category=ImportWarning) 7 | 8 | from nilmtk import * 9 | from nilmtk.version import version as __version__ 10 | from nilmtk.timeframe import TimeFrame 11 | from nilmtk.elecmeter import ElecMeter 12 | from nilmtk.datastore import DataStore, HDFDataStore, CSVDataStore, Key 13 | from nilmtk.metergroup import MeterGroup 14 | from nilmtk.appliance import Appliance 15 | from nilmtk.building import Building 16 | from nilmtk.dataset import DataSet 17 | 18 | global_meter_group = MeterGroup() 19 | 20 | 21 | def teardown_package(): 22 | """Nosetests package teardown function (run when tests are done). 23 | See http://nose.readthedocs.org/en/latest/writing_tests.html#test-packages 24 | 25 | Uses git to reset data_dir after tests have run. 26 | """ 27 | from nilmtk.tests.testingtools import data_dir 28 | import subprocess 29 | 30 | #Workaround for open .h5 files on Windows 31 | from tables.file import _open_files 32 | _open_files.close_all() 33 | 34 | cmd = "git checkout -- {}".format(data_dir()) 35 | try: 36 | subprocess.check_output(cmd, shell=True, cwd=data_dir()) 37 | except Exception: 38 | print("Failed to run '{}'".format(cmd)) 39 | raise 40 | else: 41 | print("Succeeded in running '{}'".format(cmd)) 42 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/ampds/metadata/meter_devices.yaml: -------------------------------------------------------------------------------- 1 | PS18: 2 | model: PowerScout 18 3 | manufacturer: DENT Instruments 4 | manufacturer_url: http://www.dentinstruments.com 5 | description: Branch curcuit power meter (18) 6 | sample_period: 60 7 | max_sample_period: 60 8 | measurements: 9 | - physical_quantity: voltage 10 | type: apparent 11 | upper_limit: 270 12 | lower_limit: 0 13 | - physical_quantity: current 14 | type: apparent 15 | upper_limit: 400 16 | lower_limit: 0 17 | - physical_quantity: frequency 18 | type: apparent 19 | upper_limit: 70 20 | lower_limit: 0 21 | - physical_quantity: power factor 22 | type: apparent 23 | upper_limit: 1 24 | lower_limit: 0 25 | - physical_quantity: power factor 26 | type: real 27 | upper_limit: 1 28 | lower_limit: 0 29 | - physical_quantity: power 30 | type: active 31 | upper_limit: 96000 32 | lower_limit: 0 33 | - physical_quantity: cumulative energy 34 | type: active 35 | upper_limit: 500000000 36 | lower_limit: 0 37 | - physical_quantity: power 38 | type: reactive 39 | upper_limit: 96000 40 | lower_limit: 0 41 | - physical_quantity: cumulative energy 42 | type: reactive 43 | upper_limit: 500000000 44 | lower_limit: 0 45 | - physical_quantity: power 46 | type: apparent 47 | upper_limit: 96000 48 | lower_limit: 0 49 | - physical_quantity: cumulative energy 50 | type: apparent 51 | upper_limit: 500000000 52 | lower_limit: 0 53 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/iawe/metadata/building1.yaml: -------------------------------------------------------------------------------- 1 | instance: 1 # this is the first building in the dataset 2 | original_name: house_1 # original name from REDD dataset 3 | elec_meters: 4 | 1: &EM6400 5 | site_meter: true 6 | device_model: EM6400 7 | 2: *EM6400 8 | 3: &jplug 9 | submeter_of: 0 10 | device_model: jplug 11 | 4: *jplug 12 | 5: *jplug 13 | 6: *jplug 14 | 7: *jplug 15 | 8: *jplug 16 | 9: *jplug 17 | 10: *jplug 18 | 11: *jplug 19 | 20 | appliances: 21 | - original_name: fridge 22 | type: fridge 23 | #floor: 0 24 | instance: 1 25 | meters: [3] 26 | 27 | - original_name: air conditioner 28 | type: air conditioner 29 | instance: 1 30 | #floor: 1 31 | meters: [4] 32 | 33 | - original_name: air conditioner 34 | type: air conditioner 35 | instance: 2 36 | #floor: 1 37 | meters: [5] 38 | 39 | - original_name: washing machine 40 | type: washing machine 41 | instance: 1 42 | #floor: 1 43 | meters: [6] 44 | 45 | - original_name: laptop computer 46 | #floor: 1 47 | type: computer 48 | instance: 1 49 | meters: [7] 50 | 51 | - original_name: clothes iron 52 | #floor: 1 53 | type: clothes iron 54 | instance: 1 55 | meters: [8] 56 | 57 | - original_name: kitchen outlets 58 | type: unknown 59 | instance: 1 60 | meters: [9] 61 | 62 | - original_name: television 63 | type: television 64 | instance: 1 65 | #floor: 0 66 | meters: [10] 67 | 68 | - original_name: water filter 69 | type: wet appliance 70 | instance: 1 71 | meters: [11] 72 | -------------------------------------------------------------------------------- /nilmtk/stats/histogram.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function, division 2 | import numpy as np 3 | from warnings import warn 4 | 5 | 6 | def histogram_from_generator(generator, bins=None, range=None, **kwargs): 7 | """Apart from 'generator', takes the same key word arguments 8 | as numpy.histogram. And returns the same objects as np.histogram. 9 | 10 | Parameters 11 | ---------- 12 | range : None or (min, max) 13 | range differs from np.histogram's interpretation of 'range' in 14 | that either element can be None, in which case the min or max 15 | of the first chunk is used. 16 | bins : None or int 17 | if None then uses int(range[1]-range[0]) 18 | """ 19 | 20 | if 'density' in kwargs or 'normed' in kwargs: 21 | warn("This function is not designed to output densities.") 22 | 23 | histogram_cumulator = None 24 | for chunk in generator: 25 | if range is None: 26 | range = (chunk.min(), chunk.max()) 27 | else: 28 | if range[0] is None: 29 | range = (chunk.min(), range[1]) 30 | if range[1] is None: 31 | range = (range[0], chunk.max()) 32 | if bins is None: 33 | bins = int(range[1] - range[0]) 34 | hist, bins = np.histogram(chunk, bins=bins, range=range, **kwargs) 35 | if histogram_cumulator is None: 36 | histogram_cumulator = hist 37 | else: 38 | histogram_cumulator += hist 39 | 40 | return histogram_cumulator, bins 41 | -------------------------------------------------------------------------------- /nilmtk/stats/totalenergyresults.py: -------------------------------------------------------------------------------- 1 | from ..results import Results 2 | from ..measurement import AC_TYPES 3 | import pandas as pd 4 | 5 | class TotalEnergyResults(Results): 6 | """ 7 | Attributes 8 | ---------- 9 | _data : pd.DataFrame 10 | index is start date 11 | `end` is end date 12 | `active` is (optional) energy in kWh 13 | `reactive` is (optional) energy in kVARh 14 | `apparent` is (optional) energy in kVAh 15 | """ 16 | 17 | name = "total_energy" 18 | 19 | def append(self, timeframe, new_results): 20 | """Append a single result. 21 | e.g. append(TimeFrame(start, end), {'apparent': 34, 'active': 43}) 22 | """ 23 | if set(new_results.keys()) - set(AC_TYPES): 24 | raise KeyError('new_results must be a combination of ' + 25 | str(AC_TYPES)) 26 | super(TotalEnergyResults, self).append(timeframe, new_results) 27 | 28 | def unify(self, other): 29 | super(TotalEnergyResults, self).unify(other) 30 | ac_types = set(self._data.columns) - set(['end']) 31 | for i, row in self._data.iterrows(): 32 | for ac_type in ac_types: 33 | self._data[ac_type].loc[i] += other._data[ac_type].loc[i] 34 | 35 | def to_dict(self): 36 | return {'total_energy': self.combined().to_dict()} 37 | 38 | def simple(self): 39 | return self.combined() 40 | 41 | def export_to_cache(self): 42 | return self._data.fillna(0).apply(pd.to_numeric, errors='ignore') 43 | -------------------------------------------------------------------------------- /nilmtk/tests/test_metrics.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | from __future__ import print_function, division 3 | import unittest 4 | from os.path import join 5 | from nilmtk.tests.testingtools import data_dir 6 | from nilmtk import (Appliance, MeterGroup, ElecMeter, HDFDataStore, 7 | global_meter_group, TimeFrame, DataSet) 8 | from nilmtk.utils import tree_root, nodes_adjacent_to_root 9 | from nilmtk.elecmeter import ElecMeterID 10 | from nilmtk.building import BuildingID 11 | from nilmtk.disaggregate import CombinatorialOptimisation 12 | from nilmtk.metrics import f1_score 13 | 14 | class TestMetrics(unittest.TestCase): 15 | @classmethod 16 | def setUpClass(cls): 17 | filename = join(data_dir(), 'co_test.h5') 18 | cls.dataset = DataSet(filename) 19 | 20 | @classmethod 21 | def tearDownClass(cls): 22 | cls.dataset.store.close() 23 | 24 | def test_f1(self): 25 | pass 26 | # The code below doesn't work yet because it complains that 27 | # AttributeError: Attribute 'metadata' does not exist in node: '/' 28 | """ 29 | co = CombinatorialOptimisation() 30 | co.train(self.dataset.buildings[1].elec) 31 | disag_filename = join(data_dir(), 'co-disag.h5') 32 | output = HDFDataStore(disag_filename, 'w') 33 | co.disaggregate(self.dataset.buildings[1].elec.mains(), output) 34 | output.close() 35 | disag = DataSet(disag_filename) 36 | disag_elec = disag.buildings[1].elec 37 | f1 = f1_score(disag_elec, self.dataset.buildings[1].elec) 38 | """ 39 | 40 | if __name__ == '__main__': 41 | unittest.main() 42 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/redd/metadata/building2.yaml: -------------------------------------------------------------------------------- 1 | instance: 2 # this is the second building in the dataset 2 | original_name: house_2 # original name from REDD dataset 3 | elec_meters: 4 | 1: &redd_whole_house 5 | site_meter: true 6 | device_model: REDD_whole_house 7 | 2: *redd_whole_house 8 | 3: &emonitor 9 | submeter_of: 0 10 | device_model: eMonitor 11 | 4: *emonitor 12 | 5: *emonitor 13 | 6: *emonitor 14 | 7: *emonitor 15 | 8: *emonitor 16 | 9: *emonitor 17 | 10: *emonitor 18 | 11: *emonitor 19 | 20 | appliances: 21 | - original_name: kitchen_outlets 22 | room: kitchen 23 | type: sockets # sockets is treated as an appliance 24 | instance: 1 25 | multiple: true # likely to be more than 1 socket 26 | meters: [3] 27 | 28 | - original_name: lighting 29 | type: light 30 | instance: 1 31 | multiple: true # likely to be more than 1 light 32 | meters: [4] 33 | 34 | - original_name: stove 35 | type: electric stove 36 | instance: 1 37 | meters: [5] 38 | 39 | - original_name: microwave 40 | type: microwave 41 | instance: 1 42 | meters: [6] 43 | 44 | - original_name: washer_dryer 45 | type: washer dryer 46 | instance: 1 47 | meters: [7] 48 | 49 | - original_name: kitchen_outlets 50 | room: kitchen 51 | type: sockets # sockets is treated as an appliance 52 | instance: 2 53 | multiple: true # likely to be more than 1 socket 54 | meters: [8] 55 | 56 | - original_name: refrigerator 57 | type: fridge 58 | instance: 1 59 | meters: [9] 60 | 61 | - original_name: dishwaser 62 | type: dish washer 63 | instance: 1 64 | meters: [10] 65 | 66 | - original_name: disposal 67 | type: waste disposal unit 68 | instance: 1 69 | meters: [11] 70 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/eco/metadata/building3.yaml: -------------------------------------------------------------------------------- 1 | instance: 3 2 | original_name: house_3 3 | 4 | # smart_meter_data: 5 | # days: 138 6 | # #coverage: 98.89 7 | # period_start: 26.07.12 8 | # period_end: 31.01.13 9 | 10 | elec_meters: 11 | 1: &smart_meter 12 | site_meter: true 13 | device_model: smart_meter 14 | 2: *smart_meter 15 | 3: *smart_meter 16 | 4: &plug_phase2 17 | submeter_of: 2 18 | device_model: plug 19 | 5: *plug_phase2 20 | 6: *plug_phase2 21 | 7: &plug_phase1 22 | submeter_of: 1 23 | device_model: plug 24 | 8: *plug_phase2 25 | 9: *plug_phase2 26 | 10: *plug_phase2 27 | 28 | appliances: 29 | - original_name: Tablet 30 | type: laptop computer 31 | #days_covered: 104 32 | instance: 1 33 | #coverage: 94.5 34 | meters: [4] #Plug number 35 | 36 | - original_name: Freezer 37 | type: freezer 38 | #days_covered: 104 39 | instance: 1 40 | #coverage: 90.71 41 | meters: [5] #Plug number 42 | 43 | - original_name: Coffee machine 44 | type: coffee maker 45 | #days_covered: 67 46 | instance: 1 47 | #coverage: 70.79 48 | meters: [6] #Plug number 49 | 50 | - original_name: PC 51 | type: computer 52 | #days_covered: 42 53 | instance: 1 54 | #coverage: 64.0 55 | meters: [7] #Plug number 56 | 57 | - original_name: Fridge 58 | type: fridge 59 | #days_covered: 47 60 | instance: 1 61 | #coverage: 56.0 62 | meters: [8] #Plug number 63 | 64 | - original_name: Kettle 65 | type: kettle 66 | #days_covered: 42 67 | instance: 1 68 | #coverage: 67.82 69 | meters: [9] #Plug number 70 | 71 | - original_name: Entertainment 72 | type: HTPC 73 | #days_covered: 48 74 | instance: 1 75 | #coverage: 67.65 76 | meters: [10] #Plug number 77 | 78 | time_frame: 79 | start: 2012-07-26 80 | end: 2013-01-31 81 | -------------------------------------------------------------------------------- /docs/source/nilmtk.stats.rst: -------------------------------------------------------------------------------- 1 | nilmtk.stats package 2 | ==================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | nilmtk.stats.tests 10 | 11 | Submodules 12 | ---------- 13 | 14 | nilmtk.stats.dropoutrate module 15 | ------------------------------- 16 | 17 | .. automodule:: nilmtk.stats.dropoutrate 18 | :members: 19 | :undoc-members: 20 | :show-inheritance: 21 | 22 | nilmtk.stats.dropoutrateresults module 23 | -------------------------------------- 24 | 25 | .. automodule:: nilmtk.stats.dropoutrateresults 26 | :members: 27 | :undoc-members: 28 | :show-inheritance: 29 | 30 | nilmtk.stats.goodsections module 31 | -------------------------------- 32 | 33 | .. automodule:: nilmtk.stats.goodsections 34 | :members: 35 | :undoc-members: 36 | :show-inheritance: 37 | 38 | nilmtk.stats.goodsectionsresults module 39 | --------------------------------------- 40 | 41 | .. automodule:: nilmtk.stats.goodsectionsresults 42 | :members: 43 | :undoc-members: 44 | :show-inheritance: 45 | 46 | nilmtk.stats.histogram module 47 | ----------------------------- 48 | 49 | .. automodule:: nilmtk.stats.histogram 50 | :members: 51 | :undoc-members: 52 | :show-inheritance: 53 | 54 | nilmtk.stats.totalenergy module 55 | ------------------------------- 56 | 57 | .. automodule:: nilmtk.stats.totalenergy 58 | :members: 59 | :undoc-members: 60 | :show-inheritance: 61 | 62 | nilmtk.stats.totalenergyresults module 63 | -------------------------------------- 64 | 65 | .. automodule:: nilmtk.stats.totalenergyresults 66 | :members: 67 | :undoc-members: 68 | :show-inheritance: 69 | 70 | 71 | Module contents 72 | --------------- 73 | 74 | .. automodule:: nilmtk.stats 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/eco/metadata/building6.yaml: -------------------------------------------------------------------------------- 1 | instance: 6 2 | original_name: house_6 3 | 4 | # smart_meter_data: 5 | # days: 166 6 | # #coverage: 99.67 7 | # period_start: 27.06.12 8 | # period_end: 31.01.13 9 | 10 | elec_meters: 11 | 1: &smart_meter 12 | site_meter: true 13 | device_model: smart_meter 14 | 2: *smart_meter 15 | 3: *smart_meter 16 | 4: &plug_phase2 17 | submeter_of: 2 18 | device_model: plug 19 | 5: &plug_phase3 20 | submeter_of: 3 21 | device_model: plug 22 | 6: *plug_phase3 23 | 7: &plug_phase1 24 | submeter_of: 1 25 | device_model: plug 26 | 8: *plug_phase2 27 | 9: *plug_phase1 28 | 10: *plug_phase1 29 | 30 | appliances: 31 | - original_name: Lamp 32 | type: lamp 33 | #days_covered: 166 34 | instance: 1 35 | #coverage: 67.2 36 | meters: [4] #Plug number 37 | 38 | - original_name: Laptop 39 | type: laptop computer 40 | #days_covered: 185 41 | instance: 1 42 | #coverage: 97.3 43 | meters: [5] #Plug number 44 | 45 | - original_name: Router 46 | type: broadband router 47 | #days_covered: 88 48 | instance: 1 49 | #coverage: 96.73 50 | meters: [6] #Plug number 51 | 52 | - original_name: Coffee machine 53 | type: coffee maker 54 | #days_covered: 179 55 | instance: 1 56 | #coverage: 86.03 57 | meters: [7] #Plug number 58 | 59 | - original_name: Entertainment 60 | type: HTPC 61 | #days_covered: 181 62 | instance: 1 63 | #coverage: 95.86 64 | meters: [8] #Plug number 65 | 66 | - original_name: Fridge 67 | type: fridge 68 | #days_covered: 179 69 | instance: 1 70 | #coverage: 95.78 71 | meters: [9] #Plug number 72 | 73 | - original_name: Kettle 74 | type: kettle 75 | #days_covered: 147 76 | instance: 1 77 | #coverage: 82.54 78 | meters: [10] #Plug number 79 | 80 | time_frame: 81 | start: 2012-06-27 82 | end: 2013-01-31 -------------------------------------------------------------------------------- /nilmtk/dataset_converters/eco/metadata/building1.yaml: -------------------------------------------------------------------------------- 1 | instance: 1 2 | original_name: house_1 3 | 4 | # smart_meter_data: 5 | # days: 245 6 | # coverage: 99.64 7 | # period_start: 01.06.12 8 | # period_end: 31.01.13 9 | 10 | elec_meters: 11 | 1: &smart_meter 12 | device_model: smart_meter 13 | site_meter: true 14 | 2: *smart_meter 15 | 3: *smart_meter 16 | 4: &plug_phase2 17 | submeter_of: 2 18 | device_model: plug 19 | 5: &plug_phase3 20 | submeter_of: 3 21 | device_model: plug 22 | 6: *plug_phase2 23 | 7: *plug_phase2 24 | 8: &plug_phase1 25 | submeter_of: 1 26 | device_model: plug 27 | 9: *plug_phase1 28 | 10: *plug_phase1 29 | 30 | appliances: 31 | - original_name: fridge 32 | type: fridge 33 | #days_covered: 231 34 | instance: 1 35 | #coverage: 98.53 36 | meters: [4] #Plug number 37 | 38 | - original_name: dryer 39 | type: hair dryer 40 | #days_covered: 231 41 | instance: 1 42 | #coverage: 98.56 43 | meters: [5] #Plug number 44 | 45 | - original_name: Coffee machine 46 | type: coffee maker 47 | #days_covered: 113 48 | instance: 1 49 | #coverage: 85.36 50 | meters: [6] #Plug number 51 | 52 | - original_name: Kettle 53 | type: kettle 54 | #days_covered: 203 55 | instance: 1 56 | #coverage: 77.65 57 | meters: [7] #Plug number 58 | 59 | - original_name: Washing machine 60 | type: washing machine 61 | #days_covered: 231 62 | instance: 1 63 | #coverage: 98.53 64 | meters: [8] #Plug number 65 | 66 | - original_name: PC 67 | type: computer 68 | #days_covered: 66 69 | instance: 1 70 | #coverage: 84.77 71 | meters: [9] #Plug number 72 | 73 | - original_name: Freezer 74 | type: freezer 75 | #days_covered: 231 76 | instance: 1 77 | #coverage: 98.53 78 | meters: [10] #Plug number 79 | 80 | time_frame: 81 | start: 2012-06-01 82 | end: 2013-01-31 83 | -------------------------------------------------------------------------------- /nilmtk/docinherit.py: -------------------------------------------------------------------------------- 1 | """ 2 | doc_inherit decorator 3 | 4 | Usage: 5 | 6 | class Foo(object): 7 | def foo(self): 8 | "Frobber" 9 | pass 10 | 11 | class Bar(Foo): 12 | @doc_inherit 13 | def foo(self): 14 | pass 15 | 16 | Now, Bar.foo.__doc__ == Bar().foo.__doc__ == Foo.foo.__doc__ == "Frobber" 17 | 18 | from: http://code.activestate.com/recipes/576862-docstring-inheritance-decorator/ 19 | """ 20 | 21 | from functools import wraps 22 | 23 | class DocInherit(object): 24 | """ 25 | Docstring inheriting method descriptor 26 | 27 | The class itself is also used as a decorator 28 | """ 29 | 30 | def __init__(self, mthd): 31 | self.mthd = mthd 32 | self.name = mthd.__name__ 33 | 34 | def __get__(self, obj, cls): 35 | if obj: 36 | return self.get_with_inst(obj, cls) 37 | else: 38 | return self.get_no_inst(cls) 39 | 40 | def get_with_inst(self, obj, cls): 41 | 42 | overridden = getattr(super(cls, obj), self.name, None) 43 | 44 | @wraps(self.mthd, assigned=('__name__', '__module__')) 45 | def f(*args, **kwargs): 46 | return self.mthd(obj, *args, **kwargs) 47 | 48 | return self.use_parent_doc(f, overridden) 49 | 50 | def get_no_inst(self, cls): 51 | 52 | for parent in cls.__mro__[1:]: 53 | overridden = getattr(parent, self.name, None) 54 | if overridden: 55 | break 56 | 57 | @wraps(self.mthd, assigned=('__name__', '__module__')) 58 | def f(*args, **kwargs): 59 | return self.mthd(*args, **kwargs) 60 | 61 | return self.use_parent_doc(f, overridden) 62 | 63 | def use_parent_doc(self, func, source): 64 | if source is None: 65 | raise NameError("Can't find '%s' in parents" % self.name) 66 | func.__doc__ = source.__doc__ 67 | return func 68 | 69 | doc_inherit = DocInherit 70 | -------------------------------------------------------------------------------- /nilmtk/stats/dropoutrate.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function, division 2 | import numpy as np 3 | from ..node import Node 4 | from ..exceptions import TooFewSamplesError 5 | from ..utils import get_index 6 | from .dropoutrateresults import DropoutRateResults 7 | 8 | class DropoutRate(Node): 9 | 10 | requirements = {'device': {'sample_period': 'ANY VALUE'}} 11 | postconditions = {'statistics': {'dropout_rate': None}} 12 | results_class = DropoutRateResults 13 | 14 | def process(self): 15 | self.check_requirements() 16 | metadata = self.upstream.get_metadata() 17 | sample_period = metadata['device']['sample_period'] 18 | for chunk in self.upstream.process(): 19 | dropout_rate = get_dropout_rate(chunk, sample_period) 20 | self.results.append(chunk.timeframe, 21 | {'dropout_rate': dropout_rate, 22 | 'n_samples': len(chunk)}) 23 | yield chunk 24 | 25 | 26 | def get_dropout_rate(data, sample_period): 27 | """ 28 | Parameters 29 | ---------- 30 | data : pd.DataFrame or pd.Series 31 | sample_period : number, seconds 32 | 33 | Returns 34 | ------- 35 | dropout_rate : float [0,1] 36 | The proportion of samples that have been lost; where 37 | 1 means that all samples have been lost and 38 | 0 means that no samples have been lost. 39 | NaN means too few samples. 40 | """ 41 | MIN_N_SAMPLES = 5 42 | if len(data) < MIN_N_SAMPLES: 43 | return np.NaN 44 | 45 | index = get_index(data) 46 | assert(index[-1] > index[0]) 47 | duration = index[-1] - index[0] 48 | n_expected_samples = round(duration.total_seconds() / sample_period) + 1 49 | dropout_rate = 1 - (index.size / n_expected_samples) 50 | if dropout_rate < 0: 51 | dropout_rate = 0.0 52 | assert(1 >= dropout_rate >= 0) 53 | return dropout_rate 54 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/eco/metadata/building5.yaml: -------------------------------------------------------------------------------- 1 | instance: 5 2 | original_name: house_5 3 | 4 | # smart_meter_data: 5 | # days: 215 6 | # #coverage: 99.05 7 | # period_start: 27.06.12 8 | # period_end: 31.01.13 9 | 10 | elec_meters: 11 | 1: &smart_meter 12 | site_meter: true 13 | device_model: smart_meter 14 | 2: *smart_meter 15 | 3: *smart_meter 16 | 4: &plug_phase3 17 | submeter_of: 3 18 | device_model: plug 19 | 5: *plug_phase3 20 | 6: &plug_phase2 21 | submeter_of: 2 22 | device_model: plug 23 | 7: *plug_phase3 24 | 8: *plug_phase3 25 | 9: *plug_phase2 26 | 10: *plug_phase3 27 | 11: *plug_phase3 28 | 29 | appliances: 30 | - original_name: Tablet 31 | type: laptop computer 32 | #days_covered: 218 33 | instance: 1 34 | #coverage: 97.87 35 | meters: [4] #Plug number 36 | 37 | - original_name: Coffee machine 38 | type: coffee maker 39 | #days_covered: 218 40 | instance: 1 41 | #coverage: 95.16 42 | meters: [5] #Plug number 43 | 44 | - original_name: Fountain 45 | type: garden sprinkler 46 | #days_covered: 71 47 | instance: 1 48 | #coverage: 99.43 49 | meters: [6] #Plug number 50 | 51 | - original_name: Microwave 52 | type: microwave 53 | #days_covered: 218 54 | instance: 1 55 | #coverage: 97.87 56 | meters: [7] #Plug number 57 | 58 | - original_name: Fridge 59 | type: fridge 60 | #days_covered: 218 61 | instance: 1 62 | #coverage: 97.87 63 | meters: [8] #Plug number 64 | 65 | - original_name: Entertainment 66 | type: HTPC 67 | #days_covered: 192 68 | instance: 1 69 | #coverage: 89.14 70 | meters: [9] #Plug number 71 | 72 | - original_name: PC 73 | type: computer 74 | #days_covered: 218 75 | instance: 1 76 | #coverage: 97.87 77 | meters: [10] #Plug number 78 | 79 | - original_name: Kettle 80 | type: kettle 81 | #days_covered: 25 82 | instance: 1 83 | #coverage: 76.64 84 | meters: [11] #Plug number 85 | 86 | time_frame: 87 | start: 2012-06-27 88 | end: 2013-01-31 89 | -------------------------------------------------------------------------------- /nilmtk/stats/dropoutrateresults.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | from ..results import Results 3 | from ..consts import SECS_PER_DAY 4 | 5 | class DropoutRateResults(Results): 6 | """ 7 | Attributes 8 | ---------- 9 | _data : pd.DataFrame 10 | index is start date for the whole chunk 11 | `end` is end date for the whole chunk 12 | `dropout_rate` is float [0,1] 13 | `n_samples` is int, used for calculating weighted mean 14 | """ 15 | name = "dropout_rate" 16 | 17 | def combined(self): 18 | """Calculates weighted average. 19 | 20 | Returns 21 | ------- 22 | dropout_rate : float, [0,1] 23 | """ 24 | tot_samples = self._data['n_samples'].sum() 25 | proportion = self._data['n_samples'] / tot_samples 26 | dropout_rate = (self._data['dropout_rate'] * proportion).sum() 27 | return dropout_rate 28 | 29 | def unify(self, other): 30 | super(DropoutRateResults, self).unify(other) 31 | for i, row in self._data.iterrows(): 32 | # store mean of dropout rate 33 | self._data['dropout_rate'].loc[i] += other._data['dropout_rate'].loc[i] 34 | self._data['dropout_rate'].loc[i] /= 2 35 | 36 | self._data['n_samples'].loc[i] += other._data['n_samples'].loc[i] 37 | 38 | def to_dict(self): 39 | return {'statistics': {'dropout_rate': self.combined()}} 40 | 41 | def plot(self, ax=None): 42 | if ax is None: 43 | ax = plt.gca() 44 | ax.xaxis.axis_date() 45 | for index, row in self._data.iterrows(): 46 | length = (row['end'] - index).total_seconds() / SECS_PER_DAY 47 | rect = plt.Rectangle((index, 0), # bottom left corner 48 | length, 49 | row['dropout_rate'], # width 50 | color='b') 51 | ax.add_patch(rect) 52 | ax.autoscale_view() 53 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/eco/metadata/building4.yaml: -------------------------------------------------------------------------------- 1 | instance: 4 2 | original_name: house_4 3 | 4 | # smart_meter_data: 5 | # days: 219 6 | # #coverage: 99.39 7 | # period_start: 27.06.12 8 | # period_end: 31.01.13 9 | 10 | elec_meters: 11 | 1: &smart_meter 12 | site_meter: true 13 | device_model: smart_meter 14 | 2: *smart_meter 15 | 3: *smart_meter 16 | 4: &plug_phase1 17 | submeter_of: 1 18 | device_model: plug 19 | 5: &plug_phase3 20 | submeter_of: 3 21 | device_model: plug 22 | 6: &plug_phase2 23 | submeter_of: 2 24 | device_model: plug 25 | 7: *plug_phase3 26 | 8: *plug_phase1 27 | 9: *plug_phase3 28 | 10: *plug_phase3 29 | 11: *plug_phase1 30 | 31 | appliances: 32 | - original_name: Fridge 33 | type: fridge 34 | #days_covered: 194 35 | instance: 1 36 | #coverage: 97.43 37 | meters: [4] #Plug number 38 | 39 | - original_name: Kitchen appliances 40 | type: small cooking appliance 41 | #days_covered: 194 42 | instance: 1 43 | #coverage: 96.81 44 | meters: [5] #Plug number 45 | 46 | - original_name: Lamp 47 | type: lamp 48 | #days_covered: 170 49 | instance: 1 50 | #coverage: 93.54 51 | meters: [6] #Plug number 52 | 53 | - original_name: Stereo and laptop 54 | type: laptop computer 55 | #days_covered: 169 56 | instance: 1 57 | #coverage: 90.98 58 | meters: [7] #Plug number 59 | 60 | - original_name: Freezer 61 | type: freezer 62 | #days_covered: 192 63 | instance: 1 64 | #coverage: 93.08 65 | meters: [8] #Plug number 66 | 67 | - original_name: Tablet 68 | type: games console 69 | #days_covered: 189 70 | instance: 1 71 | #coverage: 93.6 72 | meters: [9] #Plug number 73 | 74 | - original_name: Entertainment 75 | type: HTPC 76 | #days_covered: 186 77 | instance: 1 78 | #coverage: 94.69 79 | meters: [10] #Plug number 80 | 81 | - original_name: Microwave 82 | type: microwave 83 | #days_covered: 194 84 | instance: 1 85 | #coverage: 97.08 86 | meters: [11] #Plug number 87 | 88 | time_frame: 89 | start: 2012-06-27 90 | end: 2013-01-31 -------------------------------------------------------------------------------- /nilmtk/stats/tests/test_totalenergyresults.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | from __future__ import print_function, division 3 | import unittest 4 | from ..totalenergyresults import TotalEnergyResults 5 | from ... import TimeFrame 6 | 7 | class TestEnergyResults(unittest.TestCase): 8 | 9 | def test_append(self): 10 | er = TotalEnergyResults() 11 | tf = TimeFrame('2012-01-01','2012-01-02') 12 | er.append(tf, {'apparent':40, 'reactive':30, 'active':20}) 13 | self.assertEqual(er._data.index.size, 1) 14 | self.assertEqual(er._data.index[0], tf.start) 15 | self.assertEqual(er._data['end'][tf.start], tf.end) 16 | 17 | def test_combined(self): 18 | er = TotalEnergyResults() 19 | tf = TimeFrame('2012-01-01','2012-01-02') 20 | er.append(tf, {'apparent':40}) 21 | tf2 = TimeFrame('2012-01-02','2012-01-03') 22 | er.append(tf2, {'apparent':40, 'reactive':50, 'active':30}) 23 | self.assertEqual(er.combined()['apparent'], 80) 24 | self.assertEqual(er.combined()['reactive'], 50) 25 | self.assertEqual(er.combined()['active'], 30) 26 | 27 | # Try a junk measurement name 28 | tf3 = TimeFrame('2012-01-03','2012-01-04') 29 | with self.assertRaises(KeyError): 30 | er.append(tf3, {'blah':40}) 31 | 32 | # Try a duplicate start date 33 | tf4 = TimeFrame('2012-01-01','2012-01-04') 34 | with self.assertRaises(ValueError): 35 | er.append(tf4, {'active':20}) 36 | 37 | # Try a duplicate end date 38 | tf5 = TimeFrame('2010-01-01','2012-01-03') 39 | with self.assertRaises(ValueError): 40 | er.append(tf5, {'active':20}) 41 | 42 | # Try inserting an entry which overlaps 43 | tf6 = TimeFrame('2012-01-02 06:00', '2012-01-04') 44 | with self.assertRaises(ValueError): 45 | er.append(tf6, {'active':20}) 46 | 47 | tf7 = TimeFrame('2010-01-02 06:00', '2012-01-04') 48 | with self.assertRaises(ValueError): 49 | er.append(tf7, {'active':20}) 50 | 51 | if __name__ == '__main__': 52 | unittest.main() 53 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/redd/metadata/meter_devices.yaml: -------------------------------------------------------------------------------- 1 | eMonitor: 2 | model: eMonitor 3 | manufacturer: Powerhouse Dynamics 4 | manufacturer_url: http://powerhousedynamics.com 5 | description: > 6 | Measures circuit-level power demand. Comes with 24 CTs. 7 | This FAQ page suggests the eMonitor measures real (active) 8 | power: http://www.energycircle.com/node/14103 although the REDD 9 | readme.txt says all channels record apparent power. 10 | sample_period: 3 # the interval between samples. In seconds. 11 | max_sample_period: 50 # Max allowable interval between samples. Seconds. 12 | measurements: 13 | - physical_quantity: power # power, voltage, energy, current? 14 | type: active # active (real power), reactive or apparent? 15 | upper_limit: 5000 16 | lower_limit: 0 17 | wireless: false 18 | 19 | REDD_whole_house: 20 | description: > 21 | REDD's DIY power meter used to measure whole-home AC waveforms 22 | at high frequency. To quote from their paper: "CTs from TED 23 | (http://www.theenergydetective.com) to measure current in the 24 | power mains, a Pico TA041 oscilloscope probe 25 | (http://www.picotechnologies.com) to measure voltage for one of 26 | the two phases in the home, and a National Instruments NI-9239 27 | analog to digital converter to transform both these analog 28 | signals to digital readings. This A/D converter has 24 bit 29 | resolution with noise of approximately 70 µV, which determines 30 | the noise level of our current and voltage readings: the TED CTs 31 | are rated for 200 amp circuits and a maximum of 3 volts, so we 32 | are able to differentiate between currents of approximately 33 | ((200))(70 × 10−6)/(3) = 4.66mA, corresponding to power changes 34 | of about 0.5 watts. Similarly, since we use a 1:100 voltage 35 | stepdown in the oscilloscope probe, we can detect voltage 36 | differences of about 7mV." 37 | sample_period: 1 38 | max_sample_period: 30 39 | measurements: 40 | - physical_quantity: power 41 | type: apparent 42 | upper_limit: 50000 43 | lower_limit: 0 44 | wireless: false 45 | -------------------------------------------------------------------------------- /nilmtk/preprocessing/clip.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function, division 2 | from warnings import warn 3 | from ..node import Node 4 | from ..utils import index_of_column_name 5 | 6 | class Clip(Node): 7 | 8 | """Ensures that no value is below a lower limit or above an upper limit. 9 | If self.lower and self.upper are None then will use clip settings from 10 | 'device': {'measurements': {'upper_limit' and 'lower_limit'}}. 11 | """ 12 | 13 | # Not very well specified. Really want to specify that 14 | # we need 'lower_limit' and 'upper_limit' to be specified in 15 | # each measurement... 16 | requirements = {'device': {'measurements': 'ANY VALUE'}} 17 | postconditions = {'preprocessing_applied': {'clip': {}}} 18 | 19 | def reset(self): 20 | self.lower = None 21 | self.upper = None 22 | 23 | def process(self): 24 | self.check_requirements() 25 | metadata = self.upstream.get_metadata() 26 | measurements = metadata['device']['measurements'] 27 | for chunk in self.upstream.process(): 28 | for measurement in chunk: 29 | lower, upper = _find_limits(measurement, measurements) 30 | lower = lower if self.lower is None else self.lower 31 | upper = upper if self.upper is None else self.upper 32 | if lower is not None and upper is not None: 33 | # We use `chunk.iloc[:,icol]` instead of iterating 34 | # through each column so we can to the clipping in place 35 | icol = index_of_column_name(chunk, measurement) 36 | chunk.iloc[:,icol] = chunk.iloc[:,icol].clip(lower, upper) 37 | 38 | yield chunk 39 | 40 | def _find_limits(measurement, measurements): 41 | """ 42 | Returns 43 | ------- 44 | lower, upper : numbers 45 | """ 46 | for m in measurements: 47 | if ((m.get('physical_quantity'), m.get('type')) == measurement): 48 | return m.get('lower_limit'), m.get('upper_limit') 49 | 50 | warn('No measurement limits for {}.'.format(measurement), RuntimeWarning) 51 | return None, None 52 | -------------------------------------------------------------------------------- /nilmtk/building.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function, division 2 | from collections import namedtuple, OrderedDict 3 | import pandas as pd 4 | from .metergroup import MeterGroup 5 | from .datastore.datastore import join_key 6 | from .hashable import Hashable 7 | 8 | BuildingID = namedtuple('BuildingID', ['instance', 'dataset']) 9 | 10 | class Building(Hashable): 11 | """ 12 | Attributes 13 | ---------- 14 | elec : MeterGroup 15 | 16 | metadata : dict 17 | Metadata just about this building (e.g. geo location etc). 18 | See http://nilm-metadata.readthedocs.org/en/latest/dataset_metadata.html#building 19 | Has these additional keys: 20 | dataset : string 21 | """ 22 | def __init__(self): 23 | self.elec = MeterGroup() 24 | self.metadata = {} 25 | 26 | def import_metadata(self, store, key, dataset_name): 27 | self.metadata = store.load_metadata(key) 28 | if 'dataset' not in self.metadata: 29 | self.metadata['dataset'] = dataset_name 30 | elec_meters = self.metadata.pop('elec_meters', {}) 31 | appliances = self.metadata.pop('appliances', []) 32 | self.elec.import_metadata(store, elec_meters, appliances, self.identifier) 33 | 34 | def save(self, destination, key): 35 | destination.write_metadata(key, self.metadata) 36 | self.elec.save(destination, join_key(key, 'elec')) 37 | 38 | @property 39 | def identifier(self): 40 | md = self.metadata 41 | return BuildingID(instance=md.get('instance'), 42 | dataset=md.get('dataset')) 43 | 44 | def describe(self, **kwargs): 45 | """Returns a Series describing this building.""" 46 | md = self.metadata 47 | series = pd.Series(name=self.identifier.instance) 48 | 49 | for key in ['instance', 'building_type', 50 | 'construction_year', 'energy_improvements', 'heating', 51 | 'ownership', 'n_occupants', 'description_of_occupants']: 52 | series[key] = md.get(key) 53 | 54 | series = pd.concat([series, self.elec.describe(**kwargs)]) 55 | 56 | return series 57 | -------------------------------------------------------------------------------- /nilmtk/datastore/key.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function, division 2 | 3 | # do not edit! added by PythonBreakpoints 4 | from pdb import set_trace as _breakpoint 5 | from six import integer_types 6 | 7 | class Key(object): 8 | """A location of data or metadata within NILMTK. 9 | 10 | Attributes 11 | ---------- 12 | building : int 13 | meter : int 14 | utility : str 15 | """ 16 | 17 | def __init__(self, string=None, building=None, meter=None): 18 | """ 19 | Parameters 20 | ---------- 21 | string : str, optional 22 | e.g. 'building1/elec/meter1' 23 | building : int, optional 24 | meter : int, optional 25 | """ 26 | self.utility = None 27 | if string is None: 28 | self.building = building 29 | self.meter = meter 30 | else: 31 | split = string.strip('/').split('/') 32 | assert split[0].startswith('building'), "The first element must be 'building', e.g. 'building1'; not '{}'.".format(split[0]) 33 | try: 34 | self.building = int(split[0].replace("building", "")) 35 | except ValueError as e: 36 | raise ValueError("'building' must be followed by an integer.\n{}" 37 | .format(e)) 38 | if len(split) > 1: 39 | self.utility = split[1] 40 | if len(split) == 3: 41 | assert split[2].startswith('meter') 42 | self.meter = int(split[-1].replace("meter", "")) 43 | else: 44 | self.meter = None 45 | self._check() 46 | 47 | def _check(self): 48 | assert isinstance(self.building, integer_types) 49 | assert self.building >= 1 50 | if self.meter is not None: 51 | assert isinstance(self.meter, integer_types) 52 | assert self.meter >= 1 53 | 54 | def __repr__(self): 55 | self._check() 56 | s = "/building{:d}".format(self.building) 57 | if self.meter is not None: 58 | s += "/elec/meter{:d}".format(self.meter) 59 | return s 60 | -------------------------------------------------------------------------------- /docs/manual/README.md: -------------------------------------------------------------------------------- 1 | # NILMTK Documentation 2 | 3 | ## Contents 4 | 5 | (list items which are not links are planned but are not yet written) 6 | 7 | ### [User Guide](https://github.com/nilmtk/nilmtk/tree/master/docs/manual/user_guide) 8 | 9 | * [Introduction](https://github.com/nilmtk/nilmtk/blob/master/README.md) 10 | * Installation 11 | * [Users](https://github.com/nilmtk/nilmtk/blob/master/docs/manual/user_guide/install_user.md); [YouTube](https://www.youtube.com/watch?v=XZJH0CHxIMA&list=PLftoLyLEwECA6Ac95J96Xh1aRMY01nqe2&index=1) 12 | * [Developers](https://github.com/nilmtk/nilmtk/blob/master/docs/manual/user_guide/install_dev.md) 13 | * [Data](https://github.com/nilmtk/nilmtk/blob/master/docs/manual/user_guide/data.ipynb): convert and load data. 14 | * [The Load API: Loading data into memory](https://github.com/nilmtk/nilmtk/blob/master/docs/manual/user_guide/loading_data_into_memory.ipynb) 15 | * [Meter selection and basic statistics](https://github.com/nilmtk/nilmtk/blob/master/docs/manual/user_guide/elecmeter_and_metergroup.ipynb) 16 | * [Disaggregation and Metrics](https://github.com/nilmtk/nilmtk/blob/master/docs/manual/user_guide/disaggregation_and_metrics.ipynb) 17 | * [Comparing NILM algorithms](https://github.com/nilmtk/nilmtk/blob/master/docs/manual/user_guide/comparing_nilm_algorithms.ipynb) 18 | 19 | 20 | ### [Development Guide](https://github.com/nilmtk/nilmtk/tree/master/docs/manual/development_guide) 21 | 22 | * [API Documentation](http://nilmtk.github.io/nilmtk/master/index.html) 23 | * [Contributing](https://github.com/nilmtk/nilmtk/blob/master/docs/manual/development_guide/contributing.md) (including submitting a bug report) 24 | * Architectural overview 25 | * [UML Class Diagram](https://raw.githubusercontent.com/nilmtk/writing/master/figures/NILMTK_UML.png) 26 | * Overview of the flow of data through NILMTK 27 | * Out of core processing 28 | * [Writing a dataset importer](https://github.com/nilmtk/nilmtk/blob/master/docs/manual/development_guide/writing_a_dataset_converter.md) 29 | * [Writing a disaggregation algorithm](https://github.com/nilmtk/nilmtk/blob/master/docs/manual/development_guide/writing_a_disaggregation_algorithm.md) 30 | * Writing a metric 31 | * [Changelog](https://github.com/nilmtk/nilmtk/blob/master/docs/manual/development_guide/changelog.md) 32 | -------------------------------------------------------------------------------- /nilmtk/stats/tests/test_dropoutrate.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | from __future__ import print_function, division 3 | import unittest 4 | from os.path import join 5 | import numpy as np 6 | import pandas as pd 7 | from datetime import timedelta 8 | from .. import DropoutRate 9 | from ..goodsectionsresults import GoodSectionsResults 10 | from ..totalenergy import _energy_for_power_series 11 | from ... import TimeFrame, ElecMeter, HDFDataStore, MeterGroup 12 | from ...elecmeter import ElecMeterID 13 | from ...consts import JOULES_PER_KWH 14 | from ...tests.testingtools import data_dir 15 | 16 | METER_ID = ElecMeterID(instance=1, building=1, dataset='REDD') 17 | METER_ID2 = ElecMeterID(instance=2, building=1, dataset='REDD') 18 | 19 | class TestLocateGoodSections(unittest.TestCase): 20 | 21 | @classmethod 22 | def setUpClass(cls): 23 | filename = join(data_dir(), 'energy_complex.h5') 24 | cls.datastore = HDFDataStore(filename) 25 | ElecMeter.load_meter_devices(cls.datastore) 26 | cls.meter_meta = cls.datastore.load_metadata('building1')['elec_meters'][METER_ID.instance] 27 | 28 | @classmethod 29 | def tearDownClass(cls): 30 | cls.datastore.close() 31 | 32 | def test_pipeline(self): 33 | meter = ElecMeter(store=self.datastore, metadata=self.meter_meta, 34 | meter_id=METER_ID) 35 | source_node = meter.get_source_node() 36 | dropout_rate = DropoutRate(source_node) 37 | dropout_rate.run() 38 | 39 | # TODO: remove prints and actually test value of dropout rate. 40 | print(dropout_rate.results) 41 | print(next(meter.power_series())) 42 | 43 | # Now test metergroup 44 | meter2 = ElecMeter(store=self.datastore, metadata=self.meter_meta, 45 | meter_id=METER_ID2) 46 | metergroup = MeterGroup([meter, meter2]) 47 | dr = metergroup.dropout_rate(ignore_gaps=False) 48 | print("dr =", dr) # dr = 0.861386138614 49 | 50 | # Test a second time to make sure cache works 51 | dr_from_cache = metergroup.dropout_rate(ignore_gaps=False) 52 | self.assertEqual(dr, dr_from_cache) 53 | 54 | metergroup.clear_cache() 55 | 56 | if __name__ == '__main__': 57 | unittest.main() 58 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/combed/metadata/building1.yaml: -------------------------------------------------------------------------------- 1 | instance: 1 # this is the first building in the dataset 2 | original_name: academic 3 | elec_meters: 4 | 1: &total_building 5 | site_meter: true 6 | device_model: EM6400 7 | 2: &total_lifts 8 | submeter_of: 0 9 | device_model: EM6400 10 | 3: &first_floor_total 11 | submeter_of: 0 12 | device_model: EM6400 13 | name: First floor total 14 | 4: &second_floor_total 15 | submeter_of: 0 16 | device_model: EM6400 17 | name: Second floor total 18 | 5: &third_floor_total 19 | submeter_of: 0 20 | device_model: EM6400 21 | name: Third floor total 22 | 6: &fourth_floor_total 23 | submeter_of: 0 24 | device_model: EM6400 25 | name: Fourth floor total 26 | 7: &fifth_floor_total 27 | submeter_of: 0 28 | device_model: EM6400 29 | name: Fifth floor total 30 | 8: &AHU_ground 31 | submeter_of: 0 32 | device_model: EM6400 33 | 9: &AHU_first 34 | submeter_of: 3 35 | device_model: EM6400 36 | 10: &AHU_second 37 | submeter_of: 4 38 | device_model: EM6400 39 | 11: &AHU_fifth 40 | submeter_of: 7 41 | device_model: EM6400 42 | 12: &Lights 43 | submeter_of: 5 44 | device_model: EM6400 45 | 13: &Power_sockets_A 46 | submeter_of: 5 47 | device_model: EM6400 48 | 14: &UPS_sockets 49 | submeter_of: 5 50 | device_model: EM6400 51 | 52 | 53 | appliances: 54 | - original_name: lift 55 | type: elevator 56 | #floor: 0 57 | instance: 1 58 | meters: [2] 59 | 60 | - original_name: AHU 61 | type: AHU 62 | instance: 1 63 | #floor: 1 64 | meters: [8] 65 | 66 | - original_name: AHU 67 | type: AHU 68 | instance: 2 69 | #floor: 1 70 | meters: [9] 71 | 72 | - original_name: AHU 73 | type: AHU 74 | instance: 3 75 | #floor: 1 76 | meters: [10] 77 | 78 | - original_name: AHU 79 | type: AHU 80 | instance: 4 81 | #floor: 1 82 | meters: [11] 83 | 84 | - original_name: Lights 85 | type: light 86 | instance: 1 87 | #floor: 1 88 | meters: [12] 89 | 90 | - original_name: Power Sockets 91 | type: sockets 92 | instance: 1 93 | #floor: 1 94 | meters: [13] 95 | 96 | - original_name: UPS Sockets 97 | type: sockets 98 | instance: 2 99 | #floor: 1 100 | meters: [14] 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /nilmtk/stats/tests/test_totalenergy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | from __future__ import print_function, division 3 | import unittest 4 | from ..totalenergy import TotalEnergy, _energy_for_power_series 5 | from ...preprocessing import Clip 6 | from ... import TimeFrame, ElecMeter, HDFDataStore 7 | from ...elecmeter import ElecMeterID 8 | from ...consts import JOULES_PER_KWH 9 | from ...tests.testingtools import data_dir 10 | from os.path import join 11 | import numpy as np 12 | import pandas as pd 13 | from datetime import timedelta 14 | from copy import deepcopy 15 | 16 | METER_ID = ElecMeterID(instance=1, building=1, dataset='REDD') 17 | 18 | def check_energy_numbers(testcase, energy): 19 | true_active_kwh = 0.0163888888889 20 | testcase.assertAlmostEqual(energy['active'], true_active_kwh) 21 | testcase.assertAlmostEqual(energy['reactive'], true_active_kwh*0.9) 22 | testcase.assertAlmostEqual(energy['apparent'], true_active_kwh*1.1) 23 | 24 | 25 | class TestEnergy(unittest.TestCase): 26 | 27 | @classmethod 28 | def setUpClass(cls): 29 | filename = join(data_dir(), 'energy.h5') 30 | cls.datastore = HDFDataStore(filename) 31 | ElecMeter.load_meter_devices(cls.datastore) 32 | cls.meter_meta = cls.datastore.load_metadata('building1')['elec_meters'][METER_ID.instance] 33 | 34 | @classmethod 35 | def tearDownClass(cls): 36 | cls.datastore.close() 37 | 38 | def test_energy_per_power_series(self): 39 | data = np.array([0, 0, 0, 100, 100, 100, 150, 150, 200, 0, 0, 100, 5000, 0]) 40 | secs = np.arange(start=0, stop=len(data)*10, step=10) 41 | true_kwh = ((data[:-1] * np.diff(secs)) / JOULES_PER_KWH).sum() 42 | index = [pd.Timestamp('2010-01-01') + timedelta(seconds=int(sec)) for sec in secs] 43 | df = pd.Series(data=data, index=index) 44 | kwh = _energy_for_power_series(df, max_sample_period=15) 45 | self.assertAlmostEqual(true_kwh, kwh) 46 | 47 | def test_pipeline(self): 48 | meter = ElecMeter(store=self.datastore, 49 | metadata=self.meter_meta, 50 | meter_id=METER_ID) 51 | source_node = meter.get_source_node() 52 | clipped = Clip(source_node) 53 | energy = TotalEnergy(clipped) 54 | energy.run() 55 | energy_results = deepcopy(energy.results) 56 | check_energy_numbers(self, energy_results.combined()) 57 | 58 | if __name__ == '__main__': 59 | unittest.main() 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/iawe/metadata/meter_devices.yaml: -------------------------------------------------------------------------------- 1 | EM6400: 2 | model: EM6400 3 | manufacturer: Schneider Electric 4 | manufacturer_url: http://www.schneider-electric.com/ 5 | description: Multifunction meter for feeders 6 | sample_period: 60 # the interval between samples. In seconds. 7 | max_sample_period: 300 8 | measurements: 9 | - physical_quantity: power # power, voltage, energy, current? 10 | type: active # active (real power), reactive or apparent? 11 | upper_limit: 10000 12 | lower_limit: 0 13 | - physical_quantity: power # power, voltage, energy, current? 14 | type: apparent # active (real power), reactive or apparent? 15 | upper_limit: 10000 16 | lower_limit: 0 17 | - physical_quantity: power # power, voltage, energy, current? 18 | type: reactive # active (real power), reactive or apparent? 19 | upper_limit: 10000 20 | lower_limit: 0 21 | - physical_quantity: frequency 22 | type: apparent # power, voltage, energy, current? 23 | upper_limit: 70 24 | lower_limit: 0 25 | - physical_quantity: voltage 26 | type: apparent # power, voltage, energy, current? 27 | upper_limit: 270 28 | lower_limit: 0 29 | - physical_quantity: power factor 30 | type: 31 | upper_limit: 1 32 | lower_limit: 0 33 | - physical_quantity: current 34 | type: 35 | upper_limit: 100 36 | lower_limit: 0 37 | 38 | 39 | jplug: 40 | description: 41 | sample_period: 1 42 | max_sample_period: 300 43 | measurements: 44 | - physical_quantity: power # power, voltage, energy, current? 45 | type: active # active (real power), reactive or apparent? 46 | upper_limit: 10000 47 | lower_limit: 0 48 | - physical_quantity: power # power, voltage, energy, current? 49 | type: apparent # active (real power), reactive or apparent? 50 | upper_limit: 10000 51 | lower_limit: 0 52 | - physical_quantity: power # power, voltage, energy, current? 53 | type: reactive # active (real power), reactive or apparent? 54 | upper_limit: 10000 55 | lower_limit: 0 56 | - physical_quantity: frequency 57 | type: 58 | upper_limit: 70 59 | lower_limit: 0 60 | - physical_quantity: voltage 61 | type: 62 | upper_limit: 270 63 | lower_limit: 0 64 | - physical_quantity: current 65 | type: 66 | upper_limit: 100 67 | lower_limit: 0 68 | - physical_quantity: power factor 69 | type: 70 | upper_limit: 1 71 | lower_limit: 0 72 | wireless: true 73 | 74 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/greend/metadata/building6.yaml: -------------------------------------------------------------------------------- 1 | instance: 6 2 | original_name: House#5 3 | 4 | elec_meters: 5 | 1: 6 | device_model: circle 7 | submeter_of: 0 8 | room: lounge 9 | 2: 10 | device_model: circle 11 | submeter_of: 0 12 | room: lounge 13 | 3: 14 | device_model: circle 15 | submeter_of: 0 16 | room: kitchen 17 | 4: 18 | device_model: circle 19 | submeter_of: 0 20 | room: bedroom # bedroom 3 21 | 5: 22 | device_model: circle 23 | submeter_of: 0 24 | room: utility 25 | 6: 26 | device_model: circle 27 | submeter_of: 0 28 | room: bedroom # bedroom 2 29 | 7: 30 | device_model: circle 31 | submeter_of: 0 32 | room: bedroom # bedroom 1 33 | 8: 34 | device_model: circle 35 | submeter_of: 0 36 | room: utility 37 | 9: 38 | device_model: circle 39 | submeter_of: 0 40 | room: kitchen 41 | 42 | appliances: 43 | - type: television 44 | instance: 1 45 | meters: [1] 46 | control: 47 | - manual 48 | model: TH-37PA50E 49 | manufacturer: Panasonic 50 | 51 | - type: incandescent lamp 52 | instance: 1 53 | meters: [2] 54 | control: 55 | - manual 56 | nominal_consumption: 250 57 | 58 | - type: toaster 59 | instance: 1 60 | meters: [3] 61 | control: 62 | - manual 63 | nominal_consumption: 1600 64 | model: TP36 65 | manufacturer: Girmi 66 | 67 | - type: electric space heater 68 | instance: 1 69 | meters: [4] 70 | control: 71 | - manual 72 | nominal_consumption: 1800 73 | model: Kalimero 74 | manufacturer: Argo 75 | 76 | - type: clothes iron 77 | instance: 1 78 | meters: [5] 79 | control: 80 | - manual 81 | model: Maxivap 2 82 | manufacturer: Jura 83 | 84 | - type: incandescent lamp 85 | instance: 2 86 | meters: [5] 87 | control: 88 | - manual 89 | 90 | - type: laptop computer 91 | instance: 1 92 | meters: [6] 93 | control: 94 | - manual 95 | model: S400C 96 | manufacturer: Asus 97 | 98 | - type: television 99 | instance: 2 100 | meters: [7] 101 | control: 102 | - manual 103 | model: 32LD320-ZA 104 | manufacturer: LG 105 | 106 | - type: washing machine 107 | instance: 1 108 | meters: [8] 109 | control: 110 | - manual 111 | model: R16 112 | manufacturer: REX 113 | energy_rating: AA 114 | 115 | - type: fridge 116 | instance: 1 117 | meters: [9] 118 | control: 119 | - manual 120 | model: KGN362LN0 121 | manufacturer: Bosch 122 | -------------------------------------------------------------------------------- /nilmtk/timeframegroup.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function, division 2 | import matplotlib.pyplot as plt 3 | import pandas as pd 4 | from datetime import timedelta 5 | 6 | # NILMTK imports 7 | from nilmtk.consts import SECS_PER_DAY 8 | from nilmtk.timeframe import TimeFrame 9 | 10 | 11 | class TimeFrameGroup(list): 12 | """A collection of nilmtk.TimeFrame objects.""" 13 | 14 | def __init__(self, timeframes=None): 15 | if isinstance(timeframes, pd.PeriodIndex): 16 | periods = timeframes 17 | timeframes = [TimeFrame(period.start_time, period.end_time) 18 | for period in periods] 19 | args = [timeframes] if timeframes else [] 20 | super(TimeFrameGroup, self).__init__(*args) 21 | 22 | def plot(self, ax=None, y=0, height=1, gap=0.05, color='b', **kwargs): 23 | if ax is None: 24 | ax = plt.gca() 25 | ax.xaxis.axis_date() 26 | height -= gap * 2 27 | for timeframe in self: 28 | length = timeframe.timedelta 29 | bottom_left_corner = (timeframe.start, y + gap) 30 | rect = plt.Rectangle(bottom_left_corner, length, height, 31 | color=color, **kwargs) 32 | ax.add_patch(rect) 33 | 34 | ax.autoscale_view() 35 | return ax 36 | 37 | def intersection(self, other): 38 | """Returns a new TimeFrameGroup of self masked by other. 39 | 40 | Illustrated example: 41 | 42 | self.good_sections(): |######----#####-----######| 43 | other.good_sections(): |---##---####----##-----###| 44 | intersection(): |---##-----##-----------###| 45 | """ 46 | assert isinstance(other, (TimeFrameGroup, list)) 47 | new_tfg = TimeFrameGroup() 48 | for self_timeframe in self: 49 | for other_timeframe in other: 50 | intersect = self_timeframe.intersection(other_timeframe) 51 | if not intersect.empty: 52 | new_tfg.append(intersect) 53 | return new_tfg 54 | 55 | def uptime(self): 56 | """Returns total timedelta of all timeframes joined together.""" 57 | uptime = timedelta(0) 58 | for timeframe in self: 59 | uptime += timeframe.timedelta 60 | return uptime 61 | 62 | def remove_shorter_than(self, threshold): 63 | """Removes TimeFrames shorter than `threshold` seconds.""" 64 | new_tfg = TimeFrameGroup() 65 | for timeframe in self: 66 | if timeframe.timedelta.total_seconds() >= threshold: 67 | new_tfg.append(timeframe) 68 | 69 | return new_tfg 70 | -------------------------------------------------------------------------------- /docs/source/nilmtk.tests.rst: -------------------------------------------------------------------------------- 1 | nilmtk.tests package 2 | ==================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | nilmtk.tests.generate_data module 8 | --------------------------------- 9 | 10 | .. automodule:: nilmtk.tests.generate_data 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | nilmtk.tests.test_combinatorial_optimisation module 16 | --------------------------------------------------- 17 | 18 | .. automodule:: nilmtk.tests.test_combinatorial_optimisation 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | nilmtk.tests.test_datastore module 24 | ---------------------------------- 25 | 26 | .. automodule:: nilmtk.tests.test_datastore 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | nilmtk.tests.test_datastore_converter module 32 | -------------------------------------------- 33 | 34 | .. automodule:: nilmtk.tests.test_datastore_converter 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | nilmtk.tests.test_elecmeter module 40 | ---------------------------------- 41 | 42 | .. automodule:: nilmtk.tests.test_elecmeter 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | nilmtk.tests.test_measurement module 48 | ------------------------------------ 49 | 50 | .. automodule:: nilmtk.tests.test_measurement 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | nilmtk.tests.test_metergroup module 56 | ----------------------------------- 57 | 58 | .. automodule:: nilmtk.tests.test_metergroup 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | nilmtk.tests.test_metrics module 64 | -------------------------------- 65 | 66 | .. automodule:: nilmtk.tests.test_metrics 67 | :members: 68 | :undoc-members: 69 | :show-inheritance: 70 | 71 | nilmtk.tests.test_node module 72 | ----------------------------- 73 | 74 | .. automodule:: nilmtk.tests.test_node 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | 79 | nilmtk.tests.test_timeframe module 80 | ---------------------------------- 81 | 82 | .. automodule:: nilmtk.tests.test_timeframe 83 | :members: 84 | :undoc-members: 85 | :show-inheritance: 86 | 87 | nilmtk.tests.testingtools module 88 | -------------------------------- 89 | 90 | .. automodule:: nilmtk.tests.testingtools 91 | :members: 92 | :undoc-members: 93 | :show-inheritance: 94 | 95 | 96 | Module contents 97 | --------------- 98 | 99 | .. automodule:: nilmtk.tests 100 | :members: 101 | :undoc-members: 102 | :show-inheritance: 103 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/redd/metadata/building6.yaml: -------------------------------------------------------------------------------- 1 | instance: 6 2 | original_name: house_6 3 | elec_meters: 4 | 1: &redd_whole_house 5 | site_meter: true 6 | device_model: REDD_whole_house 7 | 2: *redd_whole_house 8 | 3: &emonitor 9 | submeter_of: 0 10 | device_model: eMonitor 11 | 4: *emonitor 12 | 5: *emonitor 13 | 6: *emonitor 14 | 7: *emonitor 15 | 8: *emonitor 16 | 9: *emonitor 17 | 10: *emonitor 18 | 11: *emonitor 19 | 12: *emonitor 20 | 13: *emonitor 21 | 14: *emonitor 22 | 15: *emonitor 23 | 16: *emonitor 24 | 17: *emonitor 25 | 26 | appliances: 27 | - original_name: kitchen_outlets 28 | room: kitchen 29 | type: sockets # sockets is treated as an appliance 30 | instance: 1 31 | multiple: true # likely to be more than 1 socket 32 | meters: [3] 33 | 34 | - original_name: washer_dryer 35 | type: washer dryer 36 | instance: 1 37 | meters: [4] 38 | 39 | - original_name: stove 40 | type: electric stove 41 | instance: 1 42 | meters: [5] 43 | 44 | - original_name: electronics 45 | type: CE appliance 46 | instance: 1 47 | multiple: true 48 | meters: [6] 49 | 50 | - original_name: bathroom_gfi # ground fault interrupter 51 | room: bathroom 52 | type: unknown 53 | instance: 1 54 | multiple: true 55 | meters: [7] 56 | 57 | - original_name: refrigerator 58 | type: fridge 59 | instance: 1 60 | meters: [8] 61 | 62 | - original_name: dishwaser 63 | type: dish washer 64 | instance: 1 65 | meters: [9] 66 | 67 | - original_name: outlets_unknown 68 | type: sockets 69 | instance: 2 70 | multiple: true 71 | meters: [10] 72 | 73 | - original_name: outlets_unknown 74 | type: sockets 75 | instance: 3 76 | multiple: true 77 | meters: [11] 78 | 79 | - original_name: electric_heat 80 | type: electric space heater 81 | instance: 1 82 | meters: [12] 83 | 84 | - original_name: kitchen_outlets 85 | room: kitchen 86 | type: sockets # sockets is treated as an appliance 87 | instance: 4 88 | multiple: true # likely to be more than 1 socket 89 | meters: [13] 90 | 91 | - original_name: lighting 92 | type: light 93 | instance: 1 94 | multiple: true # likely to be more than 1 light 95 | meters: [14] 96 | 97 | - original_name: air_conditioning 98 | type: air handling unit 99 | description: > 100 | a bit of a guess that this is the AHU. Channels 15,16 and 17 101 | all activate at very similar times. Channels 16 and 17 look very 102 | similar which suggest they are the chiller. 103 | instance: 1 104 | meters: [15] 105 | 106 | - original_name: air_conditioning 107 | type: air conditioner 108 | instance: 1 109 | meters: [16, 17] 110 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/eco/metadata/building2.yaml: -------------------------------------------------------------------------------- 1 | instance: 2 2 | original_name: house_2 3 | 4 | # smart_meter_data: 5 | # days: 244 6 | # coverage: 98.58 7 | # period_start: 01.06.12 8 | # period_end: 31.01.13 9 | 10 | elec_meters: 11 | 1: &smart_meter 12 | site_meter: true 13 | device_model: smart_meter 14 | 2: *smart_meter 15 | 3: *smart_meter 16 | 4: &plug_phase1 17 | submeter_of: 1 18 | device_model: plug 19 | 5: *plug_phase1 20 | 6: &plug_phase2 21 | submeter_of: 2 22 | device_model: plug 23 | 7: *plug_phase1 24 | 8: *plug_phase2 25 | 9: *plug_phase1 26 | 10: *plug_phase1 27 | 11: *plug_phase1 28 | 12: *plug_phase1 29 | 13: 30 | submeter_of: 0 31 | device_model: plug 32 | 14: *plug_phase2 33 | 15: *plug_phase2 34 | 35 | appliances: 36 | - original_name: Tablet 37 | type: tablet computer charger 38 | #days_covered: 240 39 | instance: 1 40 | #coverage: 97.43 41 | meters: [4] #Plug number 42 | 43 | - original_name: Dishwasher 44 | type: dish washer 45 | #days_covered: 240 46 | instance: 1 47 | #coverage: 97.09 48 | meters: [5] #Plug number 49 | 50 | - original_name: Air exhaust 51 | type: air handling unit 52 | #days_covered: 240 53 | instance: 1 54 | #coverage: 96.18 55 | meters: [6] #Plug number 56 | 57 | - original_name: Fridge 58 | type: fridge 59 | #days_covered: 240 60 | instance: 1 61 | #coverage: 98.0 62 | meters: [7] #Plug number 63 | 64 | - original_name: Entertainment 65 | type: HTPC # Assuming entertainment implies the home theatre 66 | #days_covered: 240 67 | instance: 1 68 | #coverage: 96.18 69 | meters: [8] #Plug number 70 | 71 | - original_name: Freezer 72 | type: freezer 73 | #days_covered: 240 74 | instance: 1 75 | #coverage: 96.39 76 | meters: [9] #Plug number 77 | 78 | - original_name: Kettle 79 | type: kettle 80 | #days_covered: 240 81 | instance: 1 82 | #coverage: 88.5 83 | meters: [10] #Plug number 84 | 85 | - original_name: Lamp 86 | type: lamp 87 | #days_covered: 240 88 | instance: 1 89 | #coverage: 90.21 90 | meters: [11] #Plug number 91 | 92 | - original_name: Laptops 93 | type: laptop computer 94 | #days_covered: 240 95 | instance: 1 96 | #coverage: 83.36 97 | meters: [12] #Plug number 98 | 99 | - original_name: Stove 100 | type: stove 101 | #days_covered: 28 102 | instance: 1 103 | #coverage: 100.0 104 | meters: [13] #Plug number 105 | 106 | - original_name: TV 107 | type: television 108 | #days_covered: 240 109 | instance: 1 110 | #coverage: 100.0 111 | meters: [14] #Plug number 112 | 113 | - original_name: Stereo 114 | type: audio system 115 | #days_covered: 240 116 | instance: 1 117 | #coverage: 95.95 118 | meters: [15] #Plug number 119 | 120 | time_frame: 121 | start: 2012-06-01 122 | end: 2013-01-31 123 | -------------------------------------------------------------------------------- /nilmtk/tests/test_measurement.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | from __future__ import print_function, division 3 | import unittest 4 | import pandas as pd 5 | import numpy as np 6 | import nilmtk.measurement as measure 7 | from nilmtk.elecmeter import ElecMeter, ElecMeterID 8 | from nilmtk.exceptions import MeasurementError 9 | 10 | BAD_AC_TYPES = ['foo', '', None, True, {'a':'b'}, 11 | (1,2), [], ['reactive'], 'reaactive'] 12 | 13 | class TestMeasurement(unittest.TestCase): 14 | def test_check_ac_type(self): 15 | for ac_type in measure.AC_TYPES: 16 | measure.check_ac_type(ac_type) 17 | for bad_ac_type in BAD_AC_TYPES: 18 | with self.assertRaises(MeasurementError): 19 | measure.check_ac_type(bad_ac_type) 20 | 21 | def _test_ac_class(self, cls): 22 | for ac_type in measure.AC_TYPES: 23 | obj = cls(ac_type=ac_type) 24 | self.assertIsInstance(obj, cls) 25 | for bad_ac_type in BAD_AC_TYPES: 26 | with self.assertRaises(MeasurementError): 27 | cls(ac_type=bad_ac_type) 28 | 29 | def test_as_dataframe_columns(self): 30 | N_ROWS = 5 31 | columns = [] 32 | 33 | # Create columns using every permutation of ac_type and cumulative 34 | for ac_type in measure.AC_TYPES: 35 | columns.append(('power', ac_type)) 36 | for cumulative in [True, False]: 37 | if cumulative: 38 | columns.append(('cumulative energy', ac_type)) 39 | else: 40 | columns.append(('energy', ac_type)) 41 | columns.append(('voltage', '')) 42 | 43 | # Create DataFrame 44 | N_COLS = len(columns) 45 | df = pd.DataFrame(np.arange(N_COLS).reshape((1,N_COLS)), 46 | columns=measure.measurement_columns(columns)) 47 | 48 | # Try accessing columns 49 | i = 0 50 | for column in columns: 51 | series = df[column] 52 | self.assertIsInstance(series, pd.Series) 53 | self.assertEqual(series.name, column) 54 | self.assertEqual(series.shape, (1,)) 55 | self.assertEqual(series.sum(), i) 56 | i += 1 57 | 58 | def test_select_best_ac_type(self): 59 | self.assertEqual(measure.select_best_ac_type(['reactive']), 'reactive') 60 | 61 | self.assertEqual(measure.select_best_ac_type(['active', 'reactive', 'apparent']), 'active') 62 | 63 | ElecMeter.meter_devices.update( 64 | {'test model': {'measurements': [{'physical_quantity': 'power', 65 | 'type': 'apparent'}]}}) 66 | meter_id = ElecMeterID(1, 1, 'REDD') 67 | meter = ElecMeter(metadata={'device_model': 'test model'}, meter_id=meter_id) 68 | 69 | self.assertEqual(measure.select_best_ac_type(['reactive'], 70 | meter.available_power_ac_types()), 71 | 'reactive') 72 | 73 | if __name__ == '__main__': 74 | unittest.main() 75 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/redd/metadata/building4.yaml: -------------------------------------------------------------------------------- 1 | instance: 4 2 | original_name: house_4 3 | elec_meters: 4 | 1: &redd_whole_house 5 | site_meter: true 6 | device_model: REDD_whole_house 7 | 2: *redd_whole_house 8 | 3: &emonitor 9 | submeter_of: 0 10 | device_model: eMonitor 11 | 4: *emonitor 12 | 5: *emonitor 13 | 6: *emonitor 14 | 7: *emonitor 15 | 8: *emonitor 16 | 9: *emonitor 17 | 10: *emonitor 18 | 11: *emonitor 19 | 12: *emonitor 20 | 13: *emonitor 21 | 14: *emonitor 22 | 15: *emonitor 23 | 16: *emonitor 24 | 17: *emonitor 25 | 18: *emonitor 26 | 19: *emonitor 27 | 20: *emonitor 28 | 29 | appliances: 30 | - original_name: lighting 31 | type: light 32 | instance: 1 33 | multiple: true # likely to be more than 1 light 34 | meters: [3] 35 | 36 | - original_name: furnace 37 | type: electric furnace 38 | instance: 1 39 | meters: [4] 40 | 41 | - original_name: kitchen_outlets 42 | room: kitchen 43 | type: sockets # sockets is treated as an appliance 44 | instance: 1 45 | multiple: true # likely to be more than 1 socket 46 | meters: [5] 47 | 48 | - original_name: outlets_unknown 49 | type: sockets 50 | instance: 2 51 | multiple: true 52 | meters: [6] 53 | 54 | - original_name: washer_dryer 55 | type: washer dryer 56 | instance: 1 57 | meters: [7] 58 | 59 | - original_name: stove 60 | type: electric stove 61 | instance: 1 62 | meters: [8] 63 | 64 | - original_name: air_conditioning 65 | type: air conditioner 66 | instance: 1 67 | meters: [9, 10] 68 | 69 | - original_name: miscellaeneous 70 | type: unknown 71 | instance: 1 72 | meters: [11] 73 | 74 | - original_name: smoke_alarms 75 | type: smoke alarm 76 | instance: 1 77 | multiple: true # likely to be more than 1 light 78 | meters: [12] 79 | 80 | - original_name: lighting 81 | type: light 82 | instance: 2 83 | multiple: true # likely to be more than 1 light 84 | meters: [13] 85 | 86 | - original_name: kitchen_outlets 87 | room: kitchen 88 | type: sockets # sockets is treated as an appliance 89 | instance: 3 90 | multiple: true # likely to be more than 1 socket 91 | meters: [14] 92 | 93 | - original_name: dishwaser 94 | type: dish washer 95 | instance: 1 96 | meters: [15] 97 | 98 | - original_name: bathroom_gfi # ground fault interrupter 99 | room: bathroom 100 | type: unknown 101 | instance: 2 102 | multiple: true 103 | meters: [16] 104 | 105 | - original_name: bathroom_gfi # ground fault interrupter 106 | room: bathroom 107 | type: unknown 108 | instance: 3 109 | multiple: true 110 | meters: [17] 111 | 112 | - original_name: lighting 113 | type: light 114 | instance: 3 115 | multiple: true # likely to be more than 1 light 116 | meters: [18] 117 | 118 | - original_name: lighting 119 | type: light 120 | instance: 4 121 | multiple: true # likely to be more than 1 light 122 | meters: [19] 123 | 124 | - original_name: air_conditioning 125 | type: air conditioner 126 | instance: 2 127 | meters: [20] 128 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/combed/download.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | import requests 3 | from os.path import join 4 | import pandas as pd 5 | import os 6 | import time 7 | from six import iteritems 8 | 9 | 10 | def download(): 11 | START_TIME_STR = "01-06-2014 0:0:0" 12 | END_TIME_STR = "01-07-2014 0:0:0" 13 | 14 | 15 | pattern = '%d-%m-%Y %H:%M:%S' 16 | START_TIME = int(time.mktime(time.strptime(START_TIME_STR, pattern)))*1000 17 | END_TIME = int(time.mktime(time.strptime(END_TIME_STR, pattern)))*1000 18 | 19 | SMAP_URL = raw_input("Enter SMAP URL") 20 | UUID_URL = join(SMAP_URL, "backend/api/query") 21 | 22 | MEASUREMENTS = ["Power", "Energy", "Current"] 23 | BASE_PATH = "/Users/nipunbatra/Desktop/iiitd/" 24 | 25 | academic_block = {'AHU': [0, 1, 2, 5], 26 | 'Building Total Mains': [0], 27 | 'Floor Total': [1, 2, 3, 4, 5], 28 | 'Lifts': [0], 29 | 'Light': [3], 30 | 'Power': [3], 31 | 'UPS': [3] 32 | } 33 | 34 | lecture_block = {'AHU-1': [0], 35 | 'AHU-2': [1], 36 | 'AHU-3': [2], 37 | 'Building Total Mains': [0], 38 | 'Floor Total': [0, 1, 2] 39 | } 40 | 41 | load_renaming = {'AHU-1': 'AHU', 42 | 'AHU-2': 'AHU', 43 | 'AHU-3': 'AHU', 44 | 'Power': 'Power Sockets', 45 | 'UPS': 'UPS Sockets'} 46 | 47 | academic_building = {'Academic Block': academic_block, 'Lecture Block': lecture_block} 48 | 49 | query = """select * where Metadata/Extra/Block = '{}' and (Metadata/SourceName = '{}') and Metadata/Extra/Type = '{}' and Metadata/Location/Floor = '{}' and Metadata/Extra/PhysicalParameter = '{}'""" 50 | 51 | for block_name, block in iteritems(academic_building): 52 | for load, floors in iteritems(block): 53 | for floor in floors: 54 | for measurement in MEASUREMENTS: 55 | query_instance = query.format(block_name, "Academic Building", load, str(floor), measurement) 56 | DATA_URL = join(SMAP_URL, "backend/api/data/uuid/{}?starttime={}&endtime={}") 57 | uuid = requests.post(UUID_URL, query_instance).json()[0]['uuid'] 58 | data = requests.get(DATA_URL.format(uuid, START_TIME, END_TIME)).json()[0]["Readings"] 59 | df = pd.DataFrame(data) 60 | # Some loads like AHU-1, etc. need to be changed to only AHU 61 | if load in load_renaming: 62 | load_renamed = load_renaming[load] 63 | else: 64 | load_renamed = load 65 | path_to_create = join(BASE_PATH, block_name, load_renamed, str(floor)) 66 | print(path_to_create) 67 | if not os.path.exists(path_to_create): 68 | os.makedirs(path_to_create) 69 | df.to_csv(path_to_create+"/"+measurement+".csv", header=False, index=False) 70 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/greend/metadata/building0.yaml: -------------------------------------------------------------------------------- 1 | instance: 1 2 | original_name: House#0 3 | 4 | elec_meters: 5 | 1: 6 | device_model: circle 7 | submeter_of: 0 8 | room: kitchen 9 | 2: 10 | device_model: circle 11 | submeter_of: 0 12 | room: basement 13 | 3: 14 | device_model: circle 15 | submeter_of: 0 16 | room: kitchen 17 | 4: 18 | device_model: circle 19 | submeter_of: 0 20 | room: kitchen 21 | 5: 22 | device_model: circle 23 | submeter_of: 0 24 | room: kitchen 25 | 6: 26 | device_model: circle 27 | submeter_of: 0 28 | room: kitchen 29 | 7: 30 | device_model: circle 31 | submeter_of: 0 32 | room: kitchen 33 | 8: 34 | device_model: circle 35 | submeter_of: 0 36 | room: lounge 37 | 9: 38 | device_model: circle 39 | submeter_of: 0 40 | room: hall 41 | 42 | appliances: 43 | - type: coffee maker 44 | instance: 1 45 | meters: [1] 46 | room: kitchen 47 | control: 48 | - manual 49 | nominal_consumption: 1450 50 | model: ESAM04.110 51 | manufacturer: Delonghi 52 | year_of_purchase: 2012 53 | 54 | - type: washing machine 55 | instance: 1 56 | meters: [2] 57 | room: basement 58 | control: 59 | - manuel 60 | manufacturer: Miele 61 | year_of_purchase: 2012 62 | 63 | - type: radio 64 | instance: 1 65 | meters: [3] 66 | room: kitchen 67 | control: 68 | - manual 69 | model: FA162 70 | manufacturer: LG 71 | year_of_purchase: 2013 72 | 73 | - type: kettle 74 | instance: 1 75 | meters: [4] 76 | room: kitchen 77 | control: 78 | - manual 79 | model: 3271/WK210 80 | manufacturer: Braun 81 | year_of_purchase: 2007 82 | 83 | 84 | - type: fridge freezer 85 | instance: 1 86 | meters: [5] 87 | room: kitchen 88 | control: 89 | - thermostat 90 | model: GC-P217LGCV 91 | manufacturer: LG 92 | year_of_purchase: 2012 93 | 94 | - type: dishwasher 95 | instance: 1 96 | meters: [6] 97 | room: kitchen 98 | control: 99 | - manual 100 | model: G578SCVi 101 | manufacturer: Miele 102 | year_of_purchase: 2012 103 | 104 | - type: lamp 105 | instance: 1 106 | meters: [7] 107 | room: kitchen 108 | control: 109 | - manual 110 | 111 | - type: television 112 | instance: 1 113 | meters: [8] 114 | room: lounge 115 | control: 116 | - manual 117 | model: 46W905A 118 | manufacturer: Sony 119 | year_of_purchase: 2014 120 | 121 | - type: vacuum cleaner 122 | instance: 1 123 | meters: [9] 124 | room: hall 125 | control: 126 | - manual 127 | manufacturer: Dyson 128 | year_of_purchase: 2003 129 | 130 | description: 2 floors; 140sqm 131 | rooms: 132 | - name: lounge 133 | instance: 1 134 | floor: 0 135 | - name: kitchen 136 | instance: 1 137 | floor: 0 138 | - name: hall #is a storage room 139 | instance: 1 140 | floor: 0 141 | - name: bedroom 142 | instance: 1 143 | floor: 1 144 | 145 | n_occupants: 2 146 | #timeframe: 147 | #periods_unoccupied: 148 | construction_year: 2002 149 | energy_improvements: 150 | - double glazing 151 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/greend/metadata/building1.yaml: -------------------------------------------------------------------------------- 1 | instance: 1 2 | original_name: House#0 3 | 4 | elec_meters: 5 | 1: 6 | device_model: circle 7 | submeter_of: 0 8 | room: kitchen 9 | 2: 10 | device_model: circle 11 | submeter_of: 0 12 | room: basement 13 | 3: 14 | device_model: circle 15 | submeter_of: 0 16 | room: kitchen 17 | 4: 18 | device_model: circle 19 | submeter_of: 0 20 | room: kitchen 21 | 5: 22 | device_model: circle 23 | submeter_of: 0 24 | room: kitchen 25 | 6: 26 | device_model: circle 27 | submeter_of: 0 28 | room: kitchen 29 | 7: 30 | device_model: circle 31 | submeter_of: 0 32 | room: kitchen 33 | 8: 34 | device_model: circle 35 | submeter_of: 0 36 | room: lounge 37 | 9: 38 | device_model: circle 39 | submeter_of: 0 40 | room: hall 41 | 42 | appliances: 43 | - type: coffee maker 44 | instance: 1 45 | meters: [1] 46 | room: kitchen 47 | control: 48 | - manual 49 | nominal_consumption: 1450 50 | model: ESAM04.110 51 | manufacturer: Delonghi 52 | year_of_purchase: 2012 53 | 54 | - type: washing machine 55 | instance: 1 56 | meters: [2] 57 | room: basement 58 | control: 59 | - manuel 60 | manufacturer: Miele 61 | year_of_purchase: 2012 62 | 63 | - type: radio 64 | instance: 1 65 | meters: [3] 66 | room: kitchen 67 | control: 68 | - manual 69 | model: FA162 70 | manufacturer: LG 71 | year_of_purchase: 2013 72 | 73 | - type: kettle 74 | instance: 1 75 | meters: [4] 76 | room: kitchen 77 | control: 78 | - manual 79 | model: 3271/WK210 80 | manufacturer: Braun 81 | year_of_purchase: 2007 82 | 83 | 84 | - type: fridge freezer 85 | instance: 1 86 | meters: [5] 87 | room: kitchen 88 | control: 89 | - thermostat 90 | model: GC-P217LGCV 91 | manufacturer: LG 92 | year_of_purchase: 2012 93 | 94 | - type: dish washer 95 | instance: 1 96 | meters: [6] 97 | room: kitchen 98 | control: 99 | - manual 100 | model: G578SCVi 101 | manufacturer: Miele 102 | year_of_purchase: 2012 103 | 104 | - type: lamp 105 | instance: 1 106 | meters: [7] 107 | room: kitchen 108 | control: 109 | - manual 110 | 111 | - type: television 112 | instance: 1 113 | meters: [8] 114 | room: lounge 115 | control: 116 | - manual 117 | model: 46W905A 118 | manufacturer: Sony 119 | year_of_purchase: 2014 120 | 121 | - type: vacuum cleaner 122 | instance: 1 123 | meters: [9] 124 | room: hall 125 | control: 126 | - manual 127 | manufacturer: Dyson 128 | year_of_purchase: 2003 129 | 130 | description: 2 floors; 140sqm 131 | rooms: 132 | - name: lounge 133 | instance: 1 134 | floor: 0 135 | - name: kitchen 136 | instance: 1 137 | floor: 0 138 | - name: hall #is a storage room 139 | instance: 1 140 | floor: 0 141 | - name: bedroom 142 | instance: 1 143 | floor: 1 144 | 145 | n_occupants: 2 146 | #timeframe: 147 | #periods_unoccupied: 148 | construction_year: 2002 149 | energy_improvements: 150 | - double glazing 151 | -------------------------------------------------------------------------------- /docs/manual/development_guide/writing_a_disaggregation_algorithm.md: -------------------------------------------------------------------------------- 1 | # Writing a disaggregation algorithm 2 | 3 | Disaggegration algorithms in NILMTK reside in the 4 | `nilmtk/nilmtk/disaggregate/` directory and are implemented as python 5 | classes. Each algorithm should extend the `Disaggregator` superclass, 6 | and implement all required methods. Algorithms should implement 7 | lazy-loading functionality via the `train_on_chunk` and 8 | `disaggregate_chunk` methods. Algorithms should specify whether they 9 | support supervised and/or unsupervised training. See the 10 | `CombinatorialOptimisation` algorithm for a simple implementation of 11 | the `Disaggregator` superclass. 12 | 13 | In the `__init__` function, set `self.MODEL_NAME` to a short string 14 | describing your algorithm. e.g. we use 'CO' for combinatorial optimisation. 15 | 16 | ## Training 17 | 18 | Disaggregation algorithms need to learn a model of how appliances consume energy from existing data. Such algorithms generally require appliance-level data from either the building which will be disaggregated (sometimes referred to as supervised) or buildings other than the one which will be disaggregated (sometimes referred to as unsupervised). The `train()` method should expect a `MeterGroup` object to be passed as a parameter containing a list of `ElecMeter` objects. Algorithms should specify if a `site_meter` is also required to be present in the `MeterGroup` object. This method is expected to iterate over chunks of data, passing each chunk to the `train_on_chunk()` method. The resulting learned method will be stored in memory as instance variables to the subclass. Subclasses should specify whether successive calls to the `train()` method either update or replace the existing model, while successive calls to `train_on_chunk()` should always update the existing model (rather than replacing it). 19 | 20 | ## Model loading and saving 21 | 22 | The models learned via `train()` are held in volatile memory, and therefore will be lost once the disaggregator object has been destroyed. Persistent models can be implemented via the `import_model()` and `export_model()` methods, which will load a model from disk (replacing any in-memory model) and save an in-memory model to disk respectively. This allows learned models to be applied to large numbers of buildings without repeating the training process, and also the sharing of learned models amongst the research community. Models can be saved to disk in any format. 23 | 24 | ## Disaggregation 25 | 26 | A disaggregation algorithm should use a learned model to separate a `site_meter`'s load into individual appliances. As with training, the `disaggregate()` method should iterate over chunks of aggregate data, calling `disaggregate_chunk()` on each chunk. The `disaggregate_chunk()` method should return a pandas dataframe, where the columns correspond to individual appliances and the rows correspond to instants in time. The returned dataframe's indexes should exactly match that of the dataframe received as a parameter. The `disaggregate()` method should save each disaggregated chunk to disk via the `datastore.append()` method, along with the required metadata. In addition to the disaggregated appliances, the method should also copy the aggregate data to the new datastore. 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NILMTK: Non-Intrusive Load Monitoring Toolkit 2 | 3 | Non-Intrusive Load Monitoring (NILM) is the process of estimating the 4 | energy consumed by individual appliances given just a whole-house 5 | power meter reading. In other words, it produces an (estimated) 6 | itemised energy bill from just a single, whole-house power meter. 7 | 8 | NILMTK is a toolkit designed to help *researchers* evaluate the 9 | accuracy of NILM algorithms. 10 | 11 | **NILMTK is not being actively developed now. However, we believe it does the job it's intended to do! 12 | It may take time for the original NILMTK authors to get back to you regarding queries/issues. However, you are more than welcome to propose changes, support!**. 13 | 14 | # Documentation 15 | 16 | [NILMTK Documentation](https://github.com/nilmtk/nilmtk/tree/master/docs/manual) 17 | 18 | # Why a toolkit for NILM? 19 | 20 | We quote our [NILMTK paper](http://arxiv.org/pdf/1404.3878v1.pdf) 21 | explaining the need for a NILM toolkit: 22 | 23 | > Empirically comparing disaggregation algorithms is currently 24 | > virtually impossible. This is due to the different data sets used, 25 | > the lack of reference implementations of these algorithms and the 26 | > variety of accuracy metrics employed. 27 | 28 | 29 | # What NILMTK provides 30 | 31 | To address this challenge, we present the Non-intrusive Load Monitoring 32 | Toolkit (NILMTK); an open source toolkit designed specifically to enable 33 | the comparison of energy disaggregation algorithms in a reproducible 34 | manner. This work is the first research to compare multiple 35 | disaggregation approaches across multiple publicly available data sets. 36 | NILMTK includes: 37 | 38 | - parsers for a range of existing data sets (8 and counting) 39 | - a collection of preprocessing algorithms 40 | - a set of statistics for describing data sets 41 | - a number of [reference benchmark disaggregation algorithms](https://github.com/nilmtk/nilmtk/wiki/NILM-Algorithms) 42 | - a common set of accuracy metrics 43 | - and much more! 44 | 45 | # Publications 46 | 47 | Please see our [list of NILMTK publications](http://nilmtk.github.io/#publications). If you use NILMTK in academic work then please consider citing our papers. 48 | 49 | Please note that NILMTK has evolved *a lot* since these papers were published! Please use the 50 | [online docs](https://github.com/nilmtk/nilmtk/tree/master/docs/manual) 51 | as a guide to the current API. 52 | 53 | 54 | # Keeping up to date with NILMTK 55 | 56 | * [NILMTK-Announce mailing list](https://groups.google.com/forum/#!forum/nilmtk-announce): stay up to speed with NILMTK. This is a low-traffic mailing list. We'll just announce new versions, new docs etc. 57 | * [NILMTK on Twitter](https://twitter.com/nilmtk). 58 | 59 | 60 | # History 61 | 62 | * April 2014: v0.1 released 63 | * June 2014: NILMTK presented at [ACM e-Energy](http://conferences.sigcomm.org/eenergy/2014/) 64 | * July 2014: v0.2 released 65 | * Nov 2014: NILMTK wins best demo award at [ACM BuildSys](http://www.buildsys.org/2014/) 66 | 67 | For more detail, please see our [changelog](https://github.com/nilmtk/nilmtk/blob/master/docs/manual/development_guide/changelog.md). 68 | 69 | [![Build Status](https://travis-ci.org/nilmtk/nilmtk.svg?branch=master)](https://travis-ci.org/nilmtk/nilmtk) 70 | -------------------------------------------------------------------------------- /nilmtk/dataset_converters/greend/metadata/building4.yaml: -------------------------------------------------------------------------------- 1 | instance: 4 2 | original_name: House#3 3 | 4 | elec_meters: 5 | 1: 6 | device_model: circle 7 | submeter_of: 0 8 | room: hall 9 | 2: 10 | device_model: circle 11 | submeter_of: 0 12 | room: kitchen 13 | 3: 14 | device_model: circle 15 | submeter_of: 0 16 | room: kitchen 17 | 4: 18 | device_model: circle 19 | submeter_of: 0 20 | room: kitchen 21 | 5: 22 | device_model: circle 23 | submeter_of: 0 24 | room: bathroom 25 | 6: 26 | device_model: circle 27 | submeter_of: 0 28 | room: bathroom 29 | 7: 30 | device_model: circle 31 | submeter_of: 0 32 | room: lounge 33 | 8: 34 | device_model: circle 35 | submeter_of: 0 36 | room: kitchen 37 | 9: 38 | device_model: circle 39 | submeter_of: 0 40 | room: lounge 41 | 42 | appliances: 43 | - type: vacuum cleaner 44 | instance: 1 45 | meters: [1] 46 | room: hall 47 | multiple: false 48 | manufacturer: Dyson 49 | model: Root Cyclone 50 | control: 51 | - manual 52 | 53 | - type: dish washer 54 | instance: 1 55 | meters: [2] 56 | room: kitchen 57 | multiple: false 58 | control: 59 | - manual 60 | model: ADG 555IX 61 | manufacturer: Whirlpool 62 | 63 | - type: kettle 64 | instance: 1 65 | meters: [3] 66 | room: kitchen 67 | manufacturer: Braun 68 | model: 3217/ WK210 69 | nominal_consumption: 2280 70 | control: 71 | - manuel 72 | 73 | - type: fridge 74 | instance: 1 75 | meters: [4] 76 | room: kitchen 77 | manufacturer: Siemens 78 | model: top-line 79 | control: 80 | - thermostat 81 | 82 | - type: washing machine 83 | instance: 1 84 | meters: [5] 85 | room: bathroom 86 | control: 87 | - manual 88 | manufacturer: Eudora 89 | model: Sparmeister W 90 | 91 | - type: hair dryer 92 | instance: 1 93 | meters: [6] 94 | room: bathroom 95 | multiple: false 96 | control: 97 | - manual 98 | manufacturer: Remington 99 | model: D-3700 100 | year_of_purchase: 2010 101 | nominal_consumption: 2200 102 | 103 | - type: desktop computer 104 | instance: 1 105 | meters: [7] 106 | room: lounge 107 | year_of_purchase: 2013 108 | year_of_manufacture: 2013 109 | control: 110 | - manuel 111 | manufacturer: dimotion PC 112 | model: QuietONE Q2 113 | 114 | - type: coffee maker 115 | instance: 1 116 | meters: [8] 117 | room: kitchen 118 | multiple: false 119 | control: 120 | - manual 121 | nominal_consumption: 1260 122 | model: Delonghi Pixie 123 | manufacturer: Delonghi 124 | 125 | - type: television 126 | instance: 1 127 | meters: [9] 128 | room: lounge 129 | control: 130 | - manual 131 | manufacturer: Samsung 132 | model: LE32C650 133 | 134 | description: House with two floors, 97sqm (except basement) 135 | rooms: 136 | - name: lounge 137 | instance: 1 138 | floor: 0 139 | - name: kitchen 140 | instance: 1 141 | floor: 0 142 | - name: hall #is a storage room 143 | instance: 1 144 | floor: 0 145 | - name: bathroom 146 | instance: 1 147 | floor: 1 148 | 149 | n_occupants: 4 150 | #timeframe: 151 | periods_unoccupied: 19.6.2014 to 21.6.2014 and 26.7.2014 to 7.8.2014 152 | -------------------------------------------------------------------------------- /docs/outdated/static/styles.css: -------------------------------------------------------------------------------- 1 |