A Two-Stage Optimization Model for P2P Market Design considering Role of Retailer and Demand Response Programs

Document Type : IIIEC 2025

Authors

Department of Industrial Engineering, Faculty of Engineering, Bu-Ali Sina University, Hamedan, Iran

Abstract

Objective: With the increasing penetration of distributed energy resources (DERs), peer-to-peer (P2P) energy trading has emerged as a promising mechanism to enhance renewable energy utilization and market efficiency. This study aims to design a P2P electricity market for grid-connected microgrids that coordinates local trading with retail and wholesale markets while accounting for geographical distance and demand response programs.
Methods: A two-stage optimization framework is proposed. In the first stage, a mixed-integer linear programming (MILP) model determines the optimal neighborhood set of prosumers by maximizing renewable energy consumption and minimizing the geographical distance between trading peers. In the second stage, a mixed-integer nonlinear programming (MINLP) model is developed to optimize energy exchanges, battery storage, and pricing decisions, with the objectives of maximizing retailer profit and minimizing prosumer costs. The model incorporates time-based and incentive-based demand response programs and is validated using real residential data from Iran.
Results: The numerical results show that limiting P2P transactions to geographically closer peers improve local renewable energy utilization. Sensitivity analysis on time-based DR programs indicates that the optimal pricing mechanism applies real-time pricing (RTP) to both the retail and P2P markets.
Conclusion: The proposed two-stage P2P optimization framework enhances renewable energy utilization by prioritizing local trading and RTP-based pricing. Results indicate that applying real-time pricing in both retail and P2P markets increases renewable energy share and economic efficiency, while providing actionable insights for sustainable microgrid and P2P market design.

Keywords


Aalami, H. A., Moghaddam, M. P., & & Yousefi, G. R. (2010). Demand response modeling considering Interruptible/Curtailable loads and capacity market programs. Applied Energy, 87(1), 243-250. doi: https://doi.org/10.1016/j.apenergy.2009.05.041
 Administration, U. E. (2019). Electricity explained: how electricity is delivered to consumers. Retrieved from US Energy Information Administration: https://www.eia.gov/energyexplained/index.php
Aghamohammadloo, H., Talaeizadeh, V., Shahanaghi, K., Aghaei, J., Shayanfar, H., Shafie-khah, M., & Catalão, J. P. (2021). Integrated Demand Response programs and energy hubs retail energy market modelling. Energy, 234, 121239. doi: https://doi.org/10.1016/j.energy.2021.121239
Cui, S., Wang, Y. W., Xiao, J. W., & Liu, N. (2019). A Two-Stage Robust Energy Sharing Management for Prosumer Microgrid. IEEE Transactions on Industrial Informatics, 15(5), 2741 - 2752. doi: https://doi.org/10.1109/TII.2018.2867878
Doan, H. T., Nam, H., & Kim, D. (2022). Optimal Peer-to-Peer Energy Trading Under Load Uncertainty Incorporating Carbon Emission and Transaction Cost for Grid-Connected Prosumers. IEEE, 10, 106202 - 106216. doi: https://doi.org/10.1109/ACCESS.2022.3211926
Ferrara, M., Violi, A., Beraldi, P., Carrozzino, G., & Ciano, T. (2021). An integrated decision approach for energy procurement and tariff definition for prosumers aggregations. Energy Economics, 97, 105034. doi: https://doi.org/10.1016/j.eneco.2020.105034
Gharibi, H., Gharibi, R., Khalili, R., Dashti, R., Marzband, M., & Rawa, M. (2025). Optimizing Multi-Objective Peer-to-Peer Energy Trading in Green Homes: Robust Strategies to Address Non-Probabilistic Uncertainty Using IGDT with Integrated Demand Response. Energy and Buildings, 116435. doi: https://doi.org/10.1016/j.enbuild.2025.116435
 Ghorbankhani, A., Sharifabadi, A. M., Ghafouri, S. H., & Mirfakhrodini, S. H. (2021). Multi-Objective Random Model to Determine the Type, Capacity and Installation Location of Distributed Products in the New Supply Chain of the Electricity Industry. Journal of Industrial Management Perspective, 11(2), 9-39. doi: https://doi.org/10.52547/jimp.11.2.9
