Role of Artificial Intelligence in Smart Meters

Sonia Singla 10 Mar, 2023 • 11 min read

Introduction

Global transformations are taking place to get the most out of the data because of the widespread deployment of smart meters, which present more than 16 million in the United Kingdom.

Aim of researchers and utilities are Timely and accurate billing, a better understanding of home energy use, easing the transition to renewable energy and electric vehicles, and improved management of electricity generation and distribution. By reducing unnecessary energy use, households and utilities can cut costs and achieve goals related to energy efficiency and climate change. But how ? Artificial intelligence is the solution.

Emerging technologies like Artificial Intelligence have a role in industries. Artificial Intelligence, Machine Learning, Deep Learning, Reinforcement Learning, and other related fields have received attention from businesses recently.

Today, we can use the power of Artificial Intelligence to analyze data from smart meters with the help of machine learning to reduce our energy consumption. Time-series machine learning algorithms make it simple for an algorithm to “learn” how much energy is consumed from historical data and predict the future. That can help the Artificial Intelligence engine decide demand-response and ensures security.

Learning Objectives

1. We will discuss the need for Smart meters and why it is necessary.

2. We will take the Smart energy csv file and do the time series analysis of the number of Smart meters applied by Large and small suppliers domestically. We will take the period analysis by fbprophet and ARIMA.

In India, work is in progress. In England, all houses and others working places will be available by the end of 2025.

This article was published as a part of the Data Science Blogathon.

Table of Contents

Why do we Need Smart Meters?

Most people have been facing a complaint about the electricity bill, charges laid down, or in the Summer the use of A.C and a big energy bill leads to financial loss.

Often they have questions in mind.

1. How to reduce electricity bills?

2. How to stop the coming of inaccurate bills?

Smart meters are the answers to all the questions.

Smart meters

Electronic or Smart meters are self-automatic reading machines that read the meter reading and show us the data stored in rupees, pounds, dollars, or pence.

Smart meters cover gas, water, and electricity. It helps to take readings of gas and electricity, send them to the suppliers, and show off the amount of gas and electricity used by the device installed in your home or office and how you can reduce your energy bill.

The use of Smart meters helps reduce your bills. Reduction in CO2 emissions and accurate readings.

Now no Complaints about inaccurate or missing bills.

Smart Meters Diagram

Why are Smart Meters Helpful to Customers and Suppliers?

1. No more inaccurate bills: A smart meter design helps to know how much you have used electricity and gas and how much is remaining. It will display the days left based on the daily use of electricity and gas. In other words, if you have a non-smart meter, then based on the use of electricity and gas in the past, Suppliers issue bills that can be inaccurate. With the help of a Smart meter, false billing gets stopped, and you know how to limit your use of electricity and gas.

2. By Smart meters, more data will come out that can help the suppliers to know about the supplies of energy customers build and make a profit. For example, if the energy bill exceeds suddenly at night will mean some fault or applications were running at night.

3. Benchmarking analysis is another way to know your competitors in the same field.

Altogether Smart meters are necessary options to be taken to reduce CO2 emissions into the atmosphere.

With the help of the SMILE project in the United Kingdom, the energy usage by a Smart meter in care-taking homes or patients will let us know when the person uses which day electricity more, leading to the observation of health in the disabled and elderly.

Smart meters will let us know when the person uses which day electricity more, which will detect health issues in the disabled and elderly.

How can a Smart Meter be Acquired?

Advanced metering infrastructure is a system with controller, Suppliers that controls your energy usage by communicating in two ways. It is not the like an Automated meter system. It conveys two ways by sending home the energy used at a particular time. It is a host to collect the reading by broadband over a power line or landline and then sends it to the meter data management system.

A Distribution Company or Discom is a business that delivers electricity to customers. These companies don’t make electricity but buy electricity from the people who make it and sell it to people. Discoms are the owners of the grids that you see all over your city. These are part of the electricity chain with two companies named GENCOs that generate and TRANSCOs that transmit the electricity.

Discoms are two types owned by the state and private. By the state, like Kerala Electricity Board and Karnataka Power Corporation Limited, and private discoms, like Tata Power, BSES Rajdhani, and Reliance.

About 1.7 million Smart meters got installed by Energy Efficiency Service Limited, IntelliSmart, and other agencies.

