Using neural nets to predict tomorrow’s electric consumptionKevin McElweeBlockedUnblockFollowFollowingMar 7Research in conjunction with the Open Modeling Framework (OMF)Electricity distributors stand to save hundreds of thousands of dollars by decreasing their peak demand charge.

Some have tried to discharge batteries or turn off customers’ water heaters at peak hours to reduce their demand.

But these efforts are only as effective as the utility’s ability to predict the day’s energy consumption.

The smallest inaccuracy can mean the difference between tens of thousands of dollars—implementing a peak-shaving strategy with incorrect load predictions can often increase demand cost.

Thankfully, advances in deep learning and neural networks can offer utilities an incredibly accurate picture of the next day’s energy consumption.

The Open Modeling Framework (OMF) and I have used neural networks to create a day-ahead load forecasting model that can be easily implemented to inform dispatch decisions.

Why not something simpler?We initially created a linear regression model with the python package SKLearn.

Although this simpler model achieved an impressive 10 percent MAE, it was not accurate enough to reduce peaks reliably.

The biggest obstacle was the difference in daily peaks between winter and summer months.

Winter months peaked twice a day and summer months peaked in the middle of the day.

A linear model cannot create these two daily load shapes at the same time.

While linear regression can find simple relationships (+500kW because it’s Monday, -100kW because it’s March), a neural network can calculate more complicated relationships (+5100kW because it’s 3pm on a Monday in April, -1500kW because it’s 5am on Thanksgiving).

This reduced our training error to roughly 2 percent MAE, which translated to tens of thousands of dollars saved.

Load prediction captures both single and double peak behavior (from OMF’s “Virtual Battery Dispatch” model)Software DetailsIn order to incorporate the load forecast software into the OMF database, our model is written in Python.

We use the pandas package to manipulate data, and we have implemented Tensorflow’s Keras (Google’s machine learning software) to create a neural network.

Here is a link to the loadForecast file.

The code is easy to use:import loadForecast as fcimport pandas as pddf = pd.

read_csv('date_load_and_temperature_data.

csv')all_X = fc.

makeUsefulDf(df)all_y = df[‘load’]predictions = fc.

neural_net_predictions(all_X, all_y)For our initial testing purposes, neural_net_predictions simply returns the predictions for the final year; however, it can be quickly updated to work for a utility in real-time.

StructureThe structure of the neural network is continually being updated as we search for more accurate and efficient methods; however, we have currently settled on a five-layer, fully-connected network where each layer contains 71 nodes.

We use a ReLU function in each layer and are minimizing mean squared error.

InputsWe recommend that the model train on at least three years of data.

The model takes a CSV as input, where each row lists the load and weather for a given date and hour.

If a utility doesn’t have temperature data available, OMF also offers “weatherPull,” a program that can easily collect and return hourly weather for a given zip code.

If there are any null temperature values, the load forecast function uses the “forward fill” method, where null values are replaced by the last non-null value.

For example, “38, 39, 41, NaN, NaN, 38, NaN, 32” would be read as “38, 39, 41, 41, 41, 38, 38, 32.

”FeaturesAlthough each training example contains the date, temperature, and weather data, we expand these three columns into 71 features that are useful for a machine learning model.

Here is a list of all features:Years since 2000*Load from 24 hours before*Hour of day (is12AM, is1AM, … is 11PM)Day of the week (isSunday, isMonday, … isSaturday)Month of the year (isJanuary, isFebruary, … is December)Temperature* **Previous day’s load* (12AM of day previous, 1AM of day previous, … 11PM of day previous)Holidays (the NERC6 holidays)*** (isNewYears, isMemorialDay…isChristmas)* These features are normalized by subtracting from the mean and dividing by the standard deviation, which helps collect all data points closely around zero.

By dividing by the standard deviation instead of the range (as some data scientists suggest), we improved accuracy by one percent.

** The National Weather Service estimates that their day-ahead hourly weather forecast is often within 2.

5 degrees.

To replicate this, we create noise in the training and test temperature data by adding a gaussian distribution centered at zero with the standard deviation of 2.

5.

When this noise was added, the accuracy of the model dropped by one percent.

***Observed holidays are also “1” (or “True”).

For example, Independence Day 2015 was on a Saturday, so it was observed on Friday, July 3.

Both July 3 and July 4 for 2015 are marked as “1” for the “isIndependenceDay” feature.

ResultsWe trained this neural net on ERCOT’s Houston data from 2002–2017 and tested the model against the load for 2018.

We achieved roughly 98 percent accuracy (2 percent MAE).

The entire program often runs within 3 minutes.

We deployed this neural net on a demand reduction model with a utility controlling air conditioning units and found that we saved 80 percent of the optimal solution (e.

g.

if everything ran perfectly, the utility would save $90,000 on demand charge, but because forecasting isn’t perfect, it saved approximately $70,000.

)The OMF is continuing experiments to increase the accuracy of our model.

There’s no straightforward way to calculate the Bayesian minimum error; however, we hope to reduce MAE by another percentage point, which could potentially save utilities tens of thousands of dollars per year.

Did you find mistakes?.Do you have any questions?.Feel free to email me.

.. More details