  In future distribution grids, prosumers (i.e., energy consumers with storage
and/or production capabilities) will trade energy with each other and with the
main grid. To ensure an efficient and safe operation of energy trading, in this
paper, we formulate a peer-to-peer energy market of prosumers as a generalized
aggregative game, in which a network operator is only responsible for the
operational constraints of the system. We design a distributed market-clearing
mechanism with convergence guarantee to an economically-efficient and
operationally-safe configuration (i.e., a variational generalized Nash
equilibrium). Numerical studies on the IEEE 37-bus testcase show the
scalability of the proposed approach and suggest that active participation in
the market is beneficial for both prosumers and the network operator.