IntelliSmart Infrastructure Private Limited is a partnership between the National Investment and Infrastructure Fund (NIIF) to
facilitate the implementation of smart meters through a BOOT (Build, Own, Operate, Transfer) model. Energy Efficiency Services Ltd (EESL) is an Indian government energy service company.

The government has mandated that energy providers provide their customers with smart meters.

Contact your energy provider for smart meter installation at a time and date that work best for you. It will not cost you anything.

According to our most recent analysis, the country is gaining more benefits from the rollout than it implemented.

What are Solar Panels?

Solar panels comprise solar cells of silicon, phosphorous (negative charge), and boron (positive) in layers.

The Photovoltaic effect is where the photons from solar panels start an electric current that hits the solar panel’s surface and releases electrons from orbits into the solar cells’ electric field, which pulls these free electrons into a directional Current.

A home roof space often has enough room for the number of solar panels needed to generate enough electricity to meet all of its needs. Any unwanted goes to the power grid, which saves money on electricity bills at night.

The sunlight collected by solar panels converts into clean, renewable electricity that powers electrical loads, like refrigerators, bulbs, washing machines, etc.

Solar Panels and Smart Meters

Energy providers installing solar-powered Smart meters have already installed solar-powered Smart meters for customers. British Gas, First Utility, Ovo Energy, and Utilita have solar panels that can also install smart meters. SSE claims it can install but advises customers to wait until technical issues get fixed.

Energy Suppliers

There are two meters, one for electricity and one for gas; Smart meters will take their places. An In-Home Display (IHD) is a handheld device attached to the home and is simple to use.

We took the data of England’s domestic and non-domestic gas and electricity meters by small and all suppliers for September 2022.

Engineers will have better information about what caused power outages and will be able to detect them much more quickly. They will be able to complete repairs more quickly and affordably.

Additionally, smart meters are contributing to our decrease in reliance on imported fossil fuels. We can save money using energy during off-peak hours or when there is more clean electricity. Some customers have even got an award for using electricity on windy days.

Electric cars, heating systems, and other appliances can connect to the Smart metering system to access pricing data, including washing machines and dishwashers. It can be programmed to take advantage of lower rates, lessen the impact on our energy grid, and save customers money.

scatter plot for smart meters

The Sum of Small suppliers for gas meters was highest for 2015 at 137450, followed by 2018 and 2021. The maximum amount of applying of gas meters is in 2018 by the large suppliers.

scatter plot for smart meters

The suppliers of large gas meters were more in 2017, 2018, and 2019. The suppliers for small electricity meters are more in 2015 and 2021.

Heatmap for smart meters

Time Series data are the data that make changes or move a period, and to know the future data values, we need Time Series forecasting.

Time Series Analysis

A procedure of analyzing a sequence of data values collected over a specific time is called time series analysis.

Time Series data analysis puts insight into seasonal patterns, trends, and the future that can help Electricity and Gas Suppliers to make profits.

Models and Techniques for Time Series Analysis

ARIMA (Autoregressive, Moving Average model): It takes past values to predict the future.

Autoregressive – An autoregression model assumes that previous time step observations can predict the value at the subsequent time step.

Integrated – The difference between the new data values and the previous values takes their place to make the data stationary.

Moving Average –  A moving average takes the arithmetic mean of a particular set of values over a specific period.

Univariate ARIMA- Jenkins model: Ony Single dependent variable like temperature.

The single variable data in the univariate ARIMA model is forecast. For example

             Temp

Date            

2023-02-01    60

2023-02-02    70

2023-02-03    55

Multivariate ARIMA – Jenkins models: Multiple dependents like temperature and humidity.

The two or more variable data in the multivariate ARIMA model are forecast. For example

             Temp   Humidity

Date            

2023-02-01    60      75.2

2023-02-02    70      60.1

2023-02-03    55      52.3

Time series data analysis involves the following steps.

1. Stationary – To check for seasonal patterns of the data. A series whose properties do not change over time is called a stationary time series. Variance, mean, and covariance are these characteristics. Trends and seasonality are absent from stationary time series.

2. Autocorrelation – Future values are correlated to past values or not.

The relationship between two variables is termed correlation means variables are related to each other.

Positive correlation occurs when both variables change in the same direction (e.g., simultaneously go up or down). A negative correlation occurs when two variables change values in opposite directions (e.g., one goes up and one goes down).

Autocorrelation is the term used to describe the correlation between the variable and itself at earlier time steps.

Interestingly, the time series problem may not be predictable if all lag variables have low or no correlation with the output variable.

