SkillAgentSearch skills...

BaseNILM

BaseNILM is a tool for solving the energy dissagregation problem. It aims to give a baseline systems for both new and experience researchers within the area of energy disaggregation and Non-Intrusive Load Monitoring.

Install / Use

/learn @pascme05/BaseNILM
About this skill

Quality Score

0/100

Category

Operations

Supported Platforms

Universal

README

Introduction

Non-Intrusive Load Monitoring (NILM), also known as energy disaggregation, is a technology used to analyze and identify the energy consumption of individual appliances within a household or building without the need for dedicated sensors on each device. Instead, NILM relies on analyzing the overall electrical signal of the entire home or building to disaggregate and identify the specific energy consumption patterns of different appliances. The process involves using advanced signal processing and machine learning algorithms to distinguish the unique electrical signatures of various devices. By understanding the power consumption patterns associated with specific appliances, NILM systems can provide insights into how energy is being used, enabling homeowners and businesses to make informed decisions about energy efficiency, conservation, and management. This technology plays a crucial role in promoting energy awareness, optimizing energy usage, and ultimately contributing to more sustainable and cost-effective energy practices. The architecture on household-, bus-, and metering-level is illustrated below:

img.png Figure 1: Household level NILM architecture.

img_1.png Figure 2: Bus level NILM architecture.

img_2.png Figure 3: Metering level NILM architecture.

BaseNILM is a tool for solving the energy disaggregation problem. It aims to provide a baseline systems for both new and experienced researchers within the area of energy disaggregation and Non-Intrusive Load Monitoring (NILM). For a full description please see the provided documentation under BaseNILM \docu.

Publication and Citation

The BaseNILM toolkit is part of the following NILM survey paper and tries to replicate the presented architectures and disaggregation approaches. Please cite the following paper when using the BaseNILM toolkit:

