*3.4. Energy Consumption Prediction Using ML*

*3.4. Energy Consumption Prediction Using ML* While most research and applications of machine learning and computational intelligence techniques relate to the energy consumption and price of electricity, the use of such technologies for enhancing future prediction is yet to be realised and demonstrated. A neural network (NN) has been employed to predict the future energy demand and the future V2G cost for the years 2018 and 2019. The predictions for energy demand on each While most research and applications of machine learning and computational intelligence techniques relate to the energy consumption and price of electricity, the use of such technologies for enhancing future prediction is yet to be realised and demonstrated. A neural network (NN) has been employed to predict the future energy demand and the future V2G cost for the years 2018 and 2019. The predictions for energy demand on each month in a year have been presented in Figure 11.

month in a year have been presented in Figure 11. A general smooth trend is observed from January to April in Figure 11. However, the prediction accuracy has been slightly decreased in the month May for the year 2018 and 2019, due to the inconsistency of the trend in actual data observed in training compared to the previous years. The fundamental principles of ML techniques are to follow the trend of its training state during prediction. Hence, the prediction of energy consumption for the remaining months gradually increases in this study. The data showing as blue in the graph is indicated as actual data, whereas the orange data is the predicted output.

The yearly average prediction of energy demand for the building has also been presented in Figure 12 for the same years 2018 and 2019. It is observed that a smooth trend exists in the actual data for all years. Hence, the predictions followed the actual curve.

The predicted yearly average and actual recorded yearly average are different. The prediction error for 2018 and 2019 are 13,170 kW and 8846 kW. The error percentages for the years are 5.62% and 3.98%, respectively. This error is due to the volatility of energy consumption.

The data collected through electricity meters and the predicted data using the machine learning are varied. This variation can be shown as the prediction error below in Figure 13.

**Figure 11.** *Cont*.