For Stationary data, we will use Dickey-Fuller Test.

It will give p-values. If we accept the null theory, the data is stationary, and if we reject it, not Stationary data.

We calculate the rolling mean and the amount of variance (STD) for seven months.

rolling_mean = meter['Large SE meter in SM'].rolling(7).mean()
rolling_std = meter['Large SE meter in SM'].rolling(7).std()#import csv

We imported the adfuller from the stats model and passed out the data meter and parameter AIC.

from statsmodels.tsa.stattools import adfuller
af = adfuller(meter['Large SE meter in SM'],autolag="AIC")
data_out = pd.DataFrame({"Values":[af[0],af[1],af[2],af[3], af[4]['1%'], af[4]['5%'], af[4]['10%']] , "Metric":["Test Statistics","p-value","No. of lags used","Number of observations used","cvalue(1%)", "cvalue (5%)", "cvalue (10%)"]})
print(data_out)

The p-value is more than 0.05, and the critical value is less than the test statistics results. The data is not stationary and has increasing trends.

Autocorrelation

autoc_lag1 = meter['Large SE meter in SM'].autocorr(lag=1)
print("One Month Lag: ", autoc_lag1)
autoc_lag3 = meter['Large SE meter in SM'].autocorr(lag=3)
print("Three Months Lag: ", autoc_lag3)
autoc_lag6 = meter['Large SE meter in SM'].autocorr(lag=6)
print("Six Months Lag: ", autoc_lag6)
autoc_lag9 = meter['Large SE meter in SM'].autocorr(lag=9)
print("Nine Months Lag: ", autoc_lag9)
One Month Lag: 0.9916188803959796Three Months Lag: 0.9549079337204182 
Six Months Lag: 0.9261679644654887 Nine Months Lag: 1.0

The results show data is highly correlated.

Decomposition

from statsmodels.tsa.seasonal import seasonal_decompose
dec = seasonal_decompose(meter['Large SE meter in SM'],model='additive', period=5)
dec.plot()plt.show()
Decomposition
meter['Year'] = meter.indexdf = pd.DataFrame()
df['ds'] = meter['Year']df['y'] = meter['Large SG meters in SM']
df.head()split_date = 2016df_train = df.loc[df.ds <= split_date].copy()
df_test = df.loc[df.ds > split_date].copy()plt.plot(df_train, color = "blue")
plt.plot(df_test, color = "red")plt.title("Train/Test split for Suppliers")
plt.ylabel("Suppliers")
plt.xlabel('Year-Month')sns.set()plt.show()#import csv
"
from pmdarima.arima import auto_arima
df['Year'] = df.index
split_date = 2016
df_train = df.loc[df.ds <= split_date].copy()
df_test = df.loc[df.ds > split_date].copy()
model = auto_arima(df_train['y'], trace=True, error_action='ignore', suppress_warnings=True)
model.fit(df_train['y'])
forecast = model.predict(n_periods=len(df_test['y']))
forecast = pd.DataFrame(forecast,index = df_test['y'].index,columns=['Prediction'])
ARIMA(1,0,1)(0,0,0)[0] intercept   : AIC=inf, Time=0.22 sec
 ARIMA(0,0,0)(0,0,0)[0] intercept   : AIC=153.606, Time=0.26 sec
 ARIMA(1,0,0)(0,0,0)[0] intercept   : AIC=155.409, Time=0.09 sec
 ARIMA(0,0,1)(0,0,0)[0] intercept   : AIC=inf, Time=0.14 sec
 ARIMA(0,0,0)(0,0,0)[0]             : AIC=154.292, Time=0.00 sec

Best model:  ARIMA(0,0,0)(0,0,0)[0] intercept
Total fit time: 0.700 seconds
plt.plot(forecast)
"
from math import sqrtfrom sklearn.metrics import mean_squared_error
rms = sqrt(mean_squared_error(df_test['y'],forecast))
print("RMSE: ", rms)RMSE: 6731165.9583494775
def mape(ac, pre): ac, pre = np.array(actual), np.array(pre) 
    return np.mean(np.abs((ac - pre) / actual)) * 100
mape(df['y'], forecast)4098.346771463499

Time Series Analysis of Large supplier’s Gas Meters by Fbprophet

Fbprophet, an open-source library developed or built by Facebook, is used for time series analysis. It requires two columns where ds refers to the year and the y column to the data variable.