P. A. Schirmer and I. Mporas, "Non-Intrusive Load Monitoring: A Review," in IEEE Transactions on Smart Grid, vol. 14, no. 1, pp. 769-784, Jan. 2023, doi: 10.1109/TSG.2022.318959 (https://ieeexplore.ieee.org/document/9820770)

When using the high frequency operating modes please also cite the following papers depending on the approach:

P. A. Schirmer and I. Mporas, "Double Fourier Integral Analysis Based Convolutional Neural Network Regression for High-Frequency Energy Disaggregation," in IEEE Transactions on Emerging Topics in Computational Intelligence, vol. 6, no. 3, pp. 439-449, June 2022, doi: 10.1109/TETCI.2021.3086226 (https://ieeexplore.ieee.org/document/9456987)

P. A. Schirmer and I. Mporas, "2D Transformations of Energy Signals for Energy Disaggregation". Sensors 2022, 22, 7200. https://doi.org/10.3390/s2219720

Furthermore, please do also cite the corresponding publicly available datasets. As well as [1] when using the data balance option, [2] when using the WaveNet pytorch implementations and [3] when using the DSC implementation. For a complete list of all publicly available datasets please see the NILM survey paper.

Dependencies

The requirements of the BaseNILM toolkit are summarized in the requirements.txt data file (CPU based). In detail, the BaseNILM toolkit was implemented using the following dependencies:

  • Python 3.8
  • Tensorflow 2.5.0
  • Keras 2.4.3
  • Scikit-Learn 1.0
  • Numpy
  • Pandas
  • Scipy

Additionally, Python 3.11 with tensorflow 2.16 was tested. The requirements.txt file was updated for version 3.11, while the old requirements have been store using req38.txt. For GPU based calculations CUDA in combination with cuDNN has been used, utilizing the Nvidia RTX 3000 series for calculation. The following versions have been tested and proven to work with the BaseNILM toolkit:

  • CUDA 11.4
  • DNN 8.2.4
  • Driver 472.39

Datasets

The toolkit utilizes the following publicly available datasets, which have been pre-processed and reshaped for the users' convenience and can be found under /data.

  1. REFIT: https://www.refitsmarthomes.org/datasets/
  2. UKDALE: https://jack-kelly.com/data/
  3. REDD: http://redd.csail.mit.edu/
  4. AMPds2: https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/FIE0S4
  5. ECO: https://vs.inf.ethz.ch/res/show.html?what=eco-data

If the user wants to utilize their own datasets, data can be either supplied using '.xlsx', '.csv', '.mat', or '.pkl' files. Additionally, the '.h5' files converted with nilmtk can be used directly as input for the BaseNILM toolkit, but this option is not fully supported. To create a new dataset please see the attached templates. For more detailed information on possible input data file types please see the readme.txt under \data.

Limitations and Known Issues

Since the toolkit is still under development there are several things that need to be improved, are not yet implemented or lack verification. In the following a list of known issues and limitations is provided:

  • Loading data from nilmtk converter '.h5' files has only limited support
  • The focus for deep learning models is TensorFlow, while pyTorch is implemented it was not reviewed as extensively
  • Source Separation methods are merely implemented for completeness and are not state-of-the-art
  • HF data is currently only supported for '.mat' data inputs
  • There are minor issues for displaying and formatting units

Quick Start

For a first test run use start.py to train, test and plot a 10-fold cross validation using the AMPds2 dataset with five loads (deferrable loads). If you don't want to train simply set 'setupExp['train']==0' as the models for the example test run are already stored in BaseNILM \mdl. For changing parameters and adapting the parameters please refer to the documentation in BaseNILM \docu.

Architecture

The aim of the PyDTS toolkit is to model the input and output relation of a household energy system, namely $\hat{y}=f(X)$ where $X \in \mathbb{R}^{T \times M}$ is a feature input vector (aggregated data) of $T$ time-steps and $M$ features and $y$ is a time-series output, i.e. appliance consumption values. Mathematically the problem can be formulated as: $y(t)=\sum_{m} x_m(t) + \epsilon(t)$, where $\epsilon(t)$ is additional time dependent noise. A more generalized architecture is illustrated below:

img_3.png Figure 4: Implemented generalized NILM architecture.

As can be seen, the general architecture consists of five steps namely pre-processing (e.g. resampling or filtering), window framing, feature extraction, model prediction, and post-processing (e.g. limiting the output). To better understand the theory it was also aimed to replicate this architecture in the code whenever possible

Operating Modes

The toolkit offers three different operating modes. The operating modes can be controlled using 'setupExp['sim']' option in the start.py file. The following three options are available. First, classical training and testing where a model is trained using a training and validation dataset, and tested on a testing dataset respectively. Second, hyperparameters optimization where free model parameters are optimally tuned using scikit GridSearchCV for machine learning models and keras hyperband tuner for deep learning models utilizing tensorboard. Third, general parameters can be optimized using a 2D grid search available in 'optiGrid.py'. This grid search performs exhaustive calculation for two independent parameters specified by the user.

Models

The toolkit as three different types of models implemented namely models based on Source Separation (SS), e.g. Non-Negative Matrix Factorization (NMF) or Discriminative Sparse Coding (DSC), models based on Machine/Deep Learning (ML/DL), e.g. Support Vector Machine (SVM) or Convolution Neural Networks (CNNs), and models based on Pattern Matching (PM), e.g. Dynamic Time Warping (DTW) or Minimum Variance Matching (MVM). These three model types also cover the majority of the proposed NILM approaches in the literature:

img_4.png Figure 5: Structure of the different NILM modeling approaches.

Exemplary Results

In the following chapter, a set of reference results is provided using the “default.txt” setup files provided in \setup. For a first test run use start.py to calculate the results presented below, which are already provided as pre-trained models under \mdl. Therefore, training is disabled in start.py. The problem considered in the default example aims to predict the power consumption of the AMPDs2 dataset (first year) using the five referable loads.

Average Results

The average results for different models and different performance metrics are provided in the table below. All results have been obtained using the default parameters of the toolkit.

| Output | MAE (W) | RMSE (W) | SAE (p.u.) | TECA (%) | |--------|----------|-----------|------------|-----------| | DNN | 14.06 | 104.58 | 0.07 | 92.69 | | CNN | 9.65 | 63.59 | 0.04 | 94.98 | | LSTM | 11.67 | 97.49 | 0.05 | 93.93 |

As can be seen in the table above CNN outperforms all other approaches for all performance metrics.

Detailed Results

The simulation output contains four different plots. The first one provides an analysis of the input features using violin plots, a heatmap of the input and output features, as well as a feature ranking calculated by RF. The second one shows the time domain input features. The third one plots the ground truth against the predicted values and evaluates mean error and error distribution. The fourth one shows the predicted results as well as the error with respect to the ground truth for both raw values and labels.

output_1.png Figure 6: Input feature analysis, heatmap, and feature ranking using RF classifier.

output_2.png Figure 7: Time-domain input features

output_3.png Figure

View on GitHub
GitHub Stars30
CategoryOperations
Updated1mo ago
Forks13

Languages

Python

Security Score

90/100

Audited on Feb 10, 2026

No findings