**Figure 11.** Energy consumptions prediction on a monthly basis for the year 2018 and 2019 using the MLA. (e.g., November (Act.) and November (Pred.). **Figure 11.** Energy consumptions prediction on a monthly basis for the year 2018 and 2019 using the MLA. (e.g., November (Act.) and November (Pred.).

**Figure 12.** Annual average energy demand prediction using NN. **Figure 12.** Annual average energy demand prediction using NN.

The predicted yearly average and actual recorded yearly average are different. The prediction error for 2018 and 2019 are 13,170 kW and 8846 kW. The error percentages for the years are 5.62% and 3.98%, respectively. This error is due to the volatility of energy consumption. The data collected through electricity meters and the predicted data using the machine learning are varied. This variation can be shown as the prediction error below in The largest error was in April 2018, at 15.1%. The month with the lowest error was in September 2019 at 0.08%. April's recorded energy consumption variance was the highest, at 98,162 kW. September's recorded energy consumption variance was among the lowest, at 9680 kW. The input data consisted of the energy consumption, so the more volatile the data, the harder it is to predict, and thus, the inaccuracy for the month, April. The average prediction error across all outputs is 5.1%.

Actual Predicted Error %

**Figure 13.** Error percentage for predicted energy consumption compared to recorded.

The largest error was in April 2018, at 15.1%. The month with the lowest error was in September 2019 at 0.08%. April's recorded energy consumption variance was the highest, at 98,162 kW. September's recorded energy consumption variance was among the lowest, at 9680 kW. The input data consisted of the energy consumption, so the more volatile the

**Error (%)**

Figure 13.

**Power consumption (kw)**

0

2018

2019

2018

2019

2018

2019

2018

2019

2018

2019

2018

2019

**Month**

2018

Jan Feb March April May June July August Sept Oct Nov Dec

2019

2018

2019

2018

2019

2018

2019

2018

2019

2018

2019

50,000 100,000 150,000 200,000 250,000 300,000 350,000 400,000

The predicted yearly average and actual recorded yearly average are different. The prediction error for 2018 and 2019 are 13,170 kW and 8846 kW. The error percentages for the years are 5.62% and 3.98%, respectively. This error is due to the volatility of energy

2012 2014 2016 2018 2020

**Year**

Yearly average Yearly average (pred.)

The data collected through electricity meters and the predicted data using the machine learning are varied. This variation can be shown as the prediction error below in

**Figure 13.** Error percentage for predicted energy consumption compared to recorded. **Figure 13.** Error percentage for predicted energy consumption compared to recorded. prediction error across all outputs is 5.1%.

### The largest error was in April 2018, at 15.1%. The month with the lowest error was in *3.5. Cost of Electricity Prediction for V2G Using ML 3.5. Cost of Electricity Prediction for V2G Using ML 3.5. Cost of Electricity Prediction for V2G Using ML* The employment of NN has brought great performance in predicting the cost of elec-

prediction error across all outputs is 5.1%.

**Figure 12.** Annual average energy demand prediction using NN.

consumption.

0

50,000

100,000

150,000

**Energy consumption (kW)**

200,000

250,000

300,000

Figure 13.

September 2019 at 0.08%. April's recorded energy consumption variance was the highest, at 98,162 kW. September's recorded energy consumption variance was among the lowest, at 9680 kW. The input data consisted of the energy consumption, so the more volatile the The employment of NN has brought great performance in predicting the cost of electricity, which has been presented in Figure 14. From the results, it is found a smooth prediction trend for the month January and February. However, the prediction accuracy has been observed irregularity for the month May to July, due to having nonsmooth trend of the actual data for those months for the year 2018 and 2019, which has been shown as yellow colour in the figure. The prediction cost from the month August to December has shown a smooth trend between the actual and predicted values. Although accuracy has been slightly decreased for the months September and October. The employment of NN has brought great performance in predicting the cost of electricity, which has been presented in Figure 14. From the results, it is found a smooth prediction trend for the month January and February. However, the prediction accuracy has been observed irregularity for the month May to July, due to having nonsmooth trend of the actual data for those months for the year 2018 and 2019, which has been shown as yellow colour in the figure. The prediction cost from the month August to December has shown a smooth trend between the actual and predicted values. Although accuracy has been slightly decreased for the months September and October. tricity, which has been presented in Figure 14. From the results, it is found a smooth prediction trend for the month January and February. However, the prediction accuracy has been observed irregularity for the month May to July, due to having nonsmooth trend of the actual data for those months for the year 2018 and 2019, which has been shown as yellow colour in the figure. The prediction cost from the month August to December has shown a smooth trend between the actual and predicted values. Although accuracy has been slightly decreased for the months September and October.

**Figure 14.** *Cont*. 116

data, the harder it is to predict, and thus, the inaccuracy for the month, April. The average

The employment of NN has brought great performance in predicting the cost of electricity, which has been presented in Figure 14. From the results, it is found a smooth prediction trend for the month January and February. However, the prediction accuracy has been observed irregularity for the month May to July, due to having nonsmooth trend of the actual data for those months for the year 2018 and 2019, which has been shown as yellow colour in the figure. The prediction cost from the month August to December has shown a smooth trend between the actual and predicted values. Although accuracy has

prediction error across all outputs is 5.1%.

*3.5. Cost of Electricity Prediction for V2G Using ML*

been slightly decreased for the months September and October.

**Figure 14.** The prediction of cost for electricity of V2G on a monthly basis for the year 2018 and 2019 using ML. **Figure 14.** The prediction of cost for electricity of V2G on a monthly basis for the year 2018 and 2019 using ML.

for both the years followed the actual trend.

The yearly average cost of the building has also been presented in Figure 15 for the

The yearly average cost of the building has also been presented in Figure 15 for the year 2018 and 2019. Having the smooth trend of actual data for all years, the prediction for both the years followed the actual trend. *Sustainability* **2021**, *13*, x FOR PEER REVIEW 20 of 25

**Figure 15.** Annual average cost of electricity prediction using NN. **Figure 15.** Annual average cost of electricity prediction using NN.

The months in the middle of Figure 16, within summer, have a higher power consumption than months in neighbouring seasons. While building becomes hotter, air conditioning is used instead of heating. This shows that air conditioning uses more energy than heating for the building. The power consumption varies from roughly 225,000 kW to 290,000 kW. The months in the middle of Figure 16, within summer, have a higher power consumption than months in neighbouring seasons. While building becomes hotter, air conditioning is used instead of heating. This shows that air conditioning uses more energy than heating for the building. The power consumption varies from roughly 225,000 kW to 290,000 kW.

**Figure 16.** Monthly basis energy consumption of the building.

**Figure 16.** Monthly basis energy consumption of the building.

1 The data taken from electricity meters and the predicted data through ML are differ-The data taken from electricity meters and the predicted data through ML are different. In the case of larger difference, the error is shown high (Figure 17).

ent. In the case of larger difference, the error is shown high (Figure 17). The largest error percentage was 32% in April 2018. The month with the lowest error was in September 2019 at 1.74%. The average error in prediction is 7.94% over 2018 and 2019. April is more varied through the years than the other months. It ranges from £15,662 to £4081 for the use of the V2G method between 2016 and 2019. This is a difference of £11,581. September is less varied. It ranges from £5711 to £9105. This is a difference of £3393. The average error across all months is 7.9%. The more varied the data is, the more data is necessary for an accurate prediction. Between 2017 and 2019, April's calculated V2G cost varied by £6822, whereas between 2017 and 2019, it varied by £5823. The cost of the V2G method is directly linked to energy consumption. The variance of the date is the reason for the error. Additional data, including weather, footfall, etc., can be added to enhance the performance of ML.

**Figure 17.** Error percentage for predicted EV purchasing price. **Figure 17.** Error percentage for predicted EV purchasing price.

### The largest error percentage was 32% in April 2018. The month with the lowest error *3.6. General Discussion*

was in September 2019 at 1.74%. The average error in prediction is 7.94% over 2018 and 2019. April is more varied through the years than the other months. It ranges from £15,662 to £4081 for the use of the V2G method between 2016 and 2019. This is a difference of £11,581. September is less varied. It ranges from £5711 to £9105. This is a difference of £3393. The average error across all months is 7.9%. The more varied the data is, the more data is necessary for an accurate prediction. Between 2017 and 2019, April's calculated V2G cost varied by £6822, whereas between 2017 and 2019, it varied by £5823. The cost of the V2G method is directly linked to energy consumption. The variance of the date is the reason for the error. Additional data, including weather, footfall, etc., can be added to enhance the performance of ML. *3.6. General Discussion* To cover the cost of battery degradation for the EV owner, the energy must be bought To cover the cost of battery degradation for the EV owner, the energy must be bought at 85.2 p/kW. This price has been considered to build ML models. Figure 11 has been analysed by comparing the actual data and the predicted data. The difference between the predicted and actual energy demand yearly averages, as shown in Figure 12, is a total of 22,016 kW between 2018 and 2019. This gives a prediction error of 2.07%. The least accurate month is in August, shown in Figure 11, the variance in 2018 and 2019 is 29,835 kW, which is 5.57% of the maximum value. The least accurate month from Figure 14, showing the price of the V2G method, is in April. On the other hand, the values collected through installed electric meters from 2018 and 2019 are £4081 and £7818, respectively, whereas the predicted values are £6004 and £6944, respectively. The prediction errors for 2018 and 2019 are £1923 and £875, which are 32% and 11%, respectively. This variance stems from the volatility of the energy demand in April, as is shown in Figure 11.

at 85.2 p/kW. This price has been considered to build ML models. Figure 11 has been analysed by comparing the actual data and the predicted data. The difference between the predicted and actual energy demand yearly averages, as shown in Figure 12, is a total of 22,016 kW between 2018 and 2019. This gives a prediction error of 2.07%. The least accurate month is in August, shown in Figure 11, the variance in 2018 and 2019 is 29,835 kW, which is 5.57% of the maximum value. The least accurate month from Figure 14, showing the price of the V2G method, is in April. On the other hand, the values collected through installed electric meters from 2018 and 2019 are £4081 and £7818, respectively, whereas the predicted values are £6004 and £6944, respectively. The prediction errors for 2018 and 2019 are £1923 and £875, which are 32% and 11%, respectively. This variance stems from the volatility of the energy demand in April, as is shown in Figure 11. The prediction error is most common in months with a larger variance of data. The more varied and inconsistent the input data is the more input data is needed to secure an accurate output. In Figures 13 and 17, has the highest energy consumption, also the month with the highest price for V2G use, whereas the same with the months with the lowest V2G price and energy consumption. The method is used so that the EVs are fully charged by 17:00, allowing the EV owner to drive home and back to the university building the next day with an 80% charge, but this can be changed in the future. Smart metering can be used so the owner of the EV can input what time they will leave. The method will then be altered, depending on the leaving time, so the EV is fully charged. It is refreshed hourly; however, the time could be shortened to provide a more efficient V2G method.

The prediction error is most common in months with a larger variance of data. The more varied and inconsistent the input data is the more input data is needed to secure an accurate output. In Figures 13 and 17, has the highest energy consumption, also the month with the highest price for V2G use, whereas the same with the months with the lowest V2G price and energy consumption. The method is used so that the EVs are fully charged by 17:00, allowing the EV owner to drive home and back to the university building the next day with an 80% charge, but this can be changed in the future. Smart metering can be used so the owner of the EV can input what time they will leave. The method will then In this work, a novel smart multienergy system with the ability to combine various energy storage technologies have been proposed to provide the best economic and environmental options for a given demand. The EV, energy storage and transaction of on-site energy must work in unison to enable an effective V2G model. Mazzoni et al. [38] have analysed the use of energy storage systems, including combined heat and power units, which show great financial and environmental benefits. V2G provides an incentive-pricing plan by motivating electric vehicles owners through participating in a charging/discharging system [39]. The master planning issue on this could be that the EVs' owners can charge vehicles at a low cost using unused or extra power in the grid during off-peak demand. In the case of shortage of power in the grid system during on-peak demand, EVs owners can earn money by discharging extra stored power from their vehicles at a higher price.

The implementation of a V2G method in any university campus or similar set-up requires inspection of key economic parameters, including initial investment, operational expenditure, maintenance, return on investment, and end net profit. Key technical parameters of energy storage include type (thermal, chemical, kinetic), capacity, physical size, charge and discharge rate, depth of discharge, and lifespan of the storage technique [39]. The economic parameters dictate the transferability of the V2G method as EV chargers must be installed, and there must be a return on investment to confirm that the method is transferrable to another circumstance. The technical parameters dictate how effective the method is. The buildings' characteristics (useable space, times of use, demand etc.) need to be met with a battery of the correct size, capacity, depth of discharge, and rate of charge, to ensure the method is effective. The replicability of the V2G method is dependent on available space for EV chargers, energy characteristics of the building, initial investment and storage techniques.