Why Fbprophet?

It hands out several outliers and null values and shows results in seconds.

The user can manually add seasonality and holiday values.

Code

from sklearn.metrics import mean_squared_error, mean_absolute_errorfrom prophet.plot import add_changepoints_to_plot
meter=pd.read_csv("Meter_energy_domestics.csv")
meter=meter.fillna(0)meter.head()
sns.boxplot(x =meter['Large SG meters in SM'])
meter=meter.set_index("Year")
meter.plot()#import csv
BoxPlot for smart meters

We then converted the Year column into the ds column and took the y column.

meter=meter.reset_index()df = pd.DataFrame()df['ds'] = meter['Year']
df['y'] = meter['Large SG meters in SM']df.head()split_date = 2016
df_train = df.loc[df.ds <= split_date].copy()df_test = df.loc[df.ds > split_date].copy()
m = Prophet()m.fit(df_train)future = m.make_future_dataframe(periods=365)
forecast = m.predict(df_test)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper', 'trend', 'trend_lower', 'trend_upper']].tail()
fig1 = m.plot(forecast)#import csv
"
m.plot_components(forecast)
Forecasting of Smart meters
print("MSE:", mean_squared_error(y_true = df_test["y"], y_pred = forecast['yhat']))
print("MAE:", mean_absolute_error(y_true = df_test["y"], y_pred = forecast['yhat']))
MSE: 788768128821.7513MAE: 790450.4288312361
print("MAPE: ", mean_abs_perc_err(y_true = (df_test["y"]), y_pred = (forecast['yhat'])))
MAPE: 57.08464486655384#import csv

Time series analysis of Large supplier’s gas meter in Traditional mode by fbprophet.

df = pd.DataFrame()
df['ds'] = meter['Year']
df['y'] = meter['Large SG meters in TM']
df.head()
split_date = 2016
df_train = df.loc[df.ds <= split_date].copy()
df_test = df.loc[df.ds > split_date].copy()
m = Prophet()m.fit(df_train)
future = m.make_future_dataframe(periods=365)
forecast = m.predict(df_test)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper', 'trend', 'trend_lower', 'trend_upper']].tail()
fig1 = m.plot(forecast)#import csv
Time series analysis of Large supplier's gas meter in Traditional mode by fbprophet

Large Suppliers’ gas meter non-smart

df = pd.DataFrame()df['ds'] = meter['Year']
df['y'] = meter['Large SG meters non-smart']
df.head()split_date = 2016
df_train = df.loc[df.ds <= split_date].copy()df_test = df.loc[df.ds > split_date].copy()
m = Prophet()m.fit(df_train)future = m.make_future_dataframe(periods=365)
forecast = m.predict(df_test)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper', 'trend', 'trend_lower', 'trend_upper']].tail()
fig1 = m.plot(forecast)#import csv
Large Suppliers' gas meter non-smart while Implements Smart meters

Large Suppliers’ Electricity meters in Smart mode

df = pd.DataFrame()df['ds'] = meter['Year']df['y'] = meter['Large SE meter in SM']df.head()split_date = 2016
df_train = df.loc[df.ds <= split_date].copy()df_test = df.loc[df.ds > split_date].copy()
m = Prophet()m.fit(df_train)future = m.make_future_dataframe(periods=365)
forecast = m.predict(df_test)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper', 'trend', 'trend_lower', 'trend_upper']].tail()
fig1 = m.plot(forecast)#import csv
Large Suppliers' Electricity meters in Smart Meters mode

Conclusion

We discuss the few benefits of Smart meters, their uses, and how they can be the foundation of the future in health-related issues. We further discussed Solar Panel and went for an analysis of the data and its future predictions.

Key Points

Before Smart meters, there was often a complaint about inaccurate or missing bills.

1. The smart meter helps reduction of electricity bills and misinformation about electricity bills.

2. Facebook created Prophet, an open-source library for automatically forecasting univariate time series data.

3. An analysis of the data and its future predictions by fbprophet and ARIMA.

4.  fbprophet results show a lower MAPE value.

5. The analysis results show the future of Large suppliers’ gas meters in Smart mode rises. The large suppliers’ gas meters non-smart will decrease, traditionally, with similar values.

The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion. 

Sonia Singla 10 Mar 2023

Frequently Asked Questions

Lorem ipsum dolor sit amet, consectetur adipiscing elit,

Responses From Readers