Grimm, V., Orlinskaya, G., Schewe, L., Schmidt, M., & Zöttl, G. (2021). Optimal design of retailer-prosumer electricity tariffs using bilevel optimization. Omega, 102, 102327. doi: https://doi.org/10.1016/j.omega.2020.102327
Guerrero, J., Sok, B., Chapman, A. C., & Verbič, G. (2021). Electrical-distance driven peer-to-peer energy trading in a low-voltage network. Applied Energy, 287, 116598. doi: https://doi.org/10.1016/j.apenergy.2021.116598
Banirazi Motlagh, S., Hosseini, S. M., & Pons-Valladares, O. (2023). Integrated value model for sustainability assessment of residential solar energy systems towards minimizing urban air pollution in Tehran. Solar Energy, 249, 40-66. doi: https://doi.org/10.1016/j.solener.2022.10.047
Hatami, A. R., Seifi, H., & Sheikh-El-Eslami, M. K. (2009). Optimal selling price and energy procurement strategies for a retailer in an electricity. Electric Power Systems Research, 79(1), 246-254. doi: https://doi.org/10.1016/j.epsr.2008.06.003
Heo, K., Kong, J., Oh, S., & Jung, J. (2021). Development of operator-oriented peer-to-peer energy trading model for integration into the existing distribution system. International Journal of Electrical Power & Energy Systems, 125, 106488. doi: https://doi.org/10.1016/j.ijepes.2020.106488
Ho, W. S., Hashim, H., & Lim, J. S. (2014). Integrated biomass and solar town concept for a smart eco-village in Iskandar Malaysia (IM). Renewable Energy, 69, 190-201. doi: https://doi.org/10.1016/j.renene.2014.02.053
Hoseinzadeh, S., Ghasemi, M. H., & Heyns, S. (2020). Application of hybrid systems in solution of low power generation at hot seasons for micro hydro systems. Renewable Energy, 160, 323-332. doi: https://doi.org/10.1016/j.renene.2020.06.149
Huang, H., Nie, S., Lin, J., Wang, Y., & Dong, J. (2020). Optimization of Peer-to-Peer Power Trading in a Microgrid with Distributed PV and Battery Energy Storage Systems. Sustainability, 12(3), 923. doi: https://doi.org/10.3390/su12030923
Iqbal, S., Nasir, M., Zia, M. F., Riaz, K., Sajjad, H., Khan, H. A., & Member, I. E. (2021). A novel approach for system loss minimization in a peer-to-peer energy sharing community DC microgrid. International Journal of Electrical Power & Energy Systems, 129, 106775. doi: https://doi.org/10.1016/j.ijepes.2021.106775
Islam, S. N., & Sivadas, A. (2022). Optimisation of Buyer and Seller Preferences for Peer-to-Peer Energy Trading in a Microgrid. Energies, 15(12), 4212. doi: https://doi.org/10.3390/en15124212
Kanakadhurga, D., & Prabaharan, N. (2021). Demand response-based peer-to-peer energy trading among the prosumers and consumers. Energy Reports, 7, 7825-7834. doi: https://doi.org/10.1016/j.egyr.2021.09.074
Kanakadhurga, D., & Prabaharan, N. (2024). Price-based demand response with renewable energy sources and peer-to-peer trading for residential microgrid with electric vehicle uncertainty. Computers and Electrical Engineering, 119, 109618. doi: https://doi.org/10.1016/j.compeleceng.2024.109618
Kaur, M., Dhundhara, S., Verma, Y. P., & Chauhan, S. (2020). Techno-economic analysis of photovoltaic-biomass-based microgrid system for reliable rural electrification. International Transactions on Electrical Energy Systems, 30(5), e12347. doi: https://doi.org/10.1002/2050-7038.12347
Khodoomi, M., & Sahebi, H. (2023). Robust Optimization and pricing of peer-to-peer energy trading considering battery storage. Computers & Industrial Engineering, 179, 109210. doi: https://doi.org/10.1016/j.cie.2023.109210
Lee, M., Aslam, O., Foster, B., Kathan, D., Kwok, J., Medearis, L., . . . Tita, M. (2023, December 23). Assessment of demand response and advanced metering. Retrieved from Federal Energy Regulatory Commission: https://www.ferc.gov/sites/default/files/202312/2023%20Assessment%20of%20Demand%20Response%20and%20Advanced%20Metering.pdf
Long, C., Wu, J., Zhou, Y., & Jenkins, N. (2018). Peer-to-peer energy sharing through a two-stage aggregated battery control in a community Microgrid. Applied Energy, 226, 261-276. doi: https://doi.org/10.1016/j.apenergy.2018.05.097
Malik, S., Duffy, M., Thakur, S., Hayes, B., & Breslin, J. (2022). A priority-based approach for peer-to-peer energy trading using cooperative game theory in local energy community. International Journal of Electrical Power & Energy Systems, 137, 107865. doi: https://doi.org/10.1016/j.ijepes.2021.107865
Masoumi, M., & Kheirkhah, A. S. (2024). A novel optimization model for pricing-based energy management in a peer-to-peer (P2P) electricity. Journal of Sustainable Energy Systems, 3(1), 1–22. doi: https://doi.org/10.22059/ses.2024.374651.1062
Monsef, H., & Khajavi, P. (2012). The influence of smart grid on TOU programs with respect to production cost and load factor: A case study of Iran. International Journal of Smart Electrical Engineering, 1(1), 33–43.
Moret, F., & & Pinson, P. (2019). Energy Collectives: A Community and Fairness Based Approach to Future Electricity Markets. IEEE Transactions on Power Systems, 34(5), 3994 - 4004. doi: https://doi.org/10.1109/TPWRS.2018.2808961
Nguyen, S., Peng, W., Sokolowski, P., Alahakoon, D., & Yu, X. (2018). Optimizing rooftop photovoltaic distributed generation with battery storage for peer-to-peer energy trading. Applied Energy, 228, 2567-2580. doi: https://doi.org/10.1016/j.apenergy.2018.07.042
Niaei, H., Masoumi, A., Jafari, A. R., Marzband, M., Hosseini, S. H., & Mahmoudi, A. (2022). Smart peer-to-peer and transactive energy sharing architecture considering incentive-based demand response programming under joint uncertainty and line outage contingency. Journal of Cleaner Production, 363, 132403. doi: https://doi.org/10.1016/j.jclepro.2022.132403
Organization, I. M. (2023, 8 10). Historical wind speed and solar radiation data. Retrieved from Iran’s Meteorological Organization: http://www.weather.ir/2013-8-10
Sebastian, A. J., Islam, S. N., Mahmud, A., & Oo, A. M. (2019). Optimum Local Energy Trading considering Priorities in a Microgrid. IEEE International Conference on Communications, Control, and Computing Technologies for Smart Grids (SmartGridComm). Beijing, China: IEEE. doi: https://10.1109/SmartGridComm.2019.8909771
shakouri, H., & Kazemi, A. (2017). Multi-objective cost-load optimization for demand-side management of a residential area in smart grids. Sustainable Cities and Society, 32, 171-180. doi: https://doi.org/10.1016/j.scs.2017.03.018
Shamsini Ghiasvand, F., Afshar, K., & Bigdeli, N. (2022). Bi-level programming of retailer and prosumers' aggregator to clear the energy of the day ahead using the combined method of mixed integer linear programming and Mayfly optimization in smart grid. Journal of Operation and Automation in Power Engineering. doi: https://doi.org/10.22098/joape.2023.10455.1742  
Sheidaei, F., & Ahmarinejad, A. (2020). Multi-stage stochastic framework for energy management of virtual power plants considering electric vehicles and demand response programs. International Journal of Electrical Power & Energy Systems, 120, 106047. doi: https://doi.org/10.1016/j.ijepes.2020.106047
Sousa, T., Soares, T., Pinson, P., Moret, F., Baroche, T., & Sorin, E. (2019). Peer-to-peer and community-based markets: A comprehensive review. Renewable and Sustainable Energy Reviews, 104, 367-378. doi: https://doi.org/10.1016/j.rser.2019.01.036
Srilakshmi, E., & Singh, S. P. (2022). Energy regulation of EV using MILP for optimal operation of incentive based prosumer microgrid with uncertainty modelling. International Journal of Electrical Power & Energy Systems, 134, 107353. doi: https://doi.org/10.1016/j.ijepes.2021.107353
Sturmberg, B. C., Shaw, M. E., Mediwaththe, C. P., Ransan-Cooper, H., Weise, B., Thomas, M., & Blackhall, L. (2021). A mutually beneficial approach to electricity network pricing in the presence of large amounts of solar power and community-scale energy storage. Energy Policy, 159, 112599. doi: https://doi.org/10.1016/j.enpol.2021.112599
Talebi, E., Mehdinejad, M., Mohammadi-Ivatloo, B., Abapour, M., & Tohidi, S. (2025). A robust framework for peer-to-peer energy trading with transmission costs consideration: A fuzzy possibilistic programming model. Applied Energy, 398, 126379. doi: https://doi.org/10.1016/j.apenergy.2025.126379
Tushar, W., Saha, T. K., Yuen, C., Smith, D., & Poor, H. V. (2020). Peer-to-Peer Trading in Electricity Networks: An Overview. IEEE Transactions on Smart Grid, 11(4), 3185 - 3200. doi: https://doi.org/10.1109/TSG.2020.2969657
Zhang, B., Du, Y., Lim, E. G., Jiang, L., & Yan, K. (2019a). Design and Simulation of Peer-to-Peer Energy Trading Framework with Dynamic Electricity Price. 29th Australasian Universities Power Engineering Conference (AUPEC). Nadi, Fiji: IEEE. doi: https://doi.org/10.1109/AUPEC48547.2019.211948 
Zhang, M., Eliassen, F., Taherkordi, A., Jacobsen, H. A., Chung, H. M., & Zhang, Y. (2019b). Energy trading with demand response in a community-based P2P energy market. 2019 IEEE International Conference on Communications, Control, and Computing Technologies for Smart Grids (SmartGridComm) (pp. 1-6). Beijing, China: IEEE. doi: https://doi.org/10.1109/SmartGridComm.2019.8909798
Zhou, K., Chu, Y., & Yin, H. (2024). Peer-to-peer electricity trading model for urban virtual power plants considering prosumer preferences and power demand heterogeneity. Sustainable Cities and Society, 107, 105465. doi: https://doi.org/10.1016/j.scs.2024.105465
Zhou, Y., Wu, J., Long, C., & Ming, W. (2020). State-of-the-Art Analysis and Perspectives for Peer-to-Peer Energy Trading. Engineering, 6(7), 739-753. doi: https://doi.org/10.1016/j.eng.2020.06.002