IDEAS home Printed from https://ideas.repec.org/a/eee/appene/v402y2026ipcs0306261925017714.html

Peer-to-peer energy trading in dairy farms using multi-agent reinforcement learning

Author

Listed:
  • Shah, Mian Ibad Ali
  • Cruz Victorio, Marcos Eduardo
  • Duffy, Maeve
  • Barrett, Enda
  • Mason, Karl

Abstract

The integration of renewable energy resources in rural areas, such as dairy farming communities, enables decentralized energy management through Peer-to-Peer (P2P) energy trading. This research highlights the role of P2P trading in efficient energy distribution and its synergy with advanced optimization techniques. While traditional rule-based methods perform well under stable conditions, they struggle in dynamic environments. To address this, Multi-Agent Reinforcement Learning (MARL), specifically Proximal Policy Optimization (PPO) and Deep Q-Networks (DQN), is combined with community/distributed P2P trading mechanisms. By incorporating auction-based market clearing, a price advisor agent, and load and battery management, the approach achieves significant improvements. Results show that, compared to baseline models, DQN reduces electricity costs by 14.2 % in Ireland and 5.16 % in Finland, while increasing electricity revenue by 7.24 % and 12.73 %, respectively. PPO achieves the lowest peak hour demand, reducing it by 55.5 % in Ireland, while DQN reduces peak hour demand by 50.0 % in Ireland and 27.02 % in Finland. These improvements are attributed to both MARL algorithms and P2P energy trading, which together result in electricity cost and peak hour demand reduction, and increase electricity selling revenue. This study highlights the complementary strengths of DQN, PPO, and P2P trading in achieving efficient, adaptable, and sustainable energy management in rural communities.

