Blockchain Based Smart-Grid Stackelberg Model for Electricity Trading and Price Forecasting Using Reinforcement Learning
Abstract
:1. Introduction
- This research introduced a dynamic Stackelberg model-based retail price forecasting of electricity in a smart grid. The Stackelberg model considered two-stage pricing between electricity producers to retailers and retailers to customers. To enable adaptive and dynamic price forecasting, reinforcement learning is used.
- A blockchain-based electricity marketplace is proposed for the smart grid environment to enable a decentralized ledger in the electricity market.
- The blockchain-based smart grid electricity marketplace is implemented, and the simulation of the system returns responsive retail prices, a change in energy consumption due to change in price, and the price pattern for an entire day. Moreover, it assesses the quality and performance of the dynamic pricing system for the demand response program. The simulation of an entire day for each customer shows that the retail price never falls below the wholesale price; however, it also changes to a price as close to the wholesale price when dissatisfaction of customers is at the maximum due to a rise in demand at lower consumption rates. Therefore, the simulation shows that the prices are responsive for both retailers and customers.
2. Literature Review
3. Proposed Blockchain-Based Model for Electricity Trading in Smart Grid
3.1. System Architecture
3.2. Smart Contract
How Smart Contract Works
3.3. User Layer
3.4. Information Layer
3.5. Users Authorization
4. Proposed Q-Learning Method for Smart Grid Price Forecasting
4.1. Problem Formulation
4.1.1. Customer Model
4.1.2. Service Provider Model
4.1.3. Objective Function
4.2. Q-Learning-Based Electricity Price Forecasting
4.2.1. Producer Input Selection
4.2.2. Formulating System Model to Markov Decision Process
- (1)
- t defines the time interval for the actions that represent retail price. It has to be discrete.
- (2)
- is the retail price chosen at time t for CU c.
- (3)
- represents a CUs energy demand before being notified of the retail price from SP. , is the consumption that occurs after the price signal.
- (4)
- is the reward that defines a minimal cost of CU c and SP’s maximum profit at time t.
4.2.3. Using Q-Learning for Dynamic Pricing Problem
Algorithm 1: Proposed Q-learning algorithm. |
5. Implementation and Analysis
5.1. Implementation of Blockchain
5.2. Experimental Setup
5.2.1. Blockchain Network
5.2.2. Smart Contract Deploy
5.2.3. Web3.js
5.2.4. MetaMask Wallet
5.2.5. React.js
5.3. Implementation of Q-Learning-Based Electricity Price Forecasting
Input Data
- Producer Input Part of the input has five different electricity producers in the form of coal, nuclear, wind, water, and air. Since each of the producers produces different quantities of electricity at different times of the day and prices them accordingly, the simulation uses a 0/1 knapsack as the algorithm to choose the best producer with the best price for retailers. The algorithm takes the maximum capacity of weight as list W for each hour of the day [0,1,2,3], the list that contains the electricity production weight in list wt [C1, C2, C3, …], and the prices for production in values V [V1, V2, V3, V4]. The algorithm filters through the list through brute force recursion, and it calculates the total weight and value of all the subsets. Moreover, it will only consider the subsets whose total weight is smaller than the maximum capacity W. The values V are shown in Figure 9 and they show the difference in prices amongst four competitive producers. Moreover, the figure also compares the producer prices with the wholesale price.
- Customer Input The other inputs that the algorithm takes are the dissatisfaction parameters—dmul, alphan, and betan. Moreover, the customers’ curtailable demand and critical demand shown in Figure 10, Figure 11 and Figure 12 are also used for determining the optimal retail price at specific times of the day, given the high demand during peak hours and the low price at off-peak hours.
5.4. Numerical Simulation Results
Optimal Retail Prices
6. Conclusions and Future Works
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Erhan, L.; Ndubuaku, M.; Mauro, M.D.; Song, W.; Chen, M.; Fortino, G.; Liotta, A. Smart anomaly detection in sensor systems: A multi-perspective review. Inf. Fusion 2021, 67, 64–79. [Google Scholar] [CrossRef]
- Ahmed, M.; Khan, A.; Ahmed, M.; Tahir, M.; Jeon, G.; Fortino, G.; Piccialli, F. Energy Theft Detection in Smart Grids: Taxonomy, Comparative Analysis, Challenges, and Future Research Directions. IEEE/CAA J. Autom. Sin. 2022, 99, 578–600. [Google Scholar] [CrossRef]
- Liu, Y.; Guan, X.; Li, J.; Sun, D.; Ohtsuki, T.; Hassan, M.M.; Alelaiwi, A. Evaluating smart grid renewable energy accommodation capability with uncertain generation using deep reinforcement learning. Future Gener. Comput. Syst. 2020, 110, 647–657. [Google Scholar] [CrossRef]
- Warmoth, B. 5 Countries Investing Heavily in Smart Grid Tech. Available online: https://www.utilitydive.com/news/5-countries-investing-heavily-in-smart-grid-tech/44875/ (accessed on 23 February 2022).
- Zahid, M.; Ali, I.; Khan, R.J.U.H.; Noshad, Z.; Javaid, A.; Javaid, N. Blockchain based balancing of electricity demand and supply. In Lecture Notes in Networks and Systems; Springer International Publishing: Cham, Switzerland, 2020; pp. 185–198. [Google Scholar]
- Lee, J.-W.; Lee, D.-H. Residential electricity load scheduling for multi-class appliances with Time-of-Use pricing. In Proceedings of the 2011 IEEE GLOBECOM Workshops (GC Wkshps), Houston, TX, USA, 5–9 December 2011; pp. 1194–1198. [Google Scholar]
- Torriti, J. Price-based demand side management: Assessing the impacts of time-of-use tariffs on residential electricity demand and peak shifting in Northern Italy. Energy 2012, 44, 576–583. [Google Scholar] [CrossRef]
- Yang, P.; Tang, G.; Nehorai, A. A game-theoretic approach for optimal time-of-use electricity pricing. IEEE Trans. Power Syst. 2013, 28, 884–892. [Google Scholar] [CrossRef]
- Zhou, Z.; Zhao, F.; Wang, J. Agent-based electricity market simulation with demand response from commercial buildings. IEEE Trans. Smart Grid 2011, 2, 580–588. [Google Scholar] [CrossRef]
- Ding, Y.M.; Hong, S.H.; Li, X.H. A demand response energy management scheme for industrial facilities in smart grid. IEEE Trans. Ind. Inform. 2014, 10, 2257–2269. [Google Scholar] [CrossRef]
- Li, X.H.; Hong, S.H. User-expected price-based demand response algorithm for a home-to-grid system. Energy 2014, 64, 437–449. [Google Scholar] [CrossRef]
- Gao, D.-C.; Sun, Y.; Lu, Y. A robust demand response control of commercial buildings for smart grid under load prediction uncertainty. Energy 2015, 93, 275–283. [Google Scholar] [CrossRef]
- Vanthournout, K.; Dupont, B.; Foubert, W.; Stuckens, C.; Claessens, S. An automated residential demand response pilot experiment, based on day-ahead dynamic pricing. Appl. Energy 2015, 155, 195–203. [Google Scholar] [CrossRef]
- Luo, Z.; Hong, S.-H.; Kim, J.-B. A price-based demand response scheme for discrete manufacturing in smart grids. Energies 2016, 9, 650. [Google Scholar] [CrossRef] [Green Version]
- Rana, R.; Oliveira, F.S. Real-time dynamic pricing in a non-stationary environment using model-free reinforcement learning. Omega 2014, 47, 116–126. [Google Scholar] [CrossRef]
- Jin, M.; Feng, W.; Marnay, C.; Spanos, C. Microgrid to enable optimal distributed energy retail and end-user demand response. Appl. Energy 2018, 210, 1321–1335. [Google Scholar] [CrossRef] [Green Version]
- Wang, H.-Z.; Li, G.-Q.; Wang, G.-B.; Peng, J.-C.; Jiang, H.; Liu, Y.-T. Deep learning based ensemble approach for probabilistic wind power forecasting. Appl. Energy 2017, 188, 56–70. [Google Scholar] [CrossRef]
- Lago, J.; Ridder, F.D.; Schutter, B.D. Forecasting spot electricity prices: Deep learning approaches and empirical comparison of traditional algorithms. Appl. Energy 2018, 221, 386–405. [Google Scholar] [CrossRef]
- Yu, M.; Hong, S.H. Supply–demand balancing for power management in smart grid: A Stackelberg game approach. Appl. Energy 2016, 164, 702–710. [Google Scholar] [CrossRef]
- Jiang, S.; Cao, J.; Wu, H.; Yang, Y. Fairness-based packing of industrial IoT data in permissioned blockchains. IEEE Trans. Ind. Inform. 2021, 17, 7639–7649. [Google Scholar] [CrossRef]
- Jiang, S.; Cao, J.; McCann, J.A.; Yang, Y.; Liu, Y.; Wang, X.; Deng, Y. Privacy-preserving and efficient multi-keyword search over encrypted data on blockchain. In Proceedings of the IEEE International Conference on Blockchain (Blockchain), Atlanta, GA, USA, 14–17 July 2019. [Google Scholar]
- Jiang, S.; Cao, J.; Wu, H.; Yang, Y.; Ma, M.; He, J. BlocHIE: A BLOCkchain-Based Platform for Healthcare Information Exchange. In Proceedings of the IEEE International Conference on Smart Computing (SMARTCOMP), Taormina, Italy, 18–20 June 2018; pp. 49–56. [Google Scholar]
- Lahouar, A.; Slama, J.B.H. Day-ahead load forecast using random forest and expert input selection. Energy Convers. Manag. 2015, 103, 1040–1051. [Google Scholar] [CrossRef]
- Lu, R.; Hong, S.H.; Zhang, X. A Dynamic pricing demand response algorithm for smart grid: Reinforcement learning approach. Appl. Energy 2018, 220, 220–230. [Google Scholar] [CrossRef]
- Sillaber, C.; Waltl, B. Life cycle of smart contracts in blockchain ecosystems. Datenschutz Datensicherheit DuD 2017, 41, 497–500. [Google Scholar] [CrossRef]
- Intro to Ethereum. Available online: https://ethereum.org/en/developers/docs/intro-to-ethereum/ (accessed on 9 June 2021).
- Ganache. Available online: https://www.trufflesuite.com/docs/ganache/overview (accessed on 9 June 2021).
Block No | Mined Date | Gas Used |
---|---|---|
82 | 2 June 2021 3:53:33 | 52,511 |
81 | 2 June 2021 3:53:01 | 117,930 |
80 | 2 June 2021 3:49:43 | 117,954 |
79 | 2 June 2021 3:48:47 | 117,918 |
78 | 2 June 2021 3:48:17 | 117,906 |
77 | 2 June 2021 3:48:02 | 132,894 |
76 | 2 June 2021 3:45:42 | 745,906 |
75 | 2 June 2021 3:45:42 | 244,636 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Moti, M.M.M.A.; Uddin, R.S.; Hai, M.A.; Saleh, T.B.; Alam, M.G.R.; Hassan, M.M.; Hassan, M.R. Blockchain Based Smart-Grid Stackelberg Model for Electricity Trading and Price Forecasting Using Reinforcement Learning. Appl. Sci. 2022, 12, 5144. https://doi.org/10.3390/app12105144
Moti MMMA, Uddin RS, Hai MA, Saleh TB, Alam MGR, Hassan MM, Hassan MR. Blockchain Based Smart-Grid Stackelberg Model for Electricity Trading and Price Forecasting Using Reinforcement Learning. Applied Sciences. 2022; 12(10):5144. https://doi.org/10.3390/app12105144
Chicago/Turabian StyleMoti, Md Mahraj Murshalin Al, Rafsan Shartaj Uddin, Md. Abdul Hai, Tanzim Bin Saleh, Md. Golam Rabiul Alam, Mohammad Mehedi Hassan, and Md. Rafiul Hassan. 2022. "Blockchain Based Smart-Grid Stackelberg Model for Electricity Trading and Price Forecasting Using Reinforcement Learning" Applied Sciences 12, no. 10: 5144. https://doi.org/10.3390/app12105144
APA StyleMoti, M. M. M. A., Uddin, R. S., Hai, M. A., Saleh, T. B., Alam, M. G. R., Hassan, M. M., & Hassan, M. R. (2022). Blockchain Based Smart-Grid Stackelberg Model for Electricity Trading and Price Forecasting Using Reinforcement Learning. Applied Sciences, 12(10), 5144. https://doi.org/10.3390/app12105144