In energy markets, microgrids can obtain additional economic benefits through peer-to-peer (P2P) trading of electricity and natural gas. However, unregulated trading behavior may pose risks of power and gas flow violations in the electricity and gas networks. To balance market efficiency and system security, this paper proposes a bilevel optimization method for electricity-gas P2P trading integrated with a multi-energy dynamic operating envelope (DOE). The proposed method enables the operator to impose constraints on the electricity and gas imports/exports of microgrids based on the real-time system power and gas flow conditions. This approach effectively mitigates the risk of network violations caused by unregulated trading activities, thereby ensuring the secure operation of energy delivery networks and the orderly execution of P2P transactions among microgrids. Furthermore, the dynamic characteristics of natural gas are incorporated into the DOE model, enhancing the accuracy of gas flow distribution and the effectiveness of trading guidance. Case studies on a modified IEEE 33-bus power network and a 7-node gas network validate the effectiveness of the proposed model and method.
Dong et al. (2026) studied this question.