Suggested Citation

  • Shah, Mian Ibad Ali & Cruz Victorio, Marcos Eduardo & Duffy, Maeve & Barrett, Enda & Mason, Karl, 2026. "Peer-to-peer energy trading in dairy farms using multi-agent reinforcement learning," Applied Energy, Elsevier, vol. 402(PC).
  • Handle: RePEc:eee:appene:v:402:y:2026:i:pc:s0306261925017714
    DOI: 10.1016/j.apenergy.2025.127041
    as

    Download full text from publisher

    File URL: http://www.sciencedirect.com/science/article/pii/S0306261925017714
    Download Restriction: Full text for ScienceDirect subscribers only

    File URL: https://libkey.io/10.1016/j.apenergy.2025.127041?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    As the access to this document is restricted, you may want to

    for a different version of it.

    References listed on IDEAS

    as
    1. Charbonnier, Flora & Morstyn, Thomas & McCulloch, Malcolm D., 2022. "Scalable multi-agent reinforcement learning for distributed control of residential energy flexibility," Applied Energy, Elsevier, vol. 314(C).
    2. May, Ross & Huang, Pei, 2023. "A multi-agent reinforcement learning approach for investigating and optimising peer-to-peer prosumer energy markets," Applied Energy, Elsevier, vol. 334(C).
    3. Umer, Khalid & Huang, Qi & Khorasany, Mohsen & Afzal, Muhammad & Amin, Waqas, 2021. "A novel communication efficient peer-to-peer energy trading scheme for enhanced privacy in microgrids," Applied Energy, Elsevier, vol. 296(C).
    4. Philip Shine & John Upton & Paria Sefeedpari & Michael D. Murphy, 2020. "Energy Consumption on Dairy Farms: A Review of Monitoring, Prediction Modelling, and Analyses," Energies, MDPI, vol. 13(5), pages 1-25, March.
    5. Liangyi Pu & Song Wang & Xiaodong Huang & Xing Liu & Yawei Shi & Huiwei Wang, 2022. "Peer-to-Peer Trading for Energy-Saving Based on Reinforcement Learning," Energies, MDPI, vol. 15(24), pages 1-16, December.
    6. Sanna Uski & Erkka Rinne & Janne Sarsama, 2018. "Microgrid as a Cost-Effective Alternative to Rural Network Underground Cabling for Adequate Reliability," Energies, MDPI, vol. 11(8), pages 1-16, July.
    7. Elkazaz, Mahmoud & Sumner, Mark & Thomas, David, 2021. "A hierarchical and decentralized energy management system for peer-to-peer energy trading," Applied Energy, Elsevier, vol. 291(C).
    8. Zhou, Yue & Wu, Jianzhong & Long, Chao, 2018. "Evaluation of peer-to-peer energy sharing mechanisms based on a multiagent simulation framework," Applied Energy, Elsevier, vol. 222(C), pages 993-1022.
    9. Qiu, Dawei & Ye, Yujian & Papadaskalopoulos, Dimitrios & Strbac, Goran, 2021. "Scalable coordinated management of peer-to-peer energy trading: A multi-cluster deep reinforcement learning approach," Applied Energy, Elsevier, vol. 292(C).
    10. Shobole, Abdulfetah Abdela & Wadi, Mohammed, 2021. "Multiagent systems application for the smart grid protection," Renewable and Sustainable Energy Reviews, Elsevier, vol. 149(C).
    11. Long, Chao & Wu, Jianzhong & Zhou, Yue & Jenkins, Nick, 2018. "Peer-to-peer energy sharing through a two-stage aggregated battery control in a community Microgrid," Applied Energy, Elsevier, vol. 226(C), pages 261-276.
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Azim, M. Imran & Tushar, Wayes & Saha, Tapan K. & Yuen, Chau & Smith, David, 2022. "Peer-to-peer kilowatt and negawatt trading: A review of challenges and recent advances in distribution networks," Renewable and Sustainable Energy Reviews, Elsevier, vol. 169(C).
    2. Zhou, Yuekuan & Lund, Peter D., 2023. "Peer-to-peer energy sharing and trading of renewable energy in smart communities ─ trading pricing models, decision-making and agent-based collaboration," Renewable Energy, Elsevier, vol. 207(C), pages 177-193.
    3. Bian, Yifan & Xie, Lirong & Ma, Lan & Cui, Chuanshi, 2025. "A novel two-stage energy sharing model for data center cluster considering integrated demand response of multiple loads," Applied Energy, Elsevier, vol. 384(C).
    4. Bian, Yifan & Xie, Lirong & Ye, Jiahao & Ma, Lan & Cui, Chuanshi, 2024. "Peer-to-peer energy sharing model considering multi-objective optimal allocation of shared energy storage in a multi-microgrid system," Energy, Elsevier, vol. 288(C).
    5. Lyu, Cheng & Jia, Youwei & Xu, Zhao, 2021. "Fully decentralized peer-to-peer energy sharing framework for smart buildings with local battery system and aggregated electric vehicles," Applied Energy, Elsevier, vol. 299(C).
    6. João Mello & Cristina de Lorenzo & Fco. Alberto Campos & José Villar, 2023. "Pricing and Simulating Energy Transactions in Energy Communities," Energies, MDPI, vol. 16(4), pages 1-22, February.
    7. Wang, Zibo & Yu, Xiaodan & Mu, Yunfei & Jia, Hongjie, 2020. "A distributed Peer-to-Peer energy transaction method for diversified prosumers in Urban Community Microgrid System," Applied Energy, Elsevier, vol. 260(C).
    8. Davarzani, Sima & Pisica, Ioana & Taylor, Gareth A. & Munisami, Kevin J., 2021. "Residential Demand Response Strategies and Applications in Active Distribution Network Management," Renewable and Sustainable Energy Reviews, Elsevier, vol. 138(C).
    9. Liu, Jia & Yang, Hongxing & Zhou, Yuekuan, 2021. "Peer-to-peer trading optimizations on net-zero energy communities with energy storage of hydrogen and battery vehicles," Applied Energy, Elsevier, vol. 302(C).
    10. Sun, Zhixiang & Li, Zhigang & Xue, Yixun & Chang, Xinyue & Li, Huajian & Zheng, J.H., 2025. "Price-function-free energy pricing in Bilevel peer-to-peer energy markets considering network security," Applied Energy, Elsevier, vol. 391(C).
    11. Esmat, Ayman & de Vos, Martijn & Ghiassi-Farrokhfal, Yashar & Palensky, Peter & Epema, Dick, 2021. "A novel decentralized platform for peer-to-peer energy trading market with blockchain technology," Applied Energy, Elsevier, vol. 282(PA).
    12. Sun, Lingling & Qiu, Jing & Han, Xiao & Yin, Xia & Dong, Zhao Yang, 2020. "Capacity and energy sharing platform with hybrid energy storage system: An example of hospitality industry," Applied Energy, Elsevier, vol. 280(C).
    13. Capper, Timothy & Gorbatcheva, Anna & Mustafa, Mustafa A. & Bahloul, Mohamed & Schwidtal, Jan Marc & Chitchyan, Ruzanna & Andoni, Merlinda & Robu, Valentin & Montakhabi, Mehdi & Scott, Ian J. & Franci, 2022. "Peer-to-peer, community self-consumption, and transactive energy: A systematic literature review of local energy market models," Renewable and Sustainable Energy Reviews, Elsevier, vol. 162(C).
    14. Ge, Shaoyun & Li, Jifeng & He, Xingtang & Liu, Hong, 2021. "Joint energy market design for local integrated energy system service procurement considering demand flexibility," Applied Energy, Elsevier, vol. 297(C).
    15. Samende, Cephas & Cao, Jun & Fan, Zhong, 2022. "Multi-agent deep deterministic policy gradient algorithm for peer-to-peer energy trading considering distribution network constraints," Applied Energy, Elsevier, vol. 317(C).
    16. Siripha Junlakarn & Phimsupha Kokchang & Kulyos Audomvongseree, 2022. "Drivers and Challenges of Peer-to-Peer Energy Trading Development in Thailand," Energies, MDPI, vol. 15(3), pages 1-25, February.
    17. Rodrigues, Daniel L. & Ye, Xianming & Xia, Xiaohua & Zhu, Bing, 2020. "Battery energy storage sizing optimisation for different ownership structures in a peer-to-peer energy sharing community," Applied Energy, Elsevier, vol. 262(C).
    18. Filipe Bandeiras & Álvaro Gomes & Mário Gomes & Paulo Coelho, 2023. "Exploring Energy Trading Markets in Smart Grid and Microgrid Systems and Their Implications for Sustainability in Smart Cities," Energies, MDPI, vol. 16(2), pages 1-41, January.
    19. El-Baz, Wessam & Tzscheutschler, Peter & Wagner, Ulrich, 2019. "Integration of energy markets in microgrids: A double-sided auction with device-oriented bidding strategies," Applied Energy, Elsevier, vol. 241(C), pages 625-639.
    20. Zhang, Bidan & Du, Yang & Chen, Xiaoyang & Lim, Eng Gee & Jiang, Lin & Yan, Ke, 2022. "A novel adaptive penalty mechanism for Peer-to-Peer energy trading," Applied Energy, Elsevier, vol. 327(C).

    More about this item

    Keywords

    ;
    ;
    ;
    ;
    ;
    ;

    JEL classification:

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:eee:appene:v:402:y:2026:i:pc:s0306261925017714. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Catherine Liu (email available below). General contact details of provider: http://www.elsevier.com/wps/find/journaldescription.cws_home/405891/description#description